Commit Graph

169009 Commits

Author SHA1 Message Date
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](https://github.com/rust-lang/rust/blob/2e667b0c6491678642a83e3aff86626397360af5/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](https://github.com/rust-lang/rust/blob/2e667b0c6491678642a83e3aff86626397360af5/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
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
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
Guillaume Gomez 4c6544b06e Run clippy both with and without default features on the GCC backend 2025-12-09 14:52:15 +01:00
Matthias Krüger b13a25377d Rollup merge of #149755 - Zalathar:test-mode, r=jieyouxu
bootstrap: Use a `CompiletestMode` enum instead of bare strings

This gives better static checking when dealing with compiletest modes in bootstrap, especially for those modes that overlap with the name of a test suite directory.

r? jieyouxu (or bootstrap)
2025-12-09 06:17:25 +01: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
Matthias Krüger c4778dcc39 Rollup merge of #149720 - jtracey:patch-1, r=notriddle
rustdoc book: mention inner doc attribute

Couldn't find this documented anywhere else.
2025-12-09 06:17:23 +01:00
bors a371038013 Auto merge of #149426 - antoyo:libgccjit-targets, r=Kobzol
Move the libgccjit.so file in a target directory

Since GCC is not multi-target, we need multiple libgccjit.so. Our solution to have a directory per target so that we can have multiple libgccjit.so.

r? `@Kobzol`
2025-12-09 01:58:46 +00: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 https://github.com/rust-lang/rust-analyzer/commit/5e3e9c4e61bba8a5e72134b9ffefbef8f531d008.

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
Zalathar dc8cdb1c00 Use a CompiletestMode enum in bootstrap 2025-12-08 21:35:58 +11:00
Zalathar 8c582e1f53 Don't require test::Coverage to implement Ord
This derive was an artifact of test-only method `Cache::all` wanting to
automatically sort its output to hide HashMap iteration order.

We can achieve an equivalent result by requiring the caller to provide a
projection function that returns results that _are_ sortable.
2025-12-08 21:35:16 +11: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
bors 5bc345055b Auto merge of #149455 - jdonszelmann:metadata-decoding-s, r=WaffleLapkin
Remove unwraps from metadata decoding: introduce `BlobDecoder`

r? `@oli-obk`
2025-12-08 09:41:00 +00: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
Jana Dönszelmann fa5f075d1c add TyCtxt everywhere replacing nothing or passed sessions 2025-12-08 00:24:28 +01: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 1eef811747 Rollup merge of #149724 - Kobzol:libstd-text-staging, r=jieyouxu
Fix off-by-one staging output when testing the library

It seems generally useful to store the `Mode` in `Cargo`, I remember thinking a few times that it would be useful in other places.

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

r? `@jieyouxu`
2025-12-07 08:26:51 +01:00
Matthias Krüger 3d4d195407 Rollup merge of #149721 - generalmimon:rustc-book-sidebar-link-label-fix, r=ChrisDenton
rustc book: fix `*-pc-windows-msvc` link label in sidebar

As far as I know, `*-unknown-windows-msvc` is not a thing. At least if I search for "unknown-windows-msvc" in the entire [rust-lang](https://github.com/rust-lang) organization (https://github.com/search?q=org%3Arust-lang+%22unknown-windows-msvc%22++&type=code&state=open), it gives only this occurrence and 3 other occurrences in https://github.com/rust-lang/lld, which was archived in 2019.

I believe `*-pc-windows-msvc` is the correct replacement because that is the name of the page the link points to:

https://github.com/rust-lang/rust/blob/ba86c0460b0233319e01fd789a42a7276eade805/src/doc/rustc/src/platform-support/windows-msvc.md?plain=1#L1
2025-12-07 08:26:50 +01: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
Zalathar 85f7a6ed61 Move Android-related discovery out of core::debuggers
While some of this information is needed by debugger discovery, it is also
needed by non-debuginfo tests, so the code doesn't belong in the `debuggers`
module.
2025-12-07 13:41:55 +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
bors d427ddfe90 Auto merge of #149717 - matthiaskrgr:rollup-spntobh, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#149659 (Look for typos when reporting an unknown nightly feature)
 - rust-lang/rust#149699 (Implement `Vec::from_fn`)
 - rust-lang/rust#149700 (rustdoc: fix bugs with search aliases and merging)
 - rust-lang/rust#149713 (Update windows-gnullvm platform support doc)
 - rust-lang/rust#149716 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-06 21:42:15 +00:00
Jakub Beránek 7fdf06693a Fix off-by-one staging output when testing the library 2025-12-06 22:02:23 +01:00