compiletest: call cargo-miri directly rather than via 'cargo run'
Fixes https://github.com/rust-lang/miri/issues/3297. Thanks to `@bjorn3` for figuring out the cause of this.
r? `@oli-obk`
Add "cargo miri clean" command
My first reaction when my miri cache was messed up was to attempt run this, which obviously failed. This helps paper over platform differences and such.
Windows miri-script execution egronomics
This allows for Windows users to use miri-script without pain. As working on miri earlier I was doing
`.\miri-script\target\debug\miri-script.exe { install | build | ... }` which wasn't fun.
In `auxiliary/sigpipe-utils.rs`, all we want to know is the current
`SIGPIPE` disposition. We should not change it. So use `libc::sigaction`
instead of `libc::signal`. That way we can also remove the code that
restores it.
Those libraries are build with `-C panic=unwind` and is expected to
be linkable to `-C panic=abort` library. To ensure unsoundness
compiler needs to prevent a `C-unwind` call to exist, as doing so may leak
foreign exceptions into `-C panic=abort`.
compiler/rustc_target/src/spec/base/apple/tests.rs: Avoid unnecessary large move
Fixes:
$ MAGIC_EXTRA_RUSTFLAGS=-Zmove-size-limit=4096 ./x test compiler/rustc_target
error: moving 6216 bytes
--> compiler/rustc_target/src/spec/base/apple/tests.rs:17:19
|
17 | for target in all_sim_targets {
| ^^^^^^^^^^^^^^^ value moved from here
|
= note: The current maximum size is 4096, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
= note: `-D large-assignments` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(large_assignments)]`
Part of https://github.com/rust-lang/rust/issues/83518
The goal is to enable the lint by default at one point. There are many cases where it needs to be allowed. But here we don't need to allow it. We can simply fix it.
I don't want to enable the lint in the file, because I don't want the "default size threshold for when a value is OK to move" to be duplicated in many places. We'll want the threshold in one central place once we enable it by default.
Ignore less tests in debug builds
Since https://github.com/rust-lang/rust/pull/120594 and https://github.com/rust-lang/rust/pull/120863, nearly all UB-detecting debug assertions get compiled out of code that is monomorphized by a crate built with debug assertions disabled.
Which means that if we default all our codegen tests to `-Cdebug-assertions=no`, most of them work just fine against a sysroot built with debug assertions.
I also tried to explain a bit better why some tests need to be skipped, for those that still need to be skipped.
Rustdoc: include crate name in links for local primitives
Fixes#121106.
This change makes links to primitives easier to use when the path of the page where they will be embedded is not known beforehand such as when we generate impls dynamically from the `register_type_impls` method in `main.js`, which is exactly what is happening in #121106.
An example to show the effect of this change: earlier, if the current page in `cx.current` inside `primitive_link_fragment()` was `std::simd::prelude::Simd` the generated path would be `../../primitive.<prim>.html`. Now it would be `../../../std/primitive.<prim>.html` instead.
A side effect of the change is that local primitive links _everywhere_ will now contain the crate name, even outside of the dynamic situation mentioned above. I'm not sure if there are any major downsides of that other than making the links a bit longer. Ideally I wanted to restrict this behaviour change to only the dynamic cases. We could have achieved that by passing an additional bool arg to `primitive_link_fragment()`, but it felt awkward to do so. Any alternative suggestions are welcome.
Account for RPITIT in E0310 explicit lifetime constraint suggestion
When given
```rust
trait Original {
fn f() -> impl Fn();
}
trait Erased {
fn f(&self) -> Box<dyn Fn()>;
}
impl<T: Original> Erased for T {
fn f(&self) -> Box<dyn Fn()> {
Box::new(<T as Original>::f())
}
}
```
emit do not emit an invalid suggestion restricting the `Trait::{opaque}` type in a `where` clause:
```
error[E0310]: the associated type `<T as Original>::{opaque#0}` may not live long enough
--> $DIR/missing-static-bound-from-impl.rs:11:9
|
LL | Box::new(<T as Original>::f())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the associated type `<T as Original>::{opaque#0}` must be valid for the static lifetime...
| ...so that the type `impl Fn()` will meet its required lifetime bounds
```
Partially address #119773. Ideally we'd suggest modifying `Erased::f` instead.
r? `@compiler-errors`
Add short flag -V for consistency with other rust tooling
Minor change to add the `-V` short flag to `rust-analyzer` to bring it in-line with other rust tooling such as:
> rustc -V
```bash
rustc 1.76.0 (07dca489a 2024-02-04)
```
> rustup -V
```bash
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.76.0 (07dca489a 2024-02-04)`
```
> cargo -V
```bash
cargo 1.76.0 (c84b36747 2024-01-18)
```
Fixes:
$ MAGIC_EXTRA_RUSTFLAGS=-Zmove-size-limit=4096 ./x test compiler/rustc_target
error: moving 6216 bytes
--> compiler/rustc_target/src/spec/base/apple/tests.rs:17:19
|
17 | for target in all_sim_targets {
| ^^^^^^^^^^^^^^^ value moved from here
|
= note: The current maximum size is 4096, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
= note: `-D large-assignments` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(large_assignments)]`
It makes the link easier to use in cases in which
the path of the page where it will be embedded is not
known beforehand such as when we generate impls
dynamically from `register_type_impls` method in
`main.js`
Earlier for local primitives we would generate a path
that was relative to the current page depth passed in `cx.current`
. e.g if the current page was `std::simd::prelude::Simd` the
generated path would be `../../primitive.<prim>.html` After this
change the path will first take you to the the wesite root and add
the crate name. e.g. for `std::simd::prelude::Simd` the path now
will be `../../../std/primitive.<prim>.html`
Fixes the explanation how to use is_finished to achieve a non-blocking
join. The updated version matches the documentation of the non-scoped
JoinHandle::is_finished.
fix: Recompiles due to RUSTC_BOOTSTRAP
Some packages (e.g. thiserror) force a recompile if the value of the `RUSTC_BOOTSTRAP` env var changes. RA sets the variable to 1 in order to enable rustc / cargo unstable options. This causes flapping recompiles when building outside of RA.
Fixes#15057
Make QNX/NTO specific "timespec capping" public to crate::sys
It is used in:
- `library/std/src/sys/locks/condvar/pthread.rs`
- `library/std/src/sys/pal/unix/thread_parking/pthread.rs`
This is probably required due to introduction of `sys/pal` and #121177
`@rustbot` label +O-neutrino
CC: `@jonathanpallant` `@japaric` `@gh-tr`
coverage: Rename `is_closure` to `is_hole`
Extracted from #121433, since I was having second thoughts about some of the other changes bundled in that PR, but these changes are still fine.
---
When refining covspans, we don't specifically care which ones represent closures; we just want to know which ones represent "holes" that should be carved out of other spans and then discarded.
(Closures are currently the only source of hole spans, but in the future we might want to also create hole spans for nested items and inactive `#[cfg(..)]` regions.)
``@rustbot`` label +A-code-coverage