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;
|
type T = stable_mir::ty::FnSig;
|
||||||
fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T {
|
fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T {
|
||||||
use rustc_target::spec::abi;
|
use rustc_target::spec::abi;
|
||||||
use stable_mir::ty::{Abi, FnSig, Unsafety};
|
use stable_mir::ty::{Abi, FnSig};
|
||||||
|
|
||||||
FnSig {
|
FnSig {
|
||||||
inputs_and_output: self
|
inputs_and_output: self
|
||||||
@ -835,10 +835,7 @@ fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T {
|
|||||||
.map(|ty| tables.intern_ty(ty))
|
.map(|ty| tables.intern_ty(ty))
|
||||||
.collect(),
|
.collect(),
|
||||||
c_variadic: self.c_variadic,
|
c_variadic: self.c_variadic,
|
||||||
unsafety: match self.unsafety {
|
unsafety: self.unsafety.stable(tables),
|
||||||
hir::Unsafety::Normal => Unsafety::Normal,
|
|
||||||
hir::Unsafety::Unsafe => Unsafety::Unsafe,
|
|
||||||
},
|
|
||||||
abi: match self.abi {
|
abi: match self.abi {
|
||||||
abi::Abi::Rust => Abi::Rust,
|
abi::Abi::Rust => Abi::Rust,
|
||||||
abi::Abi::C { unwind } => Abi::C { unwind },
|
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;
|
use crate::rustc_internal::Opaque;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
@ -140,16 +140,10 @@ pub struct AliasTy {
|
|||||||
pub struct FnSig {
|
pub struct FnSig {
|
||||||
pub inputs_and_output: Vec<Ty>,
|
pub inputs_and_output: Vec<Ty>,
|
||||||
pub c_variadic: bool,
|
pub c_variadic: bool,
|
||||||
pub unsafety: Unsafety,
|
pub unsafety: Safety,
|
||||||
pub abi: Abi,
|
pub abi: Abi,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
|
||||||
pub enum Unsafety {
|
|
||||||
Unsafe,
|
|
||||||
Normal,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum Abi {
|
pub enum Abi {
|
||||||
Rust,
|
Rust,
|
||||||
|
Loading…
Reference in New Issue
Block a user