Skip to content

Commit 920b4f0

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents 31cdb77 + 703738a commit 920b4f0

11 files changed

+58
-19
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ directories = "5"
3030
# Copied from `compiler/rustc/Cargo.toml`.
3131
# But only for some targets, it fails for others. Rustc configures this in its CI, but we can't
3232
# easily use that since we support of-tree builds.
33-
[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies.jemalloc-sys]
34-
version = "0.5.0"
33+
[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies.tikv-jemalloc-sys]
34+
version = "0.6.0"
3535
features = ['unprefixed_malloc_on_supported_platforms']
3636

3737
[target.'cfg(unix)'.dependencies]

src/bin/miri.rs

+2
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ fn jemalloc_magic() {
317317
// See there for further comments.
318318
use std::os::raw::{c_int, c_void};
319319

320+
use tikv_jemalloc_sys as jemalloc_sys;
321+
320322
#[used]
321323
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
322324
#[used]

tests/fail/breakpoint.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#![feature(core_intrinsics)]
22

33
fn main() {
4-
unsafe {
5-
core::intrinsics::breakpoint() //~ ERROR: trace/breakpoint trap
6-
};
4+
core::intrinsics::breakpoint(); //~ ERROR: trace/breakpoint trap
75
}

tests/fail/breakpoint.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: abnormal termination: trace/breakpoint trap
22
--> tests/fail/breakpoint.rs:LL:CC
33
|
4-
LL | core::intrinsics::breakpoint()
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trace/breakpoint trap
4+
LL | core::intrinsics::breakpoint();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trace/breakpoint trap
66
|
77
= note: BACKTRACE:
88
= note: inside `main` at tests/fail/breakpoint.rs:LL:CC
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Validity makes this fail at the wrong place.
2+
//@compile-flags: -Zmiri-disable-validation
3+
use std::mem;
4+
5+
// This enum has untagged variant idx 1, with niche_variants being 0..=2
6+
// and niche_start being 2.
7+
// That means the untagged variants is in the niche variant range!
8+
// However, using the corresponding value (2+1 = 3) is not a valid encoding of this variant.
9+
#[derive(Copy, Clone, PartialEq)]
10+
enum Foo {
11+
Var1,
12+
Var2(bool),
13+
Var3,
14+
}
15+
16+
fn main() {
17+
unsafe {
18+
assert!(Foo::Var2(false) == mem::transmute(0u8));
19+
assert!(Foo::Var2(true) == mem::transmute(1u8));
20+
assert!(Foo::Var1 == mem::transmute(2u8));
21+
assert!(Foo::Var3 == mem::transmute(4u8));
22+
23+
let invalid: Foo = mem::transmute(3u8);
24+
assert!(matches!(invalid, Foo::Var2(_)));
25+
//~^ ERROR: invalid tag
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: Undefined Behavior: enum value has invalid tag: 0x03
2+
--> tests/fail/enum-untagged-variant-invalid-encoding.rs:LL:CC
3+
|
4+
LL | assert!(matches!(invalid, Foo::Var2(_)));
5+
| ^^^^^^^ enum value has invalid tag: 0x03
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/enum-untagged-variant-invalid-encoding.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+

tests/pass-dep/libc/libc-fs-symlink.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ fn test_readlink() {
4747
assert_eq!(res, small_buf.len() as isize);
4848

4949
// Test that we report a proper error for a missing path.
50-
let bad_path = CString::new("MIRI_MISSING_FILE_NAME").unwrap();
5150
let res = unsafe {
52-
libc::readlink(bad_path.as_ptr(), small_buf.as_mut_ptr().cast(), small_buf.len())
51+
libc::readlink(c"MIRI_MISSING_FILE_NAME".as_ptr(), small_buf.as_mut_ptr().cast(), small_buf.len())
5352
};
5453
assert_eq!(res, -1);
5554
assert_eq!(Error::last_os_error().kind(), ErrorKind::NotFound);

tests/pass-dep/libc/libc-fs-with-isolation.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//@compile-flags: -Zmiri-isolation-error=warn-nobacktrace
33
//@normalize-stderr-test: "(stat(x)?)" -> "$$STAT"
44

5-
use std::ffi::CString;
65
use std::fs;
76
use std::io::{Error, ErrorKind};
87

@@ -13,10 +12,9 @@ fn main() {
1312
}
1413

1514
// test `readlink`
16-
let symlink_c_str = CString::new("foo.txt").unwrap();
1715
let mut buf = vec![0; "foo_link.txt".len() + 1];
1816
unsafe {
19-
assert_eq!(libc::readlink(symlink_c_str.as_ptr(), buf.as_mut_ptr(), buf.len()), -1);
17+
assert_eq!(libc::readlink(c"foo.txt".as_ptr(), buf.as_mut_ptr(), buf.len()), -1);
2018
assert_eq!(Error::last_os_error().raw_os_error(), Some(libc::EACCES));
2119
}
2220

tests/pass-dep/libc/libc-mem.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ fn test_memcpy() {
5555
}
5656

5757
fn test_strcpy() {
58-
use std::ffi::{CStr, CString};
58+
use std::ffi::CStr;
5959

6060
// case: src_size equals dest_size
6161
unsafe {
62-
let src = CString::new("rust").unwrap();
63-
let size = src.as_bytes_with_nul().len();
62+
let src = c"rust";
63+
let size = src.to_bytes_with_nul().len();
6464
let dest = libc::malloc(size);
6565
libc::strcpy(dest as *mut libc::c_char, src.as_ptr());
6666
assert_eq!(CStr::from_ptr(dest as *const libc::c_char), src.as_ref());
@@ -69,8 +69,8 @@ fn test_strcpy() {
6969

7070
// case: src_size is less than dest_size
7171
unsafe {
72-
let src = CString::new("rust").unwrap();
73-
let size = src.as_bytes_with_nul().len();
72+
let src = c"rust";
73+
let size = src.to_bytes_with_nul().len();
7474
let dest = libc::malloc(size + 1);
7575
libc::strcpy(dest as *mut libc::c_char, src.as_ptr());
7676
assert_eq!(CStr::from_ptr(dest as *const libc::c_char), src.as_ref());

tests/pass/async-closure-captures.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Same as rustc's `tests/ui/async-await/async-closures/captures.rs`, keep in sync
22

3-
#![feature(async_closure, noop_waker)]
3+
#![feature(async_closure, noop_waker, async_trait_bounds)]
44

55
use std::future::Future;
66
use std::pin::pin;

tests/pass/async-closure-drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_closure, noop_waker, async_fn_traits)]
1+
#![feature(async_closure, noop_waker, async_trait_bounds)]
22

33
use std::future::Future;
44
use std::pin::pin;

0 commit comments

Comments
 (0)