Skip to content

Failure with proc_macro2/nightly with error lifetimes cannot use keyword names #430

Closed
@TeXitoi

Description

@TeXitoi

My nightly test on structopt fail. I've tried to minimize the failure without success.

$ git clone https://github.com/TeXitoi/structopt.git
$ cd structopt
$ cargo test --features nightly --all
   Compiling structopt v0.2.8 (file:///home/texitoi/dev/structopt)
error: lifetimes cannot use keyword names
   --> tests/custom-string-parsers.rs:101:9
    |
101 |     b: &'static str,
    |         ^^^^^^^

error: lifetimes cannot use keyword names
   --> tests/custom-string-parsers.rs:105:9
    |
105 |     d: &'static str,
    |         ^^^^^^^

error[E0261]: use of undeclared lifetime name `static`
   --> tests/custom-string-parsers.rs:101:9
    |
101 |     b: &'static str,
    |         ^^^^^^^ undeclared lifetime

error[E0261]: use of undeclared lifetime name `static`
   --> tests/custom-string-parsers.rs:105:9
    |
105 |     d: &'static str,
    |         ^^^^^^^ undeclared lifetime

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0261`.
error: Could not compile `structopt`.
warning: build failed, waiting for other jobs to finish...
error: build failed

The strange thing is that the code is

#[derive(StructOpt, PartialEq, Debug)]
struct NoOpOpt {
    #[structopt(short = "a", parse(from_str = "custom_parser_1"))]
    a: &'static str,
    #[structopt(short = "b", parse(try_from_str = "custom_parser_2"))]
    b: &'static str,
    #[structopt(short = "c", parse(from_os_str = "custom_parser_3"))]
    c: &'static str,
    #[structopt(short = "d", parse(try_from_os_str = "custom_parser_4"))]
    d: &'static str,
}

and it fails on b and d, but not a and c.

Looks a bit like #411

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions