Skip to content

delegation: supporting fair resolution for delegations to inherent impls - #162190

Draft
aerooneqq wants to merge 22 commits into
rust-lang:mainfrom
aerooneqq:delegation-inh-impls-fair-resolution
Draft

delegation: supporting fair resolution for delegations to inherent impls#162190
aerooneqq wants to merge 22 commits into
rust-lang:mainfrom
aerooneqq:delegation-inh-impls-fair-resolution

Conversation

@aerooneqq

Copy link
Copy Markdown
Contributor

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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. labels Sep 2, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@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 2, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 2, 2026
…n, r=<try>

delegation: supporting fair resolution for delegations to inherent impls
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 8ac1108 (8ac1108b19e786f841079b426195f37c7b06487f)
Base parent: 3a43cb6 (3a43cb66f97d08ccde87a00599fac2d3c50eb177)

@rust-timer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@aerooneqq
aerooneqq force-pushed the delegation-inh-impls-fair-resolution branch from be08fbc to 193c5b5 Compare September 2, 2026 13:57
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (8ac1108): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@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.2% [0.1%, 0.3%] 43
Regressions ❌
(secondary)
0.2% [0.1%, 0.4%] 30
Improvements ✅
(primary)
-0.8% [-1.1%, -0.2%] 5
Improvements ✅
(secondary)
-0.5% [-1.0%, -0.1%] 22
All ❌✅ (primary) 0.1% [-1.1%, 0.3%] 48

Max RSS (memory usage)

Results (primary 9.2%, secondary 9.4%)

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

mean range count
Regressions ❌
(primary)
9.2% [2.4%, 25.2%] 258
Regressions ❌
(secondary)
9.4% [1.6%, 34.0%] 207
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 9.2% [2.4%, 25.2%] 258

Cycles

Results (primary 2.5%, secondary 1.1%)

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

mean range count
Regressions ❌
(primary)
2.5% [2.5%, 2.5%] 1
Regressions ❌
(secondary)
3.0% [2.2%, 3.8%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) 2.5% [2.5%, 2.5%] 1

Binary size

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

Bootstrap: missing data
Artifact size: 400.76 MiB -> 400.68 MiB (-0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 2, 2026
@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/delegation/inherent-impls-enums.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/delegation/inherent-impls-enums.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/delegation/inherent-impls-enums" "-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 -------------------------------
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-enums.rs:35:32
   |
LL | trait Trait<'a, AA, BB>
   | ----------------------- found this type parameter
...
LL |     reuse S::<'static, (), 1>::foo_self::<'static, _, _> as foo_self_4;
   |                                ^^^^^^^^
   |                                |
   |                                expected `S<'_, (), 1>`, found type parameter `Self`
   |                                arguments to this function are incorrect
   |
   = note:        expected enum `S<'_, (), 1>`
           found type parameter `Self`
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-enums.rs:10:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----

error[E0284]: type annotations needed
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-enums.rs:44:32
   |
LL |     reuse S::<'static, (), 1>::foo_static::<'static, _, _> as foo_static_4;
   |                                ^^^^^^^^^^ cannot infer the value of const parameter `B` declared on the associated function `foo_static`
   |
note: required by a const generic parameter in `S::<'a, A, C>::foo_static`
  --> /checkout/tests/ui/delegation/inherent-impls-enums.rs:9:34
   |
LL |     fn foo_static<'d: 'd, 'e, T, const B: bool>() {}
   |                                  ^^^^^^^^^^^^^ required by this const generic parameter in `S::<'a, A, C>::foo_static`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-enums.rs:49:32
   |
LL |     reuse S::<'static, (), 1>::foo_self::<'static, _, _> as foo_self_4;
   |                                ^^^^^^^^
   |                                |
   |                                expected `S<'_, (), 1>`, found `X`
   |                                arguments to this function are incorrect
   |
   = note: expected enum `S<'_, (), 1>`
            found struct `X`
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-enums.rs:10:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-enums.rs:64:32
   |
LL |     reuse S::<'static, (), 1>::foo_self::<'static, _, _> as foo_self_4;
   |                                ^^^^^^^^
   |                                |
   |                                expected `S<'_, (), 1>`, found `X`
   |                                arguments to this function are incorrect
   |
   = note: expected enum `S<'_, (), 1>`
            found struct `X`
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-enums.rs:10:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----

##[error]error: internal compiler error: compiler/rustc_hir_typeck/src/lib.rs:127:9: can't type-check body of DefId(0:38 ~ inherent_impls_enums[170d]::foo_self_1::{constant#0})


thread 'rustc' (63753) panicked at compiler/rustc_hir_typeck/src/lib.rs:127:9:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxtHandle>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
   7: rustc_hir_typeck::typeck_with_inspect::{closure#0}::{closure#0}
---
  11: rustc_hir_analysis::check_unused::check_unused_traits
      [... omitted 2 frames ...]
  12: rustc_hir_analysis::check_crate
  13: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  14: 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}>>
  15: <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>>
  16: <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}>
  17: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
  18: 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}>>
  19: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
  20: 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: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.100.0-nightly (a5ce51d0a 2026-09-02) 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 [typeck_root] type-checking `foo_self_1::{constant#0}`
