]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoanother TiKV bug for the trophy case :)
Ralf Jung [Wed, 21 Oct 2020 10:50:45 +0000 (12:50 +0200)]
another TiKV bug for the trophy case :)

3 years agoAuto merge of #1587 - lzutao:only-gha, r=RalfJung
bors [Tue, 20 Oct 2020 09:40:28 +0000 (09:40 +0000)]
Auto merge of #1587 - lzutao:only-gha, r=RalfJung

build: Gate only on GHA: remove travis and appveyor ci config

It's been over a week since #1571 merged.
The GHA evaluation is successful.

This PR removes CI config of travis and appveyor.
Now MIRI gates on github actions CI only.

Will need <https://github.com/rust-lang/homu/pull/109> to merge first,
otherwise bors will stuck.

Also, one may need to remove `continuous-integration/appveyor/pr` CI checks
in repo settings or appeveyor website.

3 years agobuild: Gate only on GHA: remove travis and appveyor ci config
Lzu Tao [Tue, 20 Oct 2020 05:26:30 +0000 (12:26 +0700)]
build: Gate only on GHA: remove travis and appveyor ci config

3 years agoAuto merge of #1586 - RalfJung:available-concurrency, r=RalfJung
bors [Sun, 18 Oct 2020 09:22:59 +0000 (09:22 +0000)]
Auto merge of #1586 - RalfJung:available-concurrency, r=RalfJung

test new available_concurrency function

Cc https://github.com/rust-lang/rust/pull/74480

3 years agotest new available_concurrency function
Ralf Jung [Sun, 18 Oct 2020 09:22:09 +0000 (11:22 +0200)]
test new available_concurrency function

3 years agoAuto merge of #1584 - Aaron1011:test/std-backtrace, r=RalfJung
bors [Sun, 18 Oct 2020 08:10:16 +0000 (08:10 +0000)]
Auto merge of #1584 - Aaron1011:test/std-backtrace, r=RalfJung

Test std backtrace type

Closes https://github.com/rust-lang/miri/issues/1578

3 years agoTest std::backtrace::Backtrace
Aaron Hill [Sat, 17 Oct 2020 19:36:05 +0000 (15:36 -0400)]
Test std::backtrace::Backtrace

Fixes #1578

3 years agoAuto merge of #1585 - RalfJung:rustup, r=RalfJung
bors [Sat, 17 Oct 2020 22:50:31 +0000 (22:50 +0000)]
Auto merge of #1585 - RalfJung:rustup, r=RalfJung

rustup; the bad compile times for the float test are fixed

3 years agorustup; the bad compile times for the float test are fixed
Ralf Jung [Sat, 17 Oct 2020 22:49:52 +0000 (00:49 +0200)]
rustup; the bad compile times for the float test are fixed

3 years agoAuto merge of #1583 - est31:target_refactor, r=RalfJung
bors [Thu, 15 Oct 2020 21:56:20 +0000 (21:56 +0000)]
Auto merge of #1583 - est31:target_refactor, r=RalfJung

Replace target.target with target

Fix fallout caused by rustc PR: https://github.com/rust-lang/rust/pull/77943

Fixes https://github.com/rust-lang/rust/issues/77988

3 years agoReplace target.target with target
est31 [Wed, 14 Oct 2020 17:16:00 +0000 (19:16 +0200)]
Replace target.target with target

Rustc removed the target wrapper and exposed the target directly.

Result of running:

find . -type f -exec sed -i -e 's/target\.target\([)\.,;]\)/target\1/g' {} \;

Plus one manual edit of the rust-version file

3 years agoAuto merge of #1581 - RalfJung:readme, r=RalfJung
bors [Sun, 11 Oct 2020 22:56:39 +0000 (22:56 +0000)]
Auto merge of #1581 - RalfJung:readme, r=RalfJung

README: make our cross-interpretation feature stand out more

This is a great feature, let's hope more people notice it :)

3 years agoAuto merge of #1580 - Aaron1011:feature/backtrace-fn-ptr, r=RalfJung
bors [Sun, 11 Oct 2020 22:34:57 +0000 (22:34 +0000)]
Auto merge of #1580 - Aaron1011:feature/backtrace-fn-ptr, r=RalfJung

