about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-05-02 20:22:13 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2025-05-27 18:58:51 +0200
commita83f8d02eaf36b36a7ed495e43b8bf891b6fc1af (patch)
treeab241607b1e29614e38ab0bc50526f084f1722e0 /compiler/rustc_hir_analysis/src
parent642e49bfed2481e54e252732be20d3c24cbec9e8 (diff)
downloadrust-a83f8d02eaf36b36a7ed495e43b8bf891b6fc1af.tar.gz
rust-a83f8d02eaf36b36a7ed495e43b8bf891b6fc1af.zip
Always evaluate free lifetime-generic constants
Co-authored-by: Michael Goulet <michael@errs.io>
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/lib.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs
index 010c6c376fe..a64c24f5455 100644
--- a/compiler/rustc_hir_analysis/src/lib.rs
+++ b/compiler/rustc_hir_analysis/src/lib.rs
@@ -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();