You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[resolve] use rename suggestion is not well-formatted #45799
Trying to re-import std or any other crate, I get a suggestion like this:
14 | extern crate std;
| ^^^^^^^^^^^^^^^^^ `std` reimported here
|
= note: `std` must be defined only once in the type namespace of this module
help:You can use `as` to change the binding name of the import
|
14 | extern crate std; as Otherstd
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The problem is in the formatting of the suggestion, where SEMICOLON (;) is placed before the as keyword, like this extern crate std; as Otherstd instead of extern crate std as Otherstd;.
The suggestion doesn't exist in stable or beta, so this affects only nightly at the moment.
I should be able to look into fixing this tonight (~12 hours from now) or tomorrow. @estebank, may I ask if you have any comments or input as to how this should be fixed before I do so?
@Cldfire what I would do is change the binding.span for extern crate statements to not include the semicolon. To do so, it is probably enough to modify parse_item_extern_crate in libsyntax/parse/parser.rs to take the self.prev_span before parsing the semicolon. That change would probably affect other ui tests as it would change underlines involving extern crate statements, and you should check if there're any regressions doing that change.
Activity
behnam commentedon Nov 6, 2017
Looks like the feature works fine for
usestatements, but has this bug forextern crateones. Maybe worth adding a test case forextern crate, too.Cldfire commentedon Nov 6, 2017
Whoops! Thanks for noticing that.
I should be able to look into fixing this tonight (~12 hours from now) or tomorrow. @estebank, may I ask if you have any comments or input as to how this should be fixed before I do so?
estebank commentedon Nov 6, 2017
@Cldfire what I would do is change the
binding.spanforextern cratestatements to not include the semicolon. To do so, it is probably enough to modifyparse_item_extern_crateinlibsyntax/parse/parser.rsto take theself.prev_spanbefore parsing the semicolon. That change would probably affect other ui tests as it would change underlines involvingextern cratestatements, and you should check if there're any regressions doing that change.Cldfire commentedon Nov 6, 2017
Gotcha, thanks for the advice.