Skip to content

Commit cf1ce4b

Browse files
authored
Rollup merge of #128189 - oli-obk:tainting_stuff, r=compiler-errors
Turn an unreachable code path into an ICE We're probably replacing the resolution with a `Res::Err` nowadays instead of just erroring but keeping the `Res`, so this code path should be unreachable
2 parents f378b4f + 0706cc6 commit cf1ce4b

File tree

1 file changed

+5
-11
lines changed
  • compiler/rustc_mir_build/src/thir/cx

1 file changed

+5
-11
lines changed

compiler/rustc_mir_build/src/thir/cx/expr.rs

+5-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use crate::thir::cx::region::Scope;
33
use crate::thir::cx::Cx;
44
use crate::thir::util::UserAnnotatedTyHelpers;
55
use itertools::Itertools;
6-
use rustc_ast::LitKind;
76
use rustc_data_structures::stack::ensure_sufficient_stack;
87
use rustc_hir as hir;
98
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
@@ -22,8 +21,7 @@ use rustc_middle::ty::{
2221
self, AdtKind, InlineConstArgs, InlineConstArgsParts, ScalarInt, Ty, UpvarArgs, UserType,
2322
};
2423
use rustc_middle::{bug, span_bug};
25-
use rustc_span::source_map::Spanned;
26-
use rustc_span::{sym, Span, DUMMY_SP};
24+
use rustc_span::{sym, Span};
2725
use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
2826
use tracing::{debug, info, instrument, trace};
2927

@@ -899,14 +897,10 @@ impl<'tcx> Cx<'tcx> {
899897
let hir_id = self.tcx.local_def_id_to_hir_id(def_id.expect_local());
900898
let generics = self.tcx.generics_of(hir_id.owner);
901899
let Some(&index) = generics.param_def_id_to_index.get(&def_id) else {
902-
let guar = self.tcx.dcx().has_errors().unwrap();
903-
// We already errored about a late bound const
904-
905-
let lit = self
906-
.tcx
907-
.hir_arena
908-
.alloc(Spanned { span: DUMMY_SP, node: LitKind::Err(guar) });
909-
return ExprKind::Literal { lit, neg: false };
900+
span_bug!(
901+
expr.span,
902+
"Should have already errored about late bound consts: {def_id:?}"
903+
);
910904
};
911905
let name = self.tcx.hir().name(hir_id);
912906
let param = ty::ParamConst::new(index, name);

0 commit comments

Comments
 (0)