Commit Graph

19176 Commits

Author SHA1 Message Date
Daniel Paoliello
2602653424 [Arm64EC] Only decorate functions with # 2025-06-23 12:38:35 -07:00
bjorn3
ba5556d239 Add #[loop_match] for improved DFA codegen
Co-authored-by: Folkert de Vries <folkert@folkertdev.nl>
2025-06-23 20:43:04 +02:00
Vadim Petrochenkov
7a4f09c224 compiletest: Improve diagnostics for line annotation mismatches 2025-06-23 21:30:56 +03:00
Folkert de Vries
8147646531 fix -Zmin-function-alignment without attributes
the minimum function alignment was skipped on functions without attributes. That is because in our testing we generally apply `#[no_mangle]` to functions that are tested. I've added a test now that deliberately has no attributes
2025-06-23 20:26:04 +02:00
Alona Enraght-Moony
bec2679e4e rustdoc-json: Add test for #[optimize(..)]
Follow up to https://www.github.com/rust-lang/rust/pull/138291
2025-06-23 17:23:20 +00:00
Jubilee Young
aa25b9b116 tests: Bless cannot-be-called and dedup with unsupported ABI test 2025-06-23 09:40:00 -07:00
Jubilee Young
78528bc0e6 tests: Verify varargs with unsupported fn ptr ABIs must error 2025-06-23 09:40:00 -07:00
Jubilee Young
7632fab668 tests: Adopt ABI transmute tests from crashtests 2025-06-23 09:40:00 -07:00
Jubilee Young
0dd29e1a86 tests: Update and bless cmse-nonsecure ABI tests 2025-06-23 09:40:00 -07:00
Jubilee Young
a3a6d9bf71 tests: Update raw-dylib unsupported ABI test 2025-06-23 09:40:00 -07:00
Jubilee Young
7e35b284e1 tests: Enhance unsupported ABI tests
We have fairly different error messages now and handle more cases,
so we augment the test in tests/ui/abi/unsupported.rs with more examples
to handle structs, traits, and impls on same when those feature
the unsupported ABIs of interest.
2025-06-23 09:40:00 -07:00
Jubilee Young
a69aeaf1e3 tests: Bless abi_gpu_kernel feature gate test 2025-06-23 09:40:00 -07:00
Guillaume Gomez
3b5525bc42 Improve code and documentation 2025-06-23 16:12:49 +02:00
Guillaume Gomez
a0d64177f0 Add ui test for redundant_explicit_links rustdoc lint for items coming from expansion 2025-06-23 16:02:33 +02:00
Kivooeo
793607059b cleaned up some tests 2025-06-23 18:53:56 +05:00
Jana Dönszelmann
6cee0a6ead Rollup merge of #142892 - jdonszelmann:fix-142891, r=oli-obk
Fix ICE on debug builds where lints are delayed on the crate root

r? ``@oli-obk``

Closes rust-lang/rust#142891

thanks to ``@JonathanBrouwer`` for finding it!
2025-06-23 12:39:09 +02:00
Jana Dönszelmann
c8df66f84c Rollup merge of #142822 - oli-obk:const-partial-eq, r=fee1-dead
Make `PartialEq` a `const_trait`

r? ``@fee1-dead`` or ``@compiler-errors``

something generally useful but also required for https://github.com/rust-lang/rust/pull/142789
2025-06-23 12:39:08 +02:00
Jana Dönszelmann
5c0a625205 move naked checks out of check_attr.rs 2025-06-23 12:22:57 +02:00
Jana Dönszelmann
269b67d6b8 fix 142891 2025-06-23 12:20:02 +02:00
Jana Dönszelmann
2313d4c571 test for lint on root node crash 2025-06-23 12:17:57 +02:00
Oli Scherer
993344257d Make PartialEq a const_trait 2025-06-23 08:45:26 +00:00
Matthias Krüger
9b6665fafa Rollup merge of #142823 - JonathanBrouwer:no_mangle_parser, r=jdonszelmann
Port `#[no_mangle]` to new attribute parsing infrastructure

