Skip to content

Commit 3dd5387

Browse files
committed
Rename stable_mir::Safety to stable_mir::Unsafe
1 parent 79734f1 commit 3dd5387

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

compiler/rustc_smir/src/rustc_internal/internal.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_span::Symbol;
1010
use stable_mir::abi::Layout;
1111
use stable_mir::mir::alloc::AllocId;
1212
use stable_mir::mir::mono::{Instance, MonoItem, StaticDef};
13-
use stable_mir::mir::{BinOp, Mutability, Place, ProjectionElem, Safety};
13+
use stable_mir::mir::{BinOp, Mutability, Place, ProjectionElem, Unsafe};
1414
use stable_mir::ty::{
1515
Abi, AdtDef, Binder, BoundRegionKind, BoundTyKind, BoundVariableKind, ClosureKind, Const,
1616
DynKind, ExistentialPredicate, ExistentialProjection, ExistentialTraitRef, FloatTy, FnSig,
@@ -480,13 +480,13 @@ impl RustcInternal for Abi {
480480
}
481481
}
482482

483-
impl RustcInternal for Safety {
483+
impl RustcInternal for Unsafe {
484484
type T<'tcx> = rustc_hir::Unsafety;
485485

486486
fn internal<'tcx>(&self, _tables: &mut Tables<'_>, _tcx: TyCtxt<'tcx>) -> Self::T<'tcx> {
487487
match self {
488-
Safety::Unsafe => rustc_hir::Unsafety::Unsafe,
489-
Safety::Normal => rustc_hir::Unsafety::Normal,
488+
Unsafe::Yes => rustc_hir::Unsafety::Unsafe,
489+
Unsafe::No => rustc_hir::Unsafety::Normal,
490490
}
491491
}
492492
}

compiler/rustc_smir/src/rustc_smir/convert/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ mod mir;
1010
mod ty;
1111

1212
impl<'tcx> Stable<'tcx> for rustc_hir::Unsafety {
13-
type T = stable_mir::mir::Safety;
13+
type T = stable_mir::mir::Unsafe;
1414
fn stable(&self, _: &mut Tables<'_>) -> Self::T {
1515
match self {
16-
rustc_hir::Unsafety::Unsafe => stable_mir::mir::Safety::Unsafe,
17-
rustc_hir::Unsafety::Normal => stable_mir::mir::Safety::Normal,
16+
rustc_hir::Unsafety::Unsafe => stable_mir::mir::Unsafe::Yes,
17+
rustc_hir::Unsafety::Normal => stable_mir::mir::Unsafe::No,
1818
}
1919
}
2020
}

compiler/stable_mir/src/mir/body.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,9 @@ pub enum Mutability {
914914
}
915915

916916
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
917-
pub enum Safety {
918-
Unsafe,
919-
Normal,
917+
pub enum Unsafe {
918+
Yes,
919+
No,
920920
}
921921

922922
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
@@ -929,7 +929,7 @@ pub enum PointerCoercion {
929929

930930
/// Go from a non-capturing closure to a fn pointer or an unsafe fn pointer.
931931
/// It cannot convert a closure that requires unsafe.
932-
ClosureFnPointer(Safety),
932+
ClosureFnPointer(Unsafe),
933933

934934
/// Go from a mut raw pointer to a const raw pointer.
935935
MutToConstPointer,

compiler/stable_mir/src/ty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::{
2-
mir::Safety,
2+
mir::Unsafe,
33
mir::{Body, Mutability},
44
with, DefId, Error, Symbol,
55
};
@@ -903,7 +903,7 @@ pub type PolyFnSig = Binder<FnSig>;
903903
pub struct FnSig {
904904
pub inputs_and_output: Vec<Ty>,
905905
pub c_variadic: bool,
906-
pub unsafety: Safety,
906+
pub unsafety: Unsafe,
907907
pub abi: Abi,
908908
}
909909

@@ -1194,7 +1194,7 @@ pub enum TraitSpecializationKind {
11941194
#[derive(Clone, Debug, Eq, PartialEq)]
11951195
pub struct TraitDecl {
11961196
pub def_id: TraitDef,
1197-
pub unsafety: Safety,
1197+
pub unsafety: Unsafe,
11981198
pub paren_sugar: bool,
11991199
pub has_auto_impl: bool,
12001200
pub is_marker: bool,

0 commit comments

Comments
 (0)