Skip to content

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.

@traviscross
Copy link
Contributor

@bors r-

Still some left to fix.

@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

Commit 65c70e4 has been unapproved.

@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 LorrensP-2158466 force-pushed the amb-trait-lint branch 2 times, most recently from 3a2dae5 to 8888a6f Compare January 18, 2026 16:03
@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

@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
@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.

@rustbot rustbot 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 Jan 18, 2026
@lcnr lcnr removed their assignment Jan 20, 2026
@LorrensP-2158466
Copy link
Contributor Author

Did the commands locally and everything works. @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 20, 2026
@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.

@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 20, 2026
rust-bors bot pushed a commit that referenced this pull request Jan 20, 2026
Rollup of 6 pull requests

Successful merges:

 - #147611 (Stabilize `-Zremap-path-scope`)
 - #149058 (FCW Lint when using an ambiguously glob imported trait)
 - #149644 (Create x86_64-unknown-linux-gnuasan target which enables ASAN by default)
 - #150524 (Test that -Zbuild-std=core works on a variety of profiles)
 - #151394 (Fix typos: 'occured' -> 'occurred' and 'non_existant' -> 'non_existent')
 - #151396 (`rustc_queries!`: Don't push the `(cache)` modifier twice)

r? @ghost
@rust-bors rust-bors bot merged commit b5fa749 into rust-lang:main Jan 20, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Jan 20, 2026
rust-timer added a commit that referenced this pull request Jan 20, 2026
Rollup merge of #149058 - amb-trait-lint, r=petrochenkov

FCW Lint when using an ambiguously glob imported trait

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
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jan 20, 2026
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#147611 (Stabilize `-Zremap-path-scope`)
 - rust-lang/rust#149058 (FCW Lint when using an ambiguously glob imported trait)
 - rust-lang/rust#149644 (Create x86_64-unknown-linux-gnuasan target which enables ASAN by default)
 - rust-lang/rust#150524 (Test that -Zbuild-std=core works on a variety of profiles)
 - rust-lang/rust#151394 (Fix typos: 'occured' -> 'occurred' and 'non_existant' -> 'non_existent')
 - rust-lang/rust#151396 (`rustc_queries!`: Don't push the `(cache)` modifier twice)

r? @ghost
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jan 21, 2026
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#147611 (Stabilize `-Zremap-path-scope`)
 - rust-lang/rust#149058 (FCW Lint when using an ambiguously glob imported trait)
 - rust-lang/rust#149644 (Create x86_64-unknown-linux-gnuasan target which enables ASAN by default)
 - rust-lang/rust#150524 (Test that -Zbuild-std=core works on a variety of profiles)
 - rust-lang/rust#151394 (Fix typos: 'occured' -> 'occurred' and 'non_existant' -> 'non_existent')
 - rust-lang/rust#151396 (`rustc_queries!`: Don't push the `(cache)` modifier twice)

r? @ghost
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.