]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #1992 - RalfJung:sdiv, r=RalfJung
bors [Thu, 3 Mar 2022 17:32:59 +0000 (17:32 +0000)]
Auto merge of #1992 - RalfJung:sdiv, r=RalfJung

adjust for div/rem overflow being UB

This is the Miri side of https://github.com/rust-lang/rust/pull/94512. Just some error messages change.

2 years agoadd test for simd division overflow UB
Ralf Jung [Thu, 3 Mar 2022 17:32:42 +0000 (12:32 -0500)]
add test for simd division overflow UB

2 years agorustup
Ralf Jung [Thu, 3 Mar 2022 17:26:42 +0000 (12:26 -0500)]
rustup

2 years agoadjust for div/rem overflow being UB
Ralf Jung [Wed, 2 Mar 2022 01:37:46 +0000 (20:37 -0500)]
adjust for div/rem overflow being UB

2 years agoAuto merge of #1994 - RalfJung:unaligned-ptr-test, r=RalfJung
bors [Wed, 2 Mar 2022 18:07:58 +0000 (18:07 +0000)]
Auto merge of #1994 - RalfJung:unaligned-ptr-test, r=RalfJung

Make sure we notice when a u16 is loaded at offset 1 into a u8 allocation

Cc https://github.com/rust-lang/miri/pull/1990 which would have changed the integer address logic in a way that this bug could not be found any more.

2 years agoMake sure we notice when a u16 is loaded at offset 1 into a u8 allocation
Ralf Jung [Wed, 2 Mar 2022 18:06:28 +0000 (13:06 -0500)]
Make sure we notice when a u16 is loaded at offset 1 into a u8 allocation

2 years agoAuto merge of #1991 - RalfJung:rustup, r=RalfJung
bors [Tue, 1 Mar 2022 23:47:10 +0000 (23:47 +0000)]
Auto merge of #1991 - RalfJung:rustup, r=RalfJung

Rustup: simd_select

Cc https://github.com/rust-lang/rust/issues/94474

2 years agotest overflowing Div/Rem
Ralf Jung [Tue, 1 Mar 2022 23:44:37 +0000 (18:44 -0500)]
test overflowing Div/Rem

2 years agoimplement simd_select
Ralf Jung [Tue, 1 Mar 2022 23:40:40 +0000 (18:40 -0500)]
implement simd_select

2 years agofactor SIMD bool handling into helper functions
Ralf Jung [Tue, 1 Mar 2022 23:15:39 +0000 (18:15 -0500)]
factor SIMD bool handling into helper functions

2 years agoAuto merge of #1985 - RalfJung:fn-ptr, r=RalfJung
bors [Sun, 27 Feb 2022 20:27:47 +0000 (20:27 +0000)]
Auto merge of #1985 - RalfJung:fn-ptr, r=RalfJung

update fn ptr tests

This adjusts the tests for https://github.com/rust-lang/rust/pull/94343.

2 years agoadd test for rust issue 94371
Ralf Jung [Sun, 27 Feb 2022 20:27:34 +0000 (15:27 -0500)]
add test for rust issue 94371

2 years agorustup
Ralf Jung [Sun, 27 Feb 2022 20:22:49 +0000 (15:22 -0500)]
rustup

2 years agoAuto merge of #1989 - saethlin:short-backtraces, r=RalfJung
bors [Sat, 26 Feb 2022 22:17:04 +0000 (22:17 +0000)]
Auto merge of #1989 - saethlin:short-backtraces, r=RalfJung

Only print the pruning note if the trace was definitely pruned

Per https://github.com/rust-lang/miri/pull/1987#discussion_r815337994

The only problem with this is that it looks like we can't emit the note about `-Zmiri-backtrace=full` if we also emit a tag-tracking diagnostic. The final note about the setting simply doesn't appear on the final error if it is printed before. I feel like we're running up against some diagnostic deduplication logic?

2 years agoOnly print the pruning note if the trace was definitely pruned
Ben Kimock [Sat, 26 Feb 2022 22:02:17 +0000 (17:02 -0500)]
Only print the pruning note if the trace was definitely pruned

2 years agoAuto merge of #1987 - saethlin:short-backtraces, r=oli-obk
bors [Sat, 26 Feb 2022 08:56:02 +0000 (08:56 +0000)]
Auto merge of #1987 - saethlin:short-backtraces, r=oli-obk

Prune stacktraces for tag-tracking diagnostics too

