Skip to content

Commit d0267cb

Browse files
committed
Remove an unnecessary span_delayed_bug in Resolver::valid_res_from_ribs.
`Resolver::report_error` always emits (this commit makes that clearer), so the `span_delayed_bug` is unnecessary.
1 parent c743e4a commit d0267cb

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
554554
///
555555
/// This takes the error provided, combines it with the span and any additional spans inside the
556556
/// error and emits it.
557-
pub(crate) fn report_error(&mut self, span: Span, resolution_error: ResolutionError<'a>) {
558-
self.into_struct_error(span, resolution_error).emit();
557+
pub(crate) fn report_error(
558+
&mut self,
559+
span: Span,
560+
resolution_error: ResolutionError<'a>,
561+
) -> ErrorGuaranteed {
562+
self.into_struct_error(span, resolution_error).emit()
559563
}
560564

561565
pub(crate) fn into_struct_error(

compiler/rustc_resolve/src/ident.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc_ast::{self as ast, NodeId};
2+
use rustc_errors::ErrorGuaranteed;
23
use rustc_hir::def::{DefKind, Namespace, NonMacroAttrKind, PartialRes, PerNS};
34
use rustc_middle::bug;
45
use rustc_middle::ty;
@@ -1066,7 +1067,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
10661067
original_rib_ident_def: Ident,
10671068
all_ribs: &[Rib<'a>],
10681069
) -> Res {
1069-
const CG_BUG_STR: &str = "min_const_generics resolve check didn't stop compilation";
10701070
debug!("validate_res_from_ribs({:?})", res);
10711071
let ribs = &all_ribs[rib_index + 1..];
10721072

@@ -1209,8 +1209,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
12091209
}
12101210
}
12111211
};
1212-
self.report_error(span, error);
1213-
self.dcx().span_delayed_bug(span, CG_BUG_STR);
1212+
let _: ErrorGuaranteed = self.report_error(span, error);
12141213
}
12151214

12161215
return Res::Err;

0 commit comments

Comments
 (0)