[ICE]: `expected projection ty, found ProjectionConst`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
auto-reduced (treereduce-rust):
#![feature(generic_const_args)]
use std::field::{field_of, Field};
struct Struct {
b: i64,
}
fn project_ref() {
<field_of!(Struct, b)>::OFFSET;
}
original:
#![feature(generic_const_args, min_generic_const_args)]
#![feature(field_projections)]
use std::field::{field_of, Field};
struct Struct {
b: i64,
}
fn project_ref() {
<field_of!(Struct, b)>::OFFSET;
}
fn main() {}
Version information
rustc 1.100.0-nightly (0f819a160 2026-09-05)
binary: rustc
commit-hash: 0f819a1602c3814642aa63799b43772b7bb456e8
commit-date: 2026-09-05
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1
Possibly related line of code:
https://github.com/rust-lang/rust/blob/0f819a1602c3814642aa63799b43772b7bb456e8/compiler/rustc_type_ir/src/term_kind.rs#L249-L261
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0658]: use of unstable library feature `field_projections`
--> /tmp/icemaker_global_tempdir.mrZypDRoD1TV/rustc_testrunner_tmpdir_reporting.n04So9CIWbu4/mvce.rs:8:6
|
8 | <field_of!(Struct, b)>::OFFSET;
| ^^^^^^^^
|
= note: see issue #145383 <https://github.com/rust-lang/rust/issues/145383> for more information
= help: add `#![feature(field_projections)]` to the crate attributes to enable
= note: this compiler was built on 2026-09-05; consider upgrading it if it is out of date
error: `generic_const_args` requires `min_generic_const_args` to be enabled
--> /tmp/icemaker_global_tempdir.mrZypDRoD1TV/rustc_testrunner_tmpdir_reporting.n04So9CIWbu4/mvce.rs:1:12
|
1 | #![feature(generic_const_args)]
| ^^^^^^^^^^^^^^^^^^
|
= help: enable all of these features
warning: the feature `generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.mrZypDRoD1TV/rustc_testrunner_tmpdir_reporting.n04So9CIWbu4/mvce.rs:1:12
|
1 | #![feature(generic_const_args)]
| ^^^^^^^^^^^^^^^^^^
|
= note: see issue #151972 <https://github.com/rust-lang/rust/issues/151972> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.mrZypDRoD1TV/rustc_testrunner_tmpdir_reporting.n04So9CIWbu4/mvce.rs:9:2
|
9 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.mrZypDRoD1TV/rustc_testrunner_tmpdir_reporting.n04So9CIWbu4/mvce.rs`
error[E0658]: use of unstable library feature `field_projections`
--> /tmp/icemaker_global_tempdir.mrZypDRoD1TV/rustc_testrunner_tmpdir_reporting.n04So9CIWbu4/mvce.rs:3:18
|
3 | use std::field::{field_of, Field};
| ^^^^^^^^
|
= note: see issue #145383 <https://github.com/rust-lang/rust/issues/145383> for more information
= help: add `#![feature(field_projections)]` to the crate attributes to enable
= note: this compiler was built on 2026-09-05; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature `field_projections`
--> /tmp/icemaker_global_tempdir.mrZypDRoD1TV/rustc_testrunner_tmpdir_reporting.n04So9CIWbu4/mvce.rs:3:28
|
3 | use std::field::{field_of, Field};
| ^^^^^
|
= note: see issue #145383 <https://github.com/rust-lang/rust/issues/145383> for more information
= help: add `#![feature(field_projections)]` to the crate attributes to enable
= note: this compiler was built on 2026-09-05; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature `field_projections`
--> /tmp/icemaker_global_tempdir.mrZypDRoD1TV/rustc_testrunner_tmpdir_reporting.n04So9CIWbu4/mvce.rs:8:5
|
8 | <field_of!(Struct, b)>::OFFSET;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #145383 <https://github.com/rust-lang/rust/issues/145383> for more information
= help: add `#![feature(field_projections)]` to the crate attributes to enable
= note: this compiler was built on 2026-09-05; consider upgrading it if it is out of date
thread 'rustc' (1264110) panicked at /rustc-dev/0f819a1602c3814642aa63799b43772b7bb456e8/compiler/rustc_type_ir/src/term_kind.rs:255:21:
expected projection ty, found ProjectionConst { def_id: DefId(2:4308 ~ core[d997]::field::Field::OFFSET) }
stack backtrace:
0: 0x7f65b3ac54e6 - <<std[739b682464b2cb4f]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[d997ca8b291862e0]::fmt::Display>::fmt
1: 0x7f65b420ba4f - core[d997ca8b291862e0]::fmt::write
2: 0x7f65b3ada5cc - <std[739b682464b2cb4f]::sys::stdio::unix::Stderr as core[d997ca8b291862e0]::io::write::Write>::write_fmt
3: 0x7f65b3a97d8a - std[739b682464b2cb4f]::panicking::default_hook::{closure#0}
4: 0x7f65b3ab97e3 - std[739b682464b2cb4f]::panicking::default_hook
5: 0x7f65b2a0943f - std[739b682464b2cb4f]::panicking::update_hook::<alloc[cfd194cf86e92e23]::boxed::Box<rustc_driver_impl[4b133f65db23c9ab]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f65b3ab9c82 - std[739b682464b2cb4f]::panicking::panic_with_hook
7: 0x7f65b3a97e42 - std[739b682464b2cb4f]::panicking::panic_handler::{closure#0}
8: 0x7f65b3a8ecb9 - std[739b682464b2cb4f]::sys::backtrace::__rust_end_short_backtrace::<std[739b682464b2cb4f]::panicking::panic_handler::{closure#0}, !>
9: 0x7f65b3a99a1d - __rustc[e7cd4045d256b0b7]::rust_begin_unwind
10: 0x7f65b085c07c - core[d997ca8b291862e0]::panicking::panic_fmt
11: 0x7f65b398cab3 - <rustc_type_ir[f404c092d65f65af]::predicate::NormalizesTo<rustc_middle[d333a51e0864de4]::ty::context::TyCtxt> as rustc_next_trait_solver[9898bcd21f45566e]::solve::assembly::GoalKind<rustc_trait_selection[c74f370ff3979d8d]::solve::delegate::SolverDelegate, rustc_middle[d333a51e0864de4]::ty::context::TyCtxt>>::consider_builtin_field_candidate
12: 0x7f65b51ecfb4 - <rustc_next_trait_solver[9898bcd21f45566e]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[c74f370ff3979d8d]::solve::delegate::SolverDelegate, rustc_middle[d333a51e0864de4]::ty::context::TyCtxt>>::assemble_and_evaluate_candidates::<rustc_type_ir[f404c092d65f65af]::predicate::NormalizesTo<rustc_middle[d333a51e0864de4]::ty::context::TyCtxt>>
13: 0x7f65b5211cb7 - <rustc_type_ir[f404c092d65f65af]::search_graph::SearchGraph<rustc_next_trait_solver[9898bcd21f45566e]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[c74f370ff3979d8d]::solve::delegate::SolverDelegate>, rustc_middle[d333a51e0864de4]::ty::context::TyCtxt>>::evaluate_goal::{closure#0}
14: 0x7f65b51f7eae - <rustc_next_trait_solver[9898bcd21f45566e]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[c74f370ff3979d8d]::solve::delegate::SolverDelegate, rustc_middle[d333a51e0864de4]::ty::context::TyCtxt>>::evaluate_goal_raw
15: 0x7f65b500b8bd - <rustc_next_trait_solver[9898bcd21f45566e]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[c74f370ff3979d8d]::solve::delegate::SolverDelegate, rustc_middle[d333a51e0864de4]::ty::context::TyCtxt>>::evaluate_goal_no_fast_paths
16: 0x7f65b4ef2de4 - <rustc_next_trait_solver[9898bcd21f45566e]::normalize::NormalizationFolder<rustc_infer[6d73867ab5578060]::infer::InferCtxt, rustc_middle[d333a51e0864de4]::ty::context::TyCtxt, rustc_trait_selection[c74f370ff3979d8d]::solve::normalize::normalize_with_universes<rustc_middle[d333a51e0864de4]::ty::generic_args::GenericArg>::{closure#0}>>::normalize_alias_term
17: 0x7f65b4ef21b7 - <rustc_next_trait_solver[9898bcd21f45566e]::normalize::NormalizationFolder<rustc_infer[6d73867ab5578060]::infer::InferCtxt, rustc_middle[d333a51e0864de4]::ty::context::TyCtxt, rustc_trait_selection[c74f370ff3979d8d]::solve::normalize::normalize_with_universes<rustc_middle[d333a51e0864de4]::ty::generic_args::GenericArg>::{closure#0}> as rustc_type_ir[f404c092d65f65af]::fold::FallibleTypeFolder<rustc_middle[d333a51e0864de4]::ty::context::TyCtxt>>::try_fold_const::{closure#0}
18: 0x7f65b4eee2f1 - <rustc_traits[a12678c46138d38]::normalize_erasing_regions::provide::{closure#0} as core[d997ca8b291862e0]::ops::function::FnOnce<(rustc_middle[d333a51e0864de4]::ty::context::TyCtxt, rustc_middle[d333a51e0864de4]::ty::PseudoCanonicalInput<rustc_middle[d333a51e0864de4]::ty::generic_args::GenericArg>)>>::call_once
19: 0x7f65b508bc2d - rustc_query_impl[483fff85713b0294]::execution::try_execute_query::<rustc_middle[d333a51e0864de4]::query::caches::DefaultCache<rustc_middle[d333a51e0864de4]::ty::PseudoCanonicalInput<rustc_middle[d333a51e0864de4]::ty::generic_args::GenericArg>, rustc_middle[d333a51e0864de4]::query::erase::ErasedData<[u8; 8usize]>>, false>
20: 0x7f65b508b8e0 - rustc_query_impl[483fff85713b0294]::query_vtables::try_normalize_generic_arg_after_erasing_regions::execute_query_non_incr::__rust_end_short_backtrace
21: 0x7f65b1082603 - <rustc_middle[d333a51e0864de4]::ty::normalize_erasing_regions::TryNormalizeAfterErasingRegionsFolder as rustc_type_ir[f404c092d65f65af]::fold::FallibleTypeFolder<rustc_middle[d333a51e0864de4]::ty::context::TyCtxt>>::try_fold_const
22: 0x7f65b108e85a - <rustc_mir_transform[d10c2acd6b2c0e17]::post_analysis_normalize::PostAnalysisNormalize as rustc_mir_transform[d10c2acd6b2c0e17]::pass_manager::MirPass>::run_pass
23: 0x7f65b42181a1 - rustc_mir_transform[d10c2acd6b2c0e17]::run_analysis_to_runtime_passes
24: 0x7f65b4bda0e9 - rustc_mir_transform[d10c2acd6b2c0e17]::mir_drops_elaborated_and_const_checked
25: 0x7f65b48c3535 - rustc_query_impl[483fff85713b0294]::execution::try_execute_query::<rustc_data_structures[5e241a68fe1f0d9f]::vec_cache::VecCache<rustc_span[e9d5129d271bd047]::def_id::LocalDefId, rustc_middle[d333a51e0864de4]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[d333a51e0864de4]::dep_graph::graph::DepNodeIndex>, false>
26: 0x7f65b48c306b - rustc_query_impl[483fff85713b0294]::query_vtables::mir_drops_elaborated_and_const_checked::execute_query_non_incr::__rust_end_short_backtrace
27: 0x7f65b48c5e6e - <rustc_middle[d333a51e0864de4]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[69481172a0b187c3]::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
28: 0x7f65b48c4fcc - rustc_interface[69481172a0b187c3]::passes::analysis
29: 0x7f65b53dc9ca - rustc_query_impl[483fff85713b0294]::execution::try_execute_query::<rustc_middle[d333a51e0864de4]::query::caches::SingleCache<rustc_middle[d333a51e0864de4]::query::erase::ErasedData<[u8; 0usize]>>, false>
30: 0x7f65b53dc753 - rustc_query_impl[483fff85713b0294]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
31: 0x7f65b559eae4 - rustc_interface[69481172a0b187c3]::interface::run_compiler::<(), rustc_driver_impl[4b133f65db23c9ab]::run_compiler::{closure#0}>::{closure#2}
32: 0x7f65b5603164 - std[739b682464b2cb4f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[69481172a0b187c3]::util::run_in_thread_with_globals<rustc_interface[69481172a0b187c3]::util::run_in_thread_pool_with_globals<rustc_interface[69481172a0b187c3]::interface::run_compiler<(), rustc_driver_impl[4b133f65db23c9ab]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
33: 0x7f65b5602f0b - <std[739b682464b2cb4f]::thread::lifecycle::spawn_unchecked<rustc_interface[69481172a0b187c3]::util::run_in_thread_with_globals<rustc_interface[69481172a0b187c3]::util::run_in_thread_pool_with_globals<rustc_interface[69481172a0b187c3]::interface::run_compiler<(), rustc_driver_impl[4b133f65db23c9ab]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[d997ca8b291862e0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
34: 0x7f65b5600947 - <std[739b682464b2cb4f]::sys::thread::unix::Thread>::new::thread_start
35: 0x7f65ae6980a2 - <unknown>
36: 0x7f65ae72080c - <unknown>
37: 0x0 - <unknown>
error: the compiler unexpectedly panicked. This is a bug
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 (0f819a160 2026-09-05) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [try_normalize_generic_arg_after_erasing_regions] normalizing `<field_of!(Struct, b) as core::field::Field>::OFFSET`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `project_ref`
#2 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 6 previous errors; 1 warning emitted
Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.
@rustbot label +F-generic_const_args +F-min_generic_const_args +F-field_projections
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the reduced a.rs reproducer with the listed nightly toolchain and read compiler/rustc_type_ir/src/term_kind.rs around lines 249-261. Trace the panic through consider_builtin_field_candidate and the normalization path shown in the backtrace; done means the reproducer no longer causes an internal compiler error and has regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100