Skip to content

Conversation

GuillaumeGomez
Copy link
Member

Fixes #115858.

This only appears starting the 2018 edition because of this.

@rustbot
Copy link
Collaborator

rustbot commented Sep 15, 2023

r? @compiler-errors

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 15, 2023
@GuillaumeGomez GuillaumeGomez force-pushed the fix-duplicated-crate-err branch from ba9093a to 1ca042a Compare September 15, 2023 15:49
pub mod utils {
pub fn f() {
let x = crate::linux::system::Y;
//~^ ERROR unresolved import
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find a way to ensure that in the help message, we have the correct suggested path to prevent regressions from happening. If someone knows how I could do that, it'd be awesome!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could // run-rustfix which checks that the applied suggestion works

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice! Doing that right away. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it doesn't work because there are multiple suggestions:

thread '[ui] tests/ui/imports/issue-115858-duplicated-crate-diag.rs' panicked at src/tools/compiletest/src/runtest.rs:3830:17:
failed to apply suggestions for "/home/imperio/rust/rust/tests/ui/imports/issue-115858-duplicated-crate-diag.rs" with rustfix: Could not replace range 309...322 in file -- maybe parts of it were already replaced?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know maybe how to check this @estebank ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillaumeGomez We should change the logic so that the last two suggestions aren't emitted if this one is. rustfix can't deal with multiple exclusive suggestions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean changing the logic behind the compiler error help messages or rustfix? In any case, what do you have in mind?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler is the one responsible to not emit unnecessary suggestions. I'd need to look at the code more closely to see how to signal that the more specific suggestion has already been added to the diagnostic, to not add the later ones.

@compiler-errors
Copy link
Member

r? estebank

@rustbot rustbot assigned estebank and unassigned compiler-errors Sep 18, 2023
@apiraino
Copy link
Contributor

r? compiler

@rustbot rustbot assigned oli-obk and unassigned estebank Oct 19, 2023
@oli-obk oli-obk added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 19, 2023
@JohnCSimon
Copy link
Member

@GuillaumeGomez
Ping from triage: I'm closing this due to inactivity as it has not been updated in months.

@rustbot label: +S-inactive

@JohnCSimon JohnCSimon closed this May 26, 2024
@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label May 26, 2024
@GuillaumeGomez GuillaumeGomez deleted the fix-duplicated-crate-err branch May 27, 2024 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad path suggestion (duplicating crate keyword)
7 participants