blob: 46e4afd8532e1aa1857787a49bcbbced315d959c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//! The same as the non-ICE test, but const eval will run typeck of
//! `get` before running wfcheck (as that may in itself trigger const
//! eval again, and thus cause bogus cycles). This used to ICE because
//! we asserted that an error had already been emitted.
use std::ops::Deref;
struct Foo(u32);
impl Foo {
const fn get<R: Deref<Target = Self>>(self: R) -> u32 {
//~^ ERROR invalid generic `self` parameter type
//~| ERROR destructor of `R` cannot be evaluated at compile-time
self.0
//~^ ERROR cannot perform non-const deref coercion on `R` in constant functions
}
}
const FOO: () = {
let foo = Foo(1);
foo.get::<&Foo>();
};
const BAR: [(); {
FOO;
0
}] = [];
fn main() {}
|