Skip to content

Filter do_not_recommend impls before handling a single candidate - #162771

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
kulinsky:fix-do-not-recomend
Sep 15, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
kulinsky:fix-do-not-recomend

Conversation

@kulinsky

@kulinsky kulinsky commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Fixed #160717: a single candidate could appear in the suggestion despite do_not_recommend.
The if block now executes only when there is exactly one implementation candidate and that candidate is not marked do_not_recommend.
A new test checks both solvers; it fails without the fix and passes with it.
These tests passed:
- ./x test tests/ui/diagnostic_namespace/do_not_recommend --force-rerun
- ./x test tests/ui/try-trait --force-rerun
- ./x test tidy
Used llm for code navigation.

@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 14, 2026
@rustbot

rustbot commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

r? @folkertdev

rustbot has assigned @folkertdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 76 candidates
  • Random selection from 18 candidates

@rust-log-analyzer

This comment has been minimized.

@estebank estebank left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You need to run x.py test tests/ui --bless to update existing .stderr tests.

Looking at the diffs, I am concerned that the other tests' output might be a regression (but it'll be easier to read once you update the PR).

View changes since this review

Comment thread compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs Outdated
Comment thread tests/ui/diagnostic_namespace/do_not_recommend/single-impl-candidate.rs Outdated
@estebank

Copy link
Copy Markdown
Contributor

One last nitpick: could you squash the commits? After that, we can merge.

Add regression test for do_not_recommend on a single impl candidate
@kulinsky

Copy link
Copy Markdown
Contributor Author

Squashed, thanks!

@folkertdev

Copy link
Copy Markdown
Contributor

r? estebank

@rustbot rustbot assigned estebank and unassigned folkertdev Sep 14, 2026
@estebank

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 56aed55 has been approved by estebank

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 Sep 15, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 15, 2026
…tebank

Filter do_not_recommend impls before handling a single candidate

Fixed rust-lang#160717: a single candidate could appear in the suggestion despite `do_not_recommend`.
The `if` block now executes only when there is exactly one implementation candidate and that candidate is not marked `do_not_recommend`.
A new test checks both solvers; it fails without the fix and passes with it.
These tests passed:
    - ./x test tests/ui/diagnostic_namespace/do_not_recommend --force-rerun
    - ./x test tests/ui/try-trait --force-rerun
    - ./x test tidy
Used llm for code navigation.
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
Rollup of 7 pull requests

Successful merges:

 - #160911 (Remove d32 feature from 32-bit Arm targets)
 - #162771 (Filter do_not_recommend impls before handling a single candidate)
 - #162779 (rustdoc: Revert "fix bare urls split text")
 - #161612 (std: make a lot of items crate private)
 - #162372 (Clean up `test/rustdoc-html` folder by moving tests where appropriate)
 - #162643 (Fix `path_trailing_sep` methods for Windows verbatim paths)
 - #162784 (AGENTS.md: Permit local experimentation, per the online policy.)
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 15, 2026
…tebank

Filter do_not_recommend impls before handling a single candidate

Fixed rust-lang#160717: a single candidate could appear in the suggestion despite `do_not_recommend`.
The `if` block now executes only when there is exactly one implementation candidate and that candidate is not marked `do_not_recommend`.
A new test checks both solvers; it fails without the fix and passes with it.
These tests passed:
    - ./x test tests/ui/diagnostic_namespace/do_not_recommend --force-rerun
    - ./x test tests/ui/try-trait --force-rerun
    - ./x test tidy
Used llm for code navigation.
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
Rollup of 10 pull requests

Successful merges:

 - #160911 (Remove d32 feature from 32-bit Arm targets)
 - #162771 (Filter do_not_recommend impls before handling a single candidate)
 - #162779 (rustdoc: Revert "fix bare urls split text")
 - #161548 (hir_typeck: Don't ICE on closures without drop location in closure capture lint)
 - #161612 (std: make a lot of items crate private)
 - #162204 (Suggest keyword order for `extern "C" const unsafe fn`)
 - #162372 (Clean up `test/rustdoc-html` folder by moving tests where appropriate)
 - #162638 (dont suggest changing the mutability of a borrow that comes from a macro)
 - #162643 (Fix `path_trailing_sep` methods for Windows verbatim paths)
 - #162784 (AGENTS.md: Permit local experimentation, per the online policy.)
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
Rollup of 10 pull requests

Successful merges:

 - #160911 (Remove d32 feature from 32-bit Arm targets)
 - #162771 (Filter do_not_recommend impls before handling a single candidate)
 - #162779 (rustdoc: Revert "fix bare urls split text")
 - #161548 (hir_typeck: Don't ICE on closures without drop location in closure capture lint)
 - #161612 (std: make a lot of items crate private)
 - #162204 (Suggest keyword order for `extern "C" const unsafe fn`)
 - #162372 (Clean up `test/rustdoc-html` folder by moving tests where appropriate)
 - #162638 (dont suggest changing the mutability of a borrow that comes from a macro)
 - #162643 (Fix `path_trailing_sep` methods for Windows verbatim paths)
 - #162784 (AGENTS.md: Permit local experimentation, per the online policy.)
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #160911 (Remove d32 feature from 32-bit Arm targets)
 - #161868 (libtest: never iterate over all tests in `--exact` mode)
 - #162771 (Filter do_not_recommend impls before handling a single candidate)
 - #162779 (rustdoc: Revert "fix bare urls split text")
 - #161548 (hir_typeck: Don't ICE on closures without drop location in closure capture lint)
 - #161612 (std: make a lot of items crate private)
 - #162204 (Suggest keyword order for `extern "C" const unsafe fn`)
 - #162372 (Clean up `test/rustdoc-html` folder by moving tests where appropriate)
 - #162638 (dont suggest changing the mutability of a borrow that comes from a macro)
 - #162643 (Fix `path_trailing_sep` methods for Windows verbatim paths)
 - #162654 (Improve Armv7-R documentation)
 - #162784 (AGENTS.md: Permit local experimentation, per the online policy.)
@rust-bors
rust-bors Bot merged commit d5976cf into rust-lang:main Sep 15, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 15, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
Rollup merge of #162771 - kulinsky:fix-do-not-recomend, r=estebank

Filter do_not_recommend impls before handling a single candidate

Fixed #160717: a single candidate could appear in the suggestion despite `do_not_recommend`.
The `if` block now executes only when there is exactly one implementation candidate and that candidate is not marked `do_not_recommend`.
A new test checks both solvers; it fails without the fix and passes with it.
These tests passed:
    - ./x test tests/ui/diagnostic_namespace/do_not_recommend --force-rerun
    - ./x test tests/ui/try-trait --force-rerun
    - ./x test tidy
Used llm for code navigation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

ignored [diagnostic::do_not_recommend]

5 participants