Skip to content

don't ignore ambiguity during MIR type check - #164055

Open
lcnr wants to merge 1 commit into
rust-lang:mainfrom
lcnr:next-solver-soundness-bug
Open

lcnr wants to merge 1 commit into
rust-lang:mainfrom
lcnr:next-solver-soundness-bug

Conversation

@lcnr

@lcnr lcnr commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

fixes #164054

this was previously fixed in #116530 and later reverted in #118736.

It impacts the new solver more than the old one as the new solver depends significantly more on region identity, see the relevant stabilization report section.

The old solver has significantly less region identity dependence. It does rely on region identity when merging candidates during normalization:

// Duplicates can happen inside ParamEnv. In the case, we
// perform a lazy deduplication.
if current == &candidate {
return false;
}

This check results in additional ICE with the old solver while instead triggering the potentially region dependent goals check with the new one

let value = op(&ocx).map_err(|_| {
infcx.tcx.check_potentially_region_dependent_goals(root_def_id).err().unwrap_or_else(

r? types

@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 9, 2026
@lcnr lcnr added the I-types-nominated Nominated for discussion during a types team meeting. label Oct 9, 2026
@rustbot

rustbot commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

🤖 A dedicated #t-types/nominated topic has been opened for humans to discuss this issue 🤖

@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr closed this Oct 9, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 9, 2026
@lcnr lcnr reopened this Oct 9, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 9, 2026
@rust-log-analyzer

This comment has been minimized.

@lcnr
lcnr force-pushed the next-solver-soundness-bug branch from 14f0018 to 3eee062 Compare October 12, 2026 12:04
@rustbot

rustbot commented Oct 12, 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.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-x86_64-gnu-miri failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tests/pass/shims/x86/rounding-error.rs ... ok
tests/pass/shims/x86/intrinsics-x86-gfni.rs ... ok

FAILED TEST: tests/pass/dyn-upcast.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-1pheec" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/miri" "--error-format=json" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/tmp/miri_ui/0/tests/pass" "tests/pass/dyn-upcast.rs" "--edition" "2021"

error: test got exit status: 1, but expected 0
 = note: compilation failed, but was expected to succeed

error: no output was expected
Execute `./miri test --bless` to update `tests/pass/dyn-upcast.stderr` to the actual output
+++ <stderr output>
error[E0283]: type annotations needed: cannot satisfy `dyn modulo_binder::Trait<&(), &()>: modulo_binder::Supertrait<&()>`
##[error]  --> tests/pass/dyn-upcast.rs:504:10
   |
LL |         .say_hello(&0);
   |          ^^^^^^^^^
   |
   = note: cannot satisfy `dyn modulo_binder::Trait<&(), &()>: modulo_binder::Supertrait<&()>`
help: the trait `modulo_binder::Supertrait<T>` is implemented for `()`
  --> tests/pass/dyn-upcast.rs:493:5
   |
LL |     impl<T> Supertrait<T> for () {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `modulo_binder::Trait::say_hello`
  --> tests/pass/dyn-upcast.rs:495:24
   |
LL |     trait Trait<T, U>: Supertrait<T> + Supertrait<U> {
   |                        ^^^^^^^^^^^^^ required by this bound in `Trait::say_hello`
LL |         fn say_hello(&self, _: &usize) {
---
error: no output was emitted
Execute `./miri test --bless` to remove `tests/pass/dyn-upcast.stdout`

full stderr:
error[E0283]: type annotations needed: cannot satisfy `dyn modulo_binder::Trait<&(), &()>: modulo_binder::Supertrait<&()>`
##[error]  --> tests/pass/dyn-upcast.rs:504:10
   |
LL |         .say_hello(&0);
   |          ^^^^^^^^^
   |
   = note: cannot satisfy `dyn modulo_binder::Trait<&(), &()>: modulo_binder::Supertrait<&()>`
help: the trait `modulo_binder::Supertrait<T>` is implemented for `()`
  --> tests/pass/dyn-upcast.rs:493:5
   |
LL |     impl<T> Supertrait<T> for () {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `modulo_binder::Trait::say_hello`
  --> tests/pass/dyn-upcast.rs:495:24
   |
LL |     trait Trait<T, U>: Supertrait<T> + Supertrait<U> {
   |                        ^^^^^^^^^^^^^ required by this bound in `Trait::say_hello`
LL |         fn say_hello(&self, _: &usize) {
---

Location:
   /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ui_test-0.30.7/src/lib.rs:365

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error: test failed, to rerun pass `--test ui`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/miri/d88a065f2799f036/out/ui-d88a065f2799f036` (exit status: 1)
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo test --target x86_64-unknown-linux-gnu -Zbinary-dep-depinfo -j 4 -Zroot-dir=/checkout -Zembed-metadata=no --locked --color=always --profile=release --manifest-path /checkout/src/tools/miri/Cargo.toml -- [workdir=/checkout]` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:208:21
Executed at: src/bootstrap/src/core/build_steps/test.rs:790:19

Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `test --stage 2 miri cargo-miri`
Currently active steps:
test::Miri { target: x86_64-unknown-linux-gnu } at src/bootstrap/src/core/build_steps/test.rs:716
Build completed unsuccessfully in 0:27:08
  local time: Mon Oct 12 12:35:42 UTC 2026

@rust-bors

rust-bors Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #164284) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

This branch has not been deployed

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

Labels

I-types-nominated Nominated for discussion during a types team meeting. 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MIR borrowck ignores ambiguity in ProvePredicate

4 participants