Skip to content

Resolver: Record at least 1 ambiguous trait if main decl is not a trait.#159599

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
LorrensP-2158466:fix-ambig-trait-glob-lint
Jul 20, 2026
Merged

Resolver: Record at least 1 ambiguous trait if main decl is not a trait.#159599
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
LorrensP-2158466:fix-ambig-trait-glob-lint

Conversation

@LorrensP-2158466

@LorrensP-2158466 LorrensP-2158466 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Addresses #159476.

When recording traits of a particular module, it is possible that a trait hidden in the ambiguity declaration of a main declaration (struct, enum, ...), thus causing us to never record that trait. This caused us to report an error that methods of those traits are not in scope and that we do not report the AMBIGUOUSLY_GLOB_IMPORTED_TRAIT lint, which was the case in #159476.

We now record at least 1 trait in the collection of ambiguous declarations, such that we don't report that error and can report the relevant lint.

Also updated the linked issue of the lint in question.

r? @petrochenkov

…at least 1 trait of the ambiguous decls (is possible) such that we can record the `ambiguously_glob_imported_trait` lint.

Also updated the issue linked by the lint.

+ added extra test
+ bless original test because of updated link
@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 Jul 20, 2026
@theemathas theemathas added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 20, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 73ed271 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 Jul 20, 2026
rust-bors Bot pushed a commit that referenced this pull request Jul 20, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #159600 (`rust-analyzer` subtree update)
 - #158046 (proc_macro: preserve file module spans for inner attrs)
 - #159000 (Small cleanups to the incr comp session code)
 - #159189 (Account for type alias projections in E0308 "expected/found" shortening logic)
 - #159449 (Enable single Location to issue multiple borrows)
 - #159544 (Suggest valid command-line crate names)
 - #159587 (Improve `AttrItem::span`)
 - #159594 (feat(rustc_hir_typeck): suggest `impl Fn` return for capturing closures)
 - #159597 (std: use `arc4random_buf` from libc)
 - #159599 (Resolver: Record at least 1 ambiguous trait if main decl is not a trait.)
 - #158061 (Make `pin!()` more foolproof.)
 - #159460 (Do not mark unnormalized const aliases as rigid when normalizing param env)
 - #159529 (Add regression test for nested replacement ranges in `collect_tokens`)
 - #159571 (Remove unused bundled library lookup for the local crate)
 - #159585 (Minor `TokenStream` improvements)
 - #159586 (Separate `InterpCx` usage by `ConstAnalysis` phases)
 - #159602 (Remove `ItemLike`)
 - #159603 (Clarify `push_stream`/`push_tree`)

Failed merges:

 - #159590 (Remove some dead code)
@rust-bors
rust-bors Bot merged commit 581f102 into rust-lang:main Jul 20, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 20, 2026
rust-timer added a commit that referenced this pull request Jul 20, 2026
Rollup merge of #159599 - LorrensP-2158466:fix-ambig-trait-glob-lint, r=petrochenkov

Resolver: Record at least 1 ambiguous trait if main decl is not a trait.

Addresses #159476.

When recording traits of a particular module, it is possible that a trait hidden in the ambiguity declaration of a main declaration (struct, enum, ...), thus causing us to never record that trait. This caused us to report an error that methods of those traits are not in scope and that we do not report the `AMBIGUOUSLY_GLOB_IMPORTED_TRAIT` lint, which was the case in #159476.

We now record at least 1 trait in the collection of ambiguous declarations, such that we don't report that error and can report the relevant lint.

Also updated the linked issue of the lint in question.

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

Labels

beta-nominated Nominated for backporting to the compiler in the beta channel. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants