Skip to content

Add new alias kind Ambiguous and renormalize instantiated binders#156453

Draft
adwinwhite wants to merge 13 commits into
rust-lang:mainfrom
adwinwhite:renormalize-binder
Draft

Add new alias kind Ambiguous and renormalize instantiated binders#156453
adwinwhite wants to merge 13 commits into
rust-lang:mainfrom
adwinwhite:renormalize-binder

Conversation

@adwinwhite
Copy link
Copy Markdown
Contributor

@adwinwhite adwinwhite commented May 11, 2026

Still WIP.
- fix rustdoc
- also normalize for diagnostics and assert the remaining instantiation doesn't need renormalization.
- remove the accidental staged cargo submodule

But maybe you wanna have a quick look first.
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 May 11, 2026
@adwinwhite
Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Copy Markdown
Collaborator

Awaiting bors try build completion.

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

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 11, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 11, 2026
Add new alias kind `Ambiguous` and renormalize instantiated binders
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling askama_macros v0.16.0
[RUSTC-TIMING] askama_macros test:false 0.132
    Checking askama v0.16.0
[RUSTC-TIMING] askama test:false 0.183
error[E0004]: non-exhaustive patterns: `rustc_middle::infer::canonical::rustc_type_ir::TyKind::Alias(AliasTy { kind: AliasTyKind::Ambiguous { .. }, .. })` not covered
    --> src/librustdoc/clean/mod.rs:2121:11
     |
