Skip to content

[CRATER] Crater Rollup #129660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add some more tests
  • Loading branch information
compiler-errors committed Aug 28, 2024
commit 2e88dcb7e498ec3648d6f05a4f8bfcfa0bb75462
8 changes: 8 additions & 0 deletions tests/ui/lifetimes/raw/gen-lt.e2024.stderr
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

14 changes: 14 additions & 0 deletions tests/ui/lifetimes/raw/gen-lt.rs
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() {}
12 changes: 12 additions & 0 deletions tests/ui/lifetimes/raw/macro-lt.rs
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() {}
8 changes: 8 additions & 0 deletions tests/ui/lifetimes/raw/prim-lt.rs
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() {}
21 changes: 21 additions & 0 deletions tests/ui/lifetimes/raw/simple.rs
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() {}
8 changes: 8 additions & 0 deletions tests/ui/lifetimes/raw/static-lt.rs
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() {}