Skip to content

Commit 8b6a589

Browse files
committed
Auto merge of #3913 - rust-lang:rustup-2024-09-25, r=RalfJung
Automatic Rustup
2 parents 00bafbe + 8dc52b3 commit 8b6a589

30 files changed

+109
-54
lines changed

Diff for: rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6ce376774c0bc46ac8be247bca93ff5a1287a8fc
1+
1b5aa96d6016bafe50e071b45d4d2e3c90fd766f

Diff for: src/borrow_tracker/stacked_borrows/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ use crate::borrow_tracker::{
2222
use crate::concurrency::data_race::{NaReadType, NaWriteType};
2323
use crate::*;
2424

25-
use diagnostics::{RetagCause, RetagInfo};
26-
pub use item::{Item, Permission};
27-
pub use stack::Stack;
25+
use self::diagnostics::{RetagCause, RetagInfo};
26+
pub use self::item::{Item, Permission};
27+
pub use self::stack::Stack;
2828

2929
pub type AllocState = Stacks;
3030

Diff for: src/borrow_tracker/tree_borrows/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ mod unimap;
1919
#[cfg(test)]
2020
mod exhaustive;
2121

22-
use perms::Permission;
23-
pub use tree::Tree;
22+
use self::perms::Permission;
23+
pub use self::tree::Tree;
2424

2525
pub type AllocState = Tree;
2626

Diff for: src/borrow_tracker/tree_borrows/perms.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ enum PermissionPriv {
4747
/// rejects: all child accesses (UB).
4848
Disabled,
4949
}
50-
use PermissionPriv::*;
50+
use self::PermissionPriv::*;
5151

5252
impl PartialOrd for PermissionPriv {
5353
/// PermissionPriv is ordered by the reflexive transitive closure of

Diff for: src/concurrency/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ pub mod thread;
77
mod vector_clock;
88
pub mod weak_memory;
99

10-
pub use vector_clock::VClock;
10+
pub use self::vector_clock::VClock;

Diff for: src/intrinsics/atomic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_middle::{mir, mir::BinOp, ty};
22

3+
use self::helpers::check_arg_count;
34
use crate::*;
4-
use helpers::check_arg_count;
55

66
pub enum AtomicOp {
77
/// The `bool` indicates whether the result of the operation should be negated (`UnOp::Not`,

Diff for: src/intrinsics/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use rustc_middle::{
1212
use rustc_span::{Symbol, sym};
1313
use rustc_target::abi::Size;
1414

15+
use self::atomic::EvalContextExt as _;
16+
use self::helpers::{ToHost, ToSoft, check_arg_count};
17+
use self::simd::EvalContextExt as _;
1518
use crate::*;
16-
use atomic::EvalContextExt as _;
17-
use helpers::{ToHost, ToSoft, check_arg_count};
18-
use simd::EvalContextExt as _;
1919

2020
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
2121
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

Diff for: src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
clippy::cast_lossless,
5252
clippy::cast_possible_truncation,
5353
)]
54+
#![cfg_attr(not(bootstrap), feature(unqualified_local_imports))]
55+
#![cfg_attr(not(bootstrap), warn(unqualified_local_imports))]
5456
// Needed for rustdoc from bootstrap (with `-Znormalize-docs`).
5557
#![recursion_limit = "256"]
5658

Diff for: src/shims/env.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::ffi::{OsStr, OsString};
22

33
use rustc_data_structures::fx::FxHashMap;
44

5+
use self::shims::{unix::UnixEnvVars, windows::WindowsEnvVars};
56
use crate::*;
6-
use shims::{unix::UnixEnvVars, windows::WindowsEnvVars};
77

88
#[derive(Default)]
99
pub enum EnvVars<'tcx> {

Diff for: src/shims/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use rustc_target::{
1212
spec::abi::Abi,
1313
};
1414

15+
use self::helpers::{ToHost, ToSoft};
1516
use super::alloc::EvalContextExt as _;
1617
use super::backtrace::EvalContextExt as _;
1718
use crate::*;
18-
use helpers::{ToHost, ToSoft};
1919

2020
/// Type of dynamic symbols (for `dlsym` et al)
2121
#[derive(Debug, Copy, Clone)]

Diff for: src/shims/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub mod panic;
1717
pub mod time;
1818
pub mod tls;
1919

20-
pub use unix::{DirTable, EpollInterestTable, FdTable};
20+
pub use self::unix::{DirTable, EpollInterestTable, FdTable};
2121

2222
/// What needs to be done after emulating an item (a shim or an intrinsic) is done.
2323
pub enum EmulateItemResult {

Diff for: src/shims/panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use rustc_middle::{mir, ty};
1616
use rustc_target::spec::PanicStrategy;
1717
use rustc_target::spec::abi::Abi;
1818

19+
use self::helpers::check_arg_count;
1920
use crate::*;
20-
use helpers::check_arg_count;
2121

2222
/// Holds all of the relevant data for when unwinding hits a `try` frame.
2323
#[derive(Debug)]

Diff for: src/shims/unix/foreign_items.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use crate::shims::alloc::EvalContextExt as _;
1111
use crate::shims::unix::*;
1212
use crate::*;
1313

14-
use shims::unix::android::foreign_items as android;
15-
use shims::unix::freebsd::foreign_items as freebsd;
16-
use shims::unix::linux::foreign_items as linux;
17-
use shims::unix::macos::foreign_items as macos;
18-
use shims::unix::solarish::foreign_items as solarish;
14+
use self::shims::unix::android::foreign_items as android;
15+
use self::shims::unix::freebsd::foreign_items as freebsd;
16+
use self::shims::unix::linux::foreign_items as linux;
17+
use self::shims::unix::macos::foreign_items as macos;
18+
use self::shims::unix::solarish::foreign_items as solarish;
1919

2020
pub fn is_dyn_sym(name: &str, target_os: &str) -> bool {
2121
match name {

Diff for: src/shims/unix/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use std::time::SystemTime;
1111
use rustc_data_structures::fx::FxHashMap;
1212
use rustc_target::abi::Size;
1313

14+
use self::shims::time::system_time_to_duration;
1415
use crate::shims::os_str::bytes_to_os_str;
1516
use crate::shims::unix::fd::FileDescriptionRef;
1617
use crate::shims::unix::*;
1718
use crate::*;
18-
use shims::time::system_time_to_duration;
1919

2020
use self::fd::FlockOp;
2121

Diff for: src/shims/unix/linux/foreign_items.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use rustc_span::Symbol;
22
use rustc_target::spec::abi::Abi;
33

4+
use self::shims::unix::linux::epoll::EvalContextExt as _;
5+
use self::shims::unix::linux::eventfd::EvalContextExt as _;
6+
use self::shims::unix::linux::mem::EvalContextExt as _;
7+
use self::shims::unix::linux::sync::futex;
48
use crate::machine::SIGRTMAX;
59
use crate::machine::SIGRTMIN;
610
use crate::shims::unix::*;
711
use crate::*;
8-
use shims::unix::linux::epoll::EvalContextExt as _;
9-
use shims::unix::linux::eventfd::EvalContextExt as _;
10-
use shims::unix::linux::mem::EvalContextExt as _;
11-
use shims::unix::linux::sync::futex;
1212

1313
pub fn is_dyn_sym(name: &str) -> bool {
1414
matches!(name, "statx")

Diff for: src/shims/unix/macos/foreign_items.rs

+11
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7878
this.write_pointer(environ, dest)?;
7979
}
8080

81+
// Random data generation
82+
"CCRandomGenerateBytes" => {
83+
let [bytes, count] =
84+
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
85+
let bytes = this.read_pointer(bytes)?;
86+
let count = this.read_target_usize(count)?;
87+
let success = this.eval_libc_i32("kCCSuccess");
88+
this.gen_random(bytes, count)?;
89+
this.write_int(success, dest)?;
90+
}
91+
8192
// Time related shims
8293
"mach_absolute_time" => {
8394
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;

Diff for: src/shims/unix/mod.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ mod linux;
1414
mod macos;
1515
mod solarish;
1616

17-
pub use env::UnixEnvVars;
18-
pub use fd::{FdTable, FileDescription};
19-
pub use fs::DirTable;
20-
pub use linux::epoll::EpollInterestTable;
17+
pub use self::env::UnixEnvVars;
18+
pub use self::fd::{FdTable, FileDescription};
19+
pub use self::fs::DirTable;
20+
pub use self::linux::epoll::EpollInterestTable;
2121
// All the Unix-specific extension traits
22-
pub use env::EvalContextExt as _;
23-
pub use fd::EvalContextExt as _;
24-
pub use fs::EvalContextExt as _;
25-
pub use mem::EvalContextExt as _;
26-
pub use sync::EvalContextExt as _;
27-
pub use thread::EvalContextExt as _;
28-
pub use unnamed_socket::EvalContextExt as _;
22+
pub use self::env::EvalContextExt as _;
23+
pub use self::fd::EvalContextExt as _;
24+
pub use self::fs::EvalContextExt as _;
25+
pub use self::mem::EvalContextExt as _;
26+
pub use self::sync::EvalContextExt as _;
27+
pub use self::thread::EvalContextExt as _;
28+
pub use self::unnamed_socket::EvalContextExt as _;
2929

3030
// Make up some constants.
3131
const UID: u32 = 1000;

Diff for: src/shims/windows/env.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use std::io::ErrorKind;
44

55
use rustc_data_structures::fx::FxHashMap;
66

7+
use self::helpers::windows_check_buffer_size;
78
use crate::*;
8-
use helpers::windows_check_buffer_size;
99

1010
#[derive(Default)]
1111
pub struct WindowsEnvVars {

Diff for: src/shims/windows/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ use rustc_span::Symbol;
88
use rustc_target::abi::{Align, Size};
99
use rustc_target::spec::abi::Abi;
1010

11+
use self::shims::windows::handle::{Handle, PseudoHandle};
1112
use crate::shims::os_str::bytes_to_os_str;
1213
use crate::shims::windows::*;
1314
use crate::*;
14-
use shims::windows::handle::{Handle, PseudoHandle};
1515

1616
pub fn is_dyn_sym(name: &str) -> bool {
1717
// std does dynamic detection for these symbols

Diff for: src/shims/windows/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ mod handle;
55
mod sync;
66
mod thread;
77

8-
pub use env::WindowsEnvVars;
8+
pub use self::env::WindowsEnvVars;
99
// All the Windows-specific extension traits
10-
pub use env::EvalContextExt as _;
11-
pub use handle::EvalContextExt as _;
12-
pub use sync::EvalContextExt as _;
13-
pub use thread::EvalContextExt as _;
10+
pub use self::env::EvalContextExt as _;
11+
pub use self::handle::EvalContextExt as _;
12+
pub use self::sync::EvalContextExt as _;
13+
pub use self::thread::EvalContextExt as _;

Diff for: src/shims/windows/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use rustc_middle::ty::layout::LayoutOf;
22
use rustc_target::spec::abi::Abi;
33

4+
use self::shims::windows::handle::{EvalContextExt as _, Handle, PseudoHandle};
45
use crate::*;
5-
use shims::windows::handle::{EvalContextExt as _, Handle, PseudoHandle};
66

77
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
88

Diff for: src/shims/x86/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use rustc_span::Symbol;
88
use rustc_target::abi::Size;
99
use rustc_target::spec::abi::Abi;
1010

11+
use self::helpers::bool_to_simd_element;
1112
use crate::*;
12-
use helpers::bool_to_simd_element;
1313

1414
mod aesni;
1515
mod avx;

Diff for: tests/fail/dyn-call-trait-mismatch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ impl T1 for i32 {
1616
fn main() {
1717
let r = Box::new(0) as Box<dyn T1>;
1818
let r2: Box<dyn T2> = unsafe { std::mem::transmute(r) };
19-
r2.method2(); //~ERROR: using vtable for trait `T1` but trait `T2` was expected
19+
r2.method2(); //~ERROR: using vtable for `T1` but `T2` was expected
2020
}

Diff for: tests/fail/dyn-call-trait-mismatch.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: using vtable for trait `T1` but trait `T2` was expected
1+
error: Undefined Behavior: using vtable for `T1` but `T2` was expected
22
--> tests/fail/dyn-call-trait-mismatch.rs:LL:CC
33
|
44
LL | r2.method2();
5-
| ^^^^^^^^^^^^ using vtable for trait `T1` but trait `T2` was expected
5+
| ^^^^^^^^^^^^ using vtable for `T1` but `T2` was expected
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

Diff for: tests/fail/dyn-upcast-trait-mismatch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ fn main() {
6363
let baz: &dyn Baz = &1;
6464
let baz_fake: *const dyn Bar = std::mem::transmute(baz);
6565
let _err = baz_fake as *const dyn Foo;
66-
//~^ERROR: using vtable for trait `Baz` but trait `Bar` was expected
66+
//~^ERROR: using vtable for `Baz` but `Bar` was expected
6767
}
6868
}

Diff for: tests/fail/dyn-upcast-trait-mismatch.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: using vtable for trait `Baz` but trait `Bar` was expected
1+
error: Undefined Behavior: using vtable for `Baz` but `Bar` was expected
22
--> tests/fail/dyn-upcast-trait-mismatch.rs:LL:CC
33
|
44
LL | let _err = baz_fake as *const dyn Foo;
5-
| ^^^^^^^^ using vtable for trait `Baz` but trait `Bar` was expected
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ using vtable for `Baz` but `Bar` was expected
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

Diff for: tests/fail/validity/wrong-dyn-trait-assoc-type.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
trait Trait {
2+
type Assoc;
3+
fn foo(&self) -> Self::Assoc;
4+
}
5+
6+
impl<T: Copy> Trait for T {
7+
type Assoc = T;
8+
fn foo(&self) -> T {
9+
*self
10+
}
11+
}
12+
13+
fn main() {
14+
let v: Box<dyn Trait<Assoc = u8>> = Box::new(2);
15+
let v: Box<dyn Trait<Assoc = bool>> = unsafe { std::mem::transmute(v) }; //~ERROR: wrong trait
16+
17+
if v.foo() {
18+
println!("huh");
19+
}
20+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `Trait<Assoc = bool>`, but encountered `Trait<Assoc = u8>`
2+
--> tests/fail/validity/wrong-dyn-trait-assoc-type.rs:LL:CC
3+
|
4+
LL | let v: Box<dyn Trait<Assoc = bool>> = unsafe { std::mem::transmute(v) };
5+
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: wrong trait in wide pointer vtable: expected `Trait<Assoc = bool>`, but encountered `Trait<Assoc = u8>`
6+
|
7+
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8+
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9+
= note: BACKTRACE:
10+
= note: inside `main` at tests/fail/validity/wrong-dyn-trait-assoc-type.rs:LL:CC
11+
12+
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
13+
14+
error: aborting due to 1 previous error
15+

Diff for: tests/fail/validity/wrong-dyn-trait.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `<trivial>`
1+
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `std::marker::Send`
22
--> tests/fail/validity/wrong-dyn-trait.rs:LL:CC
33
|
44
LL | let _y: *const dyn fmt::Debug = unsafe { mem::transmute(x) };
5-
| ^^^^^^^^^^^^^^^^^ constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `<trivial>`
5+
| ^^^^^^^^^^^^^^^^^ constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `std::marker::Send`
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

Diff for: tests/pass-dep/libc/ccrandomgeneratebytes_apple.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@only-target: apple # This directly tests apple-only functions
2+
3+
fn main() {
4+
let mut bytes = [0u8; 24];
5+
let ret = unsafe { libc::CCRandomGenerateBytes(bytes.as_mut_ptr().cast(), bytes.len()) };
6+
assert_eq!(ret, libc::kCCSuccess);
7+
}

0 commit comments

Comments
 (0)