Skip to content

Commit efd9c8d

Browse files
authored
Merge pull request #4009 from RalfJung/rustup
Rustup
2 parents 1154998 + 907e8b8 commit efd9c8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+551
-525
lines changed

clippy.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
arithmetic-side-effects-allowed = ["rustc_target::abi::Size"]
1+
arithmetic-side-effects-allowed = ["rustc_abi::Size", "rustc_apfloat::ieee::IeeeFloat"]

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
75eff9a5749411ba5a0b37cc3299116c4e263075
1+
00ed73cdc09a6452cb58202d56a9211fb3c73031

src/alloc_addresses/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use std::cell::RefCell;
77
use std::cmp::max;
88

99
use rand::Rng;
10+
use rustc_abi::{Align, Size};
1011
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1112
use rustc_span::Span;
12-
use rustc_target::abi::{Align, Size};
1313

1414
use self::reuse_pool::ReusePool;
1515
use crate::concurrency::VClock;

src/alloc_addresses/reuse_pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Manages a pool of addresses that can be reused.
22
33
use rand::Rng;
4-
use rustc_target::abi::{Align, Size};
4+
use rustc_abi::{Align, Size};
55

66
use crate::concurrency::VClock;
77
use crate::{MemoryKind, MiriConfig, ThreadId};

src/alloc_bytes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::alloc::Layout;
22
use std::borrow::Cow;
33
use std::{alloc, slice};
44

5+
use rustc_abi::{Align, Size};
56
use rustc_middle::mir::interpret::AllocBytes;
6-
use rustc_target::abi::{Align, Size};
77

88
/// Allocation bytes that explicitly handle the layout of the data they're storing.
99
/// This is necessary to interface with native code that accesses the program store in Miri.

src/bin/miri.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
extern crate tracing;
1212

1313
// The rustc crates we need
14+
extern crate rustc_abi;
1415
extern crate rustc_data_structures;
1516
extern crate rustc_driver;
1617
extern crate rustc_hir;
@@ -21,14 +22,14 @@ extern crate rustc_metadata;
2122
extern crate rustc_middle;
2223
extern crate rustc_session;
2324
extern crate rustc_span;
24-
extern crate rustc_target;
2525

2626
use std::env::{self, VarError};
2727
use std::num::NonZero;
2828
use std::path::PathBuf;
2929
use std::str::FromStr;
3030

3131
use miri::{BacktraceStyle, BorrowTrackerMethod, ProvenanceMode, RetagFields, ValidationMode};
32+
use rustc_abi::ExternAbi;
3233
use rustc_data_structures::sync::Lrc;
3334
use rustc_driver::Compilation;
3435
use rustc_hir::def_id::LOCAL_CRATE;
@@ -47,7 +48,6 @@ use rustc_session::config::{CrateType, EntryFnType, ErrorOutputType, OptLevel};
4748
use rustc_session::search_paths::PathKind;
4849
use rustc_session::{CtfeBacktrace, EarlyDiagCtxt};
4950
use rustc_span::def_id::DefId;
50-
use rustc_target::spec::abi::Abi;
5151
use tracing::debug;
5252

5353
struct MiriCompilerCalls {
@@ -368,7 +368,7 @@ fn entry_fn(tcx: TyCtxt<'_>) -> (DefId, EntryFnType) {
368368
tcx.types.isize,
369369
false,
370370
hir::Safety::Safe,
371-
Abi::Rust,
371+
ExternAbi::Rust,
372372
));
373373

374374
let correct_func_sig = check_function_signature(

src/borrow_tracker/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use std::cell::RefCell;
22
use std::fmt;
33
use std::num::NonZero;
44

5+
use rustc_abi::Size;
56
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
67
use rustc_middle::mir::RetagKind;
7-
use rustc_target::abi::Size;
88
use smallvec::SmallVec;
99

1010
use crate::*;

src/borrow_tracker/stacked_borrows/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::fmt;
22

3+
use rustc_abi::Size;
34
use rustc_data_structures::fx::FxHashSet;
45
use rustc_span::{Span, SpanData};
5-
use rustc_target::abi::Size;
66
use smallvec::SmallVec;
77

88
use crate::borrow_tracker::{GlobalStateInner, ProtectorKind};

src/borrow_tracker/stacked_borrows/stack.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl<'tcx> Stack {
354354
self.borrows.get(idx).cloned()
355355
}
356356

