-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9791058
commit afa24f0
Showing
11 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
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
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,8 @@ | ||
error: lifetimes cannot use keyword names | ||
--> $DIR/gen-lt.rs:11:11 | ||
| | ||
LL | fn gen_lt<'gen>() {} | ||
| ^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
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,14 @@ | ||
//@ revisions: e2021 e2024 | ||
|
||
//@[e2021] edition:2021 | ||
//@[e2024] edition:2024 | ||
//@[e2024] compile-flags: -Zunstable-options | ||
|
||
//@[e2021] check-pass | ||
|
||
fn raw_gen_lt<'r#gen>() {} | ||
|
||
fn gen_lt<'gen>() {} | ||
//[e2024]~^ ERROR lifetimes cannot use keyword names | ||
|
||
fn main() {} |
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,8 @@ | ||
//@ edition: 2021 | ||
//@ check-pass | ||
|
||
// Test that `'r#a` is `'a`. | ||
|
||
fn test<'r#a>(x: &'a ()) {} | ||
|
||
fn main() {} |
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,12 @@ | ||
//@ check-pass | ||
//@ edition: 2021 | ||
|
||
macro_rules! lifetime { | ||
($lt:lifetime) => { | ||
fn hello<$lt>() {} | ||
} | ||
} | ||
|
||
lifetime!('r#struct); | ||
|
||
fn main() {} |
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,6 @@ | ||
//@ edition: 2021 | ||
|
||
fn test(x: &'r#r#r ()) {} | ||
//~^ ERROR expected type, found `#` | ||
|
||
fn main() {} |
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,8 @@ | ||
error: expected type, found `#` | ||
--> $DIR/multiple-prefixes.rs:3:17 | ||
| | ||
LL | fn test(x: &'r#r#r ()) {} | ||
| ^ expected type | ||
|
||
error: aborting due to 1 previous error | ||
|
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,8 @@ | ||
//@ check-pass | ||
//@ edition: 2021 | ||
|
||
// Checks a primitive name can be defined as a lifetime. | ||
|
||
fn foo<'r#i32>() {} | ||
|
||
fn main() {} |
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,21 @@ | ||
//@ check-pass | ||
//@ edition: 2021 | ||
|
||
fn foo<'r#struct>() {} | ||
|
||
fn hr<T>() where for<'r#struct> T: Into<&'r#struct ()> {} | ||
|
||
trait Foo<'r#struct> {} | ||
|
||
trait Bar<'r#struct> { | ||
fn method(&'r#struct self) {} | ||
fn method2(self: &'r#struct Self) {} | ||
} | ||
|
||
fn labeled() { | ||
'r#struct: loop { | ||
break 'r#struct; | ||
} | ||
} | ||
|
||
fn main() {} |
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,8 @@ | ||
//@ check-pass | ||
//@ edition: 2021 | ||
|
||
// Makes sure that `'r#static` is `'static` | ||
|
||
const FOO: &'r#static str = "hello, world"; | ||
|
||
fn main() {} |
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,12 @@ | ||
//@ edition: 2015 | ||
//@ check-pass | ||
// Ensure that we parse `'r#lt` as three tokens in edition 2015. | ||
|
||
macro_rules! ed2015 { | ||
('r # lt) => {}; | ||
($lt:lifetime) => { compile_error!() }; | ||
} | ||
|
||
ed2015!('r#lt); | ||
|
||
fn main() {} |