In https://github.com/rust-lang/miri/pull/1977 we forgot to use the pruning logic when printing tag-tracking messages. I just saw this output before this PR which is very silly:
```
test sanity ... note: tracking was triggered
   --> src/lib.rs:110:21
    |
110 |         unsafe { &*(&self.value[range] as *const [T] as *const Aligned<A, [T]>) }
    |                     ^^^^^^^^^^^^^^^^^^ created tag 160954
    |
    = note: inside `<Aligned<A4, [u8]> as std::ops::Index<std::ops::RangeTo<usize>>>::index` at src/lib.rs:110:21
note: inside `sanity` at src/lib.rs:261:30
   --> src/lib.rs:261:30
    |
261 |     let y: &Aligned<_, _> = &y[..2];
    |                              ^^^^^^
note: inside closure at src/lib.rs:229:1
   --> src/lib.rs:229:1
    |
228 |   #[test]
    |   ------- in this procedural macro expansion
229 | / fn sanity() {
230 | |     use core::mem;
231 | |
232 | |     let x: Aligned<A2, _> = Aligned([0u8; 3]);
...   |
284 | |     let _: &[u8] = y;
285 | | }
    | |_^
    = note: inside `<[closure@src/lib.rs:229:1: 285:2] as std::ops::FnOnce<()>>::call_once - shim` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
    = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
    = note: inside `test::__rust_begin_short_backtrace::<fn()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:575:5
    = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:566:30
    = note: inside `<[closure@test::run_test::{closure#1}] as std::ops::FnOnce<()>>::call_once - shim(vtable)` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
    = note: inside `<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send> as std::ops::FnOnce<()>>::call_once` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1854:9
    = note: inside `<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:271:9
    = note: inside `std::panicking::r#try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
    = note: inside `std::panicking::r#try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
    = note: inside `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
    = note: inside `test::run_test_in_process` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:598:18
    = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:492:39
    = note: inside `test::run_test::run_test_inner` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:530:13
    = note: inside `test::run_test` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:562:28
    = note: inside `test::run_tests::<[closure@test::run_tests_console::{closure#2}]>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:305:17
    = note: inside `test::run_tests_console` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/console.rs:286:5
    = note: inside `test::test_main` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:116:15
    = note: inside `test::test_main_static` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:135:5
    = note: inside `main`
    = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
    = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:122:18
    = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:145:18
    = note: inside `std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
    = note: inside `std::panicking::r#try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
    = note: inside `std::panicking::r#try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
    = note: inside `std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
    = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:128:48
    = note: inside `std::panicking::r#try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
    = note: inside `std::panicking::r#try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
    = note: inside `std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
    = note: inside `std::rt::lang_start_internal` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:128:20
    = note: inside `std::rt::lang_start::<()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:144:17
    = note: this note originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

error: Undefined Behavior: trying to reborrow for SharedReadOnly at alloc61593+0x2, but parent tag <160954> does not have an appropriate item in the borrow stack
   --> src/lib.rs:261:30
    |
261 |     let y: &Aligned<_, _> = &y[..2];
    |                              ^^^^^^ trying to reborrow for SharedReadOnly at alloc61593+0x2, but parent tag <160954> does not have an appropriate item in the borrow stack
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information

    = note: inside `sanity` at src/lib.rs:261:30
note: inside closure at src/lib.rs:229:1
   --> src/lib.rs:229:1
    |
228 |   #[test]
    |   ------- in this procedural macro expansion
229 | / fn sanity() {
230 | |     use core::mem;
231 | |
232 | |     let x: Aligned<A2, _> = Aligned([0u8; 3]);
...   |
284 | |     let _: &[u8] = y;
285 | | }
    | |_^
    = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

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

error: aborting due to previous error

error: test failed, to rerun pass '--lib'
```

2 years agoPrune stacktraces for tag-tracking diagnostics too
Ben Kimock [Sat, 26 Feb 2022 00:18:05 +0000 (19:18 -0500)]
Prune stacktraces for tag-tracking diagnostics too

2 years agoupdate fn ptr tests
Ralf Jung [Fri, 25 Feb 2022 00:41:11 +0000 (19:41 -0500)]
update fn ptr tests

2 years agorustup
Ralf Jung [Fri, 25 Feb 2022 17:05:59 +0000 (12:05 -0500)]
rustup

2 years agoAuto merge of #1984 - RalfJung:rustup, r=RalfJung
bors [Thu, 24 Feb 2022 15:57:56 +0000 (15:57 +0000)]
Auto merge of #1984 - RalfJung:rustup, r=RalfJung

rustup

2 years agorustup
Ralf Jung [Thu, 24 Feb 2022 15:55:40 +0000 (10:55 -0500)]
rustup

2 years agoAuto merge of #1982 - saethlin:trophies, r=oli-obk
bors [Wed, 23 Feb 2022 09:13:16 +0000 (09:13 +0000)]
Auto merge of #1982 - saethlin:trophies, r=oli-obk

Add crossbeam-epoch and integer-encoding to the trophy case

What are the critera for adding SB entries to the trophy case?

2 years agoAdd crossbeam-epoch and integer-encoding to the trophy case
Ben Kimock [Wed, 23 Feb 2022 02:09:30 +0000 (21:09 -0500)]
Add crossbeam-epoch and integer-encoding to the trophy case

2 years agoAuto merge of #1977 - saethlin:short-backtraces, r=RalfJung
bors [Tue, 22 Feb 2022 15:39:07 +0000 (15:39 +0000)]
Auto merge of #1977 - saethlin:short-backtraces, r=RalfJung