357-
#[allow(clippy::len_without_is_empty)] // Stacks are never empty
357+
#[expect(clippy::len_without_is_empty)] // Stacks are never empty
358358
pub fn len(&self) -> usize {
359359
self.borrows.len()
360360
}

src/borrow_tracker/tree_borrows/tree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
1313
use std::{fmt, mem};
1414

15+
use rustc_abi::Size;
1516
use rustc_data_structures::fx::FxHashSet;
1617
use rustc_span::Span;
17-
use rustc_target::abi::Size;
1818
use smallvec::SmallVec;
1919

2020
use crate::borrow_tracker::tree_borrows::Permission;

src/concurrency/cpu_affinity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
use rustc_abi::Endian;
12
use rustc_middle::ty::layout::LayoutOf;
2-
use rustc_target::abi::Endian;
33

44
use crate::*;
55

src/concurrency/data_race.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ use std::cell::{Cell, Ref, RefCell, RefMut};
4444
use std::fmt::Debug;
4545
use std::mem;
4646

47+
use rustc_abi::{Align, HasDataLayout, Size};
4748
use rustc_ast::Mutability;
4849
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
4950
use rustc_index::{Idx, IndexVec};
5051
use rustc_middle::mir;
5152
use rustc_middle::ty::Ty;
5253
use rustc_span::Span;
53-
use rustc_target::abi::{Align, HasDataLayout, Size};
5454

5555
use super::vector_clock::{VClock, VTimestamp, VectorIdx};
5656
use super::weak_memory::EvalContextExt as _;

src/concurrency/range_object_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
55
use std::ops::{Index, IndexMut, Range};
66

7+
use rustc_abi::Size;
78
use rustc_const_eval::interpret::AllocRange;
8-
use rustc_target::abi::Size;
99

1010
#[derive(Clone, Debug)]
1111
struct Elem<T> {

src/concurrency/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::collections::hash_map::Entry;
33
use std::ops::Not;
44
use std::time::Duration;
55

6+
use rustc_abi::Size;
67
use rustc_data_structures::fx::FxHashMap;
78
use rustc_index::{Idx, IndexVec};
8-
use rustc_target::abi::Size;
99

1010
use super::init_once::InitOnce;
1111
use super::vector_clock::VClock;

src/concurrency/thread.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use std::task::Poll;
77
use std::time::{Duration, SystemTime};
88

99
use either::Either;
10+
use rustc_abi::ExternAbi;
1011
use rustc_const_eval::CTRL_C_RECEIVED;
1112
use rustc_data_structures::fx::FxHashMap;
1213
use rustc_hir::def_id::DefId;
1314
use rustc_index::{Idx, IndexVec};
1415
use rustc_middle::mir::Mutability;
1516
use rustc_middle::ty::layout::TyAndLayout;
1617
use rustc_span::Span;
17-
use rustc_target::spec::abi::Abi;
1818

1919
use crate::concurrency::data_race;
2020
use crate::shims::tls;
@@ -911,7 +911,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
911911
&mut self,
912912
thread: Option<MPlaceTy<'tcx>>,
913913
start_routine: Pointer,
914-
start_abi: Abi,
914+
start_abi: ExternAbi,
915915
func_arg: ImmTy<'tcx>,
916916
ret_layout: TyAndLayout<'tcx>,
917917
) -> InterpResult<'tcx, ThreadId> {

src/concurrency/weak_memory.rs

-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ impl<'tcx> StoreBuffer {
300300
interp_ok(())
301301
}
302302