Add an `fn_ptr` field to `MiriFrame`

The `backtrace-rs` crate can use this to implement
`Frame::symbol_address`, which is used to skip frames
above the call to `Backtrace::capture` on the stack.

The function pointer will not be useable for comparison purposes if the
function is generic, as CTFE creates a new function pointer for each
cast of a (monomorphized) generic function. However, this already
affects code running under Miri, and isn't a problem for `backtrace-rs`
(which only casts a non-generic function).

I've added logic to allow `MiriFrame` to have either 4 or 5 fields - if
a 5th field is present, we write the function pointer to it.

3 years agoImprove wording
Ralf Jung [Sun, 11 Oct 2020 22:15:01 +0000 (00:15 +0200)]
Improve wording

Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
3 years agoAuto merge of #1571 - lzutao:actions, r=RalfJung
bors [Sun, 11 Oct 2020 22:07:25 +0000 (22:07 +0000)]
Auto merge of #1571 - lzutao:actions, r=RalfJung

Adding a working github actions template

Complete adding github actions whose dummy template added in #1563 .

But it will need https://github.com/rust-lang/rust-central-station/pull/939 merged first
to be able to gate bors on Actions CI checks.

3 years agoAdd comment about deprecation
Aaron Hill [Sun, 11 Oct 2020 21:57:49 +0000 (17:57 -0400)]
Add comment about deprecation

3 years agoAuto merge of #1582 - Aaron1011:rustup-run-compiler, r=RalfJung
bors [Sun, 11 Oct 2020 21:45:09 +0000 (21:45 +0000)]
Auto merge of #1582 - Aaron1011:rustup-run-compiler, r=RalfJung

Rustup

This gets Miri building again after the `run_compiler` changes

3 years agoRustup
Aaron Hill [Sun, 11 Oct 2020 21:05:40 +0000 (17:05 -0400)]
Rustup

This gets Miri building again after the `run_compiler` changes

3 years agoApply suggestions from code review
Aaron Hill [Sun, 11 Oct 2020 15:05:14 +0000 (11:05 -0400)]
Apply suggestions from code review

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoAdd a working github actions template
Lzu Tao [Sun, 4 Oct 2020 15:01:10 +0000 (22:01 +0700)]
Add a working github actions template

3 years agoREADME: make our cross-interpretation feature stand out more
Ralf Jung [Sun, 11 Oct 2020 08:48:34 +0000 (10:48 +0200)]
README: make our cross-interpretation feature stand out more

3 years agoAdd an `fn_ptr` field to `MiriFrame`
Aaron Hill [Sat, 10 Oct 2020 17:07:57 +0000 (13:07 -0400)]
Add an `fn_ptr` field to `MiriFrame`

The `backtrace-rs` crate can use this to implement
`Frame::symbol_address`, which is used to skip frames
above the call to `Backtrace::capture` on the stack.

The function pointer will not be useable for comparison purposes if the
function is generic, as CTFE creates a new function pointer for each
cast of a (monomorphized) generic function. However, this already
affects code running under Miri, and isn't a problem for `backtrace-rs`
(which only casts a non-generic function).

I've added logic to allow `MiriFrame` to have either 4 or 5 fields - if
a 5th field is present, we write the function pointer to it.

3 years agoAuto merge of #1579 - lygstate:patch-1, r=RalfJung
bors [Fri, 9 Oct 2020 07:23:21 +0000 (07:23 +0000)]
Auto merge of #1579 - lygstate:patch-1, r=RalfJung

Update README.md

 Note however that
