diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2023-08-04 17:01:05 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2023-08-07 10:23:20 -0300 |
| commit | 4199a3c13a05d05fcc863d506ee2aed74228b8e7 (patch) | |
| tree | 7c14534892de7ad741c73ee03727304257564593 | |
| parent | 139b49b99523c43219b39079aa8fb2e084c52a1c (diff) | |
| download | rust-4199a3c13a05d05fcc863d506ee2aed74228b8e7.tar.gz rust-4199a3c13a05d05fcc863d506ee2aed74228b8e7.zip | |
Convert unsafety using the stable method and reuse mir::Safety
| -rw-r--r-- | compiler/rustc_smir/src/rustc_smir/mod.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_smir/src/stable_mir/ty.rs | 10 |
2 files changed, 4 insertions, 13 deletions
diff --git a/compiler/rustc_smir/src/rustc_smir/mod.rs b/compiler/rustc_smir/src/rustc_smir/mod.rs index e377843cdb4..6eb7e930425 100644 --- a/compiler/rustc_smir/src/rustc_smir/mod.rs +++ b/compiler/rustc_smir/src/rustc_smir/mod.rs @@ -826,7 +826,7 @@ impl<'tcx> Stable<'tcx> for ty::FnSig<'tcx> { type T = stable_mir::ty::FnSig; fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T { use rustc_target::spec::abi; - use stable_mir::ty::{Abi, FnSig, Unsafety}; + use stable_mir::ty::{Abi, FnSig}; FnSig { inputs_and_output: self @@ -835,10 +835,7 @@ impl<'tcx> Stable<'tcx> for ty::FnSig<'tcx> { .map(|ty| tables.intern_ty(ty)) .collect(), c_variadic: self.c_variadic, - unsafety: match self.unsafety { - hir::Unsafety::Normal => Unsafety::Normal, - hir::Unsafety::Unsafe => Unsafety::Unsafe, - }, + unsafety: self.unsafety.stable(tables), abi: match self.abi { abi::Abi::Rust => Abi::Rust, abi::Abi::C { unwind } => Abi::C { unwind }, diff --git a/compiler/rustc_smir/src/stable_mir/ty.rs b/compiler/rustc_smir/src/stable_mir/ty.rs index df28fc4eed9..be917b2e140 100644 --- a/compiler/rustc_smir/src/stable_mir/ty.rs +++ b/compiler/rustc_smir/src/stable_mir/ty.rs @@ -1,4 +1,4 @@ -use super::{mir::Mutability, with, DefId}; +use super::{mir::Mutability, mir::Safety, with, DefId}; use crate::rustc_internal::Opaque; #[derive(Copy, Clone, Debug)] @@ -140,17 +140,11 @@ pub type PolyFnSig = Binder<FnSig>; pub struct FnSig { pub inputs_and_output: Vec<Ty>, pub c_variadic: bool, - pub unsafety: Unsafety, + pub unsafety: Safety, pub abi: Abi, } #[derive(Clone, PartialEq, Eq, Debug)] -pub enum Unsafety { - Unsafe, - Normal, -} - -#[derive(Clone, PartialEq, Eq, Debug)] pub enum Abi { Rust, C { unwind: bool }, |
