Auto merge of #125529 - cuviper:beta-next, r=cuviper

[beta] backports

- Add `#[inline]` to float `Debug` fallback used by `cfg(no_fp_fmt_parse)` #125252
- Add v0 symbol mangling for `f16` and `f128` #123816
- Only make GAT ambiguous in `match_projection_projections` considering shallow resolvability #125214
- Update to LLVM 18.1.6 #125288

r? cuviper
This commit is contained in:
bors 2024-05-25 07:38:15 +00:00
commit d9e85b56e7
7 changed files with 37 additions and 6 deletions

2
.gitmodules vendored
View file

@ -33,7 +33,7 @@
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/18.0-2024-02-13
branch = rustc/18.1-2024-05-19
shallow = true
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book

View file

@ -318,11 +318,10 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
ty::Uint(UintTy::U64) => "y",
ty::Uint(UintTy::U128) => "o",
ty::Uint(UintTy::Usize) => "j",
// FIXME(f16_f128): update these once `rustc-demangle` supports the new types
ty::Float(FloatTy::F16) => unimplemented!("f16_f128"),
ty::Float(FloatTy::F16) => "C3f16",
ty::Float(FloatTy::F32) => "f",
ty::Float(FloatTy::F64) => "d",
ty::Float(FloatTy::F128) => unimplemented!("f16_f128"),
ty::Float(FloatTy::F128) => "C4f128",
ty::Never => "z",
// Placeholders (should be demangled as `_`).

View file

@ -1777,9 +1777,19 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// If this type is a GAT, and of the GAT args resolve to something new,
// that means that we must have newly inferred something about the GAT.
// We should give up in that case.
// FIXME(generic-associated-types): This only detects one layer of inference,
// which is probably not what we actually want, but fixing it causes some ambiguity:
// <https://github.com/rust-lang/rust/issues/125196>.
if !generics.params.is_empty()
&& obligation.predicate.args[generics.parent_count..].iter().any(|&p| {
p.has_non_region_infer() && self.infcx.resolve_vars_if_possible(p) != p
p.has_non_region_infer()
&& match p.unpack() {
ty::GenericArgKind::Const(ct) => {
self.infcx.shallow_resolve_const(ct) != ct
}
ty::GenericArgKind::Type(ty) => self.infcx.shallow_resolve(ty) != ty,
ty::GenericArgKind::Lifetime(_) => false,
}
})
{
ProjectionMatchesProjection::Ambiguous

View file

@ -4,6 +4,7 @@ macro_rules! floating {
($ty:ident) => {
#[stable(feature = "rust1", since = "1.0.0")]
impl Debug for $ty {
#[inline]
fn fmt(&self, _fmt: &mut Formatter<'_>) -> Result {
panic!("floating point support is turned off");
}

View file

@ -739,6 +739,8 @@ The type encodings based on the initial tag character are:
* `z``!`
* `p` — [placeholder] `_`
Remaining primitives are encoded as a crate production, e.g. `C4f128`.
* `A` — An [array][reference-array] `[T; N]`.
> <span id="array-type">array-type</span>`A` *[type]* *[const]*

@ -1 +1 @@
Subproject commit 5399a24c66cb6164cf32280e7d300488c90d5765
Subproject commit b31c30a9bb4dbbd13c359d0e2bea7f65d20adf3f

View file

@ -0,0 +1,19 @@
// Fix for <https://github.com/rust-lang/rust/issues/125196>.
//@ check-pass
trait Tr {
type Gat<T>;
}
struct W<T>(T);
fn foo<T: Tr>() where for<'a> &'a T: Tr<Gat<W<i32>> = i32> {
let x: <&T as Tr>::Gat<W<_>> = 1i32;
// Previously, `match_projection_projections` only checked that
// `shallow_resolve(W<?0>) = W<?0>`. This won't prevent *all* inference guidance
// from projection predicates in the environment, just ones that guide the
// outermost type of each GAT constructor. This is definitely wrong, but there is
// code that relies on it in the wild :/
}
fn main() {}