[leak checking is currently disabled on Windows targets](https://github.com/rust-lang/miri/issues/1302).

Windows issue are fixed

3 years agoUpdate README.md
Yonggang Luo [Fri, 9 Oct 2020 05:16:03 +0000 (13:16 +0800)]
Update README.md

 Note however that
[leak checking is currently disabled on Windows targets](https://github.com/rust-lang/miri/issues/1302).

Windows issue are fixed

3 years agoAuto merge of #1577 - RalfJung:rlib, r=RalfJung
bors [Wed, 7 Oct 2020 17:44:57 +0000 (17:44 +0000)]
Auto merge of #1577 - RalfJung:rlib, r=RalfJung

fix for rlib/cdylib crates in dependency tree

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

Unfortunately, I found no nice way to test for this.

3 years agofix for rlib/cdylib crates in dependency tree
Ralf Jung [Wed, 7 Oct 2020 17:42:33 +0000 (19:42 +0200)]
fix for rlib/cdylib crates in dependency tree

3 years agoAuto merge of #1550 - RalfJung:vecdeque, r=RalfJung
bors [Wed, 7 Oct 2020 07:05:52 +0000 (07:05 +0000)]
Auto merge of #1550 - RalfJung:vecdeque, r=RalfJung

test VecDeque::iter_mut aliasing

Blocked on https://github.com/rust-lang/rust/pull/76911

3 years agorustup; bring back mir-opt-level 3
Ralf Jung [Wed, 7 Oct 2020 07:05:18 +0000 (09:05 +0200)]
rustup; bring back mir-opt-level 3

3 years agotest VecDeque::iter_mut aliasing
Ralf Jung [Sat, 19 Sep 2020 09:33:16 +0000 (11:33 +0200)]
test VecDeque::iter_mut aliasing

3 years agoAuto merge of #1575 - Aaron1011:fix/macro-backtrace, r=oli-obk
bors [Tue, 6 Oct 2020 14:04:41 +0000 (14:04 +0000)]
Auto merge of #1575 - Aaron1011:fix/macro-backtrace, r=oli-obk

Use macro callsite spans in backtrace

This mirrors what we do in the debuginfo used for runtime backtraces.

3 years agoAuto merge of #1576 - RalfJung:gha, r=RalfJung
bors [Tue, 6 Oct 2020 11:36:22 +0000 (11:36 +0000)]
Auto merge of #1576 - RalfJung:gha, r=RalfJung

add bors notification jobs

There are probably ways to simplify this... I just copied this from the Rust repo and expanded the anchors and adjusted the `needs` thing. Hopefully this unblocks Miri PR landing.

3 years agoadd bors notification jobs
Ralf Jung [Tue, 6 Oct 2020 09:11:14 +0000 (11:11 +0200)]
add bors notification jobs

3 years agoUse macro callsite spans in backtrace
Aaron Hill [Mon, 5 Oct 2020 21:29:55 +0000 (17:29 -0400)]
Use macro callsite spans in backtrace

This mirrors what we do in the debuginfo used for runtime backtraces.

3 years agoAuto merge of #1573 - RalfJung:rustup, r=RalfJung
bors [Mon, 5 Oct 2020 08:31:18 +0000 (08:31 +0000)]
Auto merge of #1573 - RalfJung:rustup, r=RalfJung

rustup; disable opt level >=2 tests due to ICE

Cc https://github.com/rust-lang/rust/issues/77564 for the ICE

3 years agorustup; disable opt level >=2 tests due to ICE
Ralf Jung [Mon, 5 Oct 2020 08:22:41 +0000 (10:22 +0200)]
rustup; disable opt level >=2 tests due to ICE

3 years agoAuto merge of #1564 - Aaron1011:readlink, r=RalfJung
bors [Sun, 4 Oct 2020 21:07:55 +0000 (21:07 +0000)]
Auto merge of #1564 - Aaron1011:readlink, r=RalfJung

Implement `readlink`

Due to the truncating behavior of `readlink`, I was not able to
directly use any of the existing C-cstring helper functions.

3 years agomore punctuation
Ralf Jung [Sun, 4 Oct 2020 21:07:19 +0000 (23:07 +0200)]
more punctuation

3 years agoProperly capitalize PathConversion
Aaron Hill [Sun, 4 Oct 2020 20:28:09 +0000 (16:28 -0400)]
Properly capitalize PathConversion

3 years agoNormalize MIRI_TEMP before using it
Aaron Hill [Sun, 4 Oct 2020 20:26:09 +0000 (16:26 -0400)]
Normalize MIRI_TEMP before using it

3 years agoAuto merge of #1572 - RalfJung:rustup, r=RalfJung
bors [Sun, 4 Oct 2020 16:57:56 +0000 (16:57 +0000)]
Auto merge of #1572 - RalfJung:rustup, r=RalfJung

rustup; test NaN conversion issue

3 years agorustup; test NaN conversion issue
Ralf Jung [Sun, 4 Oct 2020 16:56:51 +0000 (18:56 +0200)]
rustup; test NaN conversion issue

3 years agoMove `convert_path_separator` to trait and use it in `readlink`
Aaron Hill [Sun, 4 Oct 2020 16:34:13 +0000 (12:34 -0400)]
Move `convert_path_separator` to trait and use it in `readlink`

3 years agoSwap order of assertions for easier debugging
Aaron Hill [Sun, 4 Oct 2020 13:41:15 +0000 (09:41 -0400)]
Swap order of assertions for easier debugging

3 years agoMake helper functions freestanding
Aaron Hill [Sun, 4 Oct 2020 12:00:26 +0000 (08:00 -0400)]
Make helper functions freestanding

3 years agoAdd trailing punctuation
Aaron Hill [Sat, 3 Oct 2020 16:59:23 +0000 (12:59 -0400)]
Add trailing punctuation

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoMerge `fs` and `fs_libc` tests
Aaron Hill [Sat, 3 Oct 2020 16:56:32 +0000 (12:56 -0400)]
Merge `fs` and `fs_libc` tests

3 years agoUse panicking coversions instead of `as`
Aaron Hill [Sat, 3 Oct 2020 16:52:06 +0000 (12:52 -0400)]
Use panicking coversions instead of `as`

3 years agoMove some helper functions around
Aaron Hill [Sat, 3 Oct 2020 16:51:46 +0000 (12:51 -0400)]
Move some helper functions around

3 years agoImplement `readlink`
Aaron Hill [Mon, 28 Sep 2020 19:02:54 +0000 (15:02 -0400)]
Implement `readlink`

Due to the truncating behavior of `readlink`, I was not able to
directly use any of the existing C-cstring helper functions.

3 years agoAuto merge of #1563 - lzutao:dummy-actions, r=RalfJung
bors [Sun, 4 Oct 2020 13:14:43 +0000 (13:14 +0000)]
Auto merge of #1563 - lzutao:dummy-actions, r=RalfJung

Add a dummy actions template to enable it on CI

I already had a complete template to transition from Travis and Appveyor.
Since actions will not run on repo haven't enabled it before.
I have this dummy template first to enable it on default branch.
We should address a few todo here, merge it and I will send another patch
to complete the migration.

3 years agoAdd a dummy actions template to enable it on CI
Lzu Tao [Sun, 4 Oct 2020 11:53:13 +0000 (18:53 +0700)]
Add a dummy actions template to enable it on CI

3 years agoAuto merge of #1570 - RalfJung:syscalls, r=RalfJung
bors [Sat, 3 Oct 2020 15:49:15 +0000 (15:49 +0000)]
Auto merge of #1570 - RalfJung:syscalls, r=RalfJung

check that all syscall arguments are scalars

`@m-ou-se` do you think this check makes sense?

The `abi` of a layout contains everything needed for the calling convention (as far as I know), so this should ensure that all the ignored arguments are passed like integers and do not otherwise mess up argument passing.

The one thing I am not sure about is what happens when more arguments are passed than fit in registers. The `syscall` man page says that all calling conventions support at least 6 arguments, except for "mips/o32" where it says that
```
       [1] The mips/o32 system call convention passes arguments 5 through 8 on the user stack.
```
If we assume that passing these extra arguments to futex is legal even with that calling convention, that would mean that those user stack arguments are just silently ignored as well, which seems plausible to me -- but I know very little about calling conventions.

3 years agocheck that all syscall arguments are scalars
Ralf Jung [Sat, 3 Oct 2020 14:01:53 +0000 (16:01 +0200)]
check that all syscall arguments are scalars

3 years agoAuto merge of #1569 - RalfJung:rustup, r=RalfJung
bors [Sat, 3 Oct 2020 13:28:37 +0000 (13:28 +0000)]
Auto merge of #1569 - RalfJung:rustup, r=RalfJung

bump Rust version and a bit of cleanup

3 years agomerge parking test into general synchronization test
Ralf Jung [Sat, 3 Oct 2020 13:27:23 +0000 (15:27 +0200)]
merge parking test into general synchronization test

3 years agoadd backtics back in isolation error message
Ralf Jung [Sat, 3 Oct 2020 13:20:16 +0000 (15:20 +0200)]
add backtics back in isolation error message

3 years agorustup
Ralf Jung [Sat, 3 Oct 2020 13:19:57 +0000 (15:19 +0200)]
rustup

3 years agoAuto merge of #1568 - fusion-engineering-forks:futex, r=RalfJung
bors [Sat, 3 Oct 2020 12:36:03 +0000 (12:36 +0000)]
Auto merge of #1568 - fusion-engineering-forks:futex, r=RalfJung

Implement futex_wait and futex_wake.

Fixes https://github.com/rust-lang/rust/issues/77406 and fixes #1562.

This makes std's park(), park_timeout(), and unpark() work. That means std::sync::Once is usable again and the test pass again with the latest rustc.

This also makes parking_lot work.

3 years agoAdd FIXME about type of `addr` in futex implementation.
Mara Bos [Sat, 3 Oct 2020 12:32:30 +0000 (14:32 +0200)]
Add FIXME about type of `addr` in futex implementation.

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoAdd note about use of force_ptr in futex implementation.
Mara Bos [Sat, 3 Oct 2020 12:21:37 +0000 (14:21 +0200)]
Add note about use of force_ptr in futex implementation.

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoUpdate syscall FIXME to include note about 'wrong' types.
Mara Bos [Sat, 3 Oct 2020 11:39:16 +0000 (13:39 +0200)]
Update syscall FIXME to include note about 'wrong' types.

3 years agoAdd test for futex syscall.
Mara Bos [Sat, 3 Oct 2020 11:09:11 +0000 (13:09 +0200)]
Add test for futex syscall.

3 years agoAdd FIXME note about variadic syscall().
Mara Bos [Sat, 3 Oct 2020 10:18:38 +0000 (12:18 +0200)]
Add FIXME note about variadic syscall().

3 years agoUse read_scalar_at_offset in futex_wait instead of memory.get_raw.
Mara Bos [Sat, 3 Oct 2020 10:11:24 +0000 (12:11 +0200)]
Use read_scalar_at_offset in futex_wait instead of memory.get_raw.

3 years agoUpdate expected error messages in tests.
Mara Bos [Sat, 3 Oct 2020 10:00:29 +0000 (12:00 +0200)]
Update expected error messages in tests.

3 years agoRemove backtics from isolation error.
Mara Bos [Sat, 3 Oct 2020 09:38:16 +0000 (11:38 +0200)]
Remove backtics from isolation error.

Otherwise `FUTEX_WAIT with timeout` will look weird.

3 years agoOnly allow FUTEX_WAIT with timeout when isoloation is disabled.
Mara Bos [Sat, 3 Oct 2020 09:35:13 +0000 (11:35 +0200)]
Only allow FUTEX_WAIT with timeout when isoloation is disabled.

3 years agoUse correct return type for syscall(SYS_futex).
Mara Bos [Fri, 2 Oct 2020 22:40:53 +0000 (00:40 +0200)]
Use correct return type for syscall(SYS_futex).

3 years agoAdd park/park_timeout/unpark test.
Mara Bos [Fri, 2 Oct 2020 21:35:00 +0000 (23:35 +0200)]
Add park/park_timeout/unpark test.

3 years agoImplement timeouts for FUTEX_WAIT.
Mara Bos [Fri, 2 Oct 2020 21:34:14 +0000 (23:34 +0200)]
Implement timeouts for FUTEX_WAIT.

3 years agoUse force_ptr in futex implementation.
Mara Bos [Fri, 2 Oct 2020 19:59:11 +0000 (21:59 +0200)]
Use force_ptr in futex implementation.

3 years agoAdd note about arguments in futex implementation.
Mara Bos [Fri, 2 Oct 2020 18:56:01 +0000 (20:56 +0200)]
Add note about arguments in futex implementation.

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoUpdate note about number of arguments to SYS_futex.
Mara Bos [Fri, 2 Oct 2020 18:53:31 +0000 (20:53 +0200)]
Update note about number of arguments to SYS_futex.

3 years agoAdd comments that document SYS_futex better.
Mara Bos [Fri, 2 Oct 2020 08:47:53 +0000 (10:47 +0200)]
Add comments that document SYS_futex better.

3 years agoImprove handling of the `addr` argument in SYS_futex.
Mara Bos [Fri, 2 Oct 2020 08:47:36 +0000 (10:47 +0200)]
Improve handling of the `addr` argument in SYS_futex.

3 years agoCheck maximum amount of arguments to SYS_futex.
Mara Bos [Fri, 2 Oct 2020 08:46:57 +0000 (10:46 +0200)]
Check maximum amount of arguments to SYS_futex.

3 years agoReturn correct value from futex_wait.
Mara Bos [Thu, 1 Oct 2020 23:49:20 +0000 (01:49 +0200)]
Return correct value from futex_wait.

3 years agoOnly check futex pointer in futex_wait and not in futex_wake.
Mara Bos [Thu, 1 Oct 2020 20:57:27 +0000 (22:57 +0200)]
Only check futex pointer in futex_wait and not in futex_wake.

futex_wake doesn't access the futex itself, so should accept pointers to
memory that's no longer there.

3 years agoErase tag from futex pointers.
Mara Bos [Thu, 1 Oct 2020 19:06:16 +0000 (21:06 +0200)]
Erase tag from futex pointers.

3 years agoMove futex syscall to its own file.
Mara Bos [Thu, 1 Oct 2020 19:03:36 +0000 (21:03 +0200)]
Move futex syscall to its own file.

3 years agoImplement futex_wait and futex_wake.
Mara Bos [Thu, 1 Oct 2020 18:47:31 +0000 (20:47 +0200)]
Implement futex_wait and futex_wake.

This does not support futex_wait with a timeout yet.

3 years agoAuto merge of #1566 - RalfJung:backtrace, r=RalfJung
bors [Wed, 30 Sep 2020 08:03:14 +0000 (08:03 +0000)]
Auto merge of #1566 - RalfJung:backtrace, r=RalfJung

normalize backtrace stderr even more

The test previously failed on rustc CI with this diff:
```
 $DIR/backtrace-api.rs:21:59 (func_c)
 $DIR/backtrace-api.rs:20:53 (func_b)
 $DIR/backtrace-api.rs:19:50 (func_a)
 $DIR/backtrace-api.rs:25:18 (main)
-RUSTLIB/src/rust/library/core/src/ops/function.rs:LL:COL (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn()))
-RUSTLIB/src/rust/library/std/src/sys_common/backtrace.rs:LL:COL (std::sys_common::backtrace::__rust_begin_short_backtrace)
-RUSTLIB/src/rust/library/std/src/rt.rs:LL:COL (std::rt::lang_start::{closure#0})
-RUSTLIB/src/rust/library/core/src/ops/function.rs:LL:COL (std::ops::function::impls::call_once)
-RUSTLIB/src/rust/library/std/src/panicking.rs:LL:COL (std::panicking::r#try::do_call)
-RUSTLIB/src/rust/library/std/src/panicking.rs:LL:COL (std::panicking::r#try)
-RUSTLIB/src/rust/library/std/src/panic.rs:LL:COL (std::panic::catch_unwind)
-RUSTLIB/src/rust/library/std/src/rt.rs:LL:COL (std::rt::lang_start_internal)
-RUSTLIB/src/rust/library/std/src/rt.rs:LL:COL (std::rt::lang_start)
+/checkout/library/core/src/ops/function.rs:227:5 (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn()))
+/checkout/library/std/src/sys_common/backtrace.rs:137:18 (std::sys_common::backtrace::__rust_begin_short_backtrace)
+/checkout/library/std/src/rt.rs:66:18 (std::rt::lang_start::{closure#0})
+/checkout/library/core/src/ops/function.rs:259:13 (std::ops::function::impls::call_once)
+/checkout/library/std/src/panicking.rs:381:40 (std::panicking::r#try::do_call)
+/checkout/library/std/src/panicking.rs:345:19 (std::panicking::r#try)
+/checkout/library/std/src/panic.rs:382:14 (std::panic::catch_unwind)
+/checkout/library/std/src/rt.rs:51:25 (std::rt::lang_start_internal)
+/checkout/library/std/src/rt.rs:65:5 (std::rt::lang_start)
```
Cc `@Aaron1011`

3 years agonormalize backtrace stderr even more
Ralf Jung [Wed, 30 Sep 2020 07:59:28 +0000 (09:59 +0200)]
normalize backtrace stderr even more

3 years agoAuto merge of #1565 - RalfJung:rustup, r=RalfJung
bors [Tue, 29 Sep 2020 09:05:35 +0000 (09:05 +0000)]
Auto merge of #1565 - RalfJung:rustup, r=RalfJung

rustup; adjust for rustc_driver changes

3 years agorustup; adjust for rustc_driver changes
Ralf Jung [Tue, 29 Sep 2020 08:31:41 +0000 (10:31 +0200)]
rustup; adjust for rustc_driver changes

3 years agoAuto merge of #1559 - Aaron1011:new-miri-backtrace, r=RalfJung
bors [Mon, 28 Sep 2020 19:16:50 +0000 (19:16 +0000)]
Auto merge of #1559 - Aaron1011:new-miri-backtrace, r=RalfJung

Add API for capturing backtrace

This PR adds two new Miri-defined extern functions:
`miri_get_backtrace` and `miri_resolve_frame`, which are documented in
the README. Together, they allow obtaining a backtrace for the currently
executing program.

I've added a test showing how these APIs are used. I've also prepared a
companion PR `backtrace-rs`, which will allow
`backtrace::Backtrace::new()` to work automatically under Miri.

Once these two PRs are merged, we will be able to print backtraces from
the normal Rust panic hook (since libstd is now using backtrace-rs).

A few notes:
* Resolving the backtrace frames is *very* slow - you can actually see
  each line being printed out one at a time. Some local testing showed
  that this is not (primrary) caused by resolving a `Span` - it seems
  to be just Miri being slow.
* For the first time, we now interact directly with a user-defined
  struct (instead of just executing the user-provided MIR that
  manipulates the struct). To allow for future changes, I've added
  a 'version' parameter (currently required to be 0). This should allow
  us to change the `MiriFrame` struct should the need ever arise.
* I used the approach suggested by `@oli-obk` - a returned backtrace
  pointer consists of a base function allocation, with the 'offset'
  used to encode the `Span.lo`. This allows losslessly reconstructing
  the location information in `miri_resolve_frame`.
* There are a few quirks on the `backtrace-rs` side:
  * `backtrace-rs` calls `getcwd()` by default to try to simplify
    the filename. This results in an isolation error by default,
    which could be annoying when printing a backtrace from libstd.
  * `backtrace-rs` tries to remove 'internal' frames (everything between
     the call to `Backtrace::new()` and the internal API call made by
     backtrace-rs) by comparing the returned frame pointer value to
     a Rust function pointer. This doesn't work due to the way we
     construct the frame pointers passed to the caller. We could
     attempt to support this kind of comparison, or just add a
    `#[cfg(miri)]` and ignore the frames ourselves.

3 years agoNormalize out generic arguments in backtrace-api stderr
Aaron Hill [Mon, 28 Sep 2020 17:55:23 +0000 (13:55 -0400)]
Normalize out generic arguments in backtrace-api stderr

3 years agofix typo
Ralf Jung [Mon, 28 Sep 2020 17:34:18 +0000 (19:34 +0200)]
fix typo

3 years agoRequire #[repr(C)] on MiriFrame
Aaron Hill [Sat, 26 Sep 2020 18:40:41 +0000 (14:40 -0400)]
Require #[repr(C)] on MiriFrame

3 years agoApply #[inline(never)] to functions that we want in the backtrace
Aaron Hill [Fri, 25 Sep 2020 03:00:32 +0000 (23:00 -0400)]
Apply #[inline(never)] to functions that we want in the backtrace

3 years agoUpdate README
Aaron Hill [Thu, 24 Sep 2020 23:10:09 +0000 (19:10 -0400)]
Update README

3 years agoMake some error messages lowercase
Aaron Hill [Thu, 24 Sep 2020 23:10:02 +0000 (19:10 -0400)]
Make some error messages lowercase

3 years agoExplain encoding scheme
Aaron Hill [Thu, 24 Sep 2020 23:06:39 +0000 (19:06 -0400)]
Explain encoding scheme

3 years agoMove things around
Aaron Hill [Thu, 24 Sep 2020 22:52:17 +0000 (18:52 -0400)]
Move things around

3 years agoPrint non-std frames to stdout in `backtrace-api` test
Aaron Hill [Thu, 24 Sep 2020 19:05:50 +0000 (15:05 -0400)]
Print non-std frames to stdout in `backtrace-api` test

3 years agoUse a 'flags' parameter instead of 'version'
Aaron Hill [Thu, 24 Sep 2020 18:18:47 +0000 (14:18 -0400)]
Use a 'flags' parameter instead of 'version'

3 years agoNormalize line and column numbers from the sysroot
Aaron Hill [Tue, 22 Sep 2020 14:58:18 +0000 (10:58 -0400)]
Normalize line and column numbers from the sysroot

3 years agoAdd API for capturing backtrace
Aaron Hill [Tue, 3 Dec 2019 02:15:58 +0000 (21:15 -0500)]
Add API for capturing backtrace

This PR adds two new Miri-defined extern functions:
`miri_get_backtrace` and `miri_resolve_frame`, which are documented in
the README. Together, they allow obtaining a backtrace for the currently
executing program.

I've added a test showing how these APIs are used. I've also prepared a
companion PR `backtrace-rs`, which will allow
`backtrace::Backtrace::new()` to work automatically under Miri.

Once these two PRs are merged, we will be able to print backtraces from
the normal Rust panic hook (since libstd is now using backtrace-rs).

A few notes:
* Resolving the backtrace frames is *very* slow - you can actually see
  each line being printed out one at a time. Some local testing showed
  that this is not (primrary) caused by resolving a `Span` - it seems
  to be just Miri being slow.
* For the first time, we now interact directly with a user-defined
  struct (instead of just executing the user-provided MIR that
  manipulates the struct). To allow for future changes, I've added
  a 'version' parameter (currently required to be 0). This should allow
  us to change the `MiriFrame` struct should the need ever arise.
* I used the approach suggested by @oli-obk - a returned backtrace
  pointer consists of a base function allocation, with the 'offset'
  used to encode the `Span.lo`. This allows losslessly reconstructing
  the location information in `miri_resolve_frame`.
* There are a few quirks on the `backtrace-rs` side:
  * `backtrace-rs` calls `getcwd()` by default to try to simplify
    the filename. This results in an isolation error by default,
    which could be annoying when printing a backtrace from libstd.
  * `backtrace-rs` tries to remove 'internal' frames (everything between
     the call to `Backtrace::new()` and the internal API call made by
     backtrace-rs) by comparing the returned frame pointer value to
     a Rust function pointer. This doesn't work due to the way we
     construct the frame pointers passed to the caller. We could
     attempt to support this kind of comparison, or just add a
    `#[cfg(miri)]` and ignore the frames ourselves.

3 years agoAuto merge of #1555 - lzutao:upstream-assume-const, r=RalfJung
bors [Sun, 27 Sep 2020 08:31:09 +0000 (08:31 +0000)]
Auto merge of #1555 - lzutao:upstream-assume-const, r=RalfJung

Remove assume intrinsic from EvalContextExt

Waiting for https://github.com/rust-lang/rust/pull/76973 merged.

3 years agoRemove assume intrinsic from EvalContextExt
Lzu Tao [Sun, 27 Sep 2020 03:00:06 +0000 (10:00 +0700)]
Remove assume intrinsic from EvalContextExt

It has been moved to rustc_mir.