Commit graph

311386 commits

Author SHA1 Message Date
Urgau
e2a69cea60 Add #[rustc_should_not_be_called_on_const_items] attribute 2025-11-22 14:27:28 +01:00
bors
e22dab387f Auto merge of #149166 - Zalathar:rollup-fyrwtcb, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#148990 (Exhaustively specify names and stability of `--print` values)
 - rust-lang/rust#149127 (unwrap ret ty of `iter::ArrayChunks::into_remainder` )
 - rust-lang/rust#149134 (std: sys: net: uefi: Implement read_vectored)
 - rust-lang/rust#149135 (Constify `residual_into_try_type`)
 - rust-lang/rust#149160 (Check for intrinsic to fn ptr casts in unified coercions)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-21 03:46:25 +00:00
Stuart Cook
db505171a3
Rollup merge of #149160 - maxdexh:fix-instrinsic-unifying-coercion-ice, r=Kivooeo,BoxyUwU
Check for intrinsic to fn ptr casts in unified coercions

Fixes rust-lang/rust#149143 by ensuring that when coercing multiple expressions to a unified type, the same "intrinsic to fn ptr" check is applied as for other coercions.
2025-11-21 14:44:44 +11:00
Stuart Cook
e7b9935fc5
Rollup merge of #149135 - nxsaken:const_residual_into_try_type, r=scottmcm
Constify `residual_into_try_type`

Feature: `const_try_residual` (related to `try_trait_v2_residual`)
Tracking issue: rust-lang/rust#91285

Constify `residual_into_try_type` introduced in rust-lang/rust#148725.

r? ``@scottmcm``
2025-11-21 14:44:43 +11:00
Stuart Cook
e397c5ddc1
Rollup merge of #149134 - Ayush1325:uefi-tcp4-vector, r=joboet
std: sys: net: uefi: Implement read_vectored

- Basically a copy of write_vectored [0]
- Tested on QEMU ovmf.

[0]: https://github.com/rust-lang/rust/pull/146301
2025-11-21 14:44:43 +11:00
Stuart Cook
f8bc31a804
Rollup merge of #149127 - bend-n:iter_array_chunks_into_remainder_is_non_optional, r=dtolnay
unwrap ret ty of `iter::ArrayChunks::into_remainder`

changes [`iter::ArrayChunks::into_remainder`](https://github.com/rust-lang/rust/issues/100450) to return `array::IntoIter` instead of `Option<array::IntoIter>` as suggested by [`@WaffleLapkin](https://github.com/rust-lang/rust/issues/100450#issuecomment-3555519025)`
2025-11-21 14:44:42 +11:00
Stuart Cook
be1e129bd2
Rollup merge of #148990 - Zalathar:print-kind, r=WaffleLapkin
Exhaustively specify names and stability of `--print` values

While trying to add a new unstable `--print` kind for use by compiletest, I found that the relevant code is quite awkward to work with, for a few reasons:

- It's spread across various parts of a multi-thousand-line source file.
- All newly-added `PrintKind` values are automatically treated as *stable*, unless they are explicitly marked as unstable in a helper function far away.
- Parsing `--print` values relies on a separate table of name/value mappings, but there's no exhaustiveness check for that table.

This PR therefore:
- Extracts the relevant code into its own `print_request` submodule.
- Uses a macro-rules derive to obtain an exhaustive list of values.
- Uses exhaustive matches to associate a name and stability status with each `PrintKind` value.

---

The first commit moves code to a separate module; the second commit contains actual changes.

There should be no change to compiler output.
2025-11-21 14:44:42 +11:00
Zalathar
9c7e7ccd25 Exhaustively specify names and stability of --print values 2025-11-21 11:35:07 +11:00
Zalathar
c81d22d506 Extract module rustc_session::config::print_request 2025-11-21 11:29:10 +11:00
Max Dexheimer
ebf1c38aa6 Check for intrinsic to fn ptr casts in unified coercions
Ensures that when coercing multiple expressions to a
unified type, the same "intrinsic to fn ptr" check is applied as for
other coercions.
2025-11-21 00:01:21 +01:00
bors
5f7653df82 Auto merge of #149158 - matthiaskrgr:rollup-qmtvboe, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#149033 (autodiff rlib handling)
 - rust-lang/rust#149088 (Add missing trailing period to RustDoc for fn create_dir().)
 - rust-lang/rust#149111 (fs: Run file lock tests on all platforms that support it)
 - rust-lang/rust#149113 (sgx: avoid unnecessarily creating a slice)
 - rust-lang/rust#149123 (std: sys: fs: uefi: Fix FileAttr size)
 - rust-lang/rust#149133 (Remove an unused variable)
 - rust-lang/rust#149139 (Enable host tools for aarch64-unknown-linux-ohos)
 - rust-lang/rust#149144 (Reject `async fn` in `const impl` during AST validation)
 - rust-lang/rust#149154 (Fix platform supports docs tiny typo)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-20 22:14:43 +00:00
Matthias Krüger
739f94128d
Rollup merge of #149154 - apiraino:fix-platform-support-typo, r=lqd
Fix platform supports docs tiny typo

This was noticed in https://github.com/rust-lang/blog.rust-lang.org/pull/1641#discussion_r2539313857

Thanks :)
2025-11-20 20:11:48 +01:00
Matthias Krüger
83e37a9be3
Rollup merge of #149144 - lapla-cogito:ice_149083, r=oli-obk
Reject `async fn` in `const impl` during AST validation