#1 [used_trait_imports] finding used_trait_imports `foo_self_1::{constant#0}`
#2 [check_unused_traits] checking unused trait imports in crate
#3 [analysis] running analysis passes on crate `inherent_impls_enums`
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0284, E0308.
For more information about an error, try `rustc --explain E0284`.
------------------------------------------

---- [ui] tests/ui/delegation/inherent-impls-enums.rs stdout end ----
---- [ui] tests/ui/delegation/inherent-impls-parent-generics.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/delegation/inherent-impls-parent-generics.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/delegation/inherent-impls-parent-generics" "-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 -------------------------------
error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:14:7
   |
LL | reuse E::foo_static as e;
   |       ^

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:14:7
   |
LL | reuse E::foo_static as e;
   |       ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:14:7
   |
LL | reuse E::foo_static as e;
   |       ^ not allowed in type signatures
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:18:7
   |
LL | reuse E::foo_self as e1;
   |       ^

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:18:7
   |
LL | reuse E::foo_self as e1;
   |       ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:18:7
   |
LL | reuse E::foo_self as e1;
   |       ^ not allowed in type signatures
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:24:7
   |
LL | reuse E::foo_static::<'static, (), true> as e2;
   |       ^

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:24:7
   |
LL | reuse E::foo_static::<'static, (), true> as e2;
   |       ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:24:7
   |
LL | reuse E::foo_static::<'static, (), true> as e2;
   |       ^ not allowed in type signatures
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:28:7
   |
LL | reuse E::foo_self::<'static, (), true> as e3;
   |       ^

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:28:7
   |
LL | reuse E::foo_self::<'static, (), true> as e3;
   |       ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:28:7
   |
LL | reuse E::foo_self::<'static, (), true> as e3;
   |       ^ not allowed in type signatures
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:40:11
   |
LL | reuse E::<'_, (), _>::foo_static as e8;
   |           ^^

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:40:19
   |
LL | reuse E::<'_, (), _>::foo_static as e8;
   |                   ^ not allowed in type signatures

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:44:11
   |
LL | reuse E::<'_, _, _>::foo_self as e9;
   |           ^^

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:44:15
   |
LL | reuse E::<'_, _, _>::foo_self as e9;
   |               ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:44:18
   |
LL | reuse E::<'_, _, _>::foo_self as e9;
   |                  ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:59:7
   |
LL | reuse S::foo_static as s;
   |       ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:59:7
   |
LL | reuse S::foo_static as s;
   |       ^ not allowed in type signatures
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:63:7
   |
LL | reuse S::foo_self as s1;
   |       ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:63:7
   |
LL | reuse S::foo_self as s1;
   |       ^ not allowed in type signatures
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:68:7
   |
LL | reuse S::foo_static::<'static, (), true> as s2;
   |       ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:68:7
   |
LL | reuse S::foo_static::<'static, (), true> as s2;
   |       ^ not allowed in type signatures
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:72:7
   |
LL | reuse S::foo_self::<'static, (), true> as s3;
   |       ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:72:7
   |
LL | reuse S::foo_self::<'static, (), true> as s3;
   |       ^ not allowed in type signatures
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:83:15
   |
LL | reuse S::<(), _>::foo_static as s8;
   |               ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:86:11
   |
LL | reuse S::<_, 123>::foo_self as s9;
   |           ^ not allowed in type signatures

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:18:10
   |
LL | reuse E::foo_self as e1;
   |          ^^^^^^^^ argument #1 of type `E<'_, _, _>` is missing
   |
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:11:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----
help: provide the argument
   |
LL | reuse E::foo_self(/* value */) as e1;
   |                  +++++++++++++

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:28:10
   |
