Skip to content

[ICE]: expected type for param #1 in... #154403

@Anonymous1-design

Description

@Anonymous1-design

Code

trait Output<'a> {
    type Type;
}
struct Wrapper;
impl Wrapper {
    fn do_something_wrapper<O, F>(self, _: F)
    where
        for<'a> F: Output<'a>,
        for<'a> O: From<<F as Output<'a>>::Type>,
    {}
}
fn main() {
    let mut wrapper = Wrapper;
    wrapper.do_something_wrapper(|value| ());
}

Meta

rustc --version --verbose:

rustc 1.96.0-nightly (b41f22de2 2026-03-08)
binary: rustc
commit-hash: b41f22de2a13a0babd28771e96feef4c309f54aa
commit-date: 2026-03-08
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Error output

error[E0277]: the trait bound `for<'a> {closure@bug.rs:14:34: 14:41}: Output<'a>` is not satisfied
  --> bug.rs:14:34
   |
14 |     wrapper.do_something_wrapper(|value| ());
   |             -------------------- ^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for closure `{closure@bug.rs:14:34: 14:41}`
   |             |
   |             required by a bound introduced by this call
   |
help: this trait has no implementations, consider adding one
  --> bug.rs:1:1
   |
 1 | trait Output<'a> {
   | ^^^^^^^^^^^^^^^^
