1 // Elided lifetimes within the type of a const generic parameters is disallowed. This matches the
2 // behaviour of trait bounds where `fn foo<T: Ord<&u8>>() {}` is illegal. Though we could change
3 // elided lifetimes within the type of a const generic parameters to be 'static, like elided
4 // lifetimes within const/static items.
7 #![cfg_attr(full, feature(const_generics))]
8 #![cfg_attr(full, allow(incomplete_features))]
10 struct A<const N: &u8>;
11 //~^ ERROR `&` without an explicit lifetime name cannot be used here
12 //[min]~^^ ERROR `&'static u8` is forbidden
15 impl<const N: &u8> A<N> {
16 //~^ ERROR `&` without an explicit lifetime name cannot be used here
17 //[min]~^^ ERROR `&'static u8` is forbidden
18 fn foo<const M: &u8>(&self) {}
19 //~^ ERROR `&` without an explicit lifetime name cannot be used here
20 //[min]~^^ ERROR `&'static u8` is forbidden
23 impl<const N: &u8> B for A<N> {}
24 //~^ ERROR `&` without an explicit lifetime name cannot be used here
25 //[min]~^^ ERROR `&'static u8` is forbidden
27 fn bar<const N: &u8>() {}
28 //~^ ERROR `&` without an explicit lifetime name cannot be used here
29 //[min]~^^ ERROR `&'static u8` is forbidden