Commit graph

22323 commits

Author SHA1 Message Date
Jacob Pratt
aec47812cf
Rollup merge of #149911 - Zalathar:no-color, r=jieyouxu
bootstrap: Don't pass an unused `--color` to compiletest

- Follow-up to https://github.com/rust-lang/rust/pull/149850

---

This flag was an artifact of compiletest's old libtest-based test executor, and currently doesn't influence compiletest's output at all.

A follow-up commit also inlines `force_coloring_in_ci` into its only remaining caller, and updates its comment.
2025-12-13 00:55:58 -05:00
Matthias Krüger
e0e575cfa9
Rollup merge of #149884 - flip1995:clippy-subtree-update, r=matthiaskrgr
Clippy subtree update

r? ``````@Manishearth``````

Cargo.lock update due to Clippy version bump.
2025-12-12 12:19:11 +01:00
Zalathar
3f63f521c1 Don't pass an unused --color to compiletest
This flag was an artifact of compiletest's old libtest-based test executor, and
currently doesn't influence compiletest's output at all.
2025-12-12 22:10:52 +11: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
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
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
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
Philipp Krones
39877b17b6
Merge commit '9e3e9649cb' into clippy-subtree-update 2025-12-11 19:13:34 +01: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
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
Guillaume Gomez
4d697d2433 Remove "tidy" tool for tests/rustdoc testsuite 2025-12-10 16:16:13 +01:00
Guillaume Gomez
6230b56eaa Update clippy code 2025-12-10 12:28:08 +01:00
Guillaume Gomez
a36c462fb8 Update clippy code to new doc attribute API 2025-12-10 12:27:34 +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
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
Esteban Küber
60b227accc Recognize type Alias = dyn Trait in fn return types
```
error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time
  --> $DIR/dyn-trait-type-alias-return-type.rs:4:11
   |
LL | fn f() -> T { loop {} }
   |           ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `(dyn Debug + 'static)`
note: this type alias is unsized
  --> $DIR/dyn-trait-type-alias-return-type.rs:1:1
   |
LL | type T = dyn core::fmt::Debug;
   | ^^^^^^
   = note: the return type of a function must have a statically known size
```
2025-12-09 16:46:33 +00:00
Matthias Krüger
2b0262c199
Rollup merge of #149754 - jieyouxu:compiletest-cli, r=Zalathar
Retire `opt_str2` from compiletest cli parsing

We have `Option<..>`, we don't need to invent "(none)" as option-at-home.

- More specifically, when some test suite expect certain values to be present, they should `.expect(..)` the value, and not potentially receive some "(none)" in some cases.

r? Zalathar
2025-12-09 06:17:25 +01:00
Zalathar
5c91f2c4d3 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.
2025-12-09 12:57:19 +11:00
bors
0b96731cd1 Auto merge of #149776 - bjorn3:sync_cg_clif-2025-12-08, r=bjorn3
Subtree sync for rustc_codegen_cranelift

The main highlights this time are a Cranelift update and adding actual support for `-Cdebuginfo=line-tables-only` rather than treating it the same as `-Cdebuginfo=full`.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2025-12-08 22:35:48 +00:00
bors
37aa2135b5 Auto merge of #149766 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 5e3e9c4e61.

Created using https://github.com/rust-lang/josh-sync.

r? `@ghost`
2025-12-08 19:24:45 +00:00
bjorn3
cb49fe5854 Update list of allowed cg_clif dependencies 2025-12-08 16:26:26 +00:00
Jieyou Xu
72541e9a51
compiletest: retire opt_str2
We either have the value of a flag specified, or we don't. Use
`Option<...>` to represent that -- don't invent a new "(none)" sentinel
value...
2025-12-08 17:44:02 +08:00
Jieyou Xu
a7ad2142e3
compiletest: make presence/absence of adb-related options clear
Instead of possibly falling back to "(none)" when they are not
specified.
2025-12-08 17:44:02 +08:00
Jieyou Xu
260b1ffc2c
compiletest: require host/target flags specified
Instead of allowing them to be missing and using some placeholder
"(none)" value instead.
2025-12-08 17:44:01 +08:00
Stuart Cook
fa9a8f45fc
Rollup merge of #149710 - Zalathar:ambient-gdb, r=jieyouxu
Move ambient gdb discovery from compiletest to bootstrap

- Follow-up to https://github.com/rust-lang/rust/pull/148099

---

This code takes the compiletest code for discovering an “ambient” `gdb` in the user's path, and moves it to bootstrap.

One of the eventual goals is to allow compiletest to assume that if it has been asked to run the debuginfo-gdb suite, then it *must* have been passed an explicit `--gdb`, though we aren't quite there yet.

r? jieyouxu
2025-12-08 11:46:24 +11:00
Stuart Cook
a76db5581b
Rollup merge of #149676 - reddevilmidzy:t10, r=Kivooeo
Tidying up tests/ui/issues tests [3/N]

> [!NOTE]
> Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge.

part of rust-lang/rust#133895

r? Kivooeo
2025-12-08 11:46:23 +11:00
bors
ba2142a19c Auto merge of #149517 - WaffleLapkin:alphabet-blessing, r=jdonszelmann
Implement blessing for tidy alphabetical check

r? `@jdonszelmann`
2025-12-07 20:08:33 +00:00
Lukas Wirth
632acd7247
Merge pull request #21222 from A4-Tacks/no-comp-resugar-unit-ret-ty
No complete unit RetType in resugar async assoc item
2025-12-07 15:06:49 +00:00
Lukas Wirth
34c61d1a72 fix: Disable postcard use temporarily 2025-12-07 14:52:10 +01:00
A4-Tacks
89a8142571
No complete unit RetType in resugar async assoc item
Example
---
```rust
use core::future::Future;

trait DesugaredAsyncTrait {
    fn foo(&self) -> impl Future<Output = ()> + Send;
}

impl DesugaredAsyncTrait for () {
    $0
}
```

**Before this PR**

```rust
use core::future::Future;

trait DesugaredAsyncTrait {
    fn foo(&self) -> impl Future<Output = ()> + Send;
}

impl DesugaredAsyncTrait for () {
    async fn foo(&self) -> () {
        $0
    }
}
```

**After this PR**

```rust
use core::future::Future;

trait DesugaredAsyncTrait {
    fn foo(&self) -> impl Future<Output = ()> + Send;
}

impl DesugaredAsyncTrait for () {
    async fn foo(&self) {
        $0
    }
}
```
2025-12-07 21:18:40 +08:00
Waffle Lapkin
3bbd6ea19a
attempt to fix tidyselftest on windows 2025-12-07 13:58:35 +01:00
Waffle Lapkin
87f9ea206e
add tests for tidy alphabetical blessing 2025-12-07 13:58:35 +01:00
Lukas Wirth
9f9c9c3845
Merge pull request #21178 from Veykril/tracked-modules
internal: Make `ModuleId` a tracked struct
2025-12-07 08:41:04 +00:00
Lukas Wirth
a1a9514f6f Turn BlockLoc into a tracked struct 2025-12-07 09:31:53 +01:00
Lukas Wirth
7766ee6869 Make ModuleId a tracked struct
optimize some stuff

Optimize `pub(crate)` visibility resolution

Optimize private visibility resolution
2025-12-07 09:31:19 +01:00
Lukas Wirth
ed043f4813
Merge pull request #21215 from ChayimFriedman2/unsized-struct
fix: Don't implement sizedness check via `all_field_tys()`
2025-12-07 08:30:54 +00:00
Matthias Krüger
842f95de70
Rollup merge of #147136 - Jules-Bertholet:const-_-unused-vis, r=jdonszelmann
Add warn-by-default lint for visibility on `const _` declarations

Add a warn-by-default `unused_visibilities` lint for visibility qualifiers on `const _` declarations—e.g. `pub const _: () = ();`. Such qualifiers have no effect.

A [Sourcegraph search](https://sourcegraph.com/search?q=context:global+lang:Rust+pub%5Cs*%28%5C%28.*%5C%29%29%3F%5Cs*const%5Cs%2B_%5Cs*:&patternType=regexp&case=yes&sm=0) suggests that this pattern is relatively rare, and mostly found in tests (with only 3 exceptions). So perhaps this could become an FCW/hard error in the future.

`@rustbot` label T-lang A-lints A-visibility -T-clippy
2025-12-07 08:26:49 +01:00
Zalathar
8f35bd17cc Move ambient gdb discovery from compiletest to bootstrap 2025-12-07 13:44:25 +11:00
Chayim Refael Friedman
aafe60d12f
Merge pull request #21218 from ChayimFriedman2/update-supported-version
internal: Update supported Rust version to 1.90.0
2025-12-07 00:24:54 +00:00
Chayim Refael Friedman
e9d18d5b60 Update supported Rust version to 1.90.0
We no longer work properly with older versions.
2025-12-07 02:14:39 +02:00