LL | reuse E::foo_self::<'static, (), true> as e3;
   |          ^^^^^^^^ argument #1 of type `E<'_, _, _>` is missing
   |
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:11:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----
help: provide the argument
   |
LL | reuse E::foo_self(/* value */)::<'static, (), true> as e3;
   |                  +++++++++++++

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:44:22
   |
LL | reuse E::<'_, _, _>::foo_self as e9;
   |                      ^^^^^^^^ argument #1 of type `E<'_, _, _>` is missing
   |
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:11:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----
help: provide the argument
   |
LL | reuse E::<'_, _, _>::foo_self(/* value */) as e9;
   |                              +++++++++++++

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:63:10
   |
LL | reuse S::foo_self as s1;
   |          ^^^^^^^^ argument #1 of type `S<_, _>` is missing
   |
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:56:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----
help: provide the argument
   |
LL | reuse S::foo_self(/* value */) as s1;
   |                  +++++++++++++

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:72:10
   |
LL | reuse S::foo_self::<'static, (), true> as s3;
   |          ^^^^^^^^ argument #1 of type `S<_, _>` is missing
   |
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:56:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----
help: provide the argument
   |
LL | reuse S::foo_self(/* value */)::<'static, (), true> as s3;
   |                  +++++++++++++

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:86:20
   |
LL | reuse S::<_, 123>::foo_self as s9;
   |                    ^^^^^^^^ argument #1 of type `S<_, 123>` is missing
   |
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-parent-generics.rs:56:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----
help: provide the argument
   |
LL | reuse S::<_, 123>::foo_self(/* value */) as s9;
   |                            +++++++++++++

##[error]error: internal compiler error: compiler/rustc_hir_typeck/src/lib.rs:127:9: can't type-check body of DefId(0:39 ~ inherent_impls_parent_generics[ca24]::e5::{constant#0})


thread 'rustc' (63770) panicked at compiler/rustc_hir_typeck/src/lib.rs:127:9:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxtHandle>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
   7: rustc_hir_typeck::typeck_with_inspect::{closure#0}::{closure#0}
---
  11: rustc_hir_analysis::check_unused::check_unused_traits
      [... omitted 2 frames ...]
  12: rustc_hir_analysis::check_crate
  13: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  14: 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}>>
  15: <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>>
  16: <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}>
  17: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
  18: 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}>>
  19: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
  20: 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: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.100.0-nightly (a5ce51d0a 2026-09-02) 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 [typeck_root] type-checking `e5::{constant#0}`
#1 [used_trait_imports] finding used_trait_imports `e5::{constant#0}`
#2 [check_unused_traits] checking unused trait imports in crate
#3 [analysis] running analysis passes on crate `inherent_impls_parent_generics`
end of query stack
error: aborting due to 34 previous errors

Some errors have detailed explanations: E0061, E0121.
For more information about an error, try `rustc --explain E0061`.
------------------------------------------

---- [ui] tests/ui/delegation/inherent-impls-parent-generics.rs stdout end ----
---- [ui] tests/ui/delegation/inherent-impls-self-replacement.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/delegation/inherent-impls-self-replacement.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/delegation/inherent-impls-self-replacement" "-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 -------------------------------
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:30:34
   |
LL |     reuse S::<(), 123>::by_box { self.get_s() }
   |                         ------   ^^^^^^^^^^^^ expected `Box<S<(), 123>>`, found `S<(), 123>`
   |                         |
   |                         arguments to this function are incorrect
   |
   = note: expected struct `Box<S<_, _>>`
              found struct `S<_, _>`
   = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:14:8
   |
LL |     fn by_box<'d: 'd, 'e, T, const B: bool>(self: Box<Self>) {}
   |        ^^^^^^                               ----
help: store this in the heap by calling `Box::new`
   |
LL |     reuse S::<(), 123>::by_box { Box::new(self.get_s()) }
   |                                  +++++++++            +

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:33:33
   |
LL |     reuse S::<(), 123>::by_rc { self.get_s() }
   |                         -----   ^^^^^^^^^^^^ expected `Rc<S<(), 123>>`, found `S<(), 123>`
   |                         |
   |                         arguments to this function are incorrect
   |
   = note: expected struct `Rc<S<_, _>>`
              found struct `S<_, _>`
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:15:8
   |
LL |     fn by_rc<'d: 'd, 'e, T, const B: bool>(self: Rc<Self>) {}
   |        ^^^^^                               ----