303-
#[allow(clippy::if_same_then_else, clippy::needless_bool)]
304303
/// Selects a valid store element in the buffer.
305304
fn fetch_store<R: rand::Rng + ?Sized>(
306305
&self,

src/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::fmt::{self, Write};
22
use std::num::NonZero;
33

4+
use rustc_abi::{Align, Size};
45
use rustc_errors::{Diag, DiagMessage, Level};
56
use rustc_span::{DUMMY_SP, SpanData, Symbol};
6-
use rustc_target::abi::{Align, Size};
77

88
use crate::borrow_tracker::stacked_borrows::diagnostics::TagHistory;
99
use crate::borrow_tracker::tree_borrows::diagnostics as tree_diagnostics;

src/eval.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use std::path::PathBuf;
66
use std::task::Poll;
77
use std::{iter, thread};
88

9+
use rustc_abi::ExternAbi;
910
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1011
use rustc_hir::def::Namespace;
1112
use rustc_hir::def_id::DefId;
1213
use rustc_middle::ty::layout::{LayoutCx, LayoutOf};
1314
use rustc_middle::ty::{self, Ty, TyCtxt};
1415
use rustc_session::config::EntryFnType;
15-
use rustc_target::spec::abi::Abi;
1616

1717
use crate::concurrency::thread::TlsAllocAction;
1818
use crate::diagnostics::report_leaks;
@@ -391,7 +391,7 @@ pub fn create_ecx<'tcx>(
391391

392392
ecx.call_function(
393393
start_instance,
394-
Abi::Rust,
394+
ExternAbi::Rust,
395395
&[
396396
ImmTy::from_scalar(
397397
Scalar::from_pointer(main_ptr, &ecx),
@@ -409,7 +409,7 @@ pub fn create_ecx<'tcx>(
409409
EntryFnType::Start => {
410410
ecx.call_function(
411411
entry_instance,
412-
Abi::Rust,
412+
ExternAbi::Rust,
413413
&[argc, argv],
414414
Some(&ret_place),
415415
StackPopCleanup::Root { cleanup: true },
@@ -423,7 +423,7 @@ pub fn create_ecx<'tcx>(
423423
/// Evaluates the entry function specified by `entry_id`.
424424
/// Returns `Some(return_code)` if program executed completed.
425425
/// Returns `None` if an evaluation error occurred.
426-
#[allow(clippy::needless_lifetimes)]
426+
#[expect(clippy::needless_lifetimes)]
427427
pub fn eval_entry<'tcx>(
428428
tcx: TyCtxt<'tcx>,
429429
entry_id: DefId,

src/helpers.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::time::Duration;
55
use std::{cmp, iter};
66

77
use rand::RngCore;
8+
use rustc_abi::{Align, ExternAbi, FieldIdx, FieldsShape, Size, Variants};
89
use rustc_apfloat::Float;
910
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
1011
use rustc_hir::Safety;
@@ -18,8 +19,6 @@ use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, MaybeResult, TyAndLayout};
1819
use rustc_middle::ty::{self, FloatTy, IntTy, Ty, TyCtxt, UintTy};
1920
use rustc_session::config::CrateType;
2021
use rustc_span::{Span, Symbol};
21-
use rustc_target::abi::{Align, FieldIdx, FieldsShape, Size, Variants};
22-
use rustc_target::spec::abi::Abi;
2322

2423
use crate::*;
2524

@@ -157,7 +156,7 @@ pub fn iter_exported_symbols<'tcx>(
157156
for cnum in dependency_format.1.iter().enumerate().filter_map(|(num, &linkage)| {
158157
// We add 1 to the number because that's what rustc also does everywhere it
159158
// calls `CrateNum::new`...
160-
#[allow(clippy::arithmetic_side_effects)]
159+
#[expect(clippy::arithmetic_side_effects)]
161160
(linkage != Linkage::NotLinked).then_some(CrateNum::new(num + 1))
162161
}) {
163162
// We can ignore `_export_info` here: we are a Rust crate, and everything is exported
@@ -435,7 +434,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
435434
fn call_function(
436435
&mut self,
437436
f: ty::Instance<'tcx>,
438-
caller_abi: Abi,
437+
caller_abi: ExternAbi,
439438
args: &[ImmTy<'tcx>],
440439
dest: Option<&MPlaceTy<'tcx>>,
441440
stack_pop: StackPopCleanup,
@@ -917,7 +916,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
917916
}
918917

919918
/// Check that the ABI is what we expect.
920-
fn check_abi<'a>(&self, abi: Abi, exp_abi: Abi) -> InterpResult<'a, ()> {
919+
fn check_abi<'a>(&self, abi: ExternAbi, exp_abi: ExternAbi) -> InterpResult<'a, ()> {
921920
if abi != exp_abi {
922921
throw_ub_format!(
923922
"calling a function with ABI {} using caller ABI {}",
@@ -953,8 +952,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
953952

954953
fn check_abi_and_shim_symbol_clash(
955954
&mut self,
956-
abi: Abi,
957-
exp_abi: Abi,
955+
abi: ExternAbi,
956+
exp_abi: ExternAbi,
958957
link_name: Symbol,
959958
) -> InterpResult<'tcx, ()> {
960959
self.check_abi(abi, exp_abi)?;
@@ -978,8 +977,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
978977

979978
fn check_shim<'a, const N: usize>(
980979
&mut self,
981-
abi: Abi,
982-
exp_abi: Abi,
980+
abi: ExternAbi,
981+
exp_abi: ExternAbi,
983982
link_name: Symbol,
984983
args: &'a [OpTy<'tcx>],
985984
) -> InterpResult<'tcx, &'a [OpTy<'tcx>; N]>

src/intrinsics/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ mod atomic;
44
mod simd;
55

66
use rand::Rng;
7+
use rustc_abi::Size;
78
use rustc_apfloat::{Float, Round};
89
use rustc_middle::mir;
910
use rustc_middle::ty::{self, FloatTy};
1011
use rustc_span::{Symbol, sym};
11-
use rustc_target::abi::Size;
1212

1313
use self::atomic::EvalContextExt as _;
1414
use self::helpers::{ToHost, ToSoft, check_arg_count};
@@ -292,7 +292,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
292292
let b = this.read_scalar(b)?.to_f32()?;
293293
let c = this.read_scalar(c)?.to_f32()?;
294294
let fuse: bool = this.machine.rng.get_mut().gen();
295-
#[allow(clippy::arithmetic_side_effects)] // float ops don't overflow
296295
let res = if fuse {
297296
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
298297
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()
@@ -308,7 +307,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
308307
let b = this.read_scalar(b)?.to_f64()?;
309308
let c = this.read_scalar(c)?.to_f64()?;
310309
let fuse: bool = this.machine.rng.get_mut().gen();
311-
#[allow(clippy::arithmetic_side_effects)] // float ops don't overflow
312310
let res = if fuse {
313311
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
314312
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()

src/intrinsics/simd.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use either::Either;
2+
use rustc_abi::{Endian, HasDataLayout};
23
use rustc_apfloat::{Float, Round};
34
use rustc_middle::ty::FloatTy;
45
use rustc_middle::ty::layout::LayoutOf;
56
use rustc_middle::{mir, ty};
67
use rustc_span::{Symbol, sym};
7-
use rustc_target::abi::{Endian, HasDataLayout};
88

99
use crate::helpers::{ToHost, ToSoft, bool_to_simd_element, check_arg_count, simd_element_to_bool};
1010
use crate::*;
@@ -750,7 +750,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
750750

751751
let val = if simd_element_to_bool(mask)? {
752752
// Size * u64 is implemented as always checked
753-
#[allow(clippy::arithmetic_side_effects)]
754753
let ptr = ptr.wrapping_offset(dest.layout.size * i, this);
755754
let place = this.ptr_to_mplace(ptr, dest.layout);
756755
this.read_immediate(&place)?
@@ -774,7 +773,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
774773

775774
if simd_element_to_bool(mask)? {
776775
// Size * u64 is implemented as always checked
777-
#[allow(clippy::arithmetic_side_effects)]
778776
let ptr = ptr.wrapping_offset(val.layout.size * i, this);
779777
let place = this.ptr_to_mplace(ptr, val.layout);
780778
this.write_immediate(*val, &place)?
@@ -831,7 +829,7 @@ fn simd_bitmask_index(idx: u32, vec_len: u32, endianness: Endian) -> u32 {
831829
assert!(idx < vec_len);
832830
match endianness {
833831
Endian::Little => idx,
834-
#[allow(clippy::arithmetic_side_effects)] // idx < vec_len
832+
#[expect(clippy::arithmetic_side_effects)] // idx < vec_len
835833
Endian::Big => vec_len - 1 - idx, // reverse order of bits
836834
}
837835
}

0 commit comments

Comments
 (0)