Skip to content
New issue

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

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

Already on GitHub? # to your account

Missing in_band_lifetimes suggestion #73775

Closed
leonardo-m opened this issue Jun 26, 2020 · 0 comments · Fixed by #74168
Closed

Missing in_band_lifetimes suggestion #73775

leonardo-m opened this issue Jun 26, 2020 · 0 comments · Fixed by #74168
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@leonardo-m
Copy link

//#![feature(in_band_lifetimes)]
fn foo(data: &'a mut [u32]) -> &'a [u32] {
    data
}
fn main() {}

Gives (rustc 1.46.0-nightly 50fc24d 2020-06-25):

error[E0261]: use of undeclared lifetime name `'a`
 --> ...\test.rs:2:15
  |
2 | fn foo(data: &'a mut [u32]) -> &'a [u32] {
  |       -       ^^ undeclared lifetime
  |       |
  |       help: consider introducing lifetime `'a` here: `<'a>`

error[E0261]: use of undeclared lifetime name `'a`
 --> ...\test.rs:2:33
  |
2 | fn foo(data: &'a mut [u32]) -> &'a [u32] {
  |       -                         ^^ undeclared lifetime
  |       |
  |       help: consider introducing lifetime `'a` here: `<'a>`

Like most other features I'd like rustc to suggest using in_band_lifetimes if it's a Nightly compiler.

@JohnTitor JohnTitor added A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 26, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 10, 2020
…s, r=petrochenkov

Add a help to use `in_band_lifetimes` in nightly

Fixes rust-lang#73775
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 10, 2020
…s, r=petrochenkov

Add a help to use `in_band_lifetimes` in nightly

Fixes rust-lang#73775
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 10, 2020
…s, r=petrochenkov

Add a help to use `in_band_lifetimes` in nightly

Fixes rust-lang#73775
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 10, 2020
…s, r=petrochenkov

Add a help to use `in_band_lifetimes` in nightly

Fixes rust-lang#73775
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 11, 2020
…s, r=petrochenkov

Add a help to use `in_band_lifetimes` in nightly

Fixes rust-lang#73775
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 11, 2020
…s, r=petrochenkov

Add a help to use `in_band_lifetimes` in nightly

Fixes rust-lang#73775
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 11, 2020
…s, r=petrochenkov

Add a help to use `in_band_lifetimes` in nightly

Fixes rust-lang#73775
@bors bors closed this as completed in 9f7b64e Jul 12, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. 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