Skip to content

Commit 45991f9

Browse files
committed
Use span_bug instead of panic
1 parent c0923c8 commit 45991f9

File tree

1 file changed

+8
-4
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+8
-4
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
5656
use rustc_hir::definitions::DefPathData;
5757
use rustc_hir::{ConstArg, GenericArg, ItemLocalId, ParamName, TraitCandidate};
5858
use rustc_index::vec::{Idx, IndexVec};
59+
use rustc_middle::span_bug;
5960
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
6061
use rustc_session::parse::feature_err;
6162
use rustc_span::hygiene::MacroKind;
@@ -1575,10 +1576,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
15751576

15761577
LifetimeRes::Static | LifetimeRes::Error => {}
15771578

1578-
res => panic!(
1579-
"Unexpected lifetime resolution {:?} for {:?} at {:?}",
1580-
res, lifetime.ident, lifetime.ident.span
1581-
),
1579+
res => {
1580+
let bug_msg = format!(
1581+
"Unexpected lifetime resolution {:?} for {:?} at {:?}",
1582+
res, lifetime.ident, lifetime.ident.span
1583+
);
1584+
span_bug!(lifetime.ident.span, "{}", bug_msg);
1585+
}
15821586
}
15831587
}
15841588

0 commit comments

Comments
 (0)