-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for an explicit non-'static lifetime in a const argument
- Loading branch information
1 parent
69d5dd6
commit c60a035
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/test/ui/const-generics/const-argument-non-static-lifetime.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,17 @@ | ||
// run-pass | ||
|
||
#![feature(const_generics)] | ||
//~^ WARN the feature `const_generics` is incomplete | ||
#![allow(dead_code)] | ||
|
||
fn test<const N: usize>() {} | ||
|
||
fn wow<'a>() -> &'a () { | ||
test::<{ | ||
let _: &'a (); | ||
3 | ||
}>(); | ||
&() | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/const-argument-non-static-lifetime.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 @@ | ||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/const-argument-non-static-lifetime.rs:3:12 | ||
| | ||
LL | #![feature(const_generics)] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information | ||
|
||
warning: 1 warning emitted | ||
|