Rust: Suggest removal of stray `;` after `struct` definition

Created on 22 Nov 2017  路  5Comments  路  Source: rust-lang/rust

For the given code

struct Struct {
    a: usize,
};

the output is only

error: expected item, found `;`
  --> file.rs:15:2
   |
15 | };
   |  ^

where it should suggest removing the semicolon (as a suggestion so the RLS does the right thing)

error: expected item, found `;`
  --> file.rs:15:2
   |
15 | };
   |  ^ consider removing this semicolon

This is an edge situation, but I feel it is a common enough typo I've made and that is very likely to happen to newcomers.

A-diagnostics C-enhancement E-easy WG-compiler-errors

Most helpful comment

Newcomers from C++ are likely to hit this error.

All 5 comments

I'll take this one :)

Newcomers from C++ are likely to hit this error.

@jjolly @raventid I think I almost have a working solution to this. Will make a pull request when I compile in test.

This can be closed due to #46312 and #46258, I believe.

Closing as fixed in #46258. Thanks for contribution!

Was this page helpful?
0 / 5 - 0 ratings