Prune backtraces similar to RUST_BACKTRACE=1 logic

This removes the majority of output from `cargo miri run` and `cargo miri test` in common usage.

~~I've copied the logic almost directly from `std`:
https://github.com/rust-lang/rust/blob/3b186511f62b0ce20e72ede0e8e13f8787155f02/library/std/src/sys_common/backtrace.rs#L76-L77~~

~~It might be nice to have the "some details were omitted" note and a fallback to a setting where we print everything just in case this logic goes sideways, but~~
~~1. I'm not sure where to put the note~~
~~2. `MIRI_BACKTRACE`, `RUST_BACKTRACE`, and `RUSTC_CTFE_BACKTRACE` already do something else. Should we repurpose or add on to the semantics of `MIRI_BACKTRACE`?~~

---
Based on this tiny silly crate:
```rust
fn main() {
    some_function();
}

fn some_function() {
    unsafe {
        let _x: &u8 = core::mem::transmute(1usize);
    }
}

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        unsafe {
            let _x: &'static u8 = core::mem::transmute(1usize);
        }
    }
}
```

`cargo miri run`:
Before:
```
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running `/home/ben/.cargo/bin/cargo-miri target/miri/x86_64-unknown-linux-gnu/debug/scratch`
error: Undefined Behavior: type validation failed: encountered a dangling reference (address 0x1 is unallocated)
 --> src/main.rs:7:23
  |
7 |         let _x: &u8 = core::mem::transmute(1usize);
  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (address 0x1 is unallocated)
  |
  = 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: inside `some_function` at src/main.rs:7:23
note: inside `main` at src/main.rs:2:5
 --> src/main.rs:2:5
  |
2 |     some_function();
  |     ^^^^^^^^^^^^^^^
  = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:122:18
  = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:145:18
  = note: inside `std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
  = note: inside `std::panicking::r#try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
  = note: inside `std::panicking::r#try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
  = note: inside `std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
  = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:128:48
  = note: inside `std::panicking::r#try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
  = note: inside `std::panicking::r#try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
  = note: inside `std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
  = note: inside `std::rt::lang_start_internal` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:128:20
  = note: inside `std::rt::lang_start::<()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:144:17

error: aborting due to previous error

```
After:
```    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running `/home/ben/.cargo/bin/cargo-miri target/miri/x86_64-unknown-linux-gnu/debug/scratch`
error: Undefined Behavior: type validation failed: encountered a dangling reference (address 0x1 is unallocated)
 --> src/main.rs:7:23
  |
7 |         let _x: &u8 = core::mem::transmute(1usize);
  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (address 0x1 is unallocated)
  |
  = 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: inside `some_function` at src/main.rs:7:23
note: inside `main` at src/main.rs:2:5
 --> src/main.rs:2:5
  |
2 |     some_function();
  |     ^^^^^^^^^^^^^^^

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

error: aborting due to previous error
```

`cargo miri test`
Before:
```
    Finished test [unoptimized + debuginfo] target(s) in 0.00s
     Running unittests (target/miri/x86_64-unknown-linux-gnu/debug/deps/scratch-9d7717efc37bb64c)

running 1 test
test tests::it_works ... error: Undefined Behavior: type validation failed: encountered a dangling reference (address 0x1 is unallocated)
  --> src/main.rs:16:35
   |
16 |             let _x: &'static u8 = core::mem::transmute(1usize);
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (address 0x1 is unallocated)
   |
   = 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: inside `tests::it_works` at src/main.rs:16:35
note: inside closure at src/main.rs:14:5
  --> src/main.rs:14:5
   |
13 |       #[test]
   |       ------- in this procedural macro expansion
14 | /     fn it_works() {
15 | |         unsafe {
16 | |             let _x: &'static u8 = core::mem::transmute(1usize);
17 | |         }
18 | |     }
   | |_____^
   = note: inside `<[closure@src/main.rs:14:5: 18:6] as std::ops::FnOnce<()>>::call_once - shim` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
   = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
   = note: inside `tests::test::__rust_begin_short_backtrace::<fn()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:575:5
   = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:566:30
   = note: inside `<[closure@tests::test::run_test::{closure#1}] as std::ops::FnOnce<()>>::call_once - shim(vtable)` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
   = note: inside `<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send> as std::ops::FnOnce<()>>::call_once` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1854:9
   = note: inside `<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:271:9
   = note: inside `std::panicking::r#try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
   = note: inside `std::panicking::r#try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
   = note: inside `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
   = note: inside `tests::test::run_test_in_process` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:598:18
   = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:492:39
   = note: inside `tests::test::run_test::run_test_inner` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:530:13
   = note: inside `tests::test::run_test` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:562:28
   = note: inside `tests::test::run_tests::<[closure@tests::test::run_tests_console::{closure#2}]>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:305:17
   = note: inside `tests::test::run_tests_console` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/console.rs:290:5
   = note: inside `tests::test::test_main` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:116:15
   = note: inside `tests::test::test_main_static` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:135:5
   = note: inside `main`
   = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:122:18
   = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:145:18
   = note: inside `std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
   = note: inside `std::panicking::r#try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
   = note: inside `std::panicking::r#try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
   = note: inside `std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
   = note: inside closure at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:128:48
   = note: inside `std::panicking::r#try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
   = note: inside `std::panicking::r#try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
   = note: inside `std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
   = note: inside `std::rt::lang_start_internal` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:128:20
   = note: inside `std::rt::lang_start::<()>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:144:17
   = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

error: test failed, to rerun pass '--bin scratch'
```

