summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-10 11:00:28 +0000
committerbors <bors@rust-lang.org>2024-10-10 11:00:28 +0000
commit4cc494bbfe9911d24f3ee521f98d5c6bb7e3ffe8 (patch)
treee19d6f2a7cab3a46426146fa6e8edf8c43730f9b /tests
parentde19f2b73d4fd456be06f299a5d9d8fd622ca298 (diff)
parent1c62cff89775b6ab0feb0ed6c888114a64a1798f (diff)
downloadrust-4cc494bbfe9911d24f3ee521f98d5c6bb7e3ffe8.tar.gz
rust-4cc494bbfe9911d24f3ee521f98d5c6bb7e3ffe8.zip
Auto merge of #131495 - matthiaskrgr:rollup-lwf2u4i, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #130625 (Fix a few relative paths in rustc doc)
 - #131397 (fix/update teach_note from 'escaping mutable ref/ptr' const-check)
 - #131479 (Apple: Avoid redundant `-Wl,-dylib` flag when linking)
 - #131480 (Fix hardcoded strip path when cross-compiling from Linux to Darwin)
 - #131482 (structurally resolve adts and tuples expectations too)
 - #131484 (Add myself back to review rotation)
 - #131491 (impossible obligations fast path)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/124894.rs11
-rw-r--r--tests/ui/error-codes/E0010-teach.stderr2
-rw-r--r--tests/ui/traits/next-solver/typeck/guide-ctors.rs32
3 files changed, 33 insertions, 12 deletions
diff --git a/tests/crashes/124894.rs b/tests/crashes/124894.rs
deleted file mode 100644
index 230cf4a89c1..00000000000
--- a/tests/crashes/124894.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ known-bug: rust-lang/rust#124894
-//@ compile-flags: -Znext-solver=coherence
-
-#![feature(generic_const_exprs)]
-
-pub trait IsTrue<const mem: bool> {}
-impl<T> IsZST for T where (): IsTrue<{ std::mem::size_of::<T>() == 0 }> {}
-
-pub trait IsZST {}
-
-impl IsZST for IsZST {}
diff --git a/tests/ui/error-codes/E0010-teach.stderr b/tests/ui/error-codes/E0010-teach.stderr
index 7634970f36e..37a9892ccbf 100644
--- a/tests/ui/error-codes/E0010-teach.stderr
+++ b/tests/ui/error-codes/E0010-teach.stderr
@@ -4,7 +4,7 @@ error[E0010]: allocations are not allowed in constants
 LL | const CON: Vec<i32> = vec![1, 2, 3];
    |                       ^^^^^^^^^^^^^ allocation not allowed in constants
    |
-   = note: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time.
+   = note: The runtime heap is not yet available at compile-time, so no runtime heap allocations can be created.
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0015]: cannot call non-const fn `slice::<impl [i32]>::into_vec::<std::alloc::Global>` in constants
diff --git a/tests/ui/traits/next-solver/typeck/guide-ctors.rs b/tests/ui/traits/next-solver/typeck/guide-ctors.rs
new file mode 100644
index 00000000000..7432ea78a56
--- /dev/null
+++ b/tests/ui/traits/next-solver/typeck/guide-ctors.rs
@@ -0,0 +1,32 @@
+//@ compile-flags: -Znext-solver
+//@ check-pass
+
+// Makes sure we structurally normalize before trying to use expectation to guide
+// coercion in adt and tuples.
+
+use std::any::Any;
+
+trait Coerce {
+    type Assoc;
+}
+
+struct TupleGuidance;
+impl Coerce for TupleGuidance {
+    type Assoc = (&'static dyn Any,);
+}
+
+struct AdtGuidance;
+impl Coerce for AdtGuidance {
+    type Assoc = Adt<&'static dyn Any>;
+}
+
+struct Adt<T> {
+    f: T,
+}
+
+fn foo<'a, T: Coerce>(_: T::Assoc) {}
+
+fn main() {
+    foo::<TupleGuidance>((&0u32,));
+    foo::<AdtGuidance>(Adt { f: &0u32 });
+}