Miri leak check: memory reachable through globals is not leaked
Also make Miri memory dump prettier by sharing more code with MIR dumping, and fix a bug where the Miri memory dump would print some allocations twice.
r? @oli-obk
Miri PR: https://github.com/rust-lang/miri/pull/1301
Small tweaks in ToOwned::clone_into
- `<[T]>::clone_into` is slightly more optimized.
- `CStr::clone_into` is new, letting it reuse its allocation.
- `OsStr::clone_into` now forwards to the underlying slice/`Vec`.
Speed up path searching with `find_library_crate`.
By doing prefix and suffix checking on a `String` copy of each relevant
`PathBuf`, rather than the `PathBuf` itself.
ty/walk: iterate `GenericArg`s instead of `Ty`s.
Before this PR, `Ty::walk` only iterated over `Ty`s, but that's becoming an increasing problem with `const` generics, as `ty::Const`s in `Substs` are missed by it.
By working with `GenericArg` instead, we can handle both `Ty`s and `ty::Const`s, but also `ty::Region`s, which used to require ad-hoc mechanisms such as `push_regions`.
I've also removed `TraitRef::input_types`, as it's both long obsolete, and easy to misuse.
Miri terminator handling: only do progress sanity check for 'Call' terminator
This will still catch mistakes in bad intrinsic/foreign-item shims, which is the main source of errors here.
Fixes https://github.com/rust-lang/rust/issues/70723
r? @oli-obk
Rollup of 5 pull requests
Successful merges:
- #70519 (Tweak output of type params and constraints in the wrong order)
- #70704 (Make panic unwind the default for aarch64-*-windows-msvc targets)
- #70713 (Prefer sysroot from rustc in same directory as rust-gdb)
- #70739 (def_collector, visit_fn: account for no body)
- #70827 (Use smaller span for suggestion restricting lifetime)
Failed merges:
r? @ghost
Make panic unwind the default for aarch64-*-windows-msvc targets
With the llvm fixes from rust-lang/llvm-project#45 (included as a submodule change) we can enable unwinding by default for these targets.
Fixes#65313
There are still a small number of test failures for which we can open individual issues.
r? @alexcrichton
Rollup of 7 pull requests
Successful merges:
- #70553 (move OS constants to platform crate)
- #70665 (Do not lose or reorder user-provided linker arguments)
- #70750 (Match options directly in the Fuse implementation)
- #70782 (Stop importing the float modules in documentation)
- #70798 ("cannot resolve" → "cannot satisfy")
- #70808 (Simplify dtor registration for HermitCore by using a list of destructors)
- #70824 (Remove marker comments in libstd/lib.rs macro imports)
Failed merges:
r? @ghost
Remove marker comments in libstd/lib.rs macro imports
These comments were probably moved around when rustfmt was introduced. They don't correctly denote what they were intended for, so I propose we remove them instead. Thanks!
Simplify dtor registration for HermitCore by using a list of destructors
The implementation is similar to the macOS version and doesn't depend on additional OS support
Stop importing the float modules in documentation
Follow up to #69860. I realized I had not searched for and fixed this for the float values. So with this PR they also use the associated constants instead of the module level constants.
For the documentation where it also was using the `consts` submodule I opted to change it to import that directly. This becomes more in line with how other docs that use the `consts` submodule looks. And it also makes it so there are not two `f32` or `f64` things in the current namespace (both the module and the primitive type) and then hopefully confusing documentation readers less.
r? @dtolnay
Match options directly in the Fuse implementation
Rather than using `as_ref()`, `as_mut()`, and `?`, we can use `match` directly to save a lot of generated code. This was mentioned as a possibility in https://github.com/rust-lang/rust/pull/70366#issuecomment-603462546, and I found that it had a very large impact on #70332 using `Fuse` within `Chain`. Let's evaluate this change on its own first.
Do not lose or reorder user-provided linker arguments
Linker arguments are potentially order-dependent, so the order in which `-C link-arg` and `-C link-args` options are passed to `rustc` should be preserved when they are passed further to the linker.
Also, multiple `-C link-args` options are now appended to each other rather than overwrite each other.
In other words, `-C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f` is now passed as `"a" "b" "c" "d" "e" "f"` and not as `"d" "e" "a" "f"`.
Addresses https://github.com/rust-lang/rust/pull/70505#issuecomment-606780163.