Skip to content

FCW Lint when using an ambiguously glob imported trait#149058

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
LorrensP-2158466:amb-trait-lint
Jan 20, 2026
Merged

FCW Lint when using an ambiguously glob imported trait#149058
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
LorrensP-2158466:amb-trait-lint

Conversation

@LorrensP-2158466
Copy link
Contributor

@LorrensP-2158466 LorrensP-2158466 commented Nov 18, 2025

Related to #147992.

Report a lint when using an ambiguously glob import trait, this is a FCW because this should not be allowed.

r? @petrochenkov

@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 Nov 18, 2025
@rust-log-analyzer

This comment has been minimized.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 18, 2025
@petrochenkov petrochenkov 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 Nov 19, 2025
@LorrensP-2158466 LorrensP-2158466 changed the title resolve: Consider all traits ambiguously glob imported to be in scope Lint when using an ambiguously glob imported trait Nov 19, 2025
@LorrensP-2158466 LorrensP-2158466 changed the title Lint when using an ambiguously glob imported trait FCW Lint when using an ambiguously glob imported trait Nov 19, 2025
@LorrensP-2158466
Copy link
Contributor Author

Addressed your comments and updated pr title and description.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 19, 2025
Comment on lines +735 to +740
self.tcx.node_lint(AMBIGUOUS_TRAIT_GLOB_IMPORTS, segment.hir_id, |diag| {
diag.primary_message(format!("Use of ambiguously glob imported trait `{trait_name}`"))
.span(segment.ident.span)
.span_label(import_span, format!("`{trait_name}`imported ambiguously here"))
.help(format!("Import `{trait_name}` explicitly"));
});
Copy link
Contributor Author

@LorrensP-2158466 LorrensP-2158466 Nov 19, 2025

Choose a reason for hiding this comment

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

Is it possible to add some kind of suggestion like:

Consider importing `{trait_name}` directly:
+ use m1::{trait_name};

@petrochenkov petrochenkov 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 Nov 20, 2025
@LorrensP-2158466
Copy link
Contributor Author

@rustbot ready

@rustbot

This comment has been minimized.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 20, 2025
@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

r? @lcnr or someone else from types for the method resolution part.

This will need to go through crater and then lang team after the review.

@LorrensP-2158466 LorrensP-2158466 force-pushed the amb-trait-lint branch 2 times, most recently from 43c4a25 to 27629ec Compare January 18, 2026 13:35
@LorrensP-2158466
Copy link
Contributor Author

Can't do r=you. @rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 18, 2026
@petrochenkov
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 18, 2026

📌 Commit 27629ec has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 18, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 18, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 18, 2026

⚠️ A new commit 65c70e4579ce3312330cfda2704e21343aadb60f was pushed to the branch, the PR will need to be re-approved.

@rust-bors rust-bors bot removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 18, 2026
@LorrensP-2158466
Copy link
Contributor Author

Damn... sorry, should've grepped lower-case as well. Should be good now
@rustbot ready

@petrochenkov
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 18, 2026

📌 Commit 65c70e4 has been approved by petrochenkov

It is now in the queue for this repository.

@traviscross
Copy link
Contributor

@bors r-

Still some left to fix.

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 18, 2026

Commit 65c70e4 has been unapproved.

@LorrensP-2158466
Copy link
Contributor Author

LorrensP-2158466 commented Jan 18, 2026

I did rg "AMBIGUOUS_GLOB_IMPORTED_TRAIT" . -i on the entire rust directory and only found matches with an S at the end. So it should be good, now...

Sorry for being a bit to fast

@rustbot ready

@rust-log-analyzer

This comment has been minimized.

@LorrensP-2158466
Copy link
Contributor Author

@rustbot author

Note to self: never do OSS when away from home.

@LorrensP-2158466
Copy link
Contributor Author

Did the commands locally and everything works. @rustbot ready

@petrochenkov
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 20, 2026

📌 Commit 3369a17 has been approved by petrochenkov

It is now in the queue for this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.