closes rust-lang/rust#149083

Fixes the ICE when using `async fn` inside `const impl` blocks by adding AST validation.

Currently, inherent `impl`s does not perform any checks to verify whether it contains `async fn` declarations. In this PR, I have modified the `visit_assoc_item` function to call `check_async_fn_in_const_trait_or_impl` within the `TraitOrImpl::Impl` case to handle this requirement. Additionally, this change has introduced three possible contexts for the corresponding error messages, so I have updated to properly distinguish between these different contexts when generating messages.

r? oli-obk
2025-11-20 20:11:47 +01:00
Matthias Krüger
6b1bdacffe
Rollup merge of #149139 - 12101111:ohos-host-tools, r=nnethercote
Enable host tools for aarch64-unknown-linux-ohos

![7dd6b50e474ee5fd14fd0bffda522874](https://github.com/user-attachments/assets/9b718630-a8a8-426c-ab54-5d767d605091)
2025-11-20 20:11:47 +01:00
Matthias Krüger
21b6ac4902
Rollup merge of #149133 - fluiderson:rustdoc-json-unused, r=chenyukang
Remove an unused variable

Deleted lines are duplicates of the lines [38 & 39](683dd08db5/src/tools/compiletest/src/runtest/rustdoc_json.rs (L38-L39)).
2025-11-20 20:11:46 +01:00
Matthias Krüger
df178d9a15
Rollup merge of #149123 - Ayush1325:uefi-fs-size-fix, r=ChrisDenton
std: sys: fs: uefi: Fix FileAttr size

- The underlying file size is represented by file_size field. The size field is just the size of structure since it is a C DST.
- Fixes bug created in https://github.com/rust-lang/rust/pull/148970

``@rustbot`` label +O-UEFI
2025-11-20 20:11:45 +01:00
Matthias Krüger
3e99b85073
Rollup merge of #149113 - RalfJung:sgx-less-unsafe, r=ChrisDenton
sgx: avoid unnecessarily creating a slice

Cc ``@jethrogb`` -- no idea why this created a slice only to directly convert it back to a raw pointer, but we can avoid this and in fact make the entire function safe. I didn't change the function signature (it's still an `unsafe fn`) as I know nothing about the surrounding code.
2025-11-20 20:11:44 +01:00
Matthias Krüger
001158a793
Rollup merge of #149111 - tgross35:fs-test-updates, r=ChrisDenton
fs: Run file lock tests on all platforms that support it

There are a number of platforms that support file locking but aren't getting tested. Synchronize the list and mark the tests `should_panic` otherwise, to make sure they get updated if more platforms add locking support.

The supported platform list comes from 07bdbaedc6/library/std/src/sys/fs/unix.rs (L1291-L1308). Windows also supports file locks, all other platforms are unsupported.
2025-11-20 20:11:44 +01:00
Matthias Krüger
ad2266b8d0
Rollup merge of #149088 - ximon18:patch-1, r=ChrisDenton
Add missing trailing period to RustDoc for fn create_dir().

Documentation for other functions in the standard library RustDocs have a trailing period at the end of the first sentence, e.g. `create_dir_all()` and `create_buffered()` have the trailing period, but the first line of documentation for `fn create_dir()` lacks a trailing period. This PR adds the missing period.
2025-11-20 20:11:43 +01:00
Matthias Krüger
710720a827
Rollup merge of #149033 - ZuseZ4:autodiff-rlib, r=bjorn3
autodiff rlib handling

