Convert unsafety using the stable method and reuse mir::Safety
This commit is contained in:
parent
139b49b995
commit
4199a3c13a
@ -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 @@ fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T {
|
||||
.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 },
|
||||
|
@ -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,16 +140,10 @@ pub struct AliasTy {
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user