Skip to content

Commit c60a035

Browse files
committed
Add test for an explicit non-'static lifetime in a const argument
1 parent 69d5dd6 commit c60a035

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// run-pass
2+
3+
#![feature(const_generics)]
4+
//~^ WARN the feature `const_generics` is incomplete
5+
#![allow(dead_code)]
6+
7+
fn test<const N: usize>() {}
8+
9+
fn wow<'a>() -> &'a () {
10+
test::<{
11+
let _: &'a ();
12+
3
13+
}>();
14+
&()
15+
}
16+
17+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/const-argument-non-static-lifetime.rs:3:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
9+
10+
warning: 1 warning emitted
11+

0 commit comments

Comments
 (0)