Skip to content

[ICE]: cannot find .. in param-env: ParamEnv #154651

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -Znext-solver=globally
trait Processor {
    type Ctx<'a, const N: usize>;
}
pub struct Phasor;
impl Processor for Phasor {
    type Ctx<'a, const N: usize> = Self::Ctx</*'a,*/ N>;
}

original:

trait Processor {
    type Ctx<'a, const N: usize>;
}
pub struct Phasor;
impl Processor for Phasor {
    type Ctx<'a, const N: usize> = Self::Ctx</*'a,*/ N>;
}

fn main() {}

Version information

rustc 1.96.0-nightly (0e95a0f4c 2026-03-31)
binary: rustc
commit-hash: 0e95a0f4c677002a5d4ac5bc59d97885e6f51f71
commit-date: 2026-03-31
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.2

Possibly related line of code:

// `Option<Ty<'tcx>>` instead of `Ty<'tcx>`; however, this is generally
// considered to be a bandaid solution, since it hides more important
// underlying issues with how we construct generics and predicates of
// items. It's advised to fix the underlying issue rather than trying
// to modify this function.
let ty = candidates.next().unwrap_or_else(|| {
panic!("cannot find `{self:?}` in param-env: {env:#?}");
});
assert!(
candidates.next().is_none(),
"did not expect duplicate `ConstParamHasTy` for `{self:?}` in param-env: {env:#?}"
);
ty

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Znext-solver=globally

Program output

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.RLRUDhZuCleE/rustc_testrunner_tmpdir_reporting.JM00f4mTzkQh/mvce.rs:7:2
  |
7 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.RLRUDhZuCleE/rustc_testrunner_tmpdir_reporting.JM00f4mTzkQh/mvce.rs`

error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
 --> /tmp/icemaker_global_tempdir.RLRUDhZuCleE/rustc_testrunner_tmpdir_reporting.JM00f4mTzkQh/mvce.rs:6:42
  |
6 |     type Ctx<'a, const N: usize> = Self::Ctx</*'a,*/ N>;
  |                                          ^^^ expected 1 lifetime argument
  |
note: associated type defined here, with 1 lifetime parameter: `'a`
 --> /tmp/icemaker_global_tempdir.RLRUDhZuCleE/rustc_testrunner_tmpdir_reporting.JM00f4mTzkQh/mvce.rs:2:10
  |
2 |     type Ctx<'a, const N: usize>;
  |          ^^^ --
help: add missing lifetime argument
  |
6 |     type Ctx<'a, const N: usize> = Self::Ctx<'a, /*'a,*/ N>;
  |                                              +++


