Skip to content

Commit

Permalink
Rename stable_mir::Safety to stable_mir::Unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Apr 29, 2024
1 parent 9084601 commit c2f4e85
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_smir/src/rustc_internal/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_span::Symbol;
use stable_mir::abi::Layout;
use stable_mir::mir::alloc::AllocId;
use stable_mir::mir::mono::{Instance, MonoItem, StaticDef};
use stable_mir::mir::{BinOp, Mutability, Place, ProjectionElem, Safety};
use stable_mir::mir::{BinOp, Mutability, Place, ProjectionElem, Unsafe};
use stable_mir::ty::{
Abi, AdtDef, Binder, BoundRegionKind, BoundTyKind, BoundVariableKind, ClosureKind, Const,
DynKind, ExistentialPredicate, ExistentialProjection, ExistentialTraitRef, FloatTy, FnSig,
Expand Down Expand Up @@ -480,13 +480,13 @@ impl RustcInternal for Abi {
}
}

impl RustcInternal for Safety {
impl RustcInternal for Unsafe {
type T<'tcx> = rustc_hir::Unsafety;

fn internal<'tcx>(&self, _tables: &mut Tables<'_>, _tcx: TyCtxt<'tcx>) -> Self::T<'tcx> {
match self {
Safety::Unsafe => rustc_hir::Unsafety::Unsafe,
Safety::Normal => rustc_hir::Unsafety::Normal,
Unsafe::Yes => rustc_hir::Unsafety::Unsafe,
Unsafe::No => rustc_hir::Unsafety::Normal,
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_smir/src/rustc_smir/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ mod mir;
mod ty;

impl<'tcx> Stable<'tcx> for rustc_hir::Unsafety {
type T = stable_mir::mir::Safety;
type T = stable_mir::mir::Unsafe;
fn stable(&self, _: &mut Tables<'_>) -> Self::T {
match self {
rustc_hir::Unsafety::Unsafe => stable_mir::mir::Safety::Unsafe,
rustc_hir::Unsafety::Normal => stable_mir::mir::Safety::Normal,
rustc_hir::Unsafety::Unsafe => stable_mir::mir::Unsafe::Yes,
rustc_hir::Unsafety::Normal => stable_mir::mir::Unsafe::No,
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions compiler/stable_mir/src/mir/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,9 +914,9 @@ pub enum Mutability {
}

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Safety {
Unsafe,
Normal,
pub enum Unsafe {
Yes,
No,
}

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

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

/// Go from a mut raw pointer to a const raw pointer.
MutToConstPointer,
Expand Down
6 changes: 3 additions & 3 deletions compiler/stable_mir/src/ty.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{
mir::Safety,
mir::Unsafe,
mir::{Body, Mutability},
with, DefId, Error, Symbol,
};
Expand Down Expand Up @@ -903,7 +903,7 @@ pub type PolyFnSig = Binder<FnSig>;
pub struct FnSig {
pub inputs_and_output: Vec<Ty>,
pub c_variadic: bool,
pub unsafety: Safety,
pub unsafety: Unsafe,
pub abi: Abi,
}

Expand Down Expand Up @@ -1194,7 +1194,7 @@ pub enum TraitSpecializationKind {
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TraitDecl {
pub def_id: TraitDef,
pub unsafety: Safety,
pub unsafety: Unsafe,
pub paren_sugar: bool,
pub has_auto_impl: bool,
pub is_marker: bool,
Expand Down

0 comments on commit c2f4e85

Please sign in to comment.