Ports `no_mangle` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? ``@jdonszelmann``
2025-06-23 06:07:19 +02:00
Matthias Krüger
f63fdde764 Rollup merge of #141597 - Oneirical:unquestionable-instruction, r=jieyouxu
Document subdirectories of UI tests with README files

Part of rust-lang/rust#133895 and the [2025 Google Summer of Code](https://blog.rust-lang.org/2025/05/08/gsoc-2025-selected-projects/) associated project.

When adding a new UI test, one is faced with hundreds of subdirectories in `tests/ui` reflecting various categories. Knowing where to put the new test is not trivial, as many of the categories have slightly misleading names. For example, `moves` does not only refer to the `move` keyword but to functions taking ownership in general, whereas `allocator` does not refer to allocation in general but rather to the very specific `allocator_api` and `global_allocator` features.

Many contributors will therefore place their test at the top level of ̀`tests/ui` where it will be mixed with hundreds of unrelated tests.

This PR is a tentative move towards more clearly defined tag/categories, with a SUMMARY.md file documenting the true purpose of each subdirectory, placed inside `tests/ui`.

r? ``@jieyouxu``
2025-06-23 06:07:19 +02:00
Mark Rousskov
928564c7bf Stop collecting unmentioned constants
This avoids generating useless dead LLVM IR.
2025-06-22 17:52:49 -04:00
Jonathan Brouwer
2084831cd5 Port #[no_mangle] to new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22 22:17:04 +02:00
bors
be19eda0dc Auto merge of #142508 - Mark-Simulacrum:skip-noop-drop-glue, r=fee1-dead
Skip no-op drop glue

Since rust-lang/rust#122662 this no longer gets used in vtables, so we're safe to fully
drop generating functions from vtables. Those are eventually cleaned up
by LLVM, but it's wasteful to produce them in the first place.

This doesn't appear to be a significant win (and shows some slight regressions) but
seems like the right thing to do. At minimum it reduces noise in the LLVM IR we generate,
which seems like a good thing.
2025-06-22 20:10:07 +00:00
Makai
e40515a494 add method to retrieve body of coroutine 2025-06-22 18:01:39 +00:00
bors
111e9bc64b Auto merge of #142878 - GuillaumeGomez:rollup-53dohob, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#142458 (Merge unboxed trait object error suggestion into regular dyn incompat error)
 - rust-lang/rust#142593 (Add a warning to LateContext::get_def_path)
 - rust-lang/rust#142594 (Add DesugaringKind::FormatLiteral)
 - rust-lang/rust#142740 (Clean-up `FnCtxt::is_destruct_assignment_desugaring`)
 - rust-lang/rust#142780 (Port `#[must_use]` to new attribute parsing infrastructure)
 - rust-lang/rust#142798 (Don't fail to parse a struct if a semicolon is used to separate fields)
 - rust-lang/rust#142856 (Add a few inline directives in rustc_serialize.)
 - rust-lang/rust#142868 (remove few allow(dead_code))
 - rust-lang/rust#142874 (cranelift: fix target feature name typo: "fxsr")
 - rust-lang/rust#142877 (Document why tidy checks if `eslint` is installed via `npm`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-22 17:10:28 +00:00
Oneirical
b433aba3df Add a SUMMARY.md outlining immediate subdirectories of the ui test suite
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
2025-06-22 12:18:22 -04:00
Mark Rousskov
b4568d9135 Fix tests to drop now-skipped codegen 2025-06-22 12:03:42 -04:00
Guillaume Gomez
194e58c75c Rollup merge of #142798 - camsteffen:recover-semi, r=compiler-errors
Don't fail to parse a struct if a semicolon is used to separate fields

The first commit is a small refactor.
2025-06-22 17:35:35 +02:00
Guillaume Gomez
2681bb0952 Rollup merge of #142780 - JonathanBrouwer:must_use_new_attr, r=jdonszelmann
Port `#[must_use]` to new attribute parsing infrastructure

Ports `must_use` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? `@jdonszelmann`
2025-06-22 17:35:34 +02:00
Guillaume Gomez
7bed341583 Rollup merge of #142594 - mejrs:new_desugaring, r=chenyukang
Add DesugaringKind::FormatLiteral

Implements `DesugaringKind::FormatLiteral` to mark the FormatArgs desugaring of format literals. The main use for this is to stop yapping about about formatting parameters if we're not anywhere near a format literal. The other use case is to fix suggestions such as https://github.com/rust-lang/rust/issues/141350. It might also be useful for new or existing diagnostics that check whether they're in a format-like macro.

cc `@xizheyin` `@fmease`
2025-06-22 17:35:33 +02:00
Guillaume Gomez
371426334b Rollup merge of #142458 - oli-obk:dyn-incompat, r=compiler-errors
Merge unboxed trait object error suggestion into regular dyn incompat error

Another hir-walker removed from the well-formed queries. This error was always a duplicate of another, but it was able to provide more information because it could invoke `is_dyn_compatible` without worrying about cycle errors. That's also the reason we can't put the error directly into hir_ty_lowering when lowering a `dyn Trait` within an associated item signature. So instead I packed it into the error handling of wf obligation checking.
2025-06-22 17:35:32 +02:00
Urgau
188023a93c Don't suggest changing a method inside a expansion 2025-06-22 17:08:54 +02:00
Urgau
6ffd0e6c23 Address review comments 2025-06-22 16:45:16 +02:00
bors
c2ec7532ee Auto merge of #142706 - fee1-dead-contrib:push-zsznlqyrzsqo, r=oli-obk
completely deduplicate `Visitor` and `MutVisitor`

r? oli-obk

This closes rust-lang/rust#127615.

### Discussion

> * Give every `MutVisitor::visit_*` method a corresponding `flat_map_*` method.

Not every AST node exists in a location where they can be mapped to multiple instances of themselves. Not every AST node exists in a location where they can be removed from existence (e.g. `filter_map_expr`). I don't think this is doable.

> * Give every `MutVisitor::visit_*` method a corresponding `Visitor` method and vice versa

The only three remaining method-level asymmetries after this PR are `visit_stmt` and `visit_nested_use_tree` (only on `Visitor`) and `visit_span` (only on `MutVisitor`).

`visit_stmt` doesn't seem applicable to `MutVisitor` because `walk_flat_map_stmt_kind` will ask `flat_map_item` / `filter_map_expr` to potentially turn a single `Stmt` to multiple based on what a visitor wants. So only using `flat_map_stmt` seems appropriate.

`visit_nested_use_tree` is used for `rustc_resolve` to track stuff. Not useful for `MutVisitor` for now.

`visit_span` is currently not used for `MutVisitor` already, it was just kept in case we want to revive rust-lang/rust#127241. cc `@cjgillot` maybe we could remove for now and re-insert later if we find a use-case? It does involve some extra effort to maintain.

* Remaining FIXMEs

`visit_lifetime` has an extra param for `Visitor` that's not in `MutVisitor`. This is again something only used by `rustc_resolve`. I think we can keep that symmetry for now.
2025-06-22 14:03:44 +00:00
Jonathan Brouwer
b24df42488 Port #[must_use] to new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22 14:51:58 +02:00
mejrs
29ce695cd4 Stop dbg! macro yapping about format modifiers 2025-06-22 10:58:27 +02:00
mejrs
b1d18129d1 Implement DesugaringKind::FormatLiteral 2025-06-22 10:58:25 +02:00
Jacob Pratt
f5b1c8e72c Rollup merge of #142850 - tshepang:patch-1, r=jieyouxu
remove asm_goto feature annotation, for it is now stabilized

This was stabilized in https://github.com/rust-lang/rust/pull/133870
2025-06-22 08:49:07 +02:00
Jacob Pratt
b64292a0cc Rollup merge of #142845 - dpaoliello:textrel-on-minimal-lib, r=jieyouxu
Enable textrel-on-minimal-lib for Windows

`bin_name` needs to be used when building a runnable executable.

Addresses item in rust-lang/rust#128602

---

try-job: x86_64-mingw-*
try-job: x86_64-msvc-*
try-job: i686-msvc-*
2025-06-22 08:49:07 +02:00
Jacob Pratt
cbfb65429c Rollup merge of #142841 - dpaoliello:fmt-write-bloat, r=jieyouxu
Enable fmt-write-bloat for Windows

Seems to be working fine for MSVC once it has the correct binary name.

Addresses item in rust-lang/rust#128602

---

try-job: x86_64-mingw-*
try-job: x86_64-msvc-*
try-job: i686-msvc-*
2025-06-22 08:49:06 +02:00
Jacob Pratt
bf63acfd35 Rollup merge of #142776 - dtolnay:hirattrstyle2, r=jdonszelmann
All HIR attributes are outer

Fixes https://github.com/rust-lang/rust/issues/142649. Closes https://github.com/rust-lang/rust/pull/142759.

All HIR attributes, including parsed and not yet parsed, will now be rendered as outer attributes by `rustc_hir_pretty`. The original style of the corresponding AST attribute(s) is not relevant for pretty printing, only for diagnostics.

r? ````@jdonszelmann````
2025-06-22 08:49:05 +02:00
bors
8051f01265 Auto merge of #141856 - folkertdev:run-make-forward-compiletest-runner, r=jieyouxu
forward the bootstrap `runner` to `run-make`

The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions.

The configuration can look like this

```toml
# in bootstrap.toml
[target.s390x-unknown-linux-gnu]
runner = "qemu-s390x -L /usr/s390x-linux-gnu"
```

Any C compilation automatically sets the correct target. Calls to rustc must use `.target(target())`. Then, a command like below will work by cross-compiling to the given target, and using the given runner for that target to execute the binary:

```
./x test tests/run-make/c-link-to-rust-va-list-fn --target s390x-unknown-linux-gnu
```

The runner can also be used for e.g. running with `valgrind`.

This PR also enables its use in the test case that I care about, hopefully that actually does work on the platforms that CI uses. We should probably run some try jobs to be sure?

r? `@jieyouxu`

try-job: test-various
try-job: armhf-gnu
2025-06-22 02:21:13 +00:00
Folkert de Vries
0d4abfc7cc forward the bootstrap runner to run-make
The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions.
2025-06-22 01:37:51 +02:00
Mark Rousskov
1f40573507 Skip collecting no-op DropGlue in vtables
Since 122662 this no longer gets used in vtables, so we're safe to fully
drop generating these empty functions. Those are eventually cleaned up
by LLVM, but it's wasteful to produce them in the first place.

This also adds a missing test for fn-ptr casts, which do still need to
generate no-op drop glue. It's possible a future optimization could
point all of those at the same drop glue (e.g., for *mut ()) rather than
for each separate type, but that would require extra work for CFI and
isn't particularly easy to do anyway.
2025-06-21 18:59:36 -04:00
Tshepang Mbambo
eb86d0951e remove asm_goto feature annotation, for it is now stabilized 2025-06-21 23:26:56 +02:00
Daniel Paoliello
0d50f9109b Enable textrel-on-minimal-lib for Windows 2025-06-21 13:16:57 -07:00
bors
d4e1159b8c Auto merge of #142546 - cjgillot:reachable-jump, r=compiler-errors
Only traverse reachable blocks in JumpThreading.

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

We only compute loop headers for reachable blocks. We shouldn't try to perform an opt on unreachable blocks anyway.
2025-06-21 18:54:29 +00:00