After:
```
    Finished test [unoptimized + debuginfo] target(s) in 0.00s
     Running unittests (target/miri/x86_64-unknown-linux-gnu/debug/deps/scratch-9d7717efc37bb64c)

running 1 test
test tests::it_works ... error: Undefined Behavior: type validation failed: encountered a dangling reference (address 0x1 is unallocated)
  --> src/main.rs:16:35
   |
16 |             let _x: &'static u8 = core::mem::transmute(1usize);
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (address 0x1 is unallocated)
   |
   = 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: inside `tests::it_works` at src/main.rs:16:35
note: inside closure at src/main.rs:14:5
  --> src/main.rs:14:5
   |
13 |       #[test]
   |       ------- in this procedural macro expansion
14 | /     fn it_works() {
15 | |         unsafe {
16 | |             let _x: &'static u8 = core::mem::transmute(1usize);
17 | |         }
18 | |     }
   | |_____^
   = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

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

error: aborting due to previous error

error: test failed, to rerun pass '--bin scratch'
```

2 years agoPrune backtraces similar to RUST_BACKTRACE=1 logic
Ben Kimock [Sun, 20 Feb 2022 16:55:39 +0000 (11:55 -0500)]
Prune backtraces similar to RUST_BACKTRACE=1 logic

Previously, Miri would always print a backtrace including all frames
when encountering an error. This adds -Zmiri-backtrace which defaults
to 1, internally called BacktraceStyle::Short. By default, backtraces
are pruned to start at __rust_begin_short_backtrace, similar to std.
Then we also remove non-local frames from the bottom of the trace.
This cleans up the last one or two shims outside main or a test.

Users can opt out of pruning by setting -Zmiri-backtrace=full, and will
be automatically opted out if there are no local frames because that
means the reported error is likely in the Rust runtime, which this
pruning is crafted to remove.

2 years agoAuto merge of #1978 - RalfJung:simd_eq, r=RalfJung
bors [Tue, 22 Feb 2022 02:43:53 +0000 (02:43 +0000)]
Auto merge of #1978 - RalfJung:simd_eq, r=RalfJung

implement simd_eq and simd_reduce_any

This lets us re-enable the division and modulo tests, since those operations now internally use simd_eq and simd_reduce_any.

However, I am not sure what exactly the rules are for simd_reduce_any. `@workingjubilee` for now I made it UB to call those with inputs that are not all-0 or all-1, but that might be taking it too far?

2 years agoimplement simd_eq and simd_reduce_any
Ralf Jung [Tue, 22 Feb 2022 02:41:52 +0000 (21:41 -0500)]
implement simd_eq and simd_reduce_any

2 years agorustup
Ralf Jung [Tue, 22 Feb 2022 02:34:05 +0000 (21:34 -0500)]
rustup

2 years agoAuto merge of #1979 - RalfJung:trophy, r=RalfJung
bors [Mon, 21 Feb 2022 02:42:18 +0000 (02:42 +0000)]
Auto merge of #1979 - RalfJung:trophy, r=RalfJung

another for the trophy case

2 years agoanother for the trophy case
Ralf Jung [Mon, 21 Feb 2022 02:41:37 +0000 (21:41 -0500)]
another for the trophy case

2 years agoAuto merge of #1974 - RalfJung:const, r=RalfJung
bors [Sat, 12 Feb 2022 11:19:37 +0000 (11:19 +0000)]
Auto merge of #1974 - RalfJung:const, r=RalfJung

implement const_deallocate as a NOP

2 years agoimplement const_deallocate as a NOP
Ralf Jung [Sat, 12 Feb 2022 11:17:37 +0000 (12:17 +0100)]
implement const_deallocate as a NOP

2 years agoAuto merge of #1973 - RalfJung:rustup, r=RalfJung
bors [Sat, 12 Feb 2022 10:54:24 +0000 (10:54 +0000)]
Auto merge of #1973 - RalfJung:rustup, r=RalfJung

implement const_allocate intrinsic

This is needed to make the libcore test suite pass again.

2 years agoimplement const_allocate intrinsic
Ralf Jung [Sat, 12 Feb 2022 10:53:51 +0000 (11:53 +0100)]
implement const_allocate intrinsic

2 years agoAuto merge of #1968 - RalfJung:rustup, r=RalfJung
bors [Fri, 4 Feb 2022 17:01:23 +0000 (17:01 +0000)]
Auto merge of #1968 - RalfJung:rustup, r=RalfJung

rustup; implement simd_and/or

I had to disable the integer division tests since they now require simd_eq, which seems [non-trivial to implement](https://github.com/rust-lang/miri/issues/1912#issuecomment-1030164843).

Cc https://github.com/rust-lang/rust/issues/93619

2 years agorustup; implement simd_and/or
Ralf Jung [Fri, 4 Feb 2022 16:55:53 +0000 (17:55 +0100)]
rustup; implement simd_and/or

2 years agoAuto merge of #1967 - RalfJung:rustup, r=RalfJung
bors [Fri, 4 Feb 2022 16:18:30 +0000 (16:18 +0000)]
Auto merge of #1967 - RalfJung:rustup, r=RalfJung

rustup: disable read_dir test for now

I don't currently have time to fix our read_dir support, so I disabled the tests for now. https://github.com/rust-lang/miri/issues/1966 tracks bringing back that functionality.

2 years agorustup: disable read_dir test for now
Ralf Jung [Fri, 4 Feb 2022 16:17:28 +0000 (17:17 +0100)]
rustup: disable read_dir test for now

2 years agoAuto merge of #1964 - RalfJung:rustup, r=RalfJung
bors [Wed, 26 Jan 2022 16:00:00 +0000 (16:00 +0000)]
Auto merge of #1964 - RalfJung:rustup, r=RalfJung

rustup

Let's hope we can finally get CI green again...

2 years agorustup
Ralf Jung [Wed, 26 Jan 2022 15:54:55 +0000 (10:54 -0500)]
rustup

2 years agoAuto merge of #1961 - ojeda:spurious-maybe_uninit_extra, r=oli-obk
bors [Tue, 11 Jan 2022 17:37:37 +0000 (17:37 +0000)]
Auto merge of #1961 - ojeda:spurious-maybe_uninit_extra, r=oli-obk

Remove spurious `maybe_uninit_extra`

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoRemove spurious `maybe_uninit_extra`
Miguel Ojeda [Tue, 11 Jan 2022 15:17:39 +0000 (16:17 +0100)]
Remove spurious `maybe_uninit_extra`

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoAuto merge of #1952 - RalfJung:self-referential, r=RalfJung
bors [Sun, 9 Jan 2022 14:10:00 +0000 (14:10 +0000)]
Auto merge of #1952 - RalfJung:self-referential, r=RalfJung

exclude mutable references to !Unpin types from uniqueness guarantees

This basically works around https://github.com/rust-lang/unsafe-code-guidelines/issues/148 by not requiring uniqueness any more for mutable references to self-referential generators. That corresponds to [the same work-around that was applied in rustc itself](https://github.com/rust-lang/rust/blob/b81553267437627af63c79c1a20c73af865a842a/compiler/rustc_middle/src/ty/layout.rs#L2482).

I am not entirely sure if this is a good idea since it might hide too many errors in case types are "accidentally" `!Unpin`. OTOH, our test suite still passes, and to my knowledge the vast majority of types is `Unpin`. (`place.layout.ty` is monomorphic, we should always exactly know which type this is.)

2 years agoAuto merge of #1960 - RalfJung:rustup, r=RalfJung
bors [Sun, 9 Jan 2022 13:50:34 +0000 (13:50 +0000)]
Auto merge of #1960 - RalfJung:rustup, r=RalfJung

rustup

Cc https://github.com/rust-lang/rust/issues/92691

2 years agorustup
Ralf Jung [Sun, 9 Jan 2022 13:50:03 +0000 (14:50 +0100)]
rustup

2 years agoAuto merge of #1959 - RalfJung:rustup, r=RalfJung
bors [Sat, 8 Jan 2022 16:28:39 +0000 (16:28 +0000)]
Auto merge of #1959 - RalfJung:rustup, r=RalfJung

rustup

2 years agorustup
Ralf Jung [Sat, 8 Jan 2022 16:27:48 +0000 (17:27 +0100)]
rustup

2 years agoAuto merge of #1956 - RalfJung:stack-pop-cleanup, r=RalfJung
bors [Wed, 5 Jan 2022 08:56:05 +0000 (08:56 +0000)]
Auto merge of #1956 - RalfJung:stack-pop-cleanup, r=RalfJung

adjust for StackPopCleanup::None rename

This is the Miri side of https://github.com/rust-lang/rust/pull/92551

2 years agorustup
Ralf Jung [Wed, 5 Jan 2022 08:55:29 +0000 (09:55 +0100)]
rustup

2 years agoadjust for StackPopCleanup::None rename
Ralf Jung [Tue, 4 Jan 2022 10:14:50 +0000 (11:14 +0100)]
adjust for StackPopCleanup::None rename

2 years agoAuto merge of #1954 - RalfJung:rustup, r=RalfJung
bors [Mon, 3 Jan 2022 22:25:44 +0000 (22:25 +0000)]
Auto merge of #1954 - RalfJung:rustup, r=RalfJung

rustup

Cc https://github.com/rust-lang/rust/issues/92527

2 years agorustup
Ralf Jung [Mon, 3 Jan 2022 21:54:58 +0000 (22:54 +0100)]
rustup

2 years agoAuto merge of #1953 - klensy:deps-up, r=RalfJung
bors [Mon, 3 Jan 2022 09:16:06 +0000 (09:16 +0000)]
Auto merge of #1953 - klensy:deps-up, r=RalfJung

update crate rustc_version 0.3 -> 0.4 to remove some deps

This removes some deps and pulls only one version of `rustc_version` crate.

2 years agoupdate crate rustc_version 0.3 -> 0.4 to remove some deps
klensy [Sun, 2 Jan 2022 23:47:42 +0000 (02:47 +0300)]
update crate rustc_version 0.3 -> 0.4 to remove some deps

2 years agoexclude mutable references to !Unpin types from uniqueness guarantees
Ralf Jung [Sat, 1 Jan 2022 18:01:46 +0000 (19:01 +0100)]
exclude mutable references to !Unpin types from uniqueness guarantees

2 years agoAuto merge of #1951 - RalfJung:rustup, r=RalfJung
bors [Sat, 1 Jan 2022 17:54:02 +0000 (17:54 +0000)]
Auto merge of #1951 - RalfJung:rustup, r=RalfJung

rustup

The previously pinned toolchain was affected by https://github.com/rust-lang/rust/issues/92163, let's switch to one where that problem is fixed.

2 years agorustup
Ralf Jung [Sat, 1 Jan 2022 17:52:45 +0000 (18:52 +0100)]
rustup

2 years agoAuto merge of #1928 - RalfJung:fn-abi, r=RalfJung
bors [Fri, 24 Dec 2021 11:04:48 +0000 (11:04 +0000)]
Auto merge of #1928 - RalfJung:fn-abi, r=RalfJung

adjust for FnAbi changes

This is the Miri side of https://github.com/rust-lang/rust/pull/91342.

2 years agoadjust output for calling convention check
Ralf Jung [Thu, 2 Dec 2021 02:37:06 +0000 (21:37 -0500)]
adjust output for calling convention check

2 years agoadjust for FnAbi changes
Ralf Jung [Mon, 29 Nov 2021 17:48:04 +0000 (12:48 -0500)]
adjust for FnAbi changes

2 years agoAuto merge of #1949 - RalfJung:miri-lib-src, r=oli-obk
bors [Thu, 23 Dec 2021 15:54:25 +0000 (15:54 +0000)]
Auto merge of #1949 - RalfJung:miri-lib-src, r=oli-obk

add and document MIRI_LIB_SRC env var to set the source from which Miri builds the standard library

This is just an alias of `XARGO_RUST_SRC`, but avoids exposing how exactly we use xargo.

2 years agoadd and document MIRI_LIB_SRC env var to set the source from which Miri builds the...
Ralf Jung [Thu, 23 Dec 2021 14:57:39 +0000 (15:57 +0100)]
add and document MIRI_LIB_SRC env var to set the source from which Miri builds the standard library

2 years agoAuto merge of #1945 - saethlin:better-sb-tracking, r=RalfJung
bors [Tue, 21 Dec 2021 21:25:52 +0000 (21:25 +0000)]
Auto merge of #1945 - saethlin:better-sb-tracking, r=RalfJung

Provide slightly better notes when tracking a pointer tag

I slapped this in as a sort of advanced println-based debugging when trying to figure out a track-raw-pointers finding in `smallvec`. Perhaps this looks like a good idea to you all?

EDIT: User scenario

Run `MIRIFLAGS=-Ztag-raw-pointers cargo miri test`, get a diagnostic that looks like
```
error: Undefined Behavior: trying to reborrow for SharedReadOnly at alloc99465+0x9, but parent tag <265507> does not have an appropriate item in the borrow stack
```
So now run `MIRIFLAGS=-Ztag-raw-pointers -Zmiri-track-pointer-tag=265507 cargo miri test`
Old:
```
note: tracking was triggered
   --> src/lib.rs:822:36
    |
822 |                 vec: NonNull::from(self),
    |                                    ^^^^ popped tracked tag for item [SharedReadOnly for <265507>]
```
New:
```
note: tracking was triggered
   --> src/lib.rs:822:36
    |
822 |                 vec: NonNull::from(self),
    |                                    ^^^^ popped tracked tag for item [SharedReadOnly for <265507>] due to Write access for <265356>
```
So that if a user is now beginning to question their sanity because they don't really understand SB yet, they can then track the tag which caused the parent tag to be removed from the stack to be sure what's going on here:
```
   --> src/lib.rs:792:5
    |
792 | /     pub fn drain<R>(&mut self, range: R) -> Drain<'_, A>
793 | |     where
794 | |         R: RangeBounds<usize>,
795 | |     {
...   |
824 | |         }
825 | |     }
    | |_____^ created tag 265356
```

The existing diagnostic can tell you where the tag you'd need was invalidated, but it cannot tell you what and why that tag was invalidated.

2 years agoProvide better notes when tracking a pointer tag
Ben Kimock [Sun, 19 Dec 2021 23:45:56 +0000 (18:45 -0500)]
Provide better notes when tracking a pointer tag

2 years agoAuto merge of #1947 - RalfJung:macos-is-from-the-stone-age, r=RalfJung
bors [Mon, 20 Dec 2021 22:17:40 +0000 (22:17 +0000)]
Auto merge of #1947 - RalfJung:macos-is-from-the-stone-age, r=RalfJung

macOS-compatible realpath

Make behavior consistent between Linux and macOS even though macOS lacks some basic shell tools

2 years agomacOS-compatible realpath
Ralf Jung [Mon, 20 Dec 2021 22:14:17 +0000 (23:14 +0100)]
macOS-compatible realpath

2 years agoAuto merge of #1944 - RalfJung:rustup, r=RalfJung
bors [Sun, 19 Dec 2021 18:49:41 +0000 (18:49 +0000)]
Auto merge of #1944 - RalfJung:rustup, r=RalfJung

rustup

2 years agorustup
Ralf Jung [Sun, 19 Dec 2021 18:49:05 +0000 (19:49 +0100)]
rustup

2 years agoAuto merge of #1943 - RalfJung:readme, r=RalfJung
bors [Sun, 19 Dec 2021 16:53:37 +0000 (16:53 +0000)]
Auto merge of #1943 - RalfJung:readme, r=RalfJung

readme: be more explicit about the toolchain

Fixes https://github.com/rust-lang/miri/issues/1942

`@robamler` would this have helped?

2 years agoreadme: be more explicit about the toolchain
Ralf Jung [Sun, 19 Dec 2021 16:46:17 +0000 (17:46 +0100)]
readme: be more explicit about the toolchain

2 years agoAuto merge of #1940 - RalfJung:xargo, r=RalfJung
bors [Thu, 16 Dec 2021 14:23:08 +0000 (14:23 +0000)]
Auto merge of #1940 - RalfJung:xargo, r=RalfJung

require xargo 0.3.23

Fixes https://github.com/rust-lang/miri/issues/1939

2 years agorequire xargo 0.3.23
Ralf Jung [Thu, 16 Dec 2021 14:20:58 +0000 (15:20 +0100)]
require xargo 0.3.23

2 years agoAuto merge of #1938 - RalfJung:test, r=RalfJung
bors [Wed, 15 Dec 2021 18:11:57 +0000 (18:11 +0000)]
Auto merge of #1938 - RalfJung:test, r=RalfJung

add regression test

Adds a regression test for https://github.com/rust-lang/rust/issues/91636 (which was fixed by https://github.com/rust-lang/rust/pull/91856)

2 years agolooks like the asm macro is stable :D
Ralf Jung [Wed, 15 Dec 2021 17:58:28 +0000 (18:58 +0100)]
looks like the asm macro is stable :D

2 years agoadd regression test
Ralf Jung [Wed, 15 Dec 2021 17:41:41 +0000 (18:41 +0100)]
add regression test

2 years agoAuto merge of #1937 - RalfJung:rustup, r=RalfJung
bors [Wed, 15 Dec 2021 16:10:43 +0000 (16:10 +0000)]
Auto merge of #1937 - RalfJung:rustup, r=RalfJung

rustup

I cannot reproduce the [nightly CI failure](https://github.com/rust-lang/miri/runs/4521890481?check_suite_focus=true) so let's see what happens...

2 years agofix iteration-order-dependent output
Ralf Jung [Wed, 15 Dec 2021 15:51:40 +0000 (16:51 +0100)]
fix iteration-order-dependent output

2 years agoupdate lockfile
Ralf Jung [Tue, 14 Dec 2021 17:20:03 +0000 (18:20 +0100)]
update lockfile

2 years agorustup
Ralf Jung [Tue, 14 Dec 2021 17:14:17 +0000 (18:14 +0100)]
rustup

2 years agoAuto merge of #1934 - RalfJung:rustup, r=RalfJung
bors [Wed, 8 Dec 2021 15:19:55 +0000 (15:19 +0000)]
Auto merge of #1934 - RalfJung:rustup, r=RalfJung

rustup

Cc https://github.com/rust-lang/rust/issues/91649

2 years agorustup
Ralf Jung [Wed, 8 Dec 2021 15:01:51 +0000 (10:01 -0500)]
rustup

2 years agoAuto merge of #1933 - 5225225:1931-condvar-false-positive, r=RalfJung
bors [Wed, 8 Dec 2021 14:51:53 +0000 (14:51 +0000)]
Auto merge of #1933 - 5225225:1931-condvar-false-positive, r=RalfJung

Fix false positive use of uninit bytes when calling `libc::pthread_condattr_destroy`

Fixes: #1931
2 years agoCode comment changes from code review
5225225 [Tue, 7 Dec 2021 17:25:28 +0000 (17:25 +0000)]
Code comment changes from code review

Co-authored-by: Ralf Jung <post@ralfj.de>
2 years agoAdd comment explaining false positives in _destroy
5225225 [Tue, 7 Dec 2021 08:26:46 +0000 (08:26 +0000)]
Add comment explaining false positives in _destroy

2 years agoAdjust pthread tests
5225225 [Mon, 6 Dec 2021 21:50:14 +0000 (21:50 +0000)]
Adjust pthread tests

2 years agoAdd tests for double destroying various pthread items
5225225 [Mon, 6 Dec 2021 21:15:02 +0000 (21:15 +0000)]
Add tests for double destroying various pthread items

2 years agoDestroying any uninit posix_ object is UB
5225225 [Mon, 6 Dec 2021 19:26:13 +0000 (19:26 +0000)]
Destroying any uninit posix_ object is UB

2 years agoAuto merge of #1930 - tavianator:avoid-adjacent-allocations, r=RalfJung
bors [Mon, 6 Dec 2021 01:33:55 +0000 (01:33 +0000)]
Auto merge of #1930 - tavianator:avoid-adjacent-allocations, r=RalfJung

intptrcast: Never allocate two objects directly adjecent

When two objects directly follow each other in memory, what is the
provenance of an integer cast to a pointer that points directly between
them?  For a zero-size region, it could point into the end of the first
object, or the start of the second.

We can avoid answering this difficult question by simply never
allocating two objects directly beside each other.  This fixes some of
the false positives from #1866.

2 years agofinal tweaks
Ralf Jung [Mon, 6 Dec 2021 01:33:20 +0000 (20:33 -0500)]
final tweaks

2 years agoHandle uninit data in pthread_condattr_destroy
5225225 [Sun, 5 Dec 2021 13:54:25 +0000 (13:54 +0000)]
Handle uninit data in pthread_condattr_destroy

2 years agoAuto merge of #1932 - RalfJung:rustup, r=RalfJung
bors [Sun, 5 Dec 2021 16:03:07 +0000 (16:03 +0000)]
Auto merge of #1932 - RalfJung:rustup, r=RalfJung

rustup

Cc https://github.com/rust-lang/rust/issues/91542

2 years agorustup
Ralf Jung [Sun, 5 Dec 2021 16:02:20 +0000 (11:02 -0500)]
rustup

2 years agointptrcast: Never allocate two objects directly adjecent
Tavian Barnes [Fri, 3 Dec 2021 20:57:37 +0000 (15:57 -0500)]
intptrcast: Never allocate two objects directly adjecent

When two objects directly follow each other in memory, what is the
provenance of an integer cast to a pointer that points directly between
them?  For a zero-size region, it could point into the end of the first
object, or the start of the second.

We can avoid answering this difficult question by simply never
allocating two objects directly beside each other.  This fixes some of
the false positives from #1866.

2 years agoAuto merge of #1929 - RalfJung:rustup, r=RalfJung
bors [Tue, 30 Nov 2021 16:45:05 +0000 (16:45 +0000)]
Auto merge of #1929 - RalfJung:rustup, r=RalfJung

rustup

With https://github.com/rust-lang/rust/pull/91323 landed, we can remove these intrinsics from Miri.

2 years agorustup
Ralf Jung [Tue, 30 Nov 2021 16:44:19 +0000 (11:44 -0500)]
rustup

2 years agoAuto merge of #1927 - RalfJung:array-align-tests, r=RalfJung
bors [Sun, 28 Nov 2021 15:28:57 +0000 (15:28 +0000)]
Auto merge of #1927 - RalfJung:array-align-tests, r=RalfJung

add tests for alignment on array initialization

This adds regression tests for https://github.com/rust-lang/miri/issues/1925, https://github.com/rust-lang/miri/issues/1919.

2 years agoadd tests for alignment on array initialization
Ralf Jung [Sun, 28 Nov 2021 15:07:31 +0000 (10:07 -0500)]
add tests for alignment on array initialization

2 years agoAuto merge of #1926 - RalfJung:rustup, r=RalfJung
bors [Sat, 27 Nov 2021 22:53:32 +0000 (22:53 +0000)]
Auto merge of #1926 - RalfJung:rustup, r=RalfJung

rustup; stub support for some extern statics used for weak symbols

2 years agorustup; stub support for some extern statics used for weak symbols
Ralf Jung [Sat, 27 Nov 2021 22:15:14 +0000 (17:15 -0500)]
rustup; stub support for some extern statics used for weak symbols

2 years agoAuto merge of #1924 - RalfJung:ra, r=oli-obk
bors [Thu, 25 Nov 2021 22:55:43 +0000 (22:55 +0000)]
Auto merge of #1924 - RalfJung:ra, r=oli-obk

hack to work around RA quirk

This is a gross hack to work around https://github.com/rust-analyzer/rust-analyzer/issues/10793: calling `cargo-miri/miri` does the same thing as calling `./miri`.

`@oli-obk` this is the best I could come up with... not sure if we want to have this in the repo. I am also okay with carrying `cargo-miri/miri` locally.