Skip to content

Silence redundant failed obligations on the same statement - #163913

Merged
rust-bors[bot] merged 5 commits into
rust-lang:mainfrom
estebank:wellformedloc
Oct 8, 2026
Merged

rust-bors[bot] merged 5 commits into
rust-lang:mainfrom
estebank:wellformedloc

Conversation

@estebank

@estebank estebank commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Fix #84346, fix #105753.

On multiple unment obligations in the same method chain, only emit one. On unmet Sized obligations on a binding, its type and its init expression, only emit one.

@rustbot

rustbot commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

changes to the core type system

cc @lcnr

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Oct 7, 2026
@rustbot

rustbot commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

r? @oli-obk

rustbot has assigned @oli-obk.
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 77 candidates
  • Random selection from 19 candidates

@rust-log-analyzer

This comment has been minimized.

@estebank

estebank commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Easier to review per-comit: first add mild mechanic changes to have more tracking to be used later, added the tests that I wanted to tackle, and finally the actual logic change that affects the emitted errors.

@oli-obk oli-obk changed the title Silence redudant failed obligations on the same statement Silence redundant failed obligations on the same statement Oct 7, 2026
Comment thread compiler/rustc_hir_typeck/src/expr.rs Outdated
field_ty,
expr.span,
ObligationCauseCode::Misc,
ObligationCauseCode::WellFormed(WellFormedLoc::None),

@oli-obk oli-obk Oct 7, 2026 •

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.

may be worth figuring out a WellFormedLoc for, as this is the only use of None that won't be removed when the old solver gets nuked Soon ™️

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Using the HirId of the expr doesn't change anything today (because it is the offset_of! macro which already points at the whole expr), but might in the future. Changed in the last commit.

Comment thread compiler/rustc_infer/src/infer/mod.rs
Comment thread compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs Outdated
Comment thread compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs Outdated
@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 Oct 7, 2026
@rustbot

rustbot commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@estebank estebank 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 Oct 7, 2026
@oli-obk

oli-obk commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 9d0888f has been approved by oli-obk

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 Oct 8, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 8, 2026
 Silence redundant failed obligations on the same statement

Fix rust-lang#84346, fix rust-lang#105753.

On multiple unment obligations in the same method chain, only emit one. On unmet `Sized` obligations on a binding, its type and its init expression, only emit one.
@JonathanBrouwer

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #163984 (comment)

@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 8, 2026
@rust-bors

rust-bors Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#163984), which was unapproved.

View changes since this unapproval

Carry more information for well-formed obligations coming from expressions.
Reduces the number of errors being emitted by a single unmet `Sized` (or other) bound in method call chains.
@rustbot

rustbot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@estebank

estebank commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@bors r=oli-obk

@rust-bors

rust-bors Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 83bd0e0 has been approved by oli-obk

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 8, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 8, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - #156112 (Distinguish `repr(C)` ZSTs from others in ABI computation)
 - #157941 (Deny partial `-Z stack-protector` by default in all editions)
 - #163462 (Fix COFF renaming of decorated (stdcall/fastcall/vectorcall) exports)
 - #163855 (Include enclosing item's context on const errors)
 - #163861 (Run LLDB debuginfo tests on `x86_64-mingw`)
 - #163913 ( Silence redundant failed obligations on the same statement)
 - #161201 (Speed up tidy again)
 - #163380 (Tweak "name not found" resolution error when it happens from within a derive expansion)
 - #163538 (Add `rustc::missing_generic_type_visitable` lint)
 - #163617 (mips: make `Complex<T>` ABI match GCC)
 - #163772 (comptime fn error: suggest wrapping in const block)
 - #163813 (use pre-borrowck typing env for early MIR validation)
 - #163924 (replace instances of NonNull::new(&mut x).expect("...") with NonNull::from_mut)
 - #163958 (only make `RustaceansAreAwesome` satisfy trait clauses)
 - #163960 (vexos: clear .bss from assembly)
 - #163974 (Condense AdtDef lang item checks into one match)
 - #163979 (Add `bf16` to arm features)
 - #163989 (Revert "compiletest: stream output of executor process when --no-capture is set")
 - #163995 (m68k-unknown-none-elf: Remove code model)

Failed merges:

 - #163832 (reject non-async coroutine closures as async callables)
 - #163972 (const-eval: ICE when we hit a non-const fn)
@rust-bors
rust-bors Bot merged commit 41dce4c into rust-lang:main Oct 8, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 8, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 8, 2026
Rollup merge of #163913 - estebank:wellformedloc, r=oli-obk

 Silence redundant failed obligations on the same statement

Fix #84346, fix #105753.

On multiple unment obligations in the same method chain, only emit one. On unmet `Sized` obligations on a binding, its type and its init expression, only emit one.
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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Too many dyn Trait is not Sized errors Provide suggestions for unsized type parameters and when involving iterators

5 participants