Commit Graph

5518 Commits

Author SHA1 Message Date
Ralf Jung
bf8b2aa8dc add test for better ptr handling in enum niches 2021-07-17 13:59:58 +02:00
Ralf Jung
a1233a721d adjust Miri to Pointer type overhaul 2021-07-16 10:10:12 +02:00
bors
a4a9a36d20 Auto merge of #1850 - RalfJung:fmt, r=RalfJung
fmt: set force_multiline_blocks=true

This is an experiment, I am not yet sure if I like it... but it does prevent rustfmt from putting stuff after the `=>` in a `match` (unless the entire arm fits there), which IMO is a big plus. What do others think?
(I also tried setting `match_arm_blocks` back to its default of `true`, but that adds too many braces for my taste.)

Btw, `@calebcartwright` is the interaction of `match_arm_blocks = false` and `force_multiline_blocks = true` as can be seen here expected? I think I like it, but it it is not at all what I expected from the docs which describe `force_multiline_blocks = true` as "Force multiline closure and match arm bodies to be wrapped in a block" -- but here that is not the effect it has, there are no new blocks being added.
2021-07-12 16:26:02 +00:00
Ralf Jung
cffa1d325c fmt cargo-miri 2021-07-11 14:27:07 +02:00
Ralf Jung
0341b8ac84 fmt: set force_multiline_blocks=true 2021-07-11 14:18:44 +02:00
bors
b06130762e Auto merge of #1849 - Aaron1011:rustup-track-caller, r=RalfJung
Rustup for `#[track_caller]` trait object changes

Change test to assert that we get the correct location
even through a trait object call.
2021-07-10 17:15:31 +00:00
Aaron Hill
811423e761
Rustup for #[track_caller] trait object changes
Change test to assert that we get the correct location
even through a trait object call.
2021-07-10 11:51:00 -05:00
bors
3cf6550cc1 Auto merge of #1848 - RalfJung:rustup, r=RalfJung
rustup

Cc https://github.com/rust-lang/rust/issues/86923
2021-07-07 07:33:42 +00:00
Ralf Jung
833dff994f rustup 2021-07-07 09:33:01 +02:00
bors
4a30b68d45 Auto merge of #1846 - RalfJung:license, r=RalfJung
sync license files with rustc repo

`@Mark-Simulacrum` pointed out that our license files are slightly different from those in rustc. This syncs them.

The question is... is this a thing we can just do?^^
2021-07-06 11:58:42 +00:00
bors
74f81e952c Auto merge of #1847 - RalfJung:more-tags, r=RalfJung
also treat CallerLocation and Machine memory as properly tagged

Only heap allocations need an exception.
2021-07-06 08:14:03 +00:00
Ralf Jung
447f23c71b fmt 2021-07-06 10:13:30 +02:00
Ralf Jung
340267525c exported_symbols_cache: ensure we do not overwrite anything 2021-07-06 10:09:53 +02:00
Ralf Jung
9b57313a4d also treat CallerLocation and Machine memory as properly tagged 2021-07-06 10:07:48 +02:00
Ralf Jung
efd582c6d8 explicitly list memory kinds for stacked borrows 2021-07-06 10:04:16 +02:00
Ralf Jung
ca782dfc1c sync license files with rustc repo 2021-07-05 19:34:08 +02:00
bors
15e81a94b1 Auto merge of #1845 - Smittyvb:fix-after-mir-alloc-oom, r=RalfJung
Make work with latest rustc

Cc https://github.com/rust-lang/rust/issues/86863, which was caused by PR https://github.com/rust-lang/rust/pull/86255.
2021-07-04 20:35:34 +00:00
Smitty
d19376985d Make work after mir-alloc-oom 2021-07-04 09:59:55 -04:00
bors
6a18683d09 Auto merge of #1842 - hyd-dev:target-dir, r=RalfJung
Use `miri` inside the target directory used by rustc as Miri's target directory

Resolves #1311.

This PR makes Miri use `miri` inside the rustc target directory as its target directory, by letting `cargo-miri` get the rustc target directory by calling `cargo metadata`, append `miri` to it, and pass it with `--target-dir` to Cargo.

Getting the rustc target directory accurately requires calling `cargo metadata` as far as I know, because the `target-dir` can be set in config files in various places that are hard for `cargo-miri` to find.

I also considered https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#custom-named-profiles, but it looks like that requires adding `cargo-features = ["named-profiles"]` to **`Cargo.toml`**, which would be tricky for `cargo-miri`:
```
$ cargo +nightly-2021-06-23 test --config 'profile.miri.inherits="release"' --profile=miri -Z named-profiles -Z unstable-options
error: config profile `miri` is not valid (defined in `--config cli option`)

Caused by:
  feature `named-profiles` is required

  consider adding `cargo-features = ["named-profiles"]` to the manifest
```
2021-07-03 07:34:41 +00:00
bors
05fdec916a Auto merge of #1844 - hyd-dev:rustup, r=RalfJung
Update for `TyCtxt::crates()` change

cc rust-lang/rust#86792
2021-07-02 08:49:49 +00:00
hyd-dev
e3fca9b3f1
Import std::process::self 2021-07-02 16:39:43 +08:00
hyd-dev
c504e3dee0
Add a comment in .github/workflows/ci.yml 2021-07-02 16:39:43 +08:00
hyd-dev
76fe48543c
Update for TyCtxt::crates() change 2021-07-02 16:08:27 +08:00
bors
61605ebde2 Auto merge of #1843 - RalfJung:rustup, r=RalfJung
rustup

Cc https://github.com/rust-lang/rust/issues/86723
2021-06-29 18:48:08 +00:00
Ralf Jung
e33bf695db rustup 2021-06-29 20:47:28 +02:00
hyd-dev
08236912a7
Improve doc comment 2021-06-27 23:10:09 +08:00
hyd-dev
7d310aa836
Fix .expect() message 2021-06-27 23:08:38 +08:00
hyd-dev
e751eeb197
drop(cmd.arg(arg)) -> cmd.arg(arg); 2021-06-27 23:07:15 +08:00
hyd-dev
34217bdc8e
Use rustup-toolchain-install-master to install Cargo 2021-06-27 23:05:08 +08:00
hyd-dev
1692932966
Show error if --target-dir is provided more than once 2021-06-26 22:36:05 +08:00
hyd-dev
8f87903ec9
Fix typo 2021-06-26 22:22:40 +08:00
hyd-dev
2ced7ecb9f
ArgFlagValueWithOtherArgsIter -> ArgSplitFlagValue 2021-06-26 22:21:07 +08:00
hyd-dev
59408b68dd
Add some comments in test-cargo-miri/run-tests.py 2021-06-26 22:21:07 +08:00
hyd-dev
c3ad18256d
long closure -> function 2021-06-26 22:21:07 +08:00
hyd-dev
2d17b5a550
Use miri inside the target directory used by rustc as Miri's target directory 2021-06-25 01:09:10 +08:00
bors
4933e280b2 Auto merge of #1841 - RalfJung:debug, r=RalfJung
use exhaustive struct match for manual Debug impl
2021-06-20 17:47:42 +00:00
Ralf Jung
7b2d2cfa46 use exhaustive struct match for manual Debug impl 2021-06-20 19:33:05 +02:00
bors
23f05fc603 Auto merge of #1840 - hyd-dev:rustup, r=RalfJung
Update backtraces

