Use span_bug instead of panic

This commit is contained in:
Santiago Pastorino 2022-08-04 12:07:03 -03:00
parent c0923c8934
commit 45991f9175
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF

View File

@ -56,6 +56,7 @@
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 @@ fn create_lifetime_defs(
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);
}
}
}