Always evaluate free lifetime-generic constants

Co-authored-by: Michael Goulet <michael@errs.io>
This commit is contained in:
León Orell Valerian Liehr
2025-05-02 20:22:13 +02:00
parent 642e49bfed
commit a83f8d02ea
4 changed files with 9 additions and 8 deletions

View File

@@ -203,7 +203,9 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
tcx.ensure_ok().eval_static_initializer(item_def_id);
check::maybe_check_static_with_link_section(tcx, item_def_id);
}
DefKind::Const if tcx.generics_of(item_def_id).is_empty() => {
DefKind::Const if !tcx.generics_of(item_def_id).own_requires_monomorphization() => {
// FIXME(generic_const_items): Passing empty instead of identity args is fishy but
// seems to be fine for now. Revisit this!
let instance = ty::Instance::new_raw(item_def_id.into(), ty::GenericArgs::empty());
let cid = GlobalId { instance, promoted: None };
let typing_env = ty::TypingEnv::fully_monomorphized();