(rust-lang/rust#86034 changed them.)

cc rust-lang/rust#86474
2021-06-20 09:54:48 +00:00
hyd-dev
2644647053
Update backtraces 2021-06-20 15:12:11 +08:00
bors
5b7f1f919b Auto merge of #1839 - RalfJung:rustup, r=RalfJung
rustup

Cc https://github.com/rust-lang/rust/issues/86409
2021-06-17 18:53:16 +00:00
Ralf Jung
7f3dd37f1e rustup 2021-06-17 20:52:35 +02:00
bors
35af23b6a9 Auto merge of #1833 - hyd-dev:82261, r=RalfJung
Filter out items other than non-generic functions and statics in our version of `exported_symbols`

[`#[no_mangle]` on a `use` item](https://docs.rs/brotli-decompressor/2.3.1/src/brotli_decompressor/ffi/mod.rs.html#3-5) can make Miri ICE when compiling a dependency (rust-lang/rust#86261):
```rs
#[no_mangle]
use std::{thread,panic, io, boxed, any, string};
```

<details>

```
error: internal compiler error: compiler/rustc_middle/src/ty/mod.rs:1650:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: Misc, disambiguator: 14 }], krate: crate0 }

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1007:9
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util:🐛:opt_span_bug_fmt
   6: rustc_middle::util:🐛:bug_fmt
   7: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::item_name
   8: rustc_symbol_mangling::symbol_name_provider
   9: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::symbol_name>::compute
  10: rustc_query_system::query::plumbing::get_query_impl
  11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::symbol_name
  12: rustc_middle::middle::exported_symbols::ExportedSymbol::symbol_name_for_local_instance
  13: rustc_codegen_ssa:🔙:symbol_export::symbol_name_for_instance_in_crate
  14: rustc_codegen_ssa:🔙:linker::exported_symbols
  15: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  16: rustc_codegen_ssa:🔙:linker::LinkerInfo::new
  17: rustc_codegen_ssa:🔙:write::start_async_codegen
  18: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  19: rustc_interface::passes::QueryContext::enter
  20: rustc_interface::queries::Queries::ongoing_codegen
  21: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  22: rustc_span::with_source_map
  23: rustc_interface::interface::create_compiler_and_run
  24: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.54.0-nightly (a50d72158 2021-06-08) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=1 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [symbol_name] computing the symbol for `{misc#14}`
end of query stack
```
</details>

This might be because in #1776, we override the `exported_symbols` query, and our version of `exported_symbols` can return a `use` item which don't have a name if the `use` item is tagged with `#[no_mangle]`, and then:
- `rustc_codegen_ssa:🔙:symbol_export::symbol_name_for_instance_in_crate` is called for for every `exported_symbols`: fb3ea63d9b/compiler/rustc_codegen_ssa/src/back/linker.rs (L1300-L1304)
- it calls `rustc_middle::middle::exported_symbols::ExportedSymbol::symbol_name_for_local_instance`: fb3ea63d9b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs (L412)
- which calls `rustc_symbol_mangling::symbol_name_provider`: fb3ea63d9b/compiler/rustc_middle/src/middle/exported_symbols.rs (L37-L44)
- which calls `item_name`: fb3ea63d9b/compiler/rustc_symbol_mangling/src/lib.rs (L216), which triggers the ICE

It might also be problematic for d39f0c64b8/src/shims/foreign_items.rs (L165) which also uses `item_name`, but Miri cannot compile the dependency, so that code can't be reached.

Therefore, this PR makes `exported_symbols` filter out all items that are not functions or statics, so all items returned will have a name, which avoids the ICE (I have tested it in the https://github.com/jorgecarleitao/arrow2 repository).
(This PR also includes a commit that fixes a small (unrelated) bug for `#[no_mangle]` on associated functions -- I found that because I notice `#[no_mangle]` is supported on associated functions and they should not be filtered out in `exported_symbols`.)

Fixes (when the submodule is bumped) rust-lang/rust#86261.
2021-06-15 10:07:24 +00:00
bors
486b5dfe74 Auto merge of #1832 - hyd-dev:1776-follow-up, r=RalfJung
Report an error if a `#[no_mangle]`/`#[export_name = ...]` function has the same symbol name as a built-in shim

Implements https://github.com/rust-lang/miri/pull/1776#issuecomment-821322605.

The error looks like this:
```
error: found `malloc` symbol definition that clashes with a built-in shim
  --> tests/compile-fail/function_calls/exported_symbol_shim_clashing.rs:12:9
   |
12 |         malloc(0);
   |         ^^^^^^^^^ found `malloc` symbol definition that clashes with a built-in shim
   |
help: the `malloc` symbol is defined here

  --> tests/compile-fail/function_calls/exported_symbol_shim_clashing.rs:2:1
   |
2  | / extern "C" fn malloc(_: usize) -> *mut std::ffi::c_void {
3  | |     //~^ HELP the `malloc` symbol is defined here
4  | |     unreachable!()
5  | | }
   | |_^
   = note: inside `main` at tests/compile-fail/function_calls/exported_symbol_shim_clashing.rs:12:9
```

This does not implement "better error messages than we do currently for arg/ABI mismatches" in https://github.com/rust-lang/miri/pull/1776#issuecomment-821343175 -- I failed to remove all `check_arg_count()` and `check_abi()` (they are still used in `src/shims/intrinsics.rs` and `call_dlsym()`) and they don't receive the name of the shim.
2021-06-15 09:53:05 +00:00
bors
042db78ab3 Auto merge of #1836 - hyd-dev:rustup, r=RalfJung
Rustup

cc https://github.com/rust-lang/rust/issues/86316

(I beat `@lqd` to this!)
2021-06-15 09:38:44 +00:00
hyd-dev
dfd7a6d5aa
Rustup 2021-06-15 16:12:47 +08:00
hyd-dev
aaaa142dc1
Rename all link_name_sym to link_name and remove the only remaining let link_name = link_name_sym.as_str() 2021-06-15 01:24:09 +08:00
hyd-dev
9011524454
Remove strip_linker_suffix 2021-06-15 01:16:38 +08:00
hyd-dev
a67a65359f
Only pass Symbol to emulate_foreign_item_by_name 2021-06-15 00:43:15 +08:00
hyd-dev
34603e586f
Add whitespace 2021-06-14 23:38:15 +08:00
hyd-dev
d1e72d0854
Check argument count for CreateThread 2021-06-14 23:01:06 +08:00