note: required by a bound in `Wrapper::do_something_wrapper`
  --> bug.rs:8:20
   |
 6 |     fn do_something_wrapper<O, F>(self, _: F)
   |        -------------------- required by a bound in this associated function
 7 |     where
 8 |         for<'a> F: Output<'a>,
   |                    ^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper`
error: internal compiler error: /rustc-dev/b41f22de2a13a0babd28771e96feef4c309f54aa/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:295:63: expected type for param #1 in [Closure(DefId(0:15 ~ bug[6dcf]::main::{closure#0}), [?7t, Binder { value: extern "RustCall" fn((?5t,)), bound_vars: [] }, ?6t]), '!3_0.Named(DefId(0:13 ~ bug[6dcf]::{impl#0}::do_something_wrapper::'a#1))]
Backtrace

thread 'rustc' (2948890) panicked at /rustc-dev/b41f22de2a13a0babd28771e96feef4c309f54aa/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:295:63:
Box<dyn Any>
stack backtrace:
   0:     0x7f1eb064154b - <<std[f377252fd1978e75]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[40ef8ddb62afa269]::fmt::Display>::fmt
   1:     0x7f1eb0d04288 - core[40ef8ddb62afa269]::fmt::write
   2:     0x7f1eb0658556 - <std[f377252fd1978e75]::sys::stdio::unix::Stderr as std[f377252fd1978e75]::io::Write>::write_fmt
   3:     0x7f1eb0617638 - std[f377252fd1978e75]::panicking::default_hook::{closure#0}
   4:     0x7f1eb06349c3 - std[f377252fd1978e75]::panicking::default_hook
   5:     0x7f1eaf6261bc - std[f377252fd1978e75]::panicking::update_hook::<alloc[7d80c8e5f2bc07aa]::boxed::Box<rustc_driver_impl[a7e284e8ff2767b6]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f1eb0634ca2 - std[f377252fd1978e75]::panicking::panic_with_hook
   7:     0x7f1eaf656331 - std[f377252fd1978e75]::panicking::begin_panic::<rustc_errors[f5c90c2ffb7f3cef]::ExplicitBug>::{closure#0}
   8:     0x7f1eaf64eea6 - std[f377252fd1978e75]::sys::backtrace::__rust_end_short_backtrace::<std[f377252fd1978e75]::panicking::begin_panic<rustc_errors[f5c90c2ffb7f3cef]::ExplicitBug>::{closure#0}, !>
   9:     0x7f1eaf64ed7b - std[f377252fd1978e75]::panicking::begin_panic::<rustc_errors[f5c90c2ffb7f3cef]::ExplicitBug>
  10:     0x7f1eaf661981 - <rustc_errors[f5c90c2ffb7f3cef]::diagnostic::BugAbort as rustc_errors[f5c90c2ffb7f3cef]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f1eafc3e9f9 - rustc_middle[6d7cfdcb6c95edb7]::util::bug::opt_span_bug_fmt::<rustc_span[825691e18cdd0684]::span_encoding::Span>::{closure#0}
  12:     0x7f1eafc3eb82 - rustc_middle[6d7cfdcb6c95edb7]::ty::context::tls::with_opt::<rustc_middle[6d7cfdcb6c95edb7]::util::bug::opt_span_bug_fmt<rustc_span[825691e18cdd0684]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7f1eafc2f82b - rustc_middle[6d7cfdcb6c95edb7]::ty::context::tls::with_context_opt::<rustc_middle[6d7cfdcb6c95edb7]::ty::context::tls::with_opt<rustc_middle[6d7cfdcb6c95edb7]::util::bug::opt_span_bug_fmt<rustc_span[825691e18cdd0684]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7f1ead61bae4 - rustc_middle[6d7cfdcb6c95edb7]::util::bug::bug_fmt
  15:     0x7f1eb041cbf3 - <rustc_trait_selection[1844f0ca5ec2ecf5]::error_reporting::TypeErrCtxt>::report_selection_error
  16:     0x7f1eaef0ac06 - <rustc_trait_selection[1844f0ca5ec2ecf5]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  17:     0x7f1eb1ab82f5 - rustc_hir_typeck[12393e4ae4b897ef]::typeck_with_inspect::{closure#0}
  18:     0x7f1eb1aae2f2 - rustc_query_impl[5ff32ada1adb4c7a]::query_impl::typeck::invoke_provider_fn::__rust_begin_short_backtrace
  19:     0x7f1eb0e86134 - rustc_query_impl[5ff32ada1adb4c7a]::execution::try_execute_query::<rustc_data_structures[86b662b2b592701f]::vec_cache::VecCache<rustc_span[825691e18cdd0684]::def_id::LocalDefId, rustc_middle[6d7cfdcb6c95edb7]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[6d7cfdcb6c95edb7]::dep_graph::graph::DepNodeIndex>, false>
  20:     0x7f1eb0e85b83 - rustc_query_impl[5ff32ada1adb4c7a]::query_impl::typeck::execute_query_non_incr::__rust_end_short_backtrace
  21:     0x7f1eb15bf93a - <rustc_middle[6d7cfdcb6c95edb7]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[c936938903594311]::check_crate::{closure#2}>::{closure#0}
  22:     0x7f1eb15bf375 - rustc_hir_analysis[c936938903594311]::check_crate
  23:     0x7f1eb0e82ae9 - rustc_interface[5f8c59f625471e6f]::passes::analysis
  24:     0x7f1eb1f74cc8 - rustc_query_impl[5ff32ada1adb4c7a]::execution::try_execute_query::<rustc_middle[6d7cfdcb6c95edb7]::query::caches::SingleCache<rustc_middle[6d7cfdcb6c95edb7]::query::erase::ErasedData<[u8; 0usize]>>, false>
  25:     0x7f1eb1f74a33 - rustc_query_impl[5ff32ada1adb4c7a]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  26:     0x7f1eb1f1e788 - rustc_interface[5f8c59f625471e6f]::interface::run_compiler::<(), rustc_driver_impl[a7e284e8ff2767b6]::run_compiler::{closure#0}>::{closure#1}
  27:     0x7f1eb1f51a7e - std[f377252fd1978e75]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5f8c59f625471e6f]::util::run_in_thread_with_globals<rustc_interface[5f8c59f625471e6f]::util::run_in_thread_pool_with_globals<rustc_interface[5f8c59f625471e6f]::interface::run_compiler<(), rustc_driver_impl[a7e284e8ff2767b6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  28:     0x7f1eb1f52320 - <std[f377252fd1978e75]::thread::lifecycle::spawn_unchecked<rustc_interface[5f8c59f625471e6f]::util::run_in_thread_with_globals<rustc_interface[5f8c59f625471e6f]::util::run_in_thread_pool_with_globals<rustc_interface[5f8c59f625471e6f]::interface::run_compiler<(), rustc_driver_impl[a7e284e8ff2767b6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[40ef8ddb62afa269]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7f1eb1f531ac - <std[f377252fd1978e75]::sys::thread::unix::Thread>::new::thread_start
  30:     0x7f1eaba8c609 - start_thread
                               at /build/glibc-B3wQXB/glibc-2.31/nptl/pthread_create.c:477:8
  31:     0x7f1eab9b1353 - clone
                               at /build/glibc-B3wQXB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95:0
  32:                0x0 - <unknown>

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: please attach the file at `test/rustc-ice-2026-03-26T03_39_17-2948880.txt` to your bug report

note: rustc 1.96.0-nightly (b41f22de2 2026-03-08) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on crate `bug`
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions