Commit graph

169051 commits

Author SHA1 Message Date
Jana Dönszelmann
2de02ac86e
EII ast changes 2025-12-12 11:17:33 +01:00
bors
c4dc70ee0a Auto merge of #149891 - matthiaskrgr:rollup-jh6xrhz, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#142380 (Put negative implementors first and apply same ordering logic to foreign implementors)
 - rust-lang/rust#146584 (remove duplicated columns from `rustc_error_code::error_codes!`)
 - rust-lang/rust#148717 (Point at span within local macros even when error happens in nested external macro)
 - rust-lang/rust#149565 (rustdoc: Add unstable `--merge-doctests=yes/no/auto` flag)
 - rust-lang/rust#149770 (Rename some issue-* tests)
 - rust-lang/rust#149807 (Use ubuntu:24.04 for the `x86_64-gnu-miri` job)
 - rust-lang/rust#149850 (Remove "tidy" tool for `tests/rustdoc` testsuite)
 - rust-lang/rust#149863 (Do not suggest moving expression out of for loop when hitting `break` from desugaring)
 - rust-lang/rust#149867 (only resolve main in bin crates)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-12 06:30:06 +00:00
Matthias Krüger
b912391535
Rollup merge of #149850 - GuillaumeGomez:rm-tidy-rustdoc, r=yotamofek
Remove "tidy" tool for `tests/rustdoc` testsuite

As discussed in the [last rustdoc meeting](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2025-12-08/near/562554410), it seems like the current `tidy` tool is not used much for the `rustdoc` testsuite by the rustdoc contributors as it doesn't fit nicely our needs.

Until we find something better, we decided to remove it.

r? ```@yotamofek```
2025-12-11 22:09:56 +01:00
Matthias Krüger
817c58a975
Rollup merge of #149807 - Kobzol:miri-ubuntu-24.04, r=marcoieni
Use ubuntu:24.04 for the `x86_64-gnu-miri` job

Ralf asked for this in https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Adding.20a.20C.2B.2B.20dependency.20to.20Miri.3F/with/560654845.
2025-12-11 22:09:55 +01:00
Matthias Krüger
17940e27c8
Rollup merge of #149770 - GrigorenkoPV:tests/consts, r=WaffleLapkin
Rename some issue-* tests

Also fixes one incorrect issue number: https://github.com/rust-lang/rust/pull/100168#issuecomment-3622946835
2025-12-11 22:09:54 +01:00
Matthias Krüger
0dfc23839b
Rollup merge of #149565 - jyn514:force-doctest-merge, r=notriddle
rustdoc: Add unstable `--merge-doctests=yes/no/auto` flag

This is useful for changing the *default* for whether doctests are merged or not. Currently, that default is solely controlled by `edition = 2024`, which adds a high switching cost to get doctest merging. This flag allows opting in even on earlier editions.

Unlike the `edition = 2024` default, `--merge-doctests=yes` gives a hard error if merging fails instead of falling back to running standalone tests. The user has explicitly said they want merging, so we shouldn't silently do something else.

`--merge-doctests=auto` is equivalent to the current 2024 edition behavior, but available on earlier editions.

Helps with https://github.com/rust-lang/rust/issues/141240. ``@epage`` said in that issue he would like a per-doctest opt-in, and that seems useful to me in addition to this flag, but I think it's a separate use case from changing the default.
2025-12-11 22:09:54 +01:00
Matthias Krüger
215d7b661e
Rollup merge of #148717 - estebank:macro-spans-2, r=petrochenkov
Point at span within local macros even when error happens in nested external macro

Address issue noticed at https://users.rust-lang.org/t/error-message-does-not-specify-where-in-macro/135157/1. On errors occurring within a macro expansion, point at the innermost local macro expansion point.

```
error[E0308]: mismatched types
  --> $DIR/macro-span-caller-replacement.rs:5:17
   |
LL |             s = format!("{arg}");
   |                 ^^^^^^^^^^^^^^^^ expected `&str`, found `String`
...
LL |     macro_with_format!();
   |     -------------------- in this macro invocation
   |
   = note: this error originates in the macro `format` which comes from the expansion of the macro `macro_with_format` (in Nightly builds, run with -Z macro-backtrace for more info)
```
2025-12-11 22:09:53 +01:00
Matthias Krüger
bf399241fe
Rollup merge of #146584 - cyrgani:error-codes-macro, r=GuillaumeGomez
remove duplicated columns from `rustc_error_code::error_codes!`

Possible because of rust-lang/rust#146308 ~~, but currently still blocked on the next stage0 bump~~.
2025-12-11 22:09:52 +01:00
Matthias Krüger
52cadc06f1
Rollup merge of #142380 - GuillaumeGomez:neg-implementors, r=yotamofek
Put negative implementors first and apply same ordering logic to foreign implementors

Fixes rust-lang/rust#51129.

This PR changeda surprisingly small amount of things to put negative trait impls before the others: basically just adding a new information in the generated JS file for foreign implementors and a "negative marker" DOM element to know where to insert negative impls.

I also used this occasion to make the foreign implementors sort the same as the local ones by using `compare_names`.

You can test it [here](https://rustdoc.crud.net/imperio/neg-implementors/core/marker/trait.Sync.html#implementors).

r? ```@notriddle```
2025-12-11 22:09:51 +01:00
bors
5b150d238f Auto merge of #149645 - GuillaumeGomez:doc-attr-based, r=jdonszelmann,jonathanbrouwer
Port `doc` attributes to new attribute API

Part of https://github.com/rust-lang/rust/issues/131229.

This PR ports the `doc` attributes to the new attribute API. However, there are things that will need to be fixed in a follow-up:

* Some part of `cfg_old.rs` are likely unused now, so they should be removed.
* Not all error/lints are emitted at the same time anymore, making them kinda less useful considering that you need to run and fix rustc/rustdoc multiple times to get through all of them.
* For coherency with the other attribute errors, I didn't modify the default output too much, meaning that we have some new messages now. I'll likely come back to that to check if the previous ones were better in a case-by-case approach.
* `doc(test(attr(...)))` is handled in a horrifying manner currently. Until we can handle it correctly with the `Attribute` system, it'll remain that thing we're all very ashamed of. 😈
* A type in rustdoc got its size increased, I'll check the impact on performance. But in any case, I plan to improve it in a follow-up so should be "ok".
* Because of error reporting, some fields of `Doc` are suboptimal, like `inline` which instead of being an `Option` is a `ThinVec` because we report the error later on. Part of the things I'm not super happy about but can be postponed to future me.
* In `src/librustdoc/clean/cfg.rs`, the `pub(crate) fn parse(cfg: &MetaItemInner) -> Result<Cfg, InvalidCfgError> {` function should be removed once `cfg_trace` has been ported to new `cfg` API.
* Size of type `DocFragment` went from 32 to 48. Would be nice to get it back to 32.
* ``malformed `doc` attribute input`` wasn't meant for so many candidates, should be improved.
* See how many of the checks in `check_attr` we can move to attribute parsing
* Port target checking to be in the attribute parser completely
* Fix target checking for `doc(alias)` on fields & patterns

And finally, once this PR is merged, I plan to finally stabilize `doc_cfg` feature. :)

cc `@jdonszelmann`
r? `@JonathanBrouwer`
2025-12-11 21:08:19 +00:00
Esteban Küber
1bd7934d89 Point at span within local macros even when error happens in nested external macro
```
error[E0308]: mismatched types
  --> $DIR/macro-span-caller-replacement.rs:5:17
   |
LL |             s = format!("{arg}");
   |                 ^^^^^^^^^^^^^^^^ expected `&str`, found `String`
...
LL |     macro_with_format!();
   |     -------------------- in this macro invocation
   |
   = note: this error originates in the macro `format` which comes from the expansion of the macro `macro_with_format` (in Nightly builds, run with -Z macro-backtrace for more info)
```
2025-12-10 19:27:40 +00:00
Pavel Grigorenko
96a7000101 Rename some issue-* tests 2025-12-10 20:31:10 +03:00
Jakub Beránek
40891c79e6
Use ubuntu:24.04 for the x86_64-gnu-miri and x86_64-gnu-aux jobs 2025-12-10 17:50:35 +01:00
Guillaume Gomez
fb9d3a5db4 Simplify the sorting of impls and use CSS classes instead of plain JS to show/hide implementors 2025-12-10 17:42:29 +01:00
Matthias Krüger
eab103688f
Rollup merge of #149846 - jdonszelmann:links-for-all-fcws, r=wafflelapkin
Statically require links to an issue or the edition guide for all FCWs

