1
Fork 0

Rollup merge of #134285 - oli-obk:push-vwrqsqlwnuxo, r=Urgau

Add some convenience helper methods on `hir::Safety`

Makes a lot of call sites simpler and should make any refactorings needed for https://github.com/rust-lang/rust/pull/134090#issuecomment-2541332415 simpler, as fewer sites have to be touched in case we end up storing some information in the variants of `hir::Safety`
This commit is contained in:
Stuart Cook 2024-12-15 20:01:38 +11:00 committed by GitHub
commit d48af09ffd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 74 additions and 70 deletions

View file

@ -57,9 +57,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
);