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

Detect type ascription use that should be let assignment #78907

Closed
estebank opened this issue Nov 9, 2020 · 0 comments · Fixed by #100111
Closed

Detect type ascription use that should be let assignment #78907

estebank opened this issue Nov 9, 2020 · 0 comments · Fixed by #100111
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

estebank commented Nov 9, 2020

The following code

    let mut foo: i32 = 1;
    foo: i32 = 4;

currently emits

error[E0658]: type ascription is experimental
 --> src/main.rs:3:5
  |
3 |     foo: i32 = 4;
  |     ^^^^^^^^
  |
  = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
  = help: add `#![feature(type_ascription)]` to the crate attributes to enable

but it should also suggest let foo: i32 = 4;

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` D-papercut Diagnostics: An error or lint that needs small tweaks. labels Nov 9, 2020
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 3, 2022
…rrors

Provide suggestion on missing `let` in binding statement

Fix rust-lang#78907.

Fallout from the type ascription syntax.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 3, 2022
…rrors

Provide suggestion on missing `let` in binding statement

Fix rust-lang#78907.

Fallout from the type ascription syntax.
@bors bors closed this as completed in 939c2b6 Aug 4, 2022
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 A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` D-papercut Diagnostics: An error or lint that needs small tweaks. 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.

1 participant