Skip to content

Commit fc02351

Browse files
committed
make sure to emit error during hir_lowering for const statics
1 parent 007fcda commit fc02351

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • compiler/rustc_hir_analysis/src/hir_ty_lowering

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2922,7 +2922,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
29222922
.unwrap_or_else(|guar| Const::new_error(tcx, guar))
29232923
}
29242924
Res::Def(DefKind::Static { .. }, _) => {
2925-
span_bug!(span, "use of bare `static` ConstArgKind::Path's not yet supported")
2925+
let guar = self
2926+
.dcx()
2927+
.span_err(path.span, "static items cannot be used as const arguments");
2928+
return Const::new_error(tcx, guar);
29262929
}
29272930
// FIXME(const_generics): create real const to allow fn items as const paths
29282931
Res::Def(DefKind::Fn | DefKind::AssocFn, did) => {

0 commit comments

Comments
 (0)