Reading issue
rust-lang / rust · Issue No. 160591
trait Context {}
struct Wrapper<C: Context + 'static> {
container: &'static C,
}
fn foobar(_: Wrapper<()>) {
foobar(Wrapper { /* missing */ })
}
fn main() {}
rustc --version --verbose:
rustc 1.99.0-nightly (1ed2df61a 2026-08-04)
binary: rustc
commit-hash: 1ed2df61a19042f231709eb05d032ae9e2cb2084
commit-date: 2026-08-04
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8
error[E0277]: the trait bound `(): Context` is not satisfied
--> code.rs:5:14
|
5 | fn foobar(_: Wrapper<()>) {
| ^^^^^^^^^^^ the trait `Context` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> code.rs:1:1
|
1 | trait Context {}
| ^^^^^^^^^^^^^
note: required by a bound in `Wrapper`
--> code.rs:2:19
|
2 | struct Wrapper<C: Context + 'static> {
| ^^^^^^^ required by this bound in `Wrapper`
error[E0277]: the trait bound `(): Context` is not satisfied
--> code.rs:6:12
|
6 | foobar(Wrapper { /* missing */ })
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Context` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> code.rs:1:1
|
1 | trait Context {}
| ^^^^^^^^^^^^^
note: required by a bound in `Wrapper`
--> code.rs:2:19
|
2 | struct Wrapper<C: Context + 'static> {
| ^^^^^^^ required by this bound in `Wrapper`
error[E0063]: missing field `container` in initializer of `Wrapper<_>`
--> code.rs:6:12
|
6 | foobar(Wrapper { /* missing */ })
| ^^^^^^^ missing `container`
Backtrace
error: internal compiler error: /rustc-dev/1ed2df61a19042f231709eb05d032ae9e2cb2084/compiler/rustc_hir_analysis/src/collect.rs:1086:13: unexpected sort of node in fn_sig(): Item(Item { owner_id: DefId(0:4 ~ code[411b]::Wrapper), kind: Struct(Wrapper#0, Generics { params: [GenericParam { hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).7), def_id: DefId(0:5 ~ code[411b]::Wrapper::C), name: Plain(C#0), span: code.rs:2:16: 2:17 (#0), pure_wrt_drop: false, kind: Type { default: None, synthetic: false }, colon_span: Some(code.rs:2:17: 2:18 (#0)), source: Generics }], predicates: [WherePredicate { hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).4), span: code.rs:2:17: 2:36 (#0), kind: BoundPredicate(WhereBoundPredicate { origin: GenericParam, bound_generic_params: [], bounded_ty: Ty { hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).6), span: code.rs:2:16: 2:17 (#0), kind: Path(Resolved(None, Path { span: code.rs:2:16: 2:17 (#0), res: Def(TyParam, DefId(0:5 ~ code[411b]::Wrapper::C)), segments: [PathSegment { ident: C#0, hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).5), res: Def(TyParam, DefId(0:5 ~ code[411b]::Wrapper::C)), args: None, infer_args: true, delegation_child_segment: false }] })) }, bounds: [Trait(PolyTraitRef { bound_generic_params: [], modifiers: TraitBoundModifiers { constness: Never, polarity: Positive }, trait_ref: TraitRef { path: Path { span: code.rs:2:19: 2:26 (#0), res: Def(Trait, DefId(0:3 ~ code[411b]::Context)), segments: [PathSegment { ident: Context#0, hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).1), res: Def(Trait, DefId(0:3 ~ code[411b]::Context)), args: None, infer_args: false, delegation_child_segment: false }] }, hir_ref_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).2) }, span: code.rs:2:19: 2:26 (#0) }), Outlives(Lifetime { hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).3), ident: 'static#0, kind: Static, source: OutlivesBound, syntax: ExplicitBound })] }) }], has_where_clause_predicates: false, where_clause_span: code.rs:2:37: 2:37 (#0), span: code.rs:2:15: 2:37 (#0) }, Struct { fields: [FieldDef { span: code.rs:3:5: 3:26 (#0), vis_span: code.rs:3:5: 3:5 (#0), mut_restriction: MutRestriction { kind: Unrestricted, span: no-location (#0) }, ident: container#0, hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).12), def_id: DefId(0:6 ~ code[411b]::Wrapper::container), ty: Ty { hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).11), span: code.rs:3:16: 3:26 (#0), kind: Ref(Lifetime { hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).8), ident: 'static#0, kind: Static, source: Reference, syntax: ExplicitBound }, MutTy { ty: Ty { hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).9), span: code.rs:3:25: 3:26 (#0), kind: Path(Resolved(None, Path { span: code.rs:3:25: 3:26 (#0), res: Def(TyParam, DefId(0:5 ~ code[411b]::Wrapper::C)), segments: [PathSegment { ident: C#0, hir_id: HirId(DefId(0:4 ~ code[411b]::Wrapper).10), res: Def(TyParam, DefId(0:5 ~ code[411b]::Wrapper::C)), args: None, infer_args: false, delegation_child_segment: false }] })) }, mutbl: Not }) }, safety: Safe, default: None }], recovered: No }), span: code.rs:2:1: 4:2 (#0), vis_span: code.rs:2:1: 2:1 (#0), eii: false })
thread 'rustc' (1805127) panicked at /rustc-dev/1ed2df61a19042f231709eb05d032ae9e2cb2084/compiler/rustc_hir_analysis/src/collect.rs:1086:13:
Box<dyn Any>
stack backtrace:
0: 0x7f7fd8563ea6 - <<std[de03ec088cd119b8]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[d9acc66213f10ee7]::fmt::Display>::fmt
1: 0x7f7fd8c096c8 - core[d9acc66213f10ee7]::fmt::write
2: 0x7f7fd8578fcc - <std[de03ec088cd119b8]::sys::stdio::unix::Stderr as core[d9acc66213f10ee7]::io::write::Write>::write_fmt
3: 0x7f7fd85373ba - std[de03ec088cd119b8]::panicking::default_hook::{closure#0}
4: 0x7f7fd8557e53 - std[de03ec088cd119b8]::panicking::default_hook
5: 0x7f7fd74910eb - std[de03ec088cd119b8]::panicking::update_hook::<alloc[b1be74dc9de5ac03]::boxed::Box<rustc_driver_impl[a78c34de1127a0fd]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f7fd85582f2 - std[de03ec088cd119b8]::panicking::panic_with_hook
7: 0x7f7fd74beed4 - std[de03ec088cd119b8]::panicking::begin_panic::<rustc_errors[52645a25f52ef92f]::ExplicitBug>::{closure#0}
8: 0x7f7fd74b7ed6 - std[de03ec088cd119b8]::sys::backtrace::__rust_end_short_backtrace::<std[de03ec088cd119b8]::panicking::begin_panic<rustc_errors[52645a25f52ef92f]::ExplicitBug>::{closure#0}, !>
9: 0x7f7fd74b7c0b - std[de03ec088cd119b8]::panicking::begin_panic::<rustc_errors[52645a25f52ef92f]::ExplicitBug>
10: 0x7f7fd74caa81 - <rustc_errors[52645a25f52ef92f]::diagnostic::BugAbort as rustc_errors[52645a25f52ef92f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7f7fd7a78409 - rustc_middle[b20510e271f7c324]::util::bug::opt_span_bug_fmt::<rustc_span[ce153ff59c471c4e]::span_encoding::Span>::{closure#0}
12: 0x7f7fd7a78822 - rustc_middle[b20510e271f7c324]::ty::context::tls::with_opt::<rustc_middle[b20510e271f7c324]::util::bug::opt_span_bug_fmt<rustc_span[ce153ff59c471c4e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
13: 0x7f7fd7a62cb0 - rustc_middle[b20510e271f7c324]::ty::context::tls::with_context_opt::<rustc_middle[b20510e271f7c324]::ty::context::tls::with_opt<rustc_middle[b20510e271f7c324]::util::bug::opt_span_bug_fmt<rustc_span[ce153ff59c471c4e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
14: 0x7f7fd60db164 - rustc_middle[b20510e271f7c324]::util::bug::bug_fmt
15: 0x7f7fd927ff56 - rustc_hir_analysis[137b1e5b1a5c7268]::collect::fn_sig
16: 0x7f7fd927f528 - rustc_query_impl[925974791126778b]::query_impl::fn_sig::invoke_provider_fn::__rust_begin_short_backtrace
17: 0x7f7fd9280dd8 - rustc_query_impl[925974791126778b]::execution::try_execute_query::<rustc_middle[b20510e271f7c324]::query::caches::DefIdCache<rustc_middle[b20510e271f7c324]::query::erase::ErasedData<[u8; 24usize]>>, false>
18: 0x7f7fd92808a5 - rustc_query_impl[925974791126778b]::query_impl::fn_sig::execute_query_non_incr::__rust_end_short_backtrace
19: 0x7f7fd83b740e - <rustc_trait_selection[5128fc3f849e4376]::error_reporting::TypeErrCtxt>::suggest_add_reference_to_arg
20: 0x7f7fd8364dc9 - <rustc_trait_selection[5128fc3f849e4376]::error_reporting::TypeErrCtxt>::report_selection_error
21: 0x7f7fd8389b1b - <rustc_trait_selection[5128fc3f849e4376]::error_reporting::TypeErrCtxt>::report_fulfillment_error
22: 0x7f7fd6d9f8c3 - <rustc_trait_selection[5128fc3f849e4376]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
23: 0x7f7fd8e137bc - <rustc_hir_typeck[1869fcc0465a555e]::fn_ctxt::FnCtxt>::check_expr_call
24: 0x7f7fd8de259f - <rustc_hir_typeck[1869fcc0465a555e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
25: 0x7f7fd8dd72c6 - <rustc_hir_typeck[1869fcc0465a555e]::fn_ctxt::FnCtxt>::check_expr_block
26: 0x7f7fd8de257b - <rustc_hir_typeck[1869fcc0465a555e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
27: 0x7f7fd8db47b2 - rustc_hir_typeck[1869fcc0465a555e]::check::check_fn
28: 0x7f7fd9664ed7 - rustc_hir_typeck[1869fcc0465a555e]::typeck_with_inspect::{closure#0}
29: 0x7f7fd9663470 - rustc_query_impl[925974791126778b]::query_impl::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
30: 0x7f7fd9641c69 - rustc_query_impl[925974791126778b]::execution::try_execute_query::<rustc_data_structures[acc06cc5ef5c76d5]::vec_cache::VecCache<rustc_span[ce153ff59c471c4e]::def_id::LocalDefId, rustc_middle[b20510e271f7c324]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[b20510e271f7c324]::dep_graph::graph::DepNodeIndex>, false>
31: 0x7f7fd9641603 - rustc_query_impl[925974791126778b]::query_impl::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
32: 0x7f7fd947f6f7 - rustc_hir_analysis[137b1e5b1a5c7268]::check_crate
33: 0x7f7fd96431b5 - rustc_interface[e1b617d0f01ef368]::passes::analysis
34: 0x7f7fd9e93e47 - rustc_query_impl[925974791126778b]::execution::try_execute_query::<rustc_middle[b20510e271f7c324]::query::caches::SingleCache<rustc_middle[b20510e271f7c324]::query::erase::ErasedData<[u8; 0usize]>>, false>
35: 0x7f7fd9e93aa9 - rustc_query_impl[925974791126778b]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
36: 0x7f7fd9e5ceab - rustc_interface[e1b617d0f01ef368]::interface::run_compiler::<(), rustc_driver_impl[a78c34de1127a0fd]::run_compiler::{closure#0}>::{closure#2}
37: 0x7f7fd9ea1ae4 - std[de03ec088cd119b8]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e1b617d0f01ef368]::util::run_in_thread_with_globals<rustc_interface[e1b617d0f01ef368]::util::run_in_thread_pool_with_globals<rustc_interface[e1b617d0f01ef368]::interface::run_compiler<(), rustc_driver_impl[a78c34de1127a0fd]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
38: 0x7f7fd9ea18ad - <std[de03ec088cd119b8]::thread::lifecycle::spawn_unchecked<rustc_interface[e1b617d0f01ef368]::util::run_in_thread_with_globals<rustc_interface[e1b617d0f01ef368]::util::run_in_thread_pool_with_globals<rustc_interface[e1b617d0f01ef368]::interface::run_compiler<(), rustc_driver_impl[a78c34de1127a0fd]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[d9acc66213f10ee7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
39: 0x7f7fd9eadcfa - <std[de03ec088cd119b8]::sys::thread::unix::Thread>::new::thread_start
40: 0x7f7fd3297739 - <unknown>
41: 0x7f7fd331bedc - <unknown>
42: 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 `/home/matthias/vcs/github/CRED/rustc-ice-2026-08-05T20_46_40-1805117.txt` to your bug report
note: rustc 1.99.0-nightly (1ed2df61a 2026-08-04) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [fn_sig] computing function signature of `Wrapper`
#1 [typeck_root] type-checking `foobar`
#2 [analysis] running analysis passes on crate `code`
end of query stack
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0063, E0277.
For more information about an error, try `rustc --explain E0063`.
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.