Skip to content

Keywords cannot be used for lifetime paramters #2306

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

Open
tamaroning opened this issue Jun 17, 2023 · 2 comments
Open

Keywords cannot be used for lifetime paramters #2306

tamaroning opened this issue Jun 17, 2023 · 2 comments

Comments

@tamaroning
Copy link
Contributor

tamaroning commented Jun 17, 2023

See https://doc.rust-lang.org/reference/tokens.html#lifetimes-and-loop-labels

I tried this code:

struct Foo<'crate, T>{
    a: &'crate T
}

fn main() {}

I expected to see this happen:
error: lifetimes cannot use keyword names

Instead, this happened:
compiled.

Meta

  • What version of Rust GCC were you using, git sha if possible.
  • Used https://godbolt.org/
  • probably recent version.
@liamnaddell
Copy link
Contributor

liamnaddell commented Dec 26, 2024

According to the issue description, the issue seems to be resolved? af5fdee

TRS-E14 gccrs-build $ cat kw.rs

#[lang = "sized"]
pub trait Sized {}

struct Foo<'crate, T>{
    _a: &'crate T
}

fn main() {
    let s = ();
    let _ = Foo { _a: &s };
}
TRS-E14 gccrs-build :( $ gccrs kw.rs
kw.rs:5:12: error: lifetimes cannot use keyword names
    5 | struct Foo<'crate, T>{
      |            ^~~~~~
kw.rs:6:10: error: lifetimes cannot use keyword names
    6 |     _a: &'crate T
      |          ^~~~~~
TRS-E14 gccrs-build :( $

There also seems to be tests for this lifetime_name_validation.rs

@tamaroning
Copy link
Contributor Author

Yes i think so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

3 participants