Skip to content

Commit

Permalink
Add test for an explicit non-'static lifetime in a const argument
Browse files Browse the repository at this point in the history
  • Loading branch information
yodaldevoid committed Jul 19, 2020
1 parent 69d5dd6 commit c60a035
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/ui/const-generics/const-argument-non-static-lifetime.rs
@@ -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() {}
@@ -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

0 comments on commit c60a035

Please sign in to comment.