Add test for an explicit non-'static lifetime in a const argument

This commit is contained in:
Gabriel Smith 2020-07-19 12:53:51 -04:00
parent 69d5dd6a50
commit c60a035658
2 changed files with 28 additions and 0 deletions

View file

@ -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() {}

View file

@ -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