resolve lifetimes for const generic defaults
This commit is contained in:
parent
b3800860e1
commit
bcf98841d4
5 changed files with 40 additions and 1 deletions
6
src/test/ui/const-generics/issue-93647.rs
Normal file
6
src/test/ui/const-generics/issue-93647.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
struct X<const N: usize = {
|
||||
(||1usize)()
|
||||
//~^ ERROR calls in constants are limited to
|
||||
}>;
|
||||
|
||||
fn main() {}
|
||||
9
src/test/ui/const-generics/issue-93647.stderr
Normal file
9
src/test/ui/const-generics/issue-93647.stderr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
--> $DIR/issue-93647.rs:2:5
|
||||
|
|
||||
LL | (||1usize)()
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
struct Foo<
|
||||
'a,
|
||||
const N: usize = {
|
||||
let x: &'a ();
|
||||
//~^ ERROR use of non-static lifetime `'a` in const generic
|
||||
3
|
||||
},
|
||||
>(&'a ());
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
error[E0771]: use of non-static lifetime `'a` in const generic
|
||||
--> $DIR/outer-lifetime-in-const-generic-default.rs:4:17
|
||||
|
|
||||
LL | let x: &'a ();
|
||||
| ^^
|
||||
|
|
||||
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0771`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue