Skip to content

Commit 3059ed8

Browse files
miri: rustc_abi::Abi => BackendRepr
1 parent 0349209 commit 3059ed8

File tree

6 files changed

+20
-9
lines changed

6 files changed

+20
-9
lines changed

src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ use std::cell::RefCell;
99
use std::fmt::Write;
1010
use std::{cmp, mem};
1111

12+
use rustc_abi::{BackendRepr, Size};
1213
use rustc_data_structures::fx::FxHashSet;
1314
use rustc_middle::mir::{Mutability, RetagKind};
1415
use rustc_middle::ty::layout::HasParamEnv;
1516
use rustc_middle::ty::{self, Ty};
16-
use rustc_target::abi::{Abi, Size};
1717

1818
use self::diagnostics::{RetagCause, RetagInfo};
1919
pub use self::item::{Item, Permission};
@@ -972,7 +972,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
972972
RetagFields::OnlyScalar => {
973973
// Matching `ArgAbi::new` at the time of writing, only fields of
974974
// `Scalar` and `ScalarPair` ABI are considered.
975-
matches!(place.layout.abi, Abi::Scalar(..) | Abi::ScalarPair(..))
975+
matches!(
976+
place.layout.backend_repr,
977+
BackendRepr::Scalar(..) | BackendRepr::ScalarPair(..)
978+
)
976979
}
977980
};
978981
if recurse {

src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use rustc_abi::{BackendRepr, Size};
12
use rustc_middle::mir::{Mutability, RetagKind};
23
use rustc_middle::ty::layout::HasParamEnv;
34
use rustc_middle::ty::{self, Ty};
45
use rustc_span::def_id::DefId;
5-
use rustc_target::abi::{Abi, Size};
66

77
use crate::borrow_tracker::{GlobalState, GlobalStateInner, ProtectorKind};
88
use crate::concurrency::data_race::NaReadType;
@@ -495,7 +495,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
495495
RetagFields::OnlyScalar => {
496496
// Matching `ArgAbi::new` at the time of writing, only fields of
497497
// `Scalar` and `ScalarPair` ABI are considered.
498-
matches!(place.layout.abi, Abi::Scalar(..) | Abi::ScalarPair(..))
498+
matches!(
499+
place.layout.backend_repr,
500+
BackendRepr::Scalar(..) | BackendRepr::ScalarPair(..)
501+
)
499502
}
500503
};
501504
if recurse {

src/tools/miri/src/helpers.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,12 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
349349
i: impl Into<i128>,
350350
dest: &impl Writeable<'tcx, Provenance>,
351351
) -> InterpResult<'tcx> {
352-
assert!(dest.layout().abi.is_scalar(), "write_int on non-scalar type {}", dest.layout().ty);
353-
let val = if dest.layout().abi.is_signed() {
352+
assert!(
353+
dest.layout().backend_repr.is_scalar(),
354+
"write_int on non-scalar type {}",
355+
dest.layout().ty
356+
);
357+
let val = if dest.layout().backend_repr.is_signed() {
354358
Scalar::from_int(i, dest.layout().size)
355359
} else {
356360
// `unwrap` can only fail here if `i` is negative

src/tools/miri/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ extern crate either;
5555
extern crate tracing;
5656

5757
// The rustc crates we need
58+
extern crate rustc_abi;
5859
extern crate rustc_apfloat;
5960
extern crate rustc_ast;
6061
extern crate rustc_attr;

src/tools/miri/src/operator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2323

2424
interp_ok(match bin_op {
2525
Eq | Ne | Lt | Le | Gt | Ge => {
26-
assert_eq!(left.layout.abi, right.layout.abi); // types can differ, e.g. fn ptrs with different `for`
26+
assert_eq!(left.layout.backend_repr, right.layout.backend_repr); // types can differ, e.g. fn ptrs with different `for`
2727
let size = this.pointer_size();
2828
// Just compare the bits. ScalarPairs are compared lexicographically.
2929
// We thus always compare pairs and simply fill scalars up with 0.

src/tools/miri/src/shims/native_lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use libffi::high::call as ffi;
55
use libffi::low::CodePtr;
66
use rustc_middle::ty::{self as ty, IntTy, UintTy};
77
use rustc_span::Symbol;
8-
use rustc_target::abi::{Abi, HasDataLayout};
8+
use rustc_abi::{BackendRepr, HasDataLayout};
99

1010
use crate::*;
1111

@@ -149,7 +149,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
149149
// Get the function arguments, and convert them to `libffi`-compatible form.
150150
let mut libffi_args = Vec::<CArg>::with_capacity(args.len());
151151
for arg in args.iter() {
152-
if !matches!(arg.layout.abi, Abi::Scalar(_)) {
152+
if !matches!(arg.layout.backend_repr, BackendRepr::Scalar(_)) {
153153
throw_unsup_format!("only scalar argument types are support for native calls")
154154
}
155155
libffi_args.push(imm_to_carg(this.read_immediate(arg)?, this)?);

0 commit comments

Comments
 (0)