-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve lifetimes for const generic defaults
- Loading branch information
1 parent
b380086
commit bcf9884
Showing
5 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
struct X<const N: usize = { | ||
(||1usize)() | ||
//~^ ERROR calls in constants are limited to | ||
}>; | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
10 changes: 10 additions & 0 deletions
10
src/test/ui/const-generics/outer-lifetime-in-const-generic-default.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/outer-lifetime-in-const-generic-default.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |