diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/crashes/124894.rs | 11 | ||||
| -rw-r--r-- | tests/ui/error-codes/E0010-teach.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/traits/next-solver/typeck/guide-ctors.rs | 32 |
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 }); +} |
