1
Fork 0

Add some convenience helper methods on hir::Safety

This commit is contained in:
Oli Scherer 2024-12-13 12:19:46 +00:00
parent 3a64bef2ba
commit 8a4e5d7444
27 changed files with 72 additions and 68 deletions

View file

@ -53,9 +53,8 @@ fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
Some(stab) => {
if cfg!(debug_assertions) && stab.promotable {
let sig = tcx.fn_sig(def_id);
assert_eq!(
sig.skip_binder().safety(),
hir::Safety::Safe,
assert!(
sig.skip_binder().safety().is_safe(),
"don't mark const unsafe fns as promotable",
// https://github.com/rust-lang/rust/pull/53851#issuecomment-418760682
);