Skip to content

[resolve] use rename suggestion is not well-formatted #45799

Closed
@behnam

Description

if let Ok(snippet) = cm.span_to_snippet(binding.span) {
err.span_suggestion(binding.span,
rename_msg,
format!("{} as Other{}", snippet, name));

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.

Original commit: ff83240
Original PR: #45660

/cc @Cldfire

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions