Rename `rustc_middle::lint::diag_lint_level` into `lint_level`
Part of https://github.com/rust-lang/rust/issues/153099.
Renaming back `diag_lint_level` into `lint_level` since the original function was completely replaced and removed.
r? @JonathanBrouwer
Include optional `dso_local` marker for functions in `enum-[match,transparent-extract].rs`
This PR adds some more `dso_local` markers to the `enum-match.rs` and `enum-transparent-extract.rs` test annotations. These markers are added by LLVM when targeting `aarch64-unknown-none` even though they are missing in `aarch64-unknown-linux-gnu`. This is causing a CI error when running the codegen suite on the `aarch64-unknown-none` target for Ferrocene.
This is a follow up of https://github.com/rust-lang/rust/pull/139891.
Rollup of 5 pull requests
Successful merges:
- rust-lang/rust#153705 (Always generate generics in delegation that match trait in trait impl scenario)
- rust-lang/rust#153751 (Detect existing turbofish on method calls to suppress useless suggestion)
- rust-lang/rust#153780 (Remove `MTLock`)
- rust-lang/rust#151572 (Fix Hexagon ABI calling convention for small aggregates)
- rust-lang/rust#153725 (Fix that `./x test --no-doc` actually keeps the same behaviour for backwards compatability)
Fix that `./x test --no-doc` actually keeps the same behaviour for backwards compatability
In https://github.com/rust-lang/rust/pull/153143 the `./x test --no-doc` flag was renamed to `--all-targets`. I added a commit that keeps the `--no-doc` flag for backwards compatibility, but unfortunately I forgot to actually keep the behaviour the same, which is fixed by this PR.
r? @Kobzol
Fix Hexagon ABI calling convention for small aggregates
Small structs (<= 64 bits) were being passed with their fields split into separate arguments instead of being packed into register-sized chunks. This caused ABI mismatches.
The fix properly casts small aggregates to consecutive register-sized chunks using Uniform::consecutive(), matching the Hexagon C ABI where small structs are packed into R1:0 register pair.
This fixes tests like extern-pass-TwoU16s.rs and extern-pass-TwoU8s.rs.
Remove `MTLock`
This removes the `MTLock` type and replaces it users with the regular `Lock`. It no longer makes sense now that we don't have a compile-time toggle for parallelism.
Detect existing turbofish on method calls to suppress useless suggestion
`expr_inferred_arg_iter` hardcoded `have_turbofish: false` for `MethodCall` expressions, while the `Path` case properly checked for existing type arguments via `segment.args`. This meant the "consider specifying the generic arguments" suggestion always fired on method calls, even when the user already had a turbofish, producing a suggestion that just rewrote user syntax into fully qualified form without resolving anything.
Fixesrust-lang/rust#153732.
cc @eggyal
Always generate generics in delegation that match trait in trait impl scenario
After rust-lang/rust#151864 there is a change in delegation code generation in `trait impl` cases: after rust-lang/rust#151864 we started to look at user-specified args and generate functions, whose generics may not match the signature of the function that is defined in trait. Such handling of delegation from trait impl is not correct, as the generated function should always have the same generics as its signature function in trait.
This addresses the "Fix generic params generation in trait impl case" future work from rust-lang/rust#151864
r? @petrochenkov
actually make the is-fn test test what it says it tests
r? @lcnr
Previously this test was (apart from the comment) identical to tests/ui/async-await/async-closures/once.rs
editorconfig: css uses tabs
Tidy enforces the fact that css files use tabs, but currently `.editorconfig` says everything that isn't llvm or a Makefile should always use spaces. This PR makes it so all editors that honor `.editorconfig` will use the correct indentation for css files.
unused_macro_rules switched used and unused comments
Incorrect swapping of "used" and "unused".
The lint example:
```rust
#[warn(unused_macro_rules)]
macro_rules! unused_empty {
(hello) => { println!("Hello, world!") }; // This rule is unused
() => { println!("empty") }; // This rule is used
}
fn main() {
unused_empty!(hello);
}
```
It is clearly using the `(hello)` case. Yet it is labeled as "unused".
This PR fixed that small issue and corrects the mistake.
fix(query): Pass Query Key to `value_from_cycle_error`
### Summary:
Pass the query key directly to `value_from_cycle_error` so that `FromCycleError` impls (notably `FnSig`) can use the recovered query's `DefId` instead of relying on `cycle[0]`, which is arbitrarily rotated by the parallel deadlock handler.
As suggested in [#153644 (comment)](https://github.com/rust-lang/rust/pull/153644#issuecomment-4030645331).
Closesrust-lang/rust#153391
r? @nnethercote
cc @zetanumbers
Fix some comments about dataflow analysis.
Mostly in the examples in `initialized.rs`. In particular, the `EverInitializedPlaces` example currently doesn't cover how it's initialization sites that are tracked, rather than local variables (that's the `b_0`/`b_1` distinction in the example.)
r? @cjgillot
Don't add empty target features for target-cpu=native on macOS
LLVM does not support host feature detection (only host cpu detection) on apple platforms. As such, the returned feature string will be empty. Adding this empty string to the target-features attribute results in a verifier error on LLVM 22.
Fix this by not adding the empty string to the target features. The reason why this was not caught by the target-cpu-native test is that it requires a function that adds *some* target features, otherwise the attribute is omitted entirely. We achieve this with a somewhat peculiar construction that enables `neon` if it's already enabled. (This is to avoid enabling it on softfloat targets.)
Fixes https://github.com/rust-lang/rust/issues/153397.
LLVM does not support host feature detection (only host cpu
detection) on apple platforms. As such, the returned feature
string will be empty. Adding this empty string to the target-features
attribute results in a verifier error on LLVM 22.
Fix this by not adding the empty string to the target features.
The reason why this was not caught by the target-cpu-native test
is that it requires a function that adds *some* target features,
otherwise the attribute is omitted entirely. We achieve this with
a somewhat peculiar construction that enables `neon` if it's
already enabled. (This is to avoid enabling it on softfloat targets.)
Make Enzyme has dependent on LLVM hash
This issue was encountered a few times by autodiff contributors.
Closes https://github.com/rust-lang/rust/issues/152969
Just adding the llvm hash here triggered a rebuild of Enzyme locally, but I'll admit I didn't try it with a real llvm submodule update.
r? @Kobzol
miri-test-libstd: use --tests and update some comments
rust-lang/rust#153143 added `./x test --tests` matching `cargo --tests`, which is exactly what Miri wants when testing the standard library. So let's use it for that. We can then also remove a hack in `library/alloctests/benches/vec_deque_append.rs`.
Also update the comment for why the other benchmarks still need to be disabled in Miri, and remove some `cfg_attr` that seem unnecessary since the entire crate that contains them is already disabled in Miri. Those were copied over in https://github.com/rust-lang/rust/commit/b8fa843a1a60146b93ca5b1d11bbe23c1b1076f3 -- they used to be needed since benches and tests were in the same crate, but they aren't any more.
Introduce `for_each_query_vtable!` to move more code out of query macros
After https://github.com/rust-lang/rust/pull/153114 moved a few for-each-query functions into the big `rustc_query_impl::plumbing` macro, I have found that those functions became much harder to navigate and modify, because they no longer have access to ordinary IDE features in rust-analyzer. Even *finding* the functions is considerably harder, because a plain go-to-definition no longer works smoothly.
This PR therefore tries to move as much of that code back out of the macro as possible, with the aid of a smaller `for_each_query_vtable!` helper macro. A typical use of that macro looks like this:
```rust
for_each_query_vtable!(ALL, tcx, |query| {
query_key_hash_verify(query, tcx);
});
```
The result is an outer function consisting almost entirely of plain Rust code, with all of the usual IDE affordances expected of normal Rust code. Because it uses plain Rust syntax, it can also be formatted automatically by rustfmt.
Adding another layer of macro-defined macros is not something I propose lightly, but in this case I think the improvement is well worth it:
- The outer functions can once again be defined as “normal” Rust functions, right next to their corresponding inner functions, making navigation and modification much easier.
- The closure expression is ordinary Rust code that simply gets repeated ~300 times in the expansion, once for each query, in order to account for the variety of key/value/cache types used by different queries. Even within the closure expression, IDE features still *mostly* work, which is an improvement over the status quo.
- For future maintainers looking at the call site, the macro's effect should hopefully be pretty obvious and intuitive, reducing the need to even look at the helper macro. And the helper macro itself is largely straightforward, with its biggest complication being that it necessarily uses the `$name` metavar from the outer macro.
There should be no change to compiler behaviour.
r? nnethercote (or compiler)
Unify same-span labels in move error diagnostics
Fixesrust-lang/rust#153506.
When there's a single binding in a move error, we emit "data moved here" and "move occurs because ... does not implement the Copy trait" as two separate labels on the same span. This combines them into one label via a new `TypeNoCopy::LabelMovedHere` variant.
The multi-binding case still uses separate labels + a note since they point at different spans.
cc @estebank