summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-25 07:38:15 +0000
committerbors <bors@rust-lang.org>2024-05-25 07:38:15 +0000
commitd9e85b56e7f85f7fdabff71f217b7bb2cee0ef68 (patch)
tree88aaba2f5a1df0b623bccf67a9f62d724bade8d7
parent66eb3e404b81e916f5e6d4755fce73800b0cb4c2 (diff)
parent16f4a2b2f96967d6f5c5512d5cc561a066883546 (diff)
downloadrust-d9e85b56e7f85f7fdabff71f217b7bb2cee0ef68.tar.gz
rust-d9e85b56e7f85f7fdabff71f217b7bb2cee0ef68.zip
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
-rw-r--r--.gitmodules2
-rw-r--r--compiler/rustc_symbol_mangling/src/v0.rs5
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs12
-rw-r--r--library/core/src/fmt/nofloat.rs1
-rw-r--r--src/doc/rustc/src/symbol-mangling/v0.md2
m---------src/llvm-project0
-rw-r--r--tests/ui/generic-associated-types/guide-inference-in-gat-arg-deeper.rs19
7 files changed, 36 insertions, 5 deletions
diff --git a/.gitmodules b/.gitmodules
index 802d61eea29..75faaba7151 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -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
diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs
index 58b67c77a61..ada2f54a19a 100644
--- a/compiler/rustc_symbol_mangling/src/v0.rs
+++ b/compiler/rustc_symbol_mangling/src/v0.rs
@@ -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 `_`).
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index fc12fed3537..49102e19a6f 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -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
diff --git a/library/core/src/fmt/nofloat.rs b/library/core/src/fmt/nofloat.rs
index a36e7efcd95..6b07236f1da 100644
--- a/library/core/src/fmt/nofloat.rs
+++ b/library/core/src/fmt/nofloat.rs
@@ -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");
             }
diff --git a/src/doc/rustc/src/symbol-mangling/v0.md b/src/doc/rustc/src/symbol-mangling/v0.md
index 61f747fac83..763694a9fda 100644
--- a/src/doc/rustc/src/symbol-mangling/v0.md
+++ b/src/doc/rustc/src/symbol-mangling/v0.md
@@ -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]*
diff --git a/src/llvm-project b/src/llvm-project
-Subproject 5399a24c66cb6164cf32280e7d300488c90d576
+Subproject b31c30a9bb4dbbd13c359d0e2bea7f65d20adf3
diff --git a/tests/ui/generic-associated-types/guide-inference-in-gat-arg-deeper.rs b/tests/ui/generic-associated-types/guide-inference-in-gat-arg-deeper.rs
new file mode 100644
index 00000000000..96a0f2f40bf
--- /dev/null
+++ b/tests/ui/generic-associated-types/guide-inference-in-gat-arg-deeper.rs
@@ -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() {}