As I learned recently, we now apparently support rlib builds already in some cases.
With the last hint from saethlin this seems to now cover all cases. To be sure I'll add a few more testcases before I mark it as ready.

Once this PR lands, we should to the best of my knowledge, support autodiff in almost code locations, only vtable/dyn ptr remain unsupported for now.

r? ghost

closes: https://github.com/rust-lang/rust/issues/148856
closes: https://github.com/rust-lang/rust/issues/137520
2025-11-20 20:11:42 +01:00
bors
53732d5e07 Auto merge of #149109 - scottmcm:align-always-alignment, r=tgross35
See if this is the time we can remove `layout::size_align`

This was a bad idea before, but now that `size_of` and `align_of` work completely differently than when removing it was first tried in 2020, maybe it makes sense now.

(Or maybe I'll just add another attempt to the list in the comments...)

r? ghost
2025-11-20 19:01:43 +00:00
apiraino
b9460471e2
Fix platform supports docs typo 2025-11-20 18:00:43 +01:00
lapla
c108451faf
Reject async fn in const impl during AST validation 2025-11-21 00:02:58 +09:00
bors
7281a3bc4b Auto merge of #149132 - matthiaskrgr:rollup-8khp9s2, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#146925 (Add doc for va_list APIs)
 - rust-lang/rust#147035 (alloc: fix `Debug` implementation of `ExtractIf`)
 - rust-lang/rust#147173 (Add support for hexagon-unknown-qurt target)
 - rust-lang/rust#148261 (rustc_public: Make Id types !Send / !Sync)
 - rust-lang/rust#149041 (ignore unsized types in mips64 and sparc64 callconvs)
 - rust-lang/rust#149056 (fix the fragment_in_dst_padding_gets_overwritten test on s390x)
 - rust-lang/rust#149071 (Add test scaffolding for the `remote-test-client`)
 - rust-lang/rust#149095 (rustc-dev-guide subtree update)
 - rust-lang/rust#149108 ([AIX][ppc64le-linux-gnu] Add Amy Kwan to target maintainers)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-20 13:25:16 +00:00
12101111
1e14a5dc73
Enable host tools for aarch64-unknown-linux-ohos 2025-11-20 19:22:01 +08:00
nxsaken
5590d7db51 Constify residual_into_try_type 2025-11-20 15:08:11 +04:00
Ayush Singh
3f08502242
std: sys: net: uefi: Implement read_vectored
- Basically a copy of write_vectored [0]
- Tested on QEMU ovmf.

[0]: https://github.com/rust-lang/rust/pull/146301

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-11-20 15:50:19 +05:30
Matthias Krüger
8613f0e7ef
Rollup merge of #149108 - daltenty:daltenty/add-maintainer, r=Noratrieb
[AIX][ppc64le-linux-gnu] Add Amy Kwan to target maintainers

Amy has effectively been helping to maintain these Power targets for a while, so add her to the maintainers list.
2025-11-20 11:15:57 +01:00
Matthias Krüger
aecee50487
Rollup merge of #149095 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to 61ad195c71.

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

r? `````@ghost`````
2025-11-20 11:15:56 +01:00
Matthias Krüger
37dc26c816
Rollup merge of #149071 - ferrocene:pvdrz/remote-test-client-timeout-tests, r=jieyouxu
Add test scaffolding for the `remote-test-client`

r? ``@jieyouxu``
2025-11-20 11:15:55 +01:00
Matthias Krüger
5172159dfd
Rollup merge of #149056 - fneddy:fix_s390_test_padding_overwrite, r=RalfJung
fix the fragment_in_dst_padding_gets_overwritten test on s390x

on s390x 128bit types have a smaller alignment then on x86[^1]. This leads to smaller structs (24 instead of 32 bytes) and therefore the write_unaligned will write outside of the structs boundary.

To fix the test, change the trailing u32 into a u8. This will generate 7 trailing padding bytes on s390x and 15 on x86_64. Also change the start of the garbage data so it will span over x,y and padding:

```
s390x:   XXXXXXXXXXXXXXXXY-------
x86_64:  XXXXXXXXXXXXXXXXY---------------
                      GGGGGGGG

```

[^1]: s390x ELF ABI Table 1.1, Page 12 https://github.com/IBM/s390x-abi
2025-11-20 11:15:54 +01:00
Matthias Krüger
7198d31e4b
Rollup merge of #149041 - folkertdev:sparc64-mips64-ignore-unsized, r=bjorn3
ignore unsized types in mips64 and sparc64 callconvs

Non-rustic calling conventions should not make up an ABI for unsized types (cc https://github.com/rust-lang/rust/pull/148302). The vast majority of our callconv implementations already ignore unsized types, `sparc64` and `mips64` I guess were missed.

r? `````@bjorn3`````
2025-11-20 11:15:53 +01:00
Matthias Krüger
34b3c9dd4d
Rollup merge of #148261 - aDotInTheVoid:no-sync-for-smir, r=celinval
rustc_public: Make Id types !Send / !Sync

These types are Id's to a table stored in TLS, so using them from another tread will either panic, or give wrong results.

Therefor, I've added a ~~`ReferencesTls`~~`ThreadLocalIndex`  marker type, which ensures types arn't `Send`/`Sync`.

This is a breaking change for users of the `rustc_public` crate.

~~It also changes how `DefId` and similar are `Serialize`d. It would be possible to preserve the old behavior if that's needed, but I couldn't see any tests for these.~~ EDIT: Not anymore: https://github.com/rust-lang/rust/pull/148261#discussion_r2476111612

Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/channel/320896-project-stable-mir/topic/WDYM.20.22should.20not.20.20be.20shared.20across.20threads.22/with/547374171
2025-11-20 11:15:52 +01:00
Matthias Krüger
422b83aeee
Rollup merge of #147173 - androm3da:bcain/hexagon_qurt, r=davidtwco,tgross35
Add support for hexagon-unknown-qurt target

MCP: https://github.com/rust-lang/compiler-team/issues/919
Fixes https://github.com/rust-lang/rust/issues/148982.
2025-11-20 11:15:51 +01:00
Matthias Krüger
cd4ce66e50
Rollup merge of #147035 - joboet:extract_if_debug, r=tgross35
alloc: fix `Debug` implementation of `ExtractIf`

I noticed this while reviewing rust-lang/rust#141032. Calling `get` on the inner `Vec` never returns `Some` as the `Vec`'s length is temporarily set to zero while the `ExtractIf` exists.
2025-11-20 11:15:50 +01:00
Matthias Krüger
2eeec770fe
Rollup merge of #146925 - DiuDiu777:va-doc-fix, r=tgross35
Add doc for va_list APIs

I observed that [PR146521](https://github.com/rust-lang/rust/pull/146521) submitted two weeks ago resolved some documentation issues related to `VaListImpl`, similar to the previous [PR136969](https://github.com/rust-lang/rust/pull/136969).

This PR specifically adds requirements about argument availability for `VaListImpl::arg`, and also adds safety descriptions to the three associated intrinsic APIs.
2025-11-20 11:15:49 +01:00
Fluid
c8ba2a59f8 remove an unused variable
Deleted lines are duplicates of the lines 38 & 39.
2025-11-20 12:14:10 +02:00
bors
2c0f4860cc Auto merge of #149118 - folkertdev:stdarch-sync-2025-11-19, r=tgross35
stdarch subtree update

Subtree update of `stdarch` to 50134e10cb.

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

The only interesting commit is the final one, which enables the `avx10_target_feature` feature in the standard library, because it is now used in `stdarch`.

r? `@sayantn` (or whoever, this is just a straightforward sync)
2025-11-20 10:08:24 +00:00
bendn
68abe69f13
iter::ArrayChunks::into_remainder ought not return option 2025-11-20 15:27:57 +07:00
Ralf Jung
7ad3c5c4f8 sgx: avoid unnecessarily creating a slice 2025-11-20 08:11:43 +01:00
Ayush Singh
ea3fe53ac0
std: sys: fs: uefi: Fix FileAttr size
- The underlying file size is represented by file_size field. The size
  field is just the size of structure since it is a C DST.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-11-20 10:13:11 +05:30
bors
683dd08db5 Auto merge of #89917 - davidtwco:issue-60705-stabilize-rust-symbol-mangling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly

cc rust-lang/rust#60705 rust-lang/compiler-team#938

Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.

Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).

This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.

The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):

- rust-lang/rust#57967
- rust-lang/rust#63559
- rust-lang/rust#75675
- rust-lang/rust#77452
- rust-lang/rust#77554
- rust-lang/rust#83767
- rust-lang/rust#87194
- rust-lang/rust#87789

Rust's symbol mangling scheme has support in the following external tools:

- `binutils`/`gdb` (GNU `libiberty`)
    - [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as 979526c9ce
    - [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as 42bf58bb13
    - [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as e1cb00db67
    - [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as 32fc3719e0
    - [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as 84096498a7
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
  - 7310403e3c
  - c8c2b4629f
  - 0a2d4f3f24
- Linux `perf`
- `valgrind`
  - [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)

https://github.com/rust-lang/rust/pull/85530#issuecomment-857855379 contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by rust-lang/rust#87194 (confirmed by follow-up crater run, https://github.com/rust-lang/rust/pull/85530#issuecomment-883679416).

`@rustbot` label +T-compiler
r? `@michaelwoerister`
2025-11-20 04:26:30 +00:00
Folkert de Vries
ae682a3862
enable avx10_target_feature in core (used by stdarch) 2025-11-20 00:27:56 +01:00
Trevor Gross
cea9dd8dc8 test: Use an ignore message for fs Android skips 2025-11-19 16:29:48 -06:00
Trevor Gross
4bf24d2b54 fs: Expect a test failure if file locks aren't supported
Rather than skipping the tests, make sure that they fail. This ensures
that if file locking support is added for more platforms in the future,
the tests don't wind up quietly skipped.
2025-11-19 16:29:48 -06:00
bors
d2f887349f Auto merge of #149073 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

13 commits in 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f..5c0343317ce45d2ec17ecf41eaa473a02d73e29c
2025-11-12 15:56:06 +0000 to 2025-11-18 19:05:44 +0000
- feat: emit a warning when both `package.publish` and `--index` are specified (rust-lang/cargo#16268)
- docs(cargo-yank): clarify yank behavior with leaked credentials (rust-lang/cargo#16274)
- feat(generate-lockfile): Add unstable --publish-time flag  (rust-lang/cargo#16265)
- Do not lock the artifact-dir for check builds (rust-lang/cargo#16230)
- fix(fingerprint): force update mtime of cargo-check artifacts (rust-lang/cargo#16262)
- fix(manifest): Point out when a key belongs to config (rust-lang/cargo#16256)
- Use raw false during cfg test (rust-lang/cargo#16261)
- Suppress metadata warnings for non–crates.io publishable packages (rust-lang/cargo#16241)
- feat(tree): Support long forms for --format variables (rust-lang/cargo#16204)
- fix(config): Fallback to non-canonical path for workspace-path-hash (rust-lang/cargo#16248)
- fix: update mtime for generated files after unpacking (rust-lang/cargo#16250)
- feat(cli): Add support for completing `--config` values in Bash (rust-lang/cargo#16245)
- feat: Add a typos CI job (rust-lang/cargo#16122)
2025-11-19 21:34:16 +00:00
Scott McMurray
30f4a2ae16 See if this is the time we can remove layout::size_align
This was a bad idea before, but now that `size_of` and `align_of` work completely differently than when removing it was first tried in 2020, maybe it makes sense now.

(Or maybe I'll just add another attempt to the list in the comments...)
2025-11-19 12:55:21 -08:00
Trevor Gross
8c4e3ff0a6 fs: Update skipped file lock tests to match flock support
The list of platforms for which file locks are tested is smaller than
the list of platforms that support it. Synchronize these here.

Link: 07bdbaedc6/library/std/src/sys/fs/unix.rs (L1291-L1308)
2025-11-19 14:36:51 -06:00
David Tenty
a74d572b74 [AIX][ppc64le-linux-gnu] Add Amy Kwan to target maintainers 2025-11-19 15:09:32 -05:00
Alona Enraght-Moony
e7b84604cb rustc_public: Make Id types !Send / !Sync
These types are Id's to a table stored in TLS, so using them from
another tread will either panic, or give wrong results.

Therefor, I've added a `ThreadLocalIndex` marker type, which ensures types
arn't `Send`/`Sync`.

This is a breaking change for users of the `rustc_public` crate.

Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/channel/320896-project-stable-mir/topic/WDYM.20.22should.20not.20.20be.20shared.20across.20threads.22/with/547374171
2025-11-19 19:46:18 +00:00