thread 'rustc' (4127042) panicked at /rustc-dev/0e95a0f4c677002a5d4ac5bc59d97885e6f51f71/compiler/rustc_type_ir/src/binder.rs:1305:13:
cannot find `!BoundConst { var: 2, .. }` in param-env: ParamEnv {
    caller_bounds: [
        Binder { value: ConstArgHasType(!BoundConst { var: 0, .. }, usize), bound_vars: [] },
        Binder { value: ProjectionPredicate(AliasTerm { args: [Phasor, '^0.Named(DefId(0:11 ~ mvce[3aca]::{impl#0}::Ctx::'a)), ^BoundConst { var: 1, .. }], def_id: DefId(0:4 ~ mvce[3aca]::Processor::Ctx), .. }, Term::Ty(Alias(Projection, AliasTy { args: [Phasor, '?0, ^BoundConst { var: 1, .. }], def_id: DefId(0:4 ~ mvce[3aca]::Processor::Ctx), .. }))), bound_vars: [Region(BrNamed(DefId(0:11 ~ mvce[3aca]::{impl#0}::Ctx::'a))), Const] },
    ],
}
stack backtrace:
   0:     0x7fb28fd9328b - <<std[3a154748be1cf171]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[6dbc07b3c623ddea]::fmt::Display>::fmt
   1:     0x7fb29042fa48 - core[6dbc07b3c623ddea]::fmt::write
   2:     0x7fb28fdaa296 - <std[3a154748be1cf171]::sys::stdio::unix::Stderr as std[3a154748be1cf171]::io::Write>::write_fmt
   3:     0x7fb28fd69298 - std[3a154748be1cf171]::panicking::default_hook::{closure#0}
   4:     0x7fb28fd86693 - std[3a154748be1cf171]::panicking::default_hook
   5:     0x7fb28ed8ae5c - std[3a154748be1cf171]::panicking::update_hook::<alloc[19c55003204b46b1]::boxed::Box<rustc_driver_impl[c52c1912fce43640]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fb28fd86972 - std[3a154748be1cf171]::panicking::panic_with_hook
   7:     0x7fb28fd69358 - std[3a154748be1cf171]::panicking::panic_handler::{closure#0}
   8:     0x7fb28fd60089 - std[3a154748be1cf171]::sys::backtrace::__rust_end_short_backtrace::<std[3a154748be1cf171]::panicking::panic_handler::{closure#0}, !>
   9:     0x7fb28fd6adbd - __rustc[3228c5cf9e31aa5]::rust_begin_unwind
  10:     0x7fb28ca8c98c - core[6dbc07b3c623ddea]::panicking::panic_fmt
  11:     0x7fb290f0d949 - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate> as rustc_type_ir[c0667d30c5973e36]::search_graph::Delegate>::compute_goal::{closure#0}
  12:     0x7fb290f226f5 - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate, rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::evaluate_goal_raw
  13:     0x7fb290f11ad2 - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate, rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::try_evaluate_added_goals
  14:     0x7fb290f04b9c - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate, rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::evaluate_added_goals_and_make_canonical_response
  15:     0x7fb291226d92 - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate, rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::assemble_impl_candidates::<rustc_type_ir[c0667d30c5973e36]::predicate::NormalizesTo<rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::{closure#0}
  16:     0x7fb29122ad0a - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate, rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::assemble_and_evaluate_candidates::<rustc_type_ir[c0667d30c5973e36]::predicate::NormalizesTo<rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>
  17:     0x7fb290f0be7d - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate> as rustc_type_ir[c0667d30c5973e36]::search_graph::Delegate>::compute_goal::{closure#0}
  18:     0x7fb290f226f5 - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate, rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::evaluate_goal_raw
  19:     0x7fb290f11f2a - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate, rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::try_evaluate_added_goals
  20:     0x7fb290f0b455 - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate> as rustc_type_ir[c0667d30c5973e36]::search_graph::Delegate>::compute_goal::{closure#0}
  21:     0x7fb290f226f5 - <rustc_next_trait_solver[b318c687bb70fcf4]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[d2702b535d15bdf3]::solve::delegate::SolverDelegate, rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::evaluate_goal_raw
  22:     0x7fb290f1097a - <rustc_trait_selection[d2702b535d15bdf3]::solve::fulfill::FulfillmentCtxt<rustc_infer[411e9d562e286661]::traits::engine::ScrubbedTraitError> as rustc_infer[411e9d562e286661]::traits::engine::TraitEngine<rustc_infer[411e9d562e286661]::traits::engine::ScrubbedTraitError>>::try_evaluate_obligations
  23:     0x7fb290c8aa9d - <rustc_trait_selection[d2702b535d15bdf3]::solve::normalize::NormalizationFolder<rustc_infer[411e9d562e286661]::traits::engine::ScrubbedTraitError>>::normalize_alias_term
  24:     0x7fb290f16987 - rustc_trait_selection[d2702b535d15bdf3]::solve::normalize::deeply_normalize_with_skipped_universes_and_ambiguous_coroutine_goals::<rustc_middle[779b3639bfd63c5a]::ty::Ty, rustc_infer[411e9d562e286661]::traits::engine::ScrubbedTraitError>
  25:     0x7fb290f161b0 - <rustc_trait_selection[d2702b535d15bdf3]::solve::normalize::DeeplyNormalizeForDiagnosticsFolder as rustc_type_ir[c0667d30c5973e36]::fold::TypeFolder<rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::fold_ty
  26:     0x7fb291c64f9f - <rustc_trait_selection[d2702b535d15bdf3]::solve::normalize::DeeplyNormalizeForDiagnosticsFolder as rustc_type_ir[c0667d30c5973e36]::fold::TypeFolder<rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::fold_predicate.warm
  27:     0x7fb291593661 - rustc_trait_selection[d2702b535d15bdf3]::solve::fulfill::derive_errors::find_best_leaf_obligation
  28:     0x7fb29159236b - <rustc_trait_selection[d2702b535d15bdf3]::traits::FulfillmentError as rustc_infer[411e9d562e286661]::traits::engine::FromSolverError<rustc_trait_selection[d2702b535d15bdf3]::solve::fulfill::NextSolverError>>::from_solver_error
  29:     0x7fb290f1c59d - <rustc_trait_selection[d2702b535d15bdf3]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[d2702b535d15bdf3]::traits::FulfillmentError> as rustc_infer[411e9d562e286661]::traits::engine::TraitEngine<rustc_trait_selection[d2702b535d15bdf3]::traits::FulfillmentError>>::try_evaluate_obligations
  30:     0x7fb291355d8d - <rustc_trait_selection[d2702b535d15bdf3]::solve::normalize::NormalizationFolder<rustc_trait_selection[d2702b535d15bdf3]::traits::FulfillmentError>>::normalize_alias_term
  31:     0x7fb291356ff2 - <rustc_trait_selection[d2702b535d15bdf3]::solve::normalize::NormalizationFolder<rustc_trait_selection[d2702b535d15bdf3]::traits::FulfillmentError> as rustc_type_ir[c0667d30c5973e36]::fold::FallibleTypeFolder<rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::try_fold_ty::{closure#0}
  32:     0x7fb291357445 - <&rustc_middle[779b3639bfd63c5a]::ty::list::RawList<(), rustc_middle[779b3639bfd63c5a]::ty::generic_args::GenericArg> as rustc_type_ir[c0667d30c5973e36]::fold::TypeFoldable<rustc_middle[779b3639bfd63c5a]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[d2702b535d15bdf3]::solve::normalize::NormalizationFolder<rustc_trait_selection[d2702b535d15bdf3]::traits::FulfillmentError>>
  33:     0x7fb290d14574 - rustc_hir_analysis[7c08228f19d0137f]::check::compare_impl_item::check_type_bounds
  34:     0x7fb290d437c3 - rustc_hir_analysis[7c08228f19d0137f]::check::compare_impl_item::compare_impl_item
  35:     0x7fb290d40cc7 - rustc_query_impl[c37ce76b3c963ce0]::query_impl::compare_impl_item::invoke_provider_fn::__rust_begin_short_backtrace
  36:     0x7fb290a6bb24 - rustc_query_impl[c37ce76b3c963ce0]::execution::try_execute_query::<rustc_data_structures[bea30f1e39587d4b]::vec_cache::VecCache<rustc_span[b2b4aa46a618de45]::def_id::LocalDefId, rustc_middle[779b3639bfd63c5a]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[779b3639bfd63c5a]::dep_graph::graph::DepNodeIndex>, false>
  37:     0x7fb290a6b64e - rustc_query_impl[c37ce76b3c963ce0]::query_impl::compare_impl_item::execute_query_non_incr::__rust_end_short_backtrace
  38:     0x7fb290a6eb49 - rustc_hir_analysis[7c08228f19d0137f]::check::check::check_item_type
  39:     0x7fb290a6c526 - rustc_hir_analysis[7c08228f19d0137f]::check::wfcheck::check_well_formed
  40:     0x7fb290a6c507 - rustc_query_impl[c37ce76b3c963ce0]::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  41:     0x7fb290a6bb24 - rustc_query_impl[c37ce76b3c963ce0]::execution::try_execute_query::<rustc_data_structures[bea30f1e39587d4b]::vec_cache::VecCache<rustc_span[b2b4aa46a618de45]::def_id::LocalDefId, rustc_middle[779b3639bfd63c5a]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[779b3639bfd63c5a]::dep_graph::graph::DepNodeIndex>, false>
  42:     0x7fb290a6b8bb - rustc_query_impl[c37ce76b3c963ce0]::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  43:     0x7fb290a67e4b - rustc_hir_analysis[7c08228f19d0137f]::check::wfcheck::check_type_wf
  44:     0x7fb290a67d55 - rustc_query_impl[c37ce76b3c963ce0]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  45:     0x7fb29160a050 - rustc_query_impl[c37ce76b3c963ce0]::execution::try_execute_query::<rustc_middle[779b3639bfd63c5a]::query::caches::SingleCache<rustc_middle[779b3639bfd63c5a]::query::erase::ErasedData<[u8; 1usize]>>, false>
  46:     0x7fb291609e29 - rustc_query_impl[c37ce76b3c963ce0]::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  47:     0x7fb290a8bd1b - rustc_hir_analysis[7c08228f19d0137f]::check_crate
  48:     0x7fb290531eb5 - rustc_interface[2621fa1c67a1630]::passes::analysis
  49:     0x7fb29160c7c9 - rustc_query_impl[c37ce76b3c963ce0]::execution::try_execute_query::<rustc_middle[779b3639bfd63c5a]::query::caches::SingleCache<rustc_middle[779b3639bfd63c5a]::query::erase::ErasedData<[u8; 0usize]>>, false>
  50:     0x7fb29160c435 - rustc_query_impl[c37ce76b3c963ce0]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  51:     0x7fb2915ba5e2 - rustc_interface[2621fa1c67a1630]::interface::run_compiler::<(), rustc_driver_impl[c52c1912fce43640]::run_compiler::{closure#0}>::{closure#1}
  52:     0x7fb2915e48fe - std[3a154748be1cf171]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2621fa1c67a1630]::util::run_in_thread_with_globals<rustc_interface[2621fa1c67a1630]::util::run_in_thread_pool_with_globals<rustc_interface[2621fa1c67a1630]::interface::run_compiler<(), rustc_driver_impl[c52c1912fce43640]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  53:     0x7fb2915e51a0 - <std[3a154748be1cf171]::thread::lifecycle::spawn_unchecked<rustc_interface[2621fa1c67a1630]::util::run_in_thread_with_globals<rustc_interface[2621fa1c67a1630]::util::run_in_thread_pool_with_globals<rustc_interface[2621fa1c67a1630]::interface::run_compiler<(), rustc_driver_impl[c52c1912fce43640]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[6dbc07b3c623ddea]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  54:     0x7fb2915e602c - <std[3a154748be1cf171]::sys::thread::unix::Thread>::new::thread_start
  55:     0x7fb28b0a097a - <unknown>
  56:     0x7fb28b1242bc - <unknown>
  57:                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.96.0-nightly (0e95a0f4c 2026-03-31) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally -Z dump-mir-dir=dir

query stack during panic:
#0 [compare_impl_item] checking assoc item `<impl at /tmp/icemaker_global_tempdir.RLRUDhZuCleE/rustc_testrunner_tmpdir_reporting.JM00f4mTzkQh/mvce.rs:5:1: 5:26>::Ctx` is compatible with trait definition
#1 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.RLRUDhZuCleE/rustc_testrunner_tmpdir_reporting.JM00f4mTzkQh/mvce.rs:5:1: 5:26>` is well-formed
#2 [check_type_wf] checking that types are well-formed
#3 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 2 previous errors

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

@rustbot label +WG-trait-system-refactor

Metadata

Metadata

Assignees

No one assigned

    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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    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