help: call `Into::into` on this expression to convert `S<(), 123>` into `Rc<S<(), 123>>`
   |
LL |     reuse S::<(), 123>::by_rc { self.get_s().into() }
   |                                             +++++++

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:36:34
   |
LL |     reuse S::<(), 123>::by_pin { self.get_s() }
   |                         ------   ^^^^^^^^^^^^ expected `Pin<Box<S<(), 123>>>`, found `S<(), 123>`
   |                         |
   |                         arguments to this function are incorrect
   |
   = note: expected struct `Pin<Box<S<(), 123>>>`
              found struct `S<(), 123>`
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:16:8
   |
LL |     fn by_pin<'d: 'd, 'e, T, const B: bool>(self: Pin<Box<Self>>) {}
   |        ^^^^^^                               ----
help: you need to pin and box this expression
   |
LL |     reuse S::<(), 123>::by_pin { Box::pin(self.get_s()) }
   |                                  +++++++++            +

error[E0599]: no method named `get_s` found for type parameter `Self` in the current scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:41:41
   |
LL | trait Trait2: Sized {
   | ------------------- method `get_s` not found for this type parameter
LL |     reuse S::<(), 123>::by_value { self.get_s() }
   |                                         ^^^^^ method not found in `Self`
   |
   = help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `get_s`, perhaps you need to add another supertrait for it:
   |
LL | trait Trait2: Sized + Trait {
   |                     +++++++

error[E0599]: no method named `get_s` found for reference `&Self` in the current scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:43:39
   |
LL |     reuse S::<(), 123>::by_ref { self.get_s() }
   |                                       ^^^^^ method not found in `&Self`
   |
   = help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `get_s`, perhaps you need to add another supertrait for it:
   |
LL | trait Trait2: Sized + Trait {
   |                     +++++++

error[E0599]: no method named `get_s` found for mutable reference `&mut Self` in the current scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:45:43
   |
LL |     reuse S::<(), 123>::by_mut_ref { self.get_s() }
   |                                           ^^^^^ method not found in `&mut Self`
   |
   = help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `get_s`, perhaps you need to add another supertrait for it:
   |
LL | trait Trait2: Sized + Trait {
   |                     +++++++

error[E0599]: no method named `get_s` found for struct `Box<Self>` in the current scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:47:39
   |
LL |     reuse S::<(), 123>::by_box { self.get_s() }
   |                                       ^^^^^ method not found in `Box<Self>`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
note: `Trait` defines an item `get_s`, perhaps you need to implement it
  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:19:1
   |
LL | trait Trait: Sized {
   | ^^^^^^^^^^^^^^^^^^

error[E0599]: no method named `get_s` found for struct `Rc<Self>` in the current scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:49:38
   |
LL |     reuse S::<(), 123>::by_rc { self.get_s() }
   |                                      ^^^^^ method not found in `Rc<Self>`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
note: `Trait` defines an item `get_s`, perhaps you need to implement it
  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:19:1
   |
LL | trait Trait: Sized {
   | ^^^^^^^^^^^^^^^^^^

error[E0599]: no method named `get_s` found for struct `Pin<Box<Self>>` in the current scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:51:39
   |
LL |     reuse S::<(), 123>::by_pin { self.get_s() }
   |                                       ^^^^^ method not found in `Pin<Box<Self>>`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
note: `Trait` defines an item `get_s`, perhaps you need to implement it
  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:19:1
   |
LL | trait Trait: Sized {
   | ^^^^^^^^^^^^^^^^^^

##[error]error: internal compiler error: compiler/rustc_hir_typeck/src/lib.rs:127:9: can't type-check body of DefId(0:50 ~ inherent_impls_self_replacement[2404]::Trait::by_value::{constant#0})
  --> /checkout/tests/ui/delegation/inherent-impls-self-replacement.rs:22:25
   |
LL |     reuse S::<(), 123>::by_value { self.get_s() }
   |                         ^^^^^^^^


thread 'rustc' (63802) panicked at compiler/rustc_hir_typeck/src/lib.rs:127:9:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxtHandle>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
   7: rustc_hir_typeck::typeck_with_inspect::{closure#0}::{closure#0}
---
  11: rustc_hir_analysis::check_unused::check_unused_traits
      [... omitted 2 frames ...]
  12: rustc_hir_analysis::check_crate
  13: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  14: 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}>>
  15: <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>>
  16: <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}>
  17: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
  18: 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}>>
  19: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
  20: 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: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.100.0-nightly (a5ce51d0a 2026-09-02) 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 [typeck_root] type-checking `Trait::by_value::{constant#0}`
#1 [used_trait_imports] finding used_trait_imports `Trait::by_value::{constant#0}`
#2 [check_unused_traits] checking unused trait imports in crate
#3 [analysis] running analysis passes on crate `inherent_impls_self_replacement`
end of query stack
error: aborting due to 10 previous errors

Some errors have detailed explanations: E0308, E0599.
For more information about an error, try `rustc --explain E0308`.
------------------------------------------

---- [ui] tests/ui/delegation/inherent-impls-self-replacement.rs stdout end ----
---- [ui] tests/ui/delegation/inherent-impls-structs.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/delegation/inherent-impls-structs.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/delegation/inherent-impls-structs" "-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 -------------------------------
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-structs.rs:31:23
   |
LL | trait Trait<'a, AA, BB> where Self: Sized {
   | ----------------------- found this type parameter
...
LL |     reuse S::<(), 1>::foo_self::<'static, _, _> as foo_self_4;
   |                       ^^^^^^^^
   |                       |
   |                       expected `S<(), 1>`, found type parameter `Self`
   |                       arguments to this function are incorrect
   |
   = note:      expected struct `S<(), 1>`
           found type parameter `Self`
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-structs.rs:9:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----

error[E0284]: type annotations needed
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-structs.rs:40:23
   |
LL |     reuse S::<(), 1>::foo_static::<'static, _, _> as foo_static_4;
   |                       ^^^^^^^^^^ cannot infer the value of const parameter `B` declared on the associated function `foo_static`
   |
note: required by a const generic parameter in `S::<A, C>::foo_static`
  --> /checkout/tests/ui/delegation/inherent-impls-structs.rs:8:34
   |
LL |     fn foo_static<'d: 'd, 'e, T, const B: bool>() {}
   |                                  ^^^^^^^^^^^^^ required by this const generic parameter in `S::<A, C>::foo_static`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-structs.rs:45:23
   |
LL |     reuse S::<(), 1>::foo_self::<'static, _, _> as foo_self_4;
   |                       ^^^^^^^^
   |                       |
   |                       expected `S<(), 1>`, found `X`
   |                       arguments to this function are incorrect
   |
   = note: expected struct `S<(), 1>`
              found struct `X`
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-structs.rs:9:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-structs.rs:60:23
   |
LL |     reuse S::<(), 1>::foo_self::<'static, _, _> as foo_self_4;
   |                       ^^^^^^^^
   |                       |
   |                       expected `S<(), 1>`, found `X`
   |                       arguments to this function are incorrect
   |
   = note: expected struct `S<(), 1>`
              found struct `X`
note: method defined here
  --> /checkout/tests/ui/delegation/inherent-impls-structs.rs:9:8
   |
LL |     fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
   |        ^^^^^^^^                               ----

##[error]error: internal compiler error: compiler/rustc_hir_typeck/src/lib.rs:127:9: can't type-check body of DefId(0:32 ~ inherent_impls_structs[4d20]::foo_self_1::{constant#0})
  --> /checkout/tests/ui/delegation/inherent-impls-structs.rs:16:19
   |
LL | reuse S::<(), 1>::foo_self::<'static, (), true> as foo_self_1;
   |                   ^^^^^^^^


thread 'rustc' (63804) panicked at compiler/rustc_hir_typeck/src/lib.rs:127:9:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxtHandle>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
   7: rustc_hir_typeck::typeck_with_inspect::{closure#0}::{closure#0}
---
  11: rustc_hir_analysis::check_unused::check_unused_traits
      [... omitted 2 frames ...]
  12: rustc_hir_analysis::check_crate
  13: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  14: 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}>>
  15: <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>>
  16: <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}>
  17: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
  18: 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}>>
  19: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
  20: 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: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.100.0-nightly (a5ce51d0a 2026-09-02) 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 [typeck_root] type-checking `foo_self_1::{constant#0}`
#1 [used_trait_imports] finding used_trait_imports `foo_self_1::{constant#0}`
#2 [check_unused_traits] checking unused trait imports in crate
#3 [analysis] running analysis passes on crate `inherent_impls_structs`
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0284, E0308.
For more information about an error, try `rustc --explain E0284`.

@rust-bors

rust-bors Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

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

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

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) perf-regression Performance regression. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants