Skip to content

trait_selection: fix assumptions-on-binders diagnostics#158588

Open
Dnreikronos wants to merge 1 commit into
rust-lang:mainfrom
Dnreikronos:trait_selection/assumptions_binders_diagnostics
Open

trait_selection: fix assumptions-on-binders diagnostics#158588
Dnreikronos wants to merge 1 commit into
rust-lang:mainfrom
Dnreikronos:trait_selection/assumptions_binders_diagnostics

Conversation

@Dnreikronos

@Dnreikronos Dnreikronos commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

fixes #157732

the assumptions-on-binders outlives paths were still emitting placeholder text (:3 and meoow :c), and the ui tests blessed it. imo the small, honest diagnostic is better here than trying to guess a source-level fix while the flag is still wip.

this adds an explicit outlives fulfillment error for the flag, uses higher-ranked lifetime bound could not be satisfied across trait selection, region reporting, and borrowck, and updates the ui output incl. the new regression test.

future work, maybe: carry the failed outlives predicate or originating binder through this path so the diagnostic can name what failed. idk that it's sound for this pr; it needs more data than these callers have rn.

@rustbot

rustbot commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 29, 2026
@rustbot rustbot added 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 Jun 29, 2026
@rustbot

rustbot commented Jun 29, 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 73 candidates
  • Random selection from 17 candidates

@rust-log-analyzer

This comment has been minimized.

@Dnreikronos Dnreikronos force-pushed the trait_selection/assumptions_binders_diagnostics branch from 6d112e4 to 36f4d5a Compare June 29, 2026 23:09
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
To only update this specific test, also pass `--test-args assumptions_on_binders/alias_outlives.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/assumptions_on_binders/alias_outlives.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/assumptions_on_binders/alias_outlives" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Znext-solver" "-Zassumptions-on-binders"
stdout: none
--- stderr -------------------------------
error: higher-ranked lifetime bound could not be satisfied
##[error]  --> /checkout/tests/ui/assumptions_on_binders/alias_outlives.rs:37:1
   |
LL | const REGIONCK_ENV_FAIL<'a, T: AliasHaver>: ReqTrait<T::Assoc> = todo!()
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: higher-ranked lifetime bound could not be satisfied
##[error]  --> /checkout/tests/ui/assumptions_on_binders/alias_outlives.rs:25:1
   |
LL | / fn borrowck_env_fail<'a, T: AliasHaver>()
LL | | //~^ ERROR: higher-ranked lifetime bound could not be satisfied
LL | | where
LL | |     <T as AliasHaver>::Assoc: 'a,
   | |_________________________________^

error: aborting due to 2 previous errors
------------------------------------------

---
To only update this specific test, also pass `--test-args assumptions_on_binders/higher-ranked-outlives-issue-157732.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/assumptions_on_binders/higher-ranked-outlives-issue-157732.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/assumptions_on_binders/higher-ranked-outlives-issue-157732" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Zassumptions-on-binders" "-Znext-solver=globally"
stdout: none
--- stderr -------------------------------
error: higher-ranked lifetime bound could not be satisfied
##[error]  --> /checkout/tests/ui/assumptions_on_binders/higher-ranked-outlives-issue-157732.rs:10:5
   |

@folkertdev

Copy link
Copy Markdown
Contributor

r? types

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Jun 30, 2026
@rustbot rustbot assigned jackh726 and unassigned folkertdev Jun 30, 2026
@lcnr

lcnr commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

r? BoxyUwU

We intend to fully rework the way these diagnostics work and the errors are currently intentionally bad as they don't even have span information (they point to the whole containing function).

I think keeping the status quo is preferable as a very explicit "this is still very WIP" and would personally prefer to close this PR

@rustbot rustbot assigned BoxyUwU and unassigned jackh726 Jun 30, 2026
@rustbot

rustbot commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

BoxyUwU is currently at their maximum review capacity.
They may take a while to respond.

@Dnreikronos

Copy link
Copy Markdown
Contributor Author

r? BoxyUwU

We intend to fully rework the way these diagnostics work and the errors are currently intentionally bad as they don't even have span information (they point to the whole containing function).

I think keeping the status quo is preferable as a very explicit "this is still very WIP" and would personally prefer to close this PR

thanks, that makes sense. i was mostly looking at this as remove the placeholder text, but imo you're right that the nicer message is a bit misleading if the span is still basically wrong.

i'll wait for boxyuwu's opinion before closing the pr. if i poke at this again later, i think i'd rather start by carrying more of the failed outlives predicate / binder info through first, then make the diagnostic nicer once it has enough data to not lie.

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

Labels

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. T-types Relevant to the types 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.

[ICE]: assumptions on binder: outlives clauses should not error outside borrowck

7 participants