Skip to content

Automatic Rustup #3913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
4e4cf61
Auto merge of #130446 - durin42:llvm-20-fix-CommandLineArgs, r=workin…
bors Sep 22, 2024
9cf9e72
Auto merge of #130689 - RalfJung:rustc_nonnull_optimization_guarantee…
bors Sep 22, 2024
2ebdcbf
Auto merge of #130697 - bjoernager:const-char-make-ascii, r=dtolnay
bors Sep 22, 2024
91fb062
Auto merge of #130709 - RalfJung:miri-sync, r=RalfJung
bors Sep 22, 2024
a3e96c2
Rollup merge of #130658 - EqualMa:patch-1, r=scottmcm
GuillaumeGomez Sep 22, 2024
25605e7
Rollup merge of #130670 - the8472:read-to-end-heuristics, r=ChrisDenton
GuillaumeGomez Sep 22, 2024
7b9e591
Auto merge of #130710 - GuillaumeGomez:rollup-mfuha68, r=GuillaumeGomez
bors Sep 22, 2024
10459f2
Auto merge of #130680 - saethlin:module-name-to-str, r=jieyouxu
bors Sep 22, 2024
e24f387
Auto merge of #129047 - DianQK:early_otherwise_branch_scalar, r=cjgillot
bors Sep 23, 2024
8712807
miri: shim `CCRandomGenerateBytes`
joboet Aug 18, 2024
7136cc4
update miri test
joboet Sep 22, 2024
743b3b8
fix unqualified_local_imports in Miri
RalfJung Sep 22, 2024
3acf865
Auto merge of #130641 - cuviper:llvm-19.1.0, r=nikic
bors Sep 23, 2024
28001b4
Rollup merge of #129201 - joboet:random_faster_sources, r=joshtriplett
workingjubilee Sep 23, 2024
aaed68f
Rollup merge of #130536 - cuviper:rustbook-dylib-path, r=Mark-Simulacrum
workingjubilee Sep 23, 2024
f33f76b
Rollup merge of #130551 - nnethercote:fix-break-last-token, r=petroch…
workingjubilee Sep 23, 2024
a96a945
Rollup merge of #130657 - arttet:fix/fuchsia, r=jieyouxu
workingjubilee Sep 23, 2024
fe88f67
Rollup merge of #130721 - GrigorenkoPV:block-no-opening-brace, r=jiey…
workingjubilee Sep 23, 2024
4cda6f8
Rollup merge of #130736 - Kobzol:rustfmt-2024-git-blame, r=compiler-e…
workingjubilee Sep 23, 2024
7d70bde
Rollup merge of #130746 - joboet:hello_again, r=joboet
workingjubilee Sep 23, 2024
41021b6
Auto merge of #130755 - workingjubilee:rollup-zpja9b3, r=workingjubilee
bors Sep 23, 2024
8fbc3f6
Auto merge of #125645 - RalfJung:unclear_local_imports, r=nnethercote
bors Sep 23, 2024
1dcfec3
Auto merge of #130620 - onur-ozkan:update-make-prepare, r=Kobzol
bors Sep 23, 2024
4dda1eb
Check vtable projections for validity in miri
compiler-errors Sep 23, 2024
4c3026d
Auto merge of #127117 - Urgau:non_local_def-syntactic, r=BoxyUwU
bors Sep 24, 2024
3e12ee0
Rollup merge of #129545 - notriddle:notriddle/toolbar-v2, r=Guillaume…
compiler-errors Sep 24, 2024
3cfd3f3
Rollup merge of #130618 - m-ou-se:skip-query, r=compiler-errors
compiler-errors Sep 24, 2024
6588caf
Rollup merge of #130727 - compiler-errors:objects, r=RalfJung
compiler-errors Sep 24, 2024
ca87c59
Rollup merge of #130750 - heiher:loong-linux-ohos-tier3, r=jieyouxu
compiler-errors Sep 24, 2024
3e3716f
Rollup merge of #130758 - compiler-errors:ctype-recursion-limit, r=ji…
compiler-errors Sep 24, 2024
b1d4eae
Rollup merge of #130759 - rustbot:docs-update, r=ehuss
compiler-errors Sep 24, 2024
8bbb443
Rollup merge of #130762 - RalfJung:const_intrinsic_copy, r=dtolnay
compiler-errors Sep 24, 2024
80bd3c7
Auto merge of #130768 - compiler-errors:rollup-8ncjy55, r=compiler-er…
bors Sep 24, 2024
0426921
Auto merge of #130738 - bjoernager:const-make-ascii, r=jhpratt
bors Sep 24, 2024
75904ca
Auto merge of #130389 - Luv-Ray:LLVMMDNodeInContext2, r=nikic
bors Sep 24, 2024
789bfcc
Auto merge of #130775 - jieyouxu:revert-129047, r=nagisa
bors Sep 24, 2024
5a703eb
Auto merge of #129587 - Voultapher:opt-for-size-variants-of-sort-impl…
bors Sep 24, 2024
037d475
be even more precise about "cast" vs "coercion"
Sep 15, 2024
7bce2c1
Auto merge of #130739 - jieyouxu:stage0_run_make, r=Kobzol
bors Sep 24, 2024
2f6a0ab
Rollup merge of #130234 - lukas-code:ptr-cast-errors, r=WaffleLapkin
tgross35 Sep 24, 2024
7326e0c
Rollup merge of #130752 - tdittr:cmse-assembly-tests, r=jieyouxu
tgross35 Sep 24, 2024
b95d759
Rollup merge of #130764 - compiler-errors:inherent, r=estebank
tgross35 Sep 24, 2024
34bb5e5
Rollup merge of #130788 - tgross35:memchr-pinning, r=Noratrieb,Mark-S…
tgross35 Sep 24, 2024
872f55a
Rollup merge of #130789 - aviramha:add_inprogress, r=Noratrieb
tgross35 Sep 24, 2024
b627dc5
Rollup merge of #130793 - jieyouxu:mention-crashes-verbose, r=matthia…
tgross35 Sep 24, 2024
76b5237
Rollup merge of #130798 - lukas-code:doc-stab, r=notriddle
tgross35 Sep 24, 2024
8469226
Auto merge of #130807 - tgross35:rollup-p304vzf, r=tgross35
bors Sep 25, 2024
a052b39
Preparing for merge from rustc
Sep 25, 2024
ef516ab
Merge from rustc
Sep 25, 2024
8dc52b3
fmt
Sep 25, 2024
6dfcb2a
add test for std::random
RalfJung Sep 25, 2024
bb59227
avoid using HashMap in fs test
RalfJung Sep 25, 2024
e649d14
update BASIC test list: no longer test HashMap, add libc-mem instead …
RalfJung Sep 25, 2024
0f3ede7
disable AVR test since it doesn't work
RalfJung Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ degree documented below):
- `solaris` / `illumos`: maintained by @devnexen. Supports `std::{env, thread, sync}`, but not `std::fs`.
- `freebsd`: **maintainer wanted**. Supports `std::env` and parts of `std::{thread, fs}`, but not `std::sync`.
- `android`: **maintainer wanted**. Support very incomplete, but a basic "hello world" works.
- `wasm`: **maintainer wanted**. Support very incomplete, not even standard output works, but an empty `main` function works.
- `wasi`: **maintainer wanted**. Support very incomplete, not even standard output works, but an empty `main` function works.
- For targets on other operating systems, Miri might fail before even reaching the `main` function.