2121 |     match *bound_ty.skip_binder().kind() {
     |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `rustc_middle::infer::canonical::rustc_type_ir::TyKind::Alias(AliasTy { kind: AliasTyKind::Ambiguous { .. }, .. })` not covered
     |
note: `rustc_middle::infer::canonical::rustc_type_ir::TyKind<TyCtxt<'_>>` defined here
    --> compiler/rustc_type_ir/src/ty_kind.rs:122:1
     |
 122 | pub enum TyKind<I: Interner> {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
 277 |     Alias(AliasTy<I>),
     |     ----- not covered
     = note: the matched value is of type `rustc_middle::infer::canonical::rustc_type_ir::TyKind<TyCtxt<'_>>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
     |
2353 ~         ty::Error(_) => FatalError.raise(),
2354 ~         rustc_middle::infer::canonical::rustc_type_ir::TyKind::Alias(AliasTy { kind: AliasTyKind::Ambiguous { .. }, .. }) => todo!(),
     |

warning: unused variable: `cx`
    --> src/librustdoc/clean/mod.rs:2116:5
     |

@adwinwhite
Copy link
Copy Markdown
Contributor Author

@bors try cancel

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 11, 2026

Try build cancelled. Cancelled workflows:

@adwinwhite
Copy link
Copy Markdown
Contributor Author

Ignore tools failures for now.

@bors try @rust-timer queue

@rust-timer
Copy link
Copy Markdown
Collaborator

This pull request is already queued and waiting for a try build to finish.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 11, 2026
Add new alias kind `Ambiguous` and renormalize instantiated binders
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 11, 2026

💔 Test for 1c015e6 failed: CI. Failed job:

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job dist-x86_64-linux-quick failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
c1e54eec4b57: Pull complete
Digest: sha256:b733d4a32c4da6a00a84df2ca32791bb03df95400243648d8c539e7b4cce329c
Status: Downloaded newer image for ghcr.io/rust-lang/alpine:3.4
905ef40d3dd0d7df147101546f6a19e7237183d2a520895ac8add05fece4fafe
[CI_JOB_NAME=dist-x86_64-linux-quick]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
   Compiling collector v0.1.0 (/tmp/tmp-multistage/opt-artifacts/rustc-perf/collector)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 32.21s
[2026-05-11T13:52:11.552Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO)` starts
[2026-05-11T13:52:11.552Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO) > Build PGO instrumented rustc and LLVM` starts
[2026-05-11T13:52:11.552Z INFO  opt_dist::exec] Executing `RUST_BACKTRACE=full python3 /checkout/x.py build --target x86_64-unknown-linux-gnu --host x86_64-unknown-linux-gnu --stage 2 library/std --set rust.llvm-bitcode-linker=false --set build.extended=false --set rust.codegen-backends=['llvm'] --set rust.deny-warnings=false --rust-profile-generate /tmp/tmp-multistage/opt-artifacts/rustc-pgo --set llvm.thin-lto=false --set llvm.link-shared=true [at /checkout/obj]`
##[endgroup]
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.06s
##[endgroup]
[TIMING:start] compile::Assemble { target_compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu, forced_compiler: false } }
---
Finished benchmark bitmaps-3.2.1 (1/9)
Executing benchmark cargo-0.87.1 (2/9)
Preparing cargo-0.87.1
Finished benchmark cargo-0.87.1 (2/9)
collector error: Failed to profile 'cargo-0.87.1' with Eprintln, recorded: expected success, got exit status: 101

stderr=    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
---
   Compiling libssh2-sys v0.3.1
    Checking flate2 v1.0.35
   Compiling libgit2-sys v0.18.0+1.9.0
    Checking elliptic-curve v0.13.8
error[E0277]: the trait bound `<C as CurveArithmetic>::Scalar: ReduceNonZero<<C as Curve>::Uint>` is not satisfied
##[error]   --> /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/elliptic-curve-0.13.8/src/scalar/nonzero.rs:258:22
    |
258 |         let scalar = Scalar::<C>::reduce_nonzero_bytes(bytes);
    |                      ^^^^^^^^^^^ the trait `ReduceNonZero<<C as Curve>::Uint>` is not implemented for `<C as CurveArithmetic>::Scalar`
    |
help: consider further restricting the associated type
    |
257 |     fn reduce_bytes(bytes: &Self::Bytes) -> Self where <C as CurveArithmetic>::Scalar: ReduceNonZero<<C as Curve>::Uint> {
    |                                                  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error[E0308]: mismatched types
##[error]   --> /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/elliptic-curve-0.13.8/src/scalar/nonzero.rs:258:56
    |
258 |         let scalar = Scalar::<C>::reduce_nonzero_bytes(bytes);
    |                      --------------------------------- ^^^^^ expected `&GenericArray<u8, ...>`, found `&<... as Reduce<...>>::Bytes`
    |                      |
    |                      arguments to this function are incorrect
    |
    = note: expected reference `&GenericArray<u8, <C as Curve>::FieldBytesSize>`
               found reference `&<<C as CurveArithmetic>::Scalar as Reduce<I>>::Bytes`
    = help: consider constraining the associated type `<<C as CurveArithmetic>::Scalar as Reduce<I>>::Bytes` to `GenericArray<u8, <C as Curve>::FieldBytesSize>`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
note: associated function defined here
   --> /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/elliptic-curve-0.13.8/src/ops.rs:228:8
    |
228 |     fn reduce_nonzero_bytes(bytes: &Self::Bytes) -> Self;
---
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.86/src/backtrace.rs:27:14
   1: collector::check_command_output
             at ./collector/src/lib.rs:237:13
   2: collector::async_command_output::{closure#0}
             at ./collector/src/lib.rs:264:5
   3: <collector::compile::execute::CargoProcess>::run_rustc::{closure#0}
             at ./collector/src/compile/execute/mod.rs:451:52
   4: <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}
             at ./collector/src/compile/benchmark/mod.rs:388:26
   5: <core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}> as core::future::future::Future>::poll
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/future/future.rs:133:9
   6: <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on::<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}::{closure#0}::{closure#0}
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/scheduler/current_thread/mod.rs:733:70
   7: tokio::task::coop::with_budget::<core::task::poll::Poll<core::result::Result<(), anyhow::Error>>, <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}::{closure#0}::{closure#0}>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/task/coop/mod.rs:167:5
   8: tokio::task::coop::budget::<core::task::poll::Poll<core::result::Result<(), anyhow::Error>>, <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}::{closure#0}::{closure#0}>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/task/coop/mod.rs:133:5
   9: <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on::<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}::{closure#0}
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/scheduler/current_thread/mod.rs:733:25
  10: <tokio::runtime::scheduler::current_thread::Context>::enter::<core::task::poll::Poll<core::result::Result<(), anyhow::Error>>, <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}::{closure#0}>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/scheduler/current_thread/mod.rs:432:19
  11: <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on::<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/scheduler/current_thread/mod.rs:732:44
  12: <tokio::runtime::scheduler::current_thread::CoreGuard>::enter::<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}, core::option::Option<core::result::Result<(), anyhow::Error>>>::{closure#0}
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/scheduler/current_thread/mod.rs:820:68
  13: <tokio::runtime::context::scoped::Scoped<tokio::runtime::scheduler::Context>>::set::<<tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}, core::option::Option<core::result::Result<(), anyhow::Error>>>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<core::result::Result<(), anyhow::Error>>)>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/context/scoped.rs:40:9
  14: tokio::runtime::context::set_scheduler::<(alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<core::result::Result<(), anyhow::Error>>), <tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}, core::option::Option<core::result::Result<(), anyhow::Error>>>::{closure#0}>::{closure#0}
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/context.rs:176:38
  15: <std::thread::local::LocalKey<tokio::runtime::context::Context>>::try_with::<tokio::runtime::context::set_scheduler<(alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<core::result::Result<(), anyhow::Error>>), <tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}, core::option::Option<core::result::Result<(), anyhow::Error>>>::{closure#0}>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<core::result::Result<(), anyhow::Error>>)>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/thread/local.rs:462:12
  16: <std::thread::local::LocalKey<tokio::runtime::context::Context>>::with::<tokio::runtime::context::set_scheduler<(alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<core::result::Result<(), anyhow::Error>>), <tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}, core::option::Option<core::result::Result<(), anyhow::Error>>>::{closure#0}>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<core::result::Result<(), anyhow::Error>>)>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/thread/local.rs:426:20
  17: tokio::runtime::context::set_scheduler::<(alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<core::result::Result<(), anyhow::Error>>), <tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}, core::option::Option<core::result::Result<(), anyhow::Error>>>::{closure#0}>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/context.rs:176:17
  18: <tokio::runtime::scheduler::current_thread::CoreGuard>::enter::<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>::{closure#0}, core::option::Option<core::result::Result<(), anyhow::Error>>>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/scheduler/current_thread/mod.rs:820:27
  19: <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on::<core::pin::Pin<&mut <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/scheduler/current_thread/mod.rs:720:24
  20: <tokio::runtime::scheduler::current_thread::CurrentThread>::block_on::<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>::{closure#0}
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/scheduler/current_thread/mod.rs:200:33
  21: tokio::runtime::context::runtime::enter_runtime::<<tokio::runtime::scheduler::current_thread::CurrentThread>::block_on<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>::{closure#0}, core::result::Result<(), anyhow::Error>>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/context/runtime.rs:65:16
  22: <tokio::runtime::scheduler::current_thread::CurrentThread>::block_on::<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/scheduler/current_thread/mod.rs:188:9
  23: <tokio::runtime::runtime::Runtime>::block_on_inner::<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/runtime.rs:356:52
  24: <tokio::runtime::runtime::Runtime>::block_on::<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}>
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.45.1/src/runtime/runtime.rs:330:18
  25: collector::utils::wait_for_future::<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}::{closure#0}, core::result::Result<(), anyhow::Error>>
             at ./collector/src/utils/mod.rs:16:10
  26: <collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}
             at ./collector/src/compile/benchmark/mod.rs:377:21
  27: std::sys::backtrace::__rust_begin_short_backtrace::<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}, core::result::Result<(), anyhow::Error>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/sys/backtrace.rs:166:18
  28: std::thread::lifecycle::spawn_unchecked::<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#1}::{closure#0}
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/thread/lifecycle.rs:91:13
  29: <core::panic::unwind_safe::AssertUnwindSafe<std::thread::lifecycle::spawn_unchecked<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#1}::{closure#0}> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/panic/unwind_safe.rs:275:9
  30: std::panicking::catch_unwind::do_call::<core::panic::unwind_safe::AssertUnwindSafe<std::thread::lifecycle::spawn_unchecked<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#1}::{closure#0}>, core::result::Result<(), anyhow::Error>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40
  31: __rust_try
  32: std::panicking::catch_unwind::<core::result::Result<(), anyhow::Error>, core::panic::unwind_safe::AssertUnwindSafe<std::thread::lifecycle::spawn_unchecked<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#1}::{closure#0}>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:544:19
  33: std::panic::catch_unwind::<core::panic::unwind_safe::AssertUnwindSafe<std::thread::lifecycle::spawn_unchecked<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#1}::{closure#0}>, core::result::Result<(), anyhow::Error>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panic.rs:359:14
  34: std::thread::lifecycle::spawn_unchecked::<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#1}
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/thread/lifecycle.rs:89:26
  35: <std::thread::lifecycle::spawn_unchecked<<collector::compile::benchmark::Benchmark>::measure::{closure#0}::{closure#3}::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/ops/function.rs:250:5
  36: <alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output = ()> + core::marker::Send> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/alloc/src/boxed.rs:2249:9
  37: <std::sys::thread::unix::Thread>::new::thread_start
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/sys/thread/unix.rs:118:17
---
   5: std::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/sys/backtrace.rs:166:18
   6: std::rt::lang_start::<()>::{closure#0}
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/rt.rs:206:18
   7: <&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/ops/function.rs:287:21
   8: std::panicking::catch_unwind::do_call::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40
   9: std::panicking::catch_unwind::<i32, &dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:544:19
  10: std::panic::catch_unwind::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panic.rs:359:14
  11: std::rt::lang_start_internal::{closure#0}
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/rt.rs:175:24
  12: std::panicking::catch_unwind::do_call::<std::rt::lang_start_internal::{closure#0}, isize>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40
---

Stack backtrace:
   0: <anyhow::Error>::msg::<alloc::string::String>
             at /rust/deps/anyhow-1.0.100/src/backtrace.rs:27:14
   1: <opt_dist::exec::CmdBuilder>::run
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/exec.rs:80:17
   2: opt_dist::training::gather_rustc_profiles::{closure#0}
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/training.rs:158:14
   3: opt_dist::utils::with_log_group::<opt_dist::training::gather_rustc_profiles::{closure#0}, core::result::Result<(), anyhow::Error>>
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/utils/mod.rs:68:22
   4: opt_dist::training::gather_rustc_profiles
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/training.rs:155:5
   5: opt_dist::execute_pipeline::{closure#1}::{closure#1}
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/main.rs:260:45
   6: <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}::{closure#1}, opt_dist::training::RustcPGOProfile>
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/timer.rs:111:22
   7: opt_dist::execute_pipeline::{closure#1}
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/main.rs:260:14
   8: <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}, opt_dist::training::RustcPGOProfile>
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/timer.rs:111:22
   9: opt_dist::execute_pipeline
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/main.rs:242:35
  10: opt_dist::main
             at /rustc/1c015e6b28ddab4208877e973be5de042035f8f9/src/tools/opt-dist/src/main.rs:469:18
  11: <fn() -> core::result::Result<(), anyhow::Error> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/ops/function.rs:250:5
  12: std::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core::result::Result<(), anyhow::Error>, core::result::Result<(), anyhow::Error>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/sys/backtrace.rs:166:18
  13: std::rt::lang_start::<core::result::Result<(), anyhow::Error>>::{closure#0}
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/rt.rs:206:18
  14: <&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/ops/function.rs:287:21
  15: std::panicking::catch_unwind::do_call::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40
  16: std::panicking::catch_unwind::<i32, &dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:544:19
  17: std::panic::catch_unwind::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panic.rs:359:14
  18: std::rt::lang_start_internal::{closure#0}
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/rt.rs:175:24
  19: std::panicking::catch_unwind::do_call::<std::rt::lang_start_internal::{closure#0}, isize>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40


// Placeholders (all printed as `_` to uniformize them).
ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => {
ty::Alias(ty::AliasTy { kind: ty::Ambiguous { .. }, .. })
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

Unnormalized::new_wip(unnormalized_external_impl_sig),
);
let external_impl_sig =
ocx.normalize(&norm_cause, param_env, Unnormalized::new(unnormalized_external_impl_sig));
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

Suggested change
ocx.normalize(&norm_cause, param_env, Unnormalized::new(unnormalized_external_impl_sig));
ocx.normalize(&norm_cause, param_env, Unnormalized::new_wip(unnormalized_external_impl_sig));

ideally this should be a map_unnormalized call in which we instantiate the binder

View changes since the review

ty::Alias(ty::AliasTy { kind: ty::Ambiguous { .. }, .. }) => {
let sp = tcx.def_span(impl_def_id);
span_bug!(sp, "weird self type for autotrait impl")
}
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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


// Placeholders (all printed as `_` to uniformize them).
ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => {
ty::Alias(ty::AliasTy { kind: ty::Ambiguous { .. }, .. })
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

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.

can you also make ty::Infer unreachable?

Comment on lines +49 to +50
// Now that we perform eager normalization inside the solver in some places,
// The aliases might be normalized away.
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

when do we do eager norm for the inputs of alias relate goals? 🤔

View changes since the review

/// next solver. See `NormalizationFolder`.
///
/// The def_id and args are the same as the original alias.
AmbiguousTy { def_id: I::DefId },
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

why does this contain the def_id

View changes since the review

}
}

pub fn instantiate_binder_with_fresh_vars_and_normalize_with<T, F>(
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

hmm, this is different from what I'd imagine 🤔

I would expect us to have

fn instantiate_binder_no_ambig_aliases(x: Binder<T>) -> T {
    instantiate_binder_renormalize_ambig_aliases(x, |_| unreachable!())
}

fn instantiate_binder_renormalize_ambig_aliases(x: Binder<T>, normalize: impl FnMut(AliasTerm<'tcx>) -> Term<'tcx>) -> T {
    instantiate binder
    walk with renormalize ambig aliases folder
}

I'd then keep the borrowck code etc the same as rn while using instantiate_binder_no_ambig_aliases and use instantiate_binder_renormalize_ambig_aliases only in the places that can encounter ambig aliases

View changes since the review

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.

where all the old solver exclusive code can just use instantiate_binder_no_ambig_aliases

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.

and the new solver places that currently can't easily use a normalization routine can just recreate the ty::Alias or ConstKind::Alias with a FIXME that they should instead normalize

self.print_def_path(def_id, args)?;
ty::Alias(ref data @ ty::AliasTy { kind, args, .. }) => match kind
.reveal_ambiguous(self.tcx())
{
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

hmm, instead of reeal_ambiguous Ambiguous aliases can just forward to their contained alias?

View changes since the review

Comment on lines +660 to +667
// Convert `AmbiguousTy` into its original kind.
pub fn reveal_ambiguous(self, interner: I) -> Self {
if let AliasTermKind::AmbiguousTy { def_id } = self {
interner.alias_term_kind_from_def_id(def_id)
} else {
self
}
}
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

ah, so what you do is ty::Alias(Projection { def_id }, [Self, T]) to ty::Alias(Ambiguous { def_id }, [Self, T]) instead of

ty::Alias(Projection { def_id }, [Self, T]) to ty::Alias(Ambiguous, ty::Alias(Projection { def_id }, [Self, T])]) which is what I would have expected 🤔

View changes since the review

Copy link
Copy Markdown
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

u accidentally commited cargo

View changes since this review

) -> InferOk<'tcx, T> {
if self.infcx.next_trait_solver() {
let Normalized { value, obligations } =
crate::solve::normalize(*self, value, NormalizationScope::AmbiguousAlias);
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

i would not add support for this to the old trait solver at all 🤔 i would only ever use ambiguous aliases in the new solver, so here ambiguous aliases should be unreachable

View changes since the review

&self,
value: ty::Binder<Self::Interner, T>,
f: impl FnOnce(T) -> U,
f: impl FnOnce(ty::Unnormalized<Self::Interner, T>) -> U,
Copy link
Copy Markdown
Contributor

@lcnr lcnr May 11, 2026

Choose a reason for hiding this comment

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

Suggested change
f: impl FnOnce(ty::Unnormalized<Self::Interner, T>) -> U,
normalize_ambiguous_aliases: impl FnMut(ALiasTerm<'tcx>) -> Term<'tcx>
f: impl FnOnce(T) -> U,

is what I would have liked🤔 I personally feel like Unnormalized for both being fully unnormalized and only having to renormalize ambiguous aliases feels suboptimal to me

View changes since the review

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. S-waiting-on-perf Status: Waiting on a perf run to be completed. 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