Skip to content

Record NormalizesTo goal for proof tree - #162113

Draft
adwinwhite wants to merge 2 commits into
rust-lang:mainfrom
adwinwhite:record-normalizes-to
Draft

adwinwhite wants to merge 2 commits into
rust-lang:mainfrom
adwinwhite:record-normalizes-to

Conversation

@adwinwhite

Copy link
Copy Markdown
Contributor

It should be doable.
Only one notable regression in AmbiguityVisitor - tests/ui/specialization/specialization-overlap-projection.rs. Will look into it tmrw.
Done for the day and open this to start perf.

r? lcnr

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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 Sep 1, 2026
@adwinwhite

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 1, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 1, 2026
Record `NormalizesTo` goal for proof tree
@rust-bors

This comment has been minimized.

@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)
---- [ui] tests/ui/specialization/specialization-overlap-projection.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit status: 101
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/specialization/specialization-overlap-projection.rs" "-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/specialization/specialization-overlap-projection" "-Znext-solver=coherence" "-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"
stdout: none
--- stderr -------------------------------

thread 'rustc' (136641) panicked at compiler/rustc_next_trait_solver/src/canonical/mod.rs:504:40:
called `Result::unwrap()` on an `Err` value: Sorts(ExpectedFound { expected: u32, found: u8 })
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: rustc_next_trait_solver::canonical::unify_query_var_values::<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>
   4: rustc_next_trait_solver::canonical::instantiate_canonical_state::<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt, ()>
   5: <rustc_trait_selection::solve::inspect::analyse::InspectCandidate>::instantiate_nested_goals
   6: <rustc_trait_selection::solve::inspect::analyse::InspectCandidate>::visit_nested_no_probe::<rustc_trait_selection::traits::coherence::AmbiguityCausesVisitor>
   7: <rustc_infer::infer::InferCtxt>::probe::<(), <rustc_trait_selection::solve::inspect::analyse::InspectCandidate>::visit_nested_in_probe<rustc_trait_selection::traits::coherence::AmbiguityCausesVisitor>::{closure#0}>
   8: <rustc_trait_selection::traits::coherence::AmbiguityCausesVisitor as rustc_trait_selection::solve::inspect::analyse::ProofTreeVisitor>::visit_goal
   9: <rustc_trait_selection::solve::inspect::analyse::InspectCandidate>::visit_nested_no_probe::<rustc_trait_selection::traits::coherence::AmbiguityCausesVisitor>
  10: <rustc_infer::infer::InferCtxt>::probe::<(), <rustc_trait_selection::solve::inspect::analyse::InspectCandidate>::visit_nested_in_probe<rustc_trait_selection::traits::coherence::AmbiguityCausesVisitor>::{closure#0}>
  11: <rustc_trait_selection::traits::coherence::AmbiguityCausesVisitor as rustc_trait_selection::solve::inspect::analyse::ProofTreeVisitor>::visit_goal
  12: <rustc_infer::infer::InferCtxt>::probe::<(), rustc_trait_selection::traits::coherence::search_ambiguity_causes::{closure#0}>
  13: rustc_trait_selection::traits::coherence::overlap
  14: rustc_trait_selection::traits::coherence::overlapping_impls
  15: rustc_trait_selection::traits::coherence::overlapping_trait_impls
  16: <rustc_middle::traits::specialization_graph::Children as rustc_trait_selection::traits::specialize::specialization_graph::ChildrenExt>::insert
  17: <rustc_middle::traits::specialization_graph::Graph as rustc_trait_selection::traits::specialize::specialization_graph::GraphExt>::insert
  18: rustc_trait_selection::traits::specialize::specialization_graph_provider
      [... omitted 2 frames ...]
  19: rustc_hir_analysis::coherence::coherent_trait
      [... omitted 2 frames ...]
  20: rustc_hir_analysis::check::check::check_item_type
  21: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 2 frames ...]
  22: rustc_middle::query::calls::query_ensure_result::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, ()>
  23: std::panicking::catch_unwind::<core::result::Result<(), rustc_span::ErrorGuaranteed>, core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_hir::hir::ImplItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_impl_items<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#1}>::{closure#0}>::{closure#0}::{closure#1}::{closure#0}>>
  24: rustc_data_structures::sync::parallel::try_par_for_each_in::<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_items<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>
  25: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 2 frames ...]
  26: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#0}>
  27: rustc_hir_analysis::check_crate
  28: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  29: std::panicking::catch_unwind::<core::option::Option<rustc_interface::queries::Linker>, core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}::{closure#0}>>
  30: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  31: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}>
  32: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
  33: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}::{closure#0}>>
  34: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
  35: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
note: please make sure that you have updated to the latest nightly

note: rustc 1.100.0-nightly (a6501fa4c 2026-09-01) running on aarch64-unknown-linux-gnu

note: compiler flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -Z next-solver=coherence -C rpath -C debuginfo=0

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `Foo`
#1 [coherent_trait] coherence checking all impls of trait `Foo`
#2 [check_well_formed] checking that `<impl at /checkout/tests/ui/specialization/specialization-overlap-projection.rs:18:1: 18:17>` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `specialization_overlap_projection`
end of query stack
------------------------------------------

---- [ui] tests/ui/specialization/specialization-overlap-projection.rs stdout end ----
---- [ui] tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/traits/next-solver/diagnostics/point-at-failing-nested/point-at-failing-nested.stderr`
diff of stderr:

2   --> $DIR/point-at-failing-nested.rs:22:17
3    |
4 LL |     needs_foo::<()>();
-    |                 ^^ the trait `Bar` is not implemented for `()`
+    |                 ^^ the trait `Foo` is not implemented for `()`
6    |
- help: this trait has no implementations, consider adding one
-   --> $DIR/point-at-failing-nested.rs:4:1
-    |
- LL | trait Bar {}
---
To only update this specific test, also pass `--test-args traits/next-solver/diagnostics/point-at-failing-nested.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/traits/next-solver/diagnostics/point-at-failing-nested.rs" "-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/traits/next-solver/diagnostics/point-at-failing-nested" "-Znext-solver=coherence" "-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"
stdout: none
--- stderr -------------------------------
error[E0277]: the trait bound `(): Foo` is not satisfied
##[error]  --> /checkout/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs:22:17
   |
LL |     needs_foo::<()>();
   |                 ^^ the trait `Foo` is not implemented for `()`
   |
note: required by a bound in `needs_foo`
  --> /checkout/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs:20:17
   |
LL | fn needs_foo<T: Foo>() {}
---
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/traits/next-solver/overflow/fcw-on-normalization.next/fcw-on-normalization.next.stderr`
diff of stderr:

6    |
7    = note: which requires `<W<W<W<W<W<W<W<W<W<()>>>>>>>>> as HasAssoc>::Assoc == ()`
8    = note: which requires `<W<W<W<W<W<W<W<W<()>>>>>>>> as HasAssoc>::Assoc == ()`
+    = note: which requires `<W<W<W<W<W<W<W<W<()>>>>>>>> as HasAssoc>::Assoc normalizes-to _`
+    = note: which requires `<W<W<W<W<W<W<W<()>>>>>>> as HasAssoc>::Assoc == _`
+    = note: which requires `<W<W<W<W<W<W<W<()>>>>>>> as HasAssoc>::Assoc normalizes-to _`
+    = note: which requires `<W<W<W<W<W<W<()>>>>>> as HasAssoc>::Assoc == _`
+    = note: which requires `<W<W<W<W<W<W<()>>>>>> as HasAssoc>::Assoc normalizes-to _`
9    = note: and so on...
10    = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved
11    = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "16"]` attribute to your crate (`fcw_on_normalization`)


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args traits/next-solver/overflow/fcw-on-normalization.rs`

error in revision `next`: 1 errors occurred comparing output.
status: exit status: 0
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/traits/next-solver/overflow/fcw-on-normalization.rs" "-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" "--cfg" "next" "--check-cfg" "cfg(test,FALSE,old,next)" "--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/traits/next-solver/overflow/fcw-on-normalization.next" "-Znext-solver=coherence" "-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"
stdout: none
--- stderr -------------------------------
warning: overflow evaluating the requirement `<W<W<W<W<W<W<W<W<W<W<()>>>>>>>>>> as HasAssoc>::Assoc == ()`
##[warning]  --> /checkout/tests/ui/traits/next-solver/overflow/fcw-on-normalization.rs:40:12
   |
LL |     let b: <W<W<W<W<W<W<W<W<W<W<()>>>>>>>>>> as HasAssoc>::Assoc = loop {};
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: which requires `<W<W<W<W<W<W<W<W<W<()>>>>>>>>> as HasAssoc>::Assoc == ()`
   = note: which requires `<W<W<W<W<W<W<W<W<()>>>>>>>> as HasAssoc>::Assoc == ()`
   = note: which requires `<W<W<W<W<W<W<W<W<()>>>>>>>> as HasAssoc>::Assoc normalizes-to _`
   = note: which requires `<W<W<W<W<W<W<W<()>>>>>>> as HasAssoc>::Assoc == _`
   = note: which requires `<W<W<W<W<W<W<W<()>>>>>>> as HasAssoc>::Assoc normalizes-to _`
   = note: which requires `<W<W<W<W<W<W<()>>>>>> as HasAssoc>::Assoc == _`
   = note: which requires `<W<W<W<W<W<W<()>>>>>> as HasAssoc>::Assoc normalizes-to _`
   = note: and so on...
   = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved
   = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "16"]` attribute to your crate (`fcw_on_normalization`)
   = note: this lint is attached to the whole crate and can't be disabled on a per-function basis
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #159228 <https://github.com/rust-lang/rust/issues/159228>
   = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default

@rust-bors

rust-bors Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 605ba82 (605ba826de1ddf0127c77551b7eaa83ca49d7510)
Base parent: 7022271 (70222712809cd5cc1718ed8995914a1cbacb6b92)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (605ba82): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.1%, 0.6%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -1.1%, secondary -1.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.1% [-1.1%, -1.0%] 2
Improvements ✅
(secondary)
-1.5% [-1.5%, -1.5%] 1
All ❌✅ (primary) -1.1% [-1.1%, -1.0%] 2

Cycles

Results (primary 2.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.6% [2.6%, 2.6%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.6% [2.6%, 2.6%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 475.539s -> 474.39s (-0.24%)
Artifact size: 400.59 MiB -> 400.12 MiB (-0.12%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 1, 2026

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

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

5 participants