This code compiles on nightly today but it should not, because Foo is not Copy:
#![feature(const_fn)]
struct Foo(usize);
const fn get(x: Foo) -> usize {
x.0
}
const X: Foo = Foo(22);
static Y: usize = get(*&X); // also a problem for `const Y`
fn main() {
}
Note that the get(*&X) in a function body properly results in an error.
This code compiles on nightly today but it should not, because
Foois notCopy:Note that the
get(*&X)in a function body properly results in an error.