However, even for targets that we do support, the degree of support for accessing platform APIs
Expand Down
13 changes: 7 additions & 6 deletions ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,19 @@ case $HOST_TARGET in
TEST_TARGET=arm-unknown-linux-gnueabi run_tests
TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
# Partially supported targets (tier 2)
BASIC="empty_main integer vec string btreemap hello hashmap heap_alloc align" # ensures we have the basics: stdout/stderr, system allocator, randomness (for HashMap initialization)
UNIX="panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
UNIX="hello panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname pthread time fs
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname pthread time fs
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX thread sync available-parallelism time tls
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX thread sync available-parallelism time tls
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX pthread --skip threadname --skip pthread_cond_timedwait
TEST_TARGET=wasm32-wasip2 run_tests_minimal empty_main wasm heap_alloc libc-mem
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal empty_main wasm
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX hashmap pthread --skip threadname --skip pthread_cond_timedwait
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
# Custom target JSON file
TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std
# FIXME: disabled due to <https://github.com/rust-lang/rust/issues/130818>.
#TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std
;;
i686-pc-windows-msvc)
# Host
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6ce376774c0bc46ac8be247bca93ff5a1287a8fc
1b5aa96d6016bafe50e071b45d4d2e3c90fd766f
6 changes: 3 additions & 3 deletions src/borrow_tracker/stacked_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ use crate::borrow_tracker::{
use crate::concurrency::data_race::{NaReadType, NaWriteType};
use crate::*;

use diagnostics::{RetagCause, RetagInfo};
pub use item::{Item, Permission};
pub use stack::Stack;
use self::diagnostics::{RetagCause, RetagInfo};
pub use self::item::{Item, Permission};
pub use self::stack::Stack;

pub type AllocState = Stacks;

Expand Down
4 changes: 2 additions & 2 deletions src/borrow_tracker/tree_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ mod unimap;
#[cfg(test)]
mod exhaustive;

use perms::Permission;
pub use tree::Tree;
use self::perms::Permission;
pub use self::tree::Tree;

pub type AllocState = Tree;

Expand Down
2 changes: 1 addition & 1 deletion src/borrow_tracker/tree_borrows/perms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ enum PermissionPriv {
/// rejects: all child accesses (UB).
Disabled,
}
use PermissionPriv::*;
use self::PermissionPriv::*;

impl PartialOrd for PermissionPriv {
/// PermissionPriv is ordered by the reflexive transitive closure of
Expand Down
2 changes: 1 addition & 1 deletion src/concurrency/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ pub mod thread;
mod vector_clock;
pub mod weak_memory;

pub use vector_clock::VClock;
pub use self::vector_clock::VClock;
2 changes: 1 addition & 1 deletion src/intrinsics/atomic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc_middle::{mir, mir::BinOp, ty};

use self::helpers::check_arg_count;
use crate::*;
use helpers::check_arg_count;

pub enum AtomicOp {
/// The `bool` indicates whether the result of the operation should be negated (`UnOp::Not`,
Expand Down
6 changes: 3 additions & 3 deletions src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use rustc_middle::{
use rustc_span::{Symbol, sym};
use rustc_target::abi::Size;

use self::atomic::EvalContextExt as _;
use self::helpers::{ToHost, ToSoft, check_arg_count};
use self::simd::EvalContextExt as _;
use crate::*;
use atomic::EvalContextExt as _;
use helpers::{ToHost, ToSoft, check_arg_count};
use simd::EvalContextExt as _;

impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
clippy::cast_lossless,
clippy::cast_possible_truncation,
)]
#![cfg_attr(not(bootstrap), feature(unqualified_local_imports))]
#![cfg_attr(not(bootstrap), warn(unqualified_local_imports))]
// Needed for rustdoc from bootstrap (with `-Znormalize-docs`).
#![recursion_limit = "256"]

Expand Down
2 changes: 1 addition & 1 deletion src/shims/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::ffi::{OsStr, OsString};

use rustc_data_structures::fx::FxHashMap;

use self::shims::{unix::UnixEnvVars, windows::WindowsEnvVars};
use crate::*;
use shims::{unix::UnixEnvVars, windows::WindowsEnvVars};

#[derive(Default)]
pub enum EnvVars<'tcx> {
Expand Down
2 changes: 1 addition & 1 deletion src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use rustc_target::{
spec::abi::Abi,
};

use self::helpers::{ToHost, ToSoft};
use super::alloc::EvalContextExt as _;
use super::backtrace::EvalContextExt as _;
use crate::*;
use helpers::{ToHost, ToSoft};

/// Type of dynamic symbols (for `dlsym` et al)
#[derive(Debug, Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/shims/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub mod panic;
pub mod time;
pub mod tls;

pub use unix::{DirTable, EpollInterestTable, FdTable};
pub use self::unix::{DirTable, EpollInterestTable, FdTable};

/// What needs to be done after emulating an item (a shim or an intrinsic) is done.
pub enum EmulateItemResult {
Expand Down
2 changes: 1 addition & 1 deletion src/shims/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use rustc_middle::{mir, ty};
use rustc_target::spec::PanicStrategy;
use rustc_target::spec::abi::Abi;

use self::helpers::check_arg_count;
use crate::*;
use helpers::check_arg_count;

/// Holds all of the relevant data for when unwinding hits a `try` frame.
#[derive(Debug)]
Expand Down
10 changes: 5 additions & 5 deletions src/shims/unix/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use crate::shims::alloc::EvalContextExt as _;
use crate::shims::unix::*;
use crate::*;

use shims::unix::android::foreign_items as android;
use shims::unix::freebsd::foreign_items as freebsd;
use shims::unix::linux::foreign_items as linux;
use shims::unix::macos::foreign_items as macos;
use shims::unix::solarish::foreign_items as solarish;
use self::shims::unix::android::foreign_items as android;
use self::shims::unix::freebsd::foreign_items as freebsd;
use self::shims::unix::linux::foreign_items as linux;
use self::shims::unix::macos::foreign_items as macos;
use self::shims::unix::solarish::foreign_items as solarish;

pub fn is_dyn_sym(name: &str, target_os: &str) -> bool {
match name {
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use std::time::SystemTime;
use rustc_data_structures::fx::FxHashMap;
use rustc_target::abi::Size;

use self::shims::time::system_time_to_duration;
use crate::shims::os_str::bytes_to_os_str;
use crate::shims::unix::fd::FileDescriptionRef;
use crate::shims::unix::*;
use crate::*;
use shims::time::system_time_to_duration;

use self::fd::FlockOp;

Expand Down
8 changes: 4 additions & 4 deletions src/shims/unix/linux/foreign_items.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use rustc_span::Symbol;
use rustc_target::spec::abi::Abi;

use self::shims::unix::linux::epoll::EvalContextExt as _;
use self::shims::unix::linux::eventfd::EvalContextExt as _;
use self::shims::unix::linux::mem::EvalContextExt as _;
use self::shims::unix::linux::sync::futex;
use crate::machine::SIGRTMAX;
use crate::machine::SIGRTMIN;
use crate::shims::unix::*;
use crate::*;
use shims::unix::linux::epoll::EvalContextExt as _;
use shims::unix::linux::eventfd::EvalContextExt as _;
use shims::unix::linux::mem::EvalContextExt as _;
use shims::unix::linux::sync::futex;

pub fn is_dyn_sym(name: &str) -> bool {
matches!(name, "statx")
Expand Down
11 changes: 11 additions & 0 deletions src/shims/unix/macos/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
this.write_pointer(environ, dest)?;
}

// Random data generation
"CCRandomGenerateBytes" => {
let [bytes, count] =
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
let bytes = this.read_pointer(bytes)?;
let count = this.read_target_usize(count)?;
let success = this.eval_libc_i32("kCCSuccess");
this.gen_random(bytes, count)?;
this.write_int(success, dest)?;
}

// Time related shims
"mach_absolute_time" => {
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
Expand Down
22 changes: 11 additions & 11 deletions src/shims/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ mod linux;
mod macos;
mod solarish;

pub use env::UnixEnvVars;
pub use fd::{FdTable, FileDescription};
pub use fs::DirTable;
pub use linux::epoll::EpollInterestTable;
pub use self::env::UnixEnvVars;
pub use self::fd::{FdTable, FileDescription};
pub use self::fs::DirTable;
pub use self::linux::epoll::EpollInterestTable;
// All the Unix-specific extension traits
pub use env::EvalContextExt as _;
pub use fd::EvalContextExt as _;
pub use fs::EvalContextExt as _;
pub use mem::EvalContextExt as _;
pub use sync::EvalContextExt as _;
pub use thread::EvalContextExt as _;
pub use unnamed_socket::EvalContextExt as _;
pub use self::env::EvalContextExt as _;
pub use self::fd::EvalContextExt as _;
pub use self::fs::EvalContextExt as _;
pub use self::mem::EvalContextExt as _;
pub use self::sync::EvalContextExt as _;
pub use self::thread::EvalContextExt as _;
pub use self::unnamed_socket::EvalContextExt as _;

// Make up some constants.
const UID: u32 = 1000;
2 changes: 1 addition & 1 deletion src/shims/windows/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::io::ErrorKind;

use rustc_data_structures::fx::FxHashMap;

use self::helpers::windows_check_buffer_size;
use crate::*;
use helpers::windows_check_buffer_size;

#[derive(Default)]
pub struct WindowsEnvVars {
Expand Down
2 changes: 1 addition & 1 deletion src/shims/windows/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ use rustc_span::Symbol;
use rustc_target::abi::{Align, Size};
use rustc_target::spec::abi::Abi;

use self::shims::windows::handle::{Handle, PseudoHandle};
use crate::shims::os_str::bytes_to_os_str;
use crate::shims::windows::*;
use crate::*;
use shims::windows::handle::{Handle, PseudoHandle};

pub fn is_dyn_sym(name: &str) -> bool {
// std does dynamic detection for these symbols
Expand Down
10 changes: 5 additions & 5 deletions src/shims/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ mod handle;
mod sync;
mod thread;

pub use env::WindowsEnvVars;
pub use self::env::WindowsEnvVars;
// All the Windows-specific extension traits
pub use env::EvalContextExt as _;
pub use handle::EvalContextExt as _;
pub use sync::EvalContextExt as _;
pub use thread::EvalContextExt as _;
pub use self::env::EvalContextExt as _;
pub use self::handle::EvalContextExt as _;
pub use self::sync::EvalContextExt as _;
pub use self::thread::EvalContextExt as _;
2 changes: 1 addition & 1 deletion src/shims/windows/thread.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use rustc_middle::ty::layout::LayoutOf;
use rustc_target::spec::abi::Abi;

use self::shims::windows::handle::{EvalContextExt as _, Handle, PseudoHandle};
use crate::*;
use shims::windows::handle::{EvalContextExt as _, Handle, PseudoHandle};

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

Expand Down
2 changes: 1 addition & 1 deletion src/shims/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use rustc_span::Symbol;
use rustc_target::abi::Size;
use rustc_target::spec::abi::Abi;

use self::helpers::bool_to_simd_element;
use crate::*;
use helpers::bool_to_simd_element;

mod aesni;
mod avx;
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dyn-call-trait-mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ impl T1 for i32 {
fn main() {
let r = Box::new(0) as Box<dyn T1>;
let r2: Box<dyn T2> = unsafe { std::mem::transmute(r) };
r2.method2(); //~ERROR: using vtable for trait `T1` but trait `T2` was expected
r2.method2(); //~ERROR: using vtable for `T1` but `T2` was expected
}
4 changes: 2 additions & 2 deletions tests/fail/dyn-call-trait-mismatch.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: using vtable for trait `T1` but trait `T2` was expected
error: Undefined Behavior: using vtable for `T1` but `T2` was expected
--> tests/fail/dyn-call-trait-mismatch.rs:LL:CC
|
LL | r2.method2();
| ^^^^^^^^^^^^ using vtable for trait `T1` but trait `T2` was expected
| ^^^^^^^^^^^^ using vtable for `T1` but `T2` was expected
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dyn-upcast-trait-mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ fn main() {
let baz: &dyn Baz = &1;
let baz_fake: *const dyn Bar = std::mem::transmute(baz);
let _err = baz_fake as *const dyn Foo;
//~^ERROR: using vtable for trait `Baz` but trait `Bar` was expected
//~^ERROR: using vtable for `Baz` but `Bar` was expected
}
}
4 changes: 2 additions & 2 deletions tests/fail/dyn-upcast-trait-mismatch.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: using vtable for trait `Baz` but trait `Bar` was expected
error: Undefined Behavior: using vtable for `Baz` but `Bar` was expected
--> tests/fail/dyn-upcast-trait-mismatch.rs:LL:CC
|
LL | let _err = baz_fake as *const dyn Foo;
| ^^^^^^^^ using vtable for trait `Baz` but trait `Bar` was expected
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ using vtable for `Baz` but `Bar` was expected
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
20 changes: 20 additions & 0 deletions tests/fail/validity/wrong-dyn-trait-assoc-type.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
trait Trait {
type Assoc;
fn foo(&self) -> Self::Assoc;
}

impl<T: Copy> Trait for T {
type Assoc = T;
fn foo(&self) -> T {
*self
}
}

fn main() {
let v: Box<dyn Trait<Assoc = u8>> = Box::new(2);
let v: Box<dyn Trait<Assoc = bool>> = unsafe { std::mem::transmute(v) }; //~ERROR: wrong trait

if v.foo() {
println!("huh");
}
}
15 changes: 15 additions & 0 deletions tests/fail/validity/wrong-dyn-trait-assoc-type.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `Trait<Assoc = bool>`, but encountered `Trait<Assoc = u8>`
--> tests/fail/validity/wrong-dyn-trait-assoc-type.rs:LL:CC
|
LL | let v: Box<dyn Trait<Assoc = bool>> = unsafe { std::mem::transmute(v) };
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: wrong trait in wide pointer vtable: expected `Trait<Assoc = bool>`, but encountered `Trait<Assoc = u8>`
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `main` at tests/fail/validity/wrong-dyn-trait-assoc-type.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error

4 changes: 2 additions & 2 deletions tests/fail/validity/wrong-dyn-trait.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `<trivial>`
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `std::marker::Send`
--> tests/fail/validity/wrong-dyn-trait.rs:LL:CC
|
LL | let _y: *const dyn fmt::Debug = unsafe { mem::transmute(x) };
| ^^^^^^^^^^^^^^^^^ constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `<trivial>`
| ^^^^^^^^^^^^^^^^^ constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `std::marker::Send`
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
7 changes: 7 additions & 0 deletions tests/pass-dep/libc/ccrandomgeneratebytes_apple.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@only-target: apple # This directly tests apple-only functions

fn main() {
let mut bytes = [0u8; 24];
let ret = unsafe { libc::CCRandomGenerateBytes(bytes.as_mut_ptr().cast(), bytes.len()) };
assert_eq!(ret, libc::kCCSuccess);
}
Loading