diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2022-08-04 12:07:03 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2022-08-04 12:07:03 -0300 |
| commit | 45991f9175604becdcf8592e22f41fa1acba58fe (patch) | |
| tree | 204a20524a2595ca2abfa851c199250c04d54e70 | |
| parent | c0923c893485be4deba7470e55d98fbf80f5c3d9 (diff) | |
| download | rust-45991f9175604becdcf8592e22f41fa1acba58fe.tar.gz rust-45991f9175604becdcf8592e22f41fa1acba58fe.zip | |
Use span_bug instead of panic
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 4a3e58b2f8e..49f5470d181 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -56,6 +56,7 @@ use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID}; use rustc_hir::definitions::DefPathData; use rustc_hir::{ConstArg, GenericArg, ItemLocalId, ParamName, TraitCandidate}; use rustc_index::vec::{Idx, IndexVec}; +use rustc_middle::span_bug; use rustc_middle::ty::{ResolverAstLowering, TyCtxt}; use rustc_session::parse::feature_err; use rustc_span::hygiene::MacroKind; @@ -1575,10 +1576,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { LifetimeRes::Static | LifetimeRes::Error => {} - res => panic!( - "Unexpected lifetime resolution {:?} for {:?} at {:?}", - res, lifetime.ident, lifetime.ident.span - ), + res => { + let bug_msg = format!( + "Unexpected lifetime resolution {:?} for {:?} at {:?}", + res, lifetime.ident, lifetime.ident.span + ); + span_bug!(lifetime.ident.span, "{}", bug_msg); + } } } |
