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.
6 #![cfg_attr(full, feature(adt_const_params))]
7 #![cfg_attr(full, allow(incomplete_features))]
9 struct A<const N: &u8>;
10 //~^ ERROR `&` without an explicit lifetime name cannot be used here
11 //[min]~^^ ERROR `&'static u8` is forbidden
14 impl<const N: &u8> A<N> {
15 //~^ ERROR `&` without an explicit lifetime name cannot be used here
16 //[min]~^^ ERROR `&'static u8` is forbidden
17 fn foo<const M: &u8>(&self) {}
18 //~^ ERROR `&` without an explicit lifetime name cannot be used here
19 //[min]~^^ ERROR `&'static u8` is forbidden
22 impl<const N: &u8> B for A<N> {}
23 //~^ ERROR `&` without an explicit lifetime name cannot be used here
24 //[min]~^^ ERROR `&'static u8` is forbidden
26 fn bar<const N: &u8>() {}
27 //~^ ERROR `&` without an explicit lifetime name cannot be used here
28 //[min]~^^ ERROR `&'static u8` is forbidden