This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +71
-0
lines changed Expand file tree Collapse file tree 6 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ error: lifetimes cannot use keyword names
2+ --> $DIR/gen-lt.rs:11:11
3+ |
4+ LL | fn gen_lt<'gen>() {}
5+ | ^^^^
6+
7+ error: aborting due to 1 previous error
8+
Original file line number Diff line number Diff line change 1+ //@ revisions: e2021 e2024
2+
3+ //@[e2021] edition:2021
4+ //@[e2024] edition:2024
5+ //@[e2024] compile-flags: -Zunstable-options
6+
7+ //@[e2021] check-pass
8+
9+ fn raw_gen_lt < ' r#gen > ( ) { }
10+
11+ fn gen_lt < ' gen > ( ) { }
12+ //[e2024]~^ ERROR lifetimes cannot use keyword names
13+
14+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+ //@ edition: 2021
3+
4+ macro_rules! lifetime {
5+ ( $lt: lifetime) => {
6+ fn hello<$lt>( ) { }
7+ }
8+ }
9+
10+ lifetime ! ( ' r#struct) ;
11+
12+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+ //@ edition: 2021
3+
4+ // Checks a primitive name can be defined as a lifetime.
5+
6+ fn foo < ' r#i32 > ( ) { }
7+
8+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+ //@ edition: 2021
3+
4+ fn foo < ' r#struct > ( ) { }
5+
6+ fn hr < T > ( ) where for < ' r#struct > T : Into < & ' r#struct ( ) > { }
7+
8+ trait Foo < ' r#struct > { }
9+
10+ trait Bar < ' r#struct > {
11+ fn method ( & ' r#struct self ) { }
12+ fn method2 ( self : & ' r#struct Self ) { }
13+ }
14+
15+ fn labeled ( ) {
16+ ' r#struct: loop {
17+ break ' r#struct;
18+ }
19+ }
20+
21+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+ //@ edition: 2021
3+
4+ // Makes sure that `'r#static` is `'static`
5+
6+ const FOO : & ' r#static str = "hello, world" ;
7+
8+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments