]>
Commit | Line | Data |
---|---|---|
dfeec247 XL |
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. | |
3dfed10e | 5 | // revisions: full min |
94222f64 | 6 | #![cfg_attr(full, feature(adt_const_params))] |
3dfed10e | 7 | #![cfg_attr(full, allow(incomplete_features))] |
dfeec247 XL |
8 | |
9 | struct A<const N: &u8>; | |
10 | //~^ ERROR `&` without an explicit lifetime name cannot be used here | |
3dfed10e | 11 | //[min]~^^ ERROR `&'static u8` is forbidden |
dfeec247 XL |
12 | trait B {} |
13 | ||
3dfed10e XL |
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 | |
dfeec247 XL |
17 | fn foo<const M: &u8>(&self) {} |
18 | //~^ ERROR `&` without an explicit lifetime name cannot be used here | |
3dfed10e | 19 | //[min]~^^ ERROR `&'static u8` is forbidden |
dfeec247 XL |
20 | } |
21 | ||
22 | impl<const N: &u8> B for A<N> {} | |
23 | //~^ ERROR `&` without an explicit lifetime name cannot be used here | |
3dfed10e | 24 | //[min]~^^ ERROR `&'static u8` is forbidden |
dfeec247 XL |
25 | |
26 | fn bar<const N: &u8>() {} | |
27 | //~^ ERROR `&` without an explicit lifetime name cannot be used here | |
3dfed10e | 28 | //[min]~^^ ERROR `&'static u8` is forbidden |
dfeec247 XL |
29 | |
30 | fn main() {} |