r? `@wafflelapkin`
2025-12-10 17:16:50 +01:00
Matthias Krüger
7b2f36e7ac
Rollup merge of #149838 - aerooneqq:build-aux-in-pp-tests, r=petrochenkov
Build auxiliary in pretty tests

I've encountered a problem with building auxiliary in pretty tests with the following configuration:
```
//@ edition:2021
//@ aux-crate:to_reuse_functions=to-reuse-functions.rs
//@ pretty-mode:hir
//@ pretty-compare-only
//@ pp-exact:delegation-inherit-attributes.pp
```

In such kind of tests, I want to test the resulting HIR, without final typecheck (`pretty-compare-only`). I plan to use such tests during testing the attribute inheritance in delegation feature. However, related auxiliary is built only in [self.typecheck_source](2e667b0c64/src/tools/compiletest/src/runtest/pretty.rs (L79)) method (in `compose_and_run_compiler` routine), so it is impossible to execute test in my scenario. As a solution I've added the auxiliary build in [print_source](2e667b0c64/src/tools/compiletest/src/runtest.rs (L434)) method, so it is also built in a compare only scenarios.

I've tried to search other solutions to this problem, but I haven't found a way to force auxiliary build in such a configuration of a pretty test.

r? `@petrochenkov`
2025-12-10 17:16:48 +01:00
Matthias Krüger
d1e921e854
Rollup merge of #149764 - Zalathar:has-zstd, r=bjorn3
Make `--print=backend-has-zstd` work by default on any backend

Using a defaulted `CodegenBackend` method that querying for zstd support should automatically print a safe value of `false` on any backend that doesn't specifically indicate the presence or absence of zstd.

This should fix the compiletest failures reported in https://github.com/rust-lang/rust/pull/149666#discussion_r2597881482, which can occur when LLVM is not the default codegen backend.
2025-12-10 17:16:48 +01:00
Matthias Krüger
02a58a9bee
Rollup merge of #149489 - scottmcm:try-bikeshed, r=nnethercote
Experimentally add *heterogeneous* `try` blocks

rust-lang/rust#148725 moved the default to being homogeneous; this adds heterogeneous ones back under an obvious-bikeshed syntax so people can experiment with that as well.

Essentially resolves rust-lang/rust#149025 by letting them move to this syntax instead.

New tracking issue: rust-lang/rust#149488
Related RFC: https://github.com/rust-lang/rfcs/pull/3721#issuecomment-3208342727 (specifically about experimenting)
2025-12-10 17:16:47 +01:00
Jana Dönszelmann
183048c83e
update docs 2025-12-10 16:34:16 +01:00
Guillaume Gomez
13091ddc93 Make implementors list visible only when filled 2025-12-10 16:18:22 +01:00
Guillaume Gomez
450916305f Put negative implementors first and apply same ordering logic to foreign implementors 2025-12-10 16:18:20 +01:00
Guillaume Gomez
4d697d2433 Remove "tidy" tool for tests/rustdoc testsuite 2025-12-10 16:16:13 +01:00
Jana Dönszelmann
0eed5ab550
introduce fcw macro 2025-12-10 15:15:54 +01:00
Guillaume Gomez
3ea9462167 Remove Cfg::matches and use eval_config_entry instead 2025-12-10 12:28:08 +01:00
Guillaume Gomez
64aaeacd71 Update to new API, allowing to remove check_doc_cfg.rs file from librustdoc 2025-12-10 12:28:08 +01:00
Guillaume Gomez
6230b56eaa Update clippy code 2025-12-10 12:28:08 +01:00
Guillaume Gomez
4191e94715 Improve spans for auto_cfg(hide/show) errors 2025-12-10 12:28:08 +01:00
Guillaume Gomez
1da7684c7d Improve code and add more comments 2025-12-10 12:28:07 +01:00
Guillaume Gomez
06238bd93e Update rustdoc JSON output to new attribute API 2025-12-10 12:28:07 +01:00
Guillaume Gomez
2340f8054c Update to new lint API 2025-12-10 12:28:07 +01:00
Guillaume Gomez
a36c462fb8 Update clippy code to new doc attribute API 2025-12-10 12:27:34 +01:00
Guillaume Gomez
d1277ccffa Update check_doc_cfg pass in rustdoc, remove old rustc_attr_parsing::cfg_matches API 2025-12-10 12:27:34 +01:00
Guillaume Gomez
9c8c67bfdd Fix warning messages 2025-12-10 12:27:34 +01:00
Guillaume Gomez
976d45452a Update rustdoc unit tests 2025-12-10 12:27:34 +01:00
Guillaume Gomez
5c47240ad1 Correctly handle doc(test(attr(...))) 2025-12-10 12:27:34 +01:00
Guillaume Gomez
57870b7242 Fix doc(auto_cfg) attribute parsing 2025-12-10 12:27:34 +01:00
Guillaume Gomez
d35ec316c5 Keep a list of CfgEntry instead of just one 2025-12-10 12:27:33 +01:00
Guillaume Gomez
368a103902 Fix Cfg add/or operations 2025-12-10 12:27:33 +01:00
Guillaume Gomez
92edc499a6 Correctly handle doc items inlining 2025-12-10 12:27:33 +01:00
Guillaume Gomez
148e522112 Correctly differentiate between sugared and raw doc comments 2025-12-10 12:27:33 +01:00
Guillaume Gomez
131323f910 Migrate doc(cfg) to new Attribute API 2025-12-10 12:27:33 +01:00
aerooneqq
a3970b079b Build auxiliary in pretty tests 2025-12-10 11:06:31 +03:00
Matthias Krüger
bea56365dc
Rollup merge of #149826 - jieyouxu:compiletest-adb, r=Zalathar
compiletest: tidy up `adb_path`/`adb_test_dir` handling

Be more faithful that they aren't always available.

try-job: arm-android
2025-12-10 07:54:23 +01:00
Matthias Krüger
573ed40b89
Rollup merge of #149458 - GuillaumeGomez:clippy-cg_gcc, r=kobzol
Run clippy on cg_gcc in CI

This is to prevent [this issue](https://github.com/rust-lang/rust/pull/149449#discussion_r2573045524): in cg_gcc repository, we run clippy on our code but not in here, which can create issues.

cc ````@antoyo````
r? ````@Kobzol````
2025-12-10 07:54:19 +01:00
Matthias Krüger
8a4312a069
Rollup merge of #148491 - estebank:issue-147894, r=jackh726
Correctly provide suggestions when encountering `async fn` with a `dyn Trait` return type

Point at return type of `async fn`s instead of their def `Span`.

Correctly provide suggestions when encountering `async fn` with a `dyn Trait` return type.

Correctly address `type Alias = dyn Trait` when `fn foo() -> Alias { .. }`.

Fix rust-lang/rust#147894.
2025-12-10 07:54:18 +01:00
Matthias Krüger
6078dd3bdf
Rollup merge of #147725 - bjorn3:remove_oom_panic, r=Amanieu
Remove -Zoom=panic

There are major questions remaining about the reentrancy that this allows. It doesn't have any users on github outside of a single project that uses it in a panic=abort project to show backtraces. It can still be emulated through `#[alloc_error_handler]` or `set_alloc_error_hook` depending on if you use the standard library or not. And finally it makes it harder to do various improvements to the allocator shim.

With this PR the sole remaining symbol in the allocator shim that is not effectively emulating weak symbols is the symbol that prevents skipping the allocator shim on stable even when it would otherwise be empty because libstd + `#[global_allocator]` is used.

Closes https://github.com/rust-lang/rust/issues/43596
Fixes https://github.com/rust-lang/rust/issues/126683
2025-12-10 07:54:17 +01:00
Scott McMurray
35598c1318 Also get rustfmt to at least compile 2025-12-09 20:18:44 -08:00
Scott McMurray
f9e1031c1e Update clippy for the ast TryBlock change 2025-12-09 20:18:43 -08:00
Jieyou Xu
fc3d61ee7c
compiletest: tidy up adb_path/adb_test_dir handling
Be more faithful that they aren't always available.
2025-12-10 09:35:24 +08:00
Guillaume Gomez
06500aa2dd Add message when running clippy with --no-default-features for cg_gcc 2025-12-09 17:59:24 +01:00