]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs
Rollup merge of #84083 - ltratt:threadid_doc_tweak, r=dtolnay
[rust.git] / src / test / ui / consts / miri_unleashed / feature-gate-unleash_the_miri_inside_of_you.rs
1 #![allow(const_err)]
2
3 // a test demonstrating why we do need to run static const qualification on associated constants
4 // instead of just checking the final constant
5
6 trait Foo<T> {
7     const X: T;
8 }
9
10 trait Bar<T, U: Foo<T>> {
11     const F: u32 = (U::X, 42).1; //~ ERROR destructors cannot be evaluated at compile-time
12 }
13
14 impl Foo<u32> for () {
15     const X: u32 = 42;
16 }
17
18 impl Foo<Vec<u32>> for String {
19     const X: Vec<u32> = Vec::new();
20 }
21
22 impl Bar<u32, ()> for () {}
23 impl Bar<Vec<u32>, String> for String {}
24
25 fn main() {
26     let x = <() as Bar<u32, ()>>::F;
27     let y = <String as Bar<Vec<u32>, String>>::F;
28 }