Skip to content

Commit 9d42e35

Browse files
miri: sed to CanonAbi
1 parent 87fa1ea commit 9d42e35

27 files changed

+354
-327
lines changed

src/tools/miri/src/helpers.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::time::Duration;
33
use std::{cmp, iter};
44

55
use rand::RngCore;
6-
use rustc_abi::{Align, ExternAbi, FieldIdx, FieldsShape, Size, Variants};
6+
use rustc_abi::{Align, CanonAbi, ExternAbi, FieldIdx, FieldsShape, Size, Variants};
77
use rustc_apfloat::Float;
88
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
99
use rustc_hir::Safety;
@@ -18,7 +18,7 @@ use rustc_middle::ty::{self, Binder, FloatTy, FnSig, IntTy, Ty, TyCtxt, UintTy};
1818
use rustc_session::config::CrateType;
1919
use rustc_span::{Span, Symbol};
2020
use rustc_symbol_mangling::mangle_internal_symbol;
21-
use rustc_target::callconv::{Conv, FnAbi};
21+
use rustc_target::callconv::FnAbi;
2222

2323
use crate::*;
2424

@@ -936,11 +936,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
936936
fn check_callconv<'a>(
937937
&self,
938938
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
939-
exp_abi: Conv,
939+
exp_abi: CanonAbi,
940940
) -> InterpResult<'a, ()> {
941941
if fn_abi.conv != exp_abi {
942942
throw_ub_format!(
943-
"calling a function with calling convention {exp_abi} using caller calling convention {}",
943+
r#"calling a function with calling convention "{exp_abi}" using caller calling convention "{}""#,
944944
fn_abi.conv
945945
);
946946
}
@@ -973,7 +973,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
973973
fn check_abi_and_shim_symbol_clash(
974974
&mut self,
975975
abi: &FnAbi<'tcx, Ty<'tcx>>,
976-
exp_abi: Conv,
976+
exp_abi: CanonAbi,
977977
link_name: Symbol,
978978
) -> InterpResult<'tcx, ()> {
979979
self.check_callconv(abi, exp_abi)?;
@@ -998,7 +998,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
998998
fn check_shim<'a, const N: usize>(
999999
&mut self,
10001000
abi: &FnAbi<'tcx, Ty<'tcx>>,
1001-
exp_abi: Conv,
1001+
exp_abi: CanonAbi,
10021002
link_name: Symbol,
10031003
args: &'a [OpTy<'tcx>],
10041004
) -> InterpResult<'tcx, &'a [OpTy<'tcx>; N]> {
@@ -1098,7 +1098,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
10981098
fn check_shim_variadic<'a, const N: usize>(
10991099
&mut self,
11001100
abi: &FnAbi<'tcx, Ty<'tcx>>,
1101-
exp_abi: Conv,
1101+
exp_abi: CanonAbi,
11021102
link_name: Symbol,
11031103
args: &'a [OpTy<'tcx>],
11041104
) -> InterpResult<'tcx, (&'a [OpTy<'tcx>; N], &'a [OpTy<'tcx>])>

src/tools/miri/src/shims/aarch64.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
use rustc_abi::CanonAbi;
12
use rustc_middle::mir::BinOp;
23
use rustc_middle::ty::Ty;
34
use rustc_span::Symbol;
4-
use rustc_target::callconv::{Conv, FnAbi};
5+
use rustc_target::callconv::FnAbi;
56

67
use crate::*;
78

@@ -19,7 +20,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1920
let unprefixed_name = link_name.as_str().strip_prefix("llvm.aarch64.").unwrap();
2021
match unprefixed_name {
2122
"isb" => {
22-
let [arg] = this.check_shim(abi, Conv::C, link_name, args)?;
23+
let [arg] = this.check_shim(abi, CanonAbi::C, link_name, args)?;
2324
let arg = this.read_scalar(arg)?.to_i32()?;
2425
match arg {
2526
// SY ("full system scope")
@@ -37,7 +38,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3738
// `left` input, the second half of the output from the `right` input.
3839
// https://developer.arm.com/architectures/instruction-sets/intrinsics/vpmaxq_u8
3940
"neon.umaxp.v16i8" => {
40-
let [left, right] = this.check_shim(abi, Conv::C, link_name, args)?;
41+
let [left, right] = this.check_shim(abi, CanonAbi::C, link_name, args)?;
4142

4243
let (left, left_len) = this.project_to_simd(left)?;
4344
let (right, right_len) = this.project_to_simd(right)?;

src/tools/miri/src/shims/backtrace.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use rustc_abi::Size;
1+
use rustc_abi::{CanonAbi, Size};
22
use rustc_middle::ty::layout::LayoutOf as _;
33
use rustc_middle::ty::{self, Instance, Ty};
44
use rustc_span::{BytePos, Loc, Symbol, hygiene};
5-
use rustc_target::callconv::{Conv, FnAbi};
5+
use rustc_target::callconv::FnAbi;
66

77
use crate::*;
88

@@ -16,7 +16,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1616
dest: &MPlaceTy<'tcx>,
1717
) -> InterpResult<'tcx> {
1818
let this = self.eval_context_mut();
19-
let [flags] = this.check_shim(abi, Conv::Rust, link_name, args)?;
19+
let [flags] = this.check_shim(abi, CanonAbi::Rust, link_name, args)?;
2020

2121
let flags = this.read_scalar(flags)?.to_u64()?;
2222
if flags != 0 {
@@ -38,7 +38,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3838
let ptr_ty = this.machine.layouts.mut_raw_ptr.ty;
3939
let ptr_layout = this.layout_of(ptr_ty)?;
4040

41-
let [flags, buf] = this.check_shim(abi, Conv::Rust, link_name, args)?;
41+
let [flags, buf] = this.check_shim(abi, CanonAbi::Rust, link_name, args)?;
4242

4343
let flags = this.read_scalar(flags)?.to_u64()?;
4444
let buf_place = this.deref_pointer_as(buf, ptr_layout)?;
@@ -118,7 +118,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
118118
dest: &MPlaceTy<'tcx>,
119119
) -> InterpResult<'tcx> {
120120
let this = self.eval_context_mut();
121-
let [ptr, flags] = this.check_shim(abi, Conv::Rust, link_name, args)?;
121+
let [ptr, flags] = this.check_shim(abi, CanonAbi::Rust, link_name, args)?;
122122

123123
let flags = this.read_scalar(flags)?.to_u64()?;
124124

@@ -190,7 +190,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
190190
let this = self.eval_context_mut();
191191

192192
let [ptr, flags, name_ptr, filename_ptr] =
193-
this.check_shim(abi, Conv::Rust, link_name, args)?;
193+
this.check_shim(abi, CanonAbi::Rust, link_name, args)?;
194194

195195
let flags = this.read_scalar(flags)?.to_u64()?;
196196
if flags != 0 {

0 commit comments

Comments
 (0)