Skip to content
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

Lifetimes are inconsistently printed with backticks #65287

Closed
varkor opened this issue Oct 10, 2019 · 0 comments · Fixed by #65292
Closed

Lifetimes are inconsistently printed with backticks #65287

varkor opened this issue Oct 10, 2019 · 0 comments · Fixed by #65292
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-inconsistent Diagnostics: Inconsistency in formatting, grammar or style between diagnostic messages. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@varkor
Copy link
Member

varkor commented Oct 10, 2019

fn foo<'a>(u: &'a usize) -> impl IntoIterator<Item = usize> + 'a {
    std::thread::spawn(|| {
        println!("{}", u);
    });
    vec![]
}

displays:

error: cannot infer an appropriate lifetime
 --> src/lib.rs:2:24
  |
2 |       std::thread::spawn(|| {
  |  _____------------------_^
  | |     |
  | |     this return type evaluates to the `'static` lifetime...
3 | |         println!("{}", u);
4 | |     });
  | |_____^ ...but this borrow...
  |
note: ...can't outlive the lifetime 'a as defined on the function body at 1:8

Notice how `'static` is surrounded in backticks, but 'a is not.

@varkor varkor added A-diagnostics Area: Messages for errors, warnings, and lints D-inconsistent Diagnostics: Inconsistency in formatting, grammar or style between diagnostic messages. labels Oct 10, 2019
@estebank estebank added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 10, 2019
Centril added a commit to Centril/rust that referenced this issue Oct 14, 2019
@bors bors closed this as completed in c2ae4de Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-inconsistent Diagnostics: Inconsistency in formatting, grammar or style between diagnostic messages. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants