introduce UnevaluatedConstKind#157094
Conversation
|
changes to the core type system cc @lcnr Some changes occurred in cc @BoxyUwU Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor Some changes occurred in match checking cc @Nadrieril This PR changes rustc_public cc @oli-obk, @celinval, @ouz-a, @makai410 changes to the core type system cc @lcnr Some changes occurred in cc @BoxyUwU Some changes occurred in cc @BoxyUwU Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr HIR ty lowering was modified cc @fmease |
|
|
|
|
||
| #[inline] | ||
| pub fn new_unevaluated(tcx: TyCtxt<'tcx>, uv: ty::UnevaluatedConst<'tcx>) -> Const<'tcx> { | ||
| tcx.debug_assert_args_compatible(uv.def, uv.args); |
There was a problem hiding this comment.
this assert has moved to the UnevaluatedConstKind constructor, which is what AliasTyKind does
| && self.tcx.def_kind(trait_def_id) == DefKind::Trait => | ||
| { | ||
| AllowSelfProjections::Yes => { | ||
| let trait_def_id = self.tcx.parent(proj.kind.def_id()); |
There was a problem hiding this comment.
this rework seems real wonky, but it's changing the shape of the code to look the same as visit_ty above
| } | ||
| } | ||
| DefKind::Const { .. } => ty::UnevaluatedConstKind::Free { def_id }, | ||
| DefKind::AnonConst | DefKind::InlineConst | DefKind::Ctor(_, CtorKind::Const) => { |
There was a problem hiding this comment.
I am unsure about DefKind::InlineConst. alias_term_kind_from_def_id does not include it. Removing it causes MIR stuff to panic: rustc_codegen_ssa immediate_const_vector -> eval_unevaluated_mir_constant_to_valtree -> MIR::UnevaluatedConst::shrink -> unevaluated_const_kind_from_def_id -> unexpected DefKind in UnevaluatedConst: InlineConst
|
|
||
| #[cfg(target_pointer_width = "64")] | ||
| rustc_data_structures::static_assert_size!(ConstKind<'_>, 24); | ||
| rustc_data_structures::static_assert_size!(ConstKind<'_>, 32); |
(no rush on this, boxy, if you get this notif, I know you're on break after rustweek)
Partially fixes rust-lang/project-const-generics#98
ConstKind::Exprinto Unevaluated, which is part of that issuer? @BoxyUwU