-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Error message for duplicate names suggests invalid Rust #45829
Comments
Fix help for duplicated names: `extern crate (...) as (...)` On the case of duplicated names caused by an `extern crate` statement with a rename, don't include the inline suggestion, instead using a span label with only the text to avoid incorrect rust code output. Fix rust-lang#45829.
#![allow(unused_imports)]
mod foo {
pub struct A;
pub struct B;
}
use foo::{A, B as A};
fn main() {}
|
@pietroalbini thanks for fishing this out! The fix for |
Hello ! I took a shot at this. I noticed that rust no longer suggests a new name for an if let (Ok(snippet), false) = (cm.span_to_snippet(binding.span),
binding.is_renamed_extern_crate()) { I didn't change that in #55113 in case it was done willingly, but that should be easy to change. |
@mockersf commented on the PR. If you can apply the fix to |
#45829 when a renamed import conflict with a previous import Fix the suggestion when a renamed import conflict. It check if the snipped contains `" as "`, and if so uses everything before for the suggestion.
Consider the following library (with
hello
andaleph
externs provided):rustc
will reasonably identify a problem:but will then go on to suggest a rather unhelpful solution that isn't even valid Rust code:
The text was updated successfully, but these errors were encountered: