Commit Graph

286200 Commits

Author SHA1 Message Date
Chris Denton
830bd8b6f4
Implement Default for raw pointers 2025-04-11 10:49:33 +00:00
bors
18a029cfe8 Auto merge of #139657 - Zalathar:rollup-6oh6f9q, r=Zalathar
Rollup of 12 pull requests

Successful merges:

 - #137447 (add `core::intrinsics::simd::{simd_extract_dyn, simd_insert_dyn}`)
 - #138182 (rustc_target: update x86_win64 to match the documented calling convention for f128)
 - #138682 (Allow drivers to supply a list of extra symbols to intern)
 - #138904 (Test linking and running `no_std` binaries)
 - #138998 (Don't suggest the use of  `impl Trait` in closure parameter)
 - #139447 (doc changes: debug assertions -> overflow checks)
 - #139469 (Introduce a `//@ needs-crate-type` compiletest directive)
 - #139564 (Deeply normalize obligations in `BestObligation` folder)
 - #139574 (bootstrap: improve `channel` handling)
 - #139600 (Update `compiler-builtins` to 0.1.153)
 - #139641 (Allow parenthesis around inferred array lengths)
 - #139654 (Improve `AssocItem::descr`.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-11 04:24:47 +00:00
Stuart Cook
96d282c87b
Rollup merge of #139654 - nnethercote:AssocKind-descr, r=compiler-errors
Improve `AssocItem::descr`.

The commit adds "associated" to the description of associated types and associated consts, to match the description of associated functions. This increases error message precision and consistency with `AssocKind::fmt`.

The commit also notes an imperfection in `AssocKind::fmt`; fixing this imperfection is possible but beyond the scope of this PR.

r? `@estebank`
2025-04-11 13:31:50 +10:00
Stuart Cook
25d282efd4
Rollup merge of #139641 - BoxyUwU:allow_parend_array_len_infer, r=compiler-errors
Allow parenthesis around inferred array lengths

In #135272 it was noticed that we weren't handling `Vec<(((((_)))))>` correctly under the new desugaring for `generic_arg_infer`, this had to be fixed in order to not regress stable code for types that should continue working. This has the side effect of *also* allowing the following to work:
```rust
#![feature(generic_arg_infer)]
struct Bar<const N: usize>;
fn main() {
    let a: Bar<((_))> = Bar::<10>;
}
```

However I did not make the same change for array lengths resulting in the following not compiling:
```rust
#![feature(generic_arg_infer)]
fn main() {
    let a: [u8; (((_)))] = [2; 2];
    let a: [u8; 2] = [2; (((((_)))))];
}
```

This is rather inconsistent as parenthesis around `_` *are* supported for const args to non-arrays, and type args. This PR fixes this allowing the above example to compile. No stable impact.

r? compiler-errors
2025-04-11 13:31:49 +10:00
Stuart Cook
c8acc23d1d
Rollup merge of #139600 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.153

Includes the following changes:

* Avoid OOB access in `memcpy` and `memmove` [1]
* Enable intrinsics on AVR [2]
* `libm` updates to avoid using `core::arch` vector intrinsics [3]
* Re-enable `f16` on aarch64 without Neon [4]

[1]: https://github.com/rust-lang/compiler-builtins/pull/799
[2]: https://github.com/rust-lang/compiler-builtins/pull/791
[3]: https://github.com/rust-lang/compiler-builtins/pull/814
[4]: https://github.com/rust-lang/compiler-builtins/pull/809
2025-04-11 13:31:49 +10:00
Stuart Cook
fb7f0e4029
Rollup merge of #139574 - onur-ozkan:better-channel-handling, r=onur-ozkan
bootstrap: improve `channel` handling

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

See [this comment](https://github.com/rust-lang/rust/pull/139574#discussion_r2034611993) for the explanation of this bug.
2025-04-11 13:31:48 +10:00
Stuart Cook
d213934874
Rollup merge of #139564 - compiler-errors:deeply-norm, r=lcnr
Deeply normalize obligations in `BestObligation` folder

Built on #139513.

This establishes a somewhat rough invariant that the `Obligation`'s predicate is always deeply normalized in the folder; when we construct a new obligation we normalize it.

Putting this up for discussion since it does affect some goals.

r? lcnr
2025-04-11 13:31:48 +10:00
Stuart Cook
ea1a31b150
Rollup merge of #139469 - jieyouxu:compiletest-supports-crate-type, r=onur-ozkan
Introduce a `//@ needs-crate-type` compiletest directive

The `//@ needs-crate-type: $crate_types...` directive takes a comma-separated list of crate types that the target platform must support in order for the test to be run. This allows the test writer to semantically convey that the ignore condition is based on target crate type needs, instead of using a general purpose `//@ ignore-$target` directive (often without comment).

Fixes #132309.

### Example

```rs
//@ needs-crate-type: dylib (ignored on e.g. wasm32-unknown-unknown)
//@ compile-flags: --crate-type=dylib

fn foo() {}
```

### Review advice

- Best reviewed commit-by-commit.
- The impl is not very clean, I briefly attempted to clean up the directive handling but found that more invasive changes are needed, so I'd like to not block on the cleanup for now.

try-job: test-various
try-job: armhf-gnu
2025-04-11 13:31:47 +10:00
Stuart Cook
a7d7a6d0eb
Rollup merge of #139447 - izarma:issue-108131-fix, r=scottmcm
doc changes: debug assertions -> overflow checks

This PR is for the following issue:
https://github.com/rust-lang/rust/issues/108131

has some changes in docs
2025-04-11 13:31:46 +10:00
Stuart Cook
573ebf011e
Rollup merge of #138998 - rperier:donot_suggest_to_use_impl_trait_in_closure_params, r=Noratrieb
Don't suggest the use of  `impl Trait` in closure parameter

Fixes #138932
2025-04-11 13:31:46 +10:00
Stuart Cook
9a9a0781fa
Rollup merge of #138904 - madsmtm:apple-test-no-std, r=tgross35
Test linking and running `no_std` binaries

I looked around, but it seems that we do not have a test that tests a `#![no_std]` + `#![no_main]` binary. So now I've added one. Motivated by discussion in [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Provide.20.60__isPlatformVersionAtLeast.60.20in.20.60std.60.3F/with/507870028).

r? ```@tgross35```

try-job: arm-android
try-job: armhf-gnu
try-job: dist-ohos
try-job: x86_64-mingw-1
2025-04-11 13:31:45 +10:00
Stuart Cook
0abc6c6e98
Rollup merge of #138682 - Alexendoo:extra-symbols, r=fee1-dead
Allow drivers to supply a list of extra symbols to intern

Allows adding new symbols as `const`s in external drivers, desirable in Clippy so we can use them in patterns to replace code like 75530e9f72/src/tools/clippy/clippy_lints/src/casts/cast_ptr_alignment.rs (L66)

The Clippy change adds a couple symbols as a demo, the exact `clippy_utils` API and replacing other usages can be done on the Clippy side to minimise sync conflicts

---

try-job: aarch64-gnu
2025-04-11 13:31:44 +10:00
Stuart Cook
63df6f1200
Rollup merge of #138182 - durin42:llvm-21-fp128-windows, r=tgross35
rustc_target: update x86_win64 to match the documented calling convention for f128

llvm/llvm-project@5ee1c0b714 updates llvm to match the documented calling convention to pass f128 indirectly. This change makes us do that on all versions of LLVM, not just starting with LLVM 21.

`@rustbot` label llvm-main

try-job: dist-x86_64-msvc
try-job: dist-x86_64-mingw
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
2025-04-11 13:31:44 +10:00
Stuart Cook
45ebc4060b
Rollup merge of #137447 - folkertdev:simd-extract-insert-dyn, r=scottmcm
add `core::intrinsics::simd::{simd_extract_dyn, simd_insert_dyn}`

fixes https://github.com/rust-lang/rust/issues/137372

adds `core::intrinsics::simd::{simd_extract_dyn, simd_insert_dyn}`, which contrary to their non-dyn counterparts allow a non-const index. Many platforms (but notably not x86_64 or aarch64) have dedicated instructions for this operation, which stdarch can emit with this change.

Future work is to also make the `Index` operation on the `Simd` type emit this operation, but the intrinsic can't be used directly. We'll need some MIR shenanigans for that.

r? `@ghost`
2025-04-11 13:31:43 +10:00
Nicholas Nethercote
7e8184fa2a Improve AssocItem::descr.
The commit adds "associated" to the description of associated types and
associated consts, to match the description of associated functions.
This increases error message precision and consistency with
`AssocKind::fmt`.

The commit also notes an imperfection in `AssocKind::fmt`; fixing this
imperfection is possible but beyond the scope of this PR.
2025-04-11 11:03:08 +10:00
bors
e62d47dace Auto merge of #139410 - Zoxc:fix-dep-graph-no-prev-map, r=oli-obk
Reuse the index from promoted nodes when coloring executed tasks

https://github.com/rust-lang/rust/pull/138824 did not correctly handle the case where a dep node was promoted green, but later or concurrently executed. It resulted in multiple dep nodes being allocated to it. This fixes that by checking that the node was not previously green in the encoder lock.

This also fixes a race when forcing diagnostic nodes introduced in https://github.com/rust-lang/rust/pull/138824.

https://github.com/rust-lang/rust/pull/138824 should get reverted on beta.

This should fix #139110.

r? `@oli-obk`
2025-04-10 23:28:37 +00:00
bors
0fe8f3454d Auto merge of #137412 - scottmcm:redo-swap, r=cuviper
Ensure `swap_nonoverlapping` is really always untyped

This replaces #134954, which was arguably overcomplicated.

## Fixes #134713

Actually using the type passed to `ptr::swap_nonoverlapping` for anything other than its size + align turns out to not work, so this goes back to always erasing the types down to just bytes.

(Except in `const`, which keeps doing the same thing as before to preserve `@RalfJung's` fix from #134689)

## Fixes #134946

I'd previously moved the swapping to use auto-vectorization *on bytes*, but someone pointed out on Discord that the tail loop handling from that left a whole bunch of byte-by-byte swapping around.  This goes back to manual tail handling to avoid that, then still triggers auto-vectorization on pointer-width values.  (So you'll see `<4 x i64>` on `x86-64-v3` for example.)
2025-04-10 20:19:11 +00:00
Augie Fackler
d7e7f8b522 tests: adjust expectation for f128 abi on Windows
llvm/llvm-project@5ee1c0b714 updates llvm
to match the documented calling convention to pass f128 indirectly.

@rustbot label llvm-main
2025-04-10 15:28:56 -04:00
Folkert de Vries
59c55339af
add simd_insert_dyn and simd_extract_dyn 2025-04-10 21:22:07 +02:00
Michael Goulet
decd7ecd1e Deeply normalize obligations in BestObligation 2025-04-10 18:58:04 +00:00
Boxy
8f00b1fdad Allow parenthesis around inferred array lengths 2025-04-10 18:57:42 +01:00
Michael Goulet
62d5fb85ac Simplify 2025-04-10 17:52:46 +00:00
Trevor Gross
b435def33c Update compiler-builtins to 0.1.153
Includes the following changes:

* Avoid OOB access in `memcpy` and `memmove` [1]
* Enable intrinsics on AVR [2]
* `libm` updates to avoid using `core::arch` vector intrinsics [3]
* Re-enable `f16` on aarch64 without Neon [4]

[1]: https://github.com/rust-lang/compiler-builtins/pull/799
[2]: https://github.com/rust-lang/compiler-builtins/pull/791
[3]: https://github.com/rust-lang/compiler-builtins/pull/814
[4]: https://github.com/rust-lang/compiler-builtins/pull/809
2025-04-10 17:40:15 +00:00
bors
2205455d44 Auto merge of #139634 - matthiaskrgr:rollup-45shqa5, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #139502 (fix "still mutable" ice while metrics are enabled)
 - #139510 (Rename some `name` variables as `ident`.)
 - #139606 (Update compiletest to Edition 2024)
 - #139609 (compiletest: don't use stringly paths for `compose_and_run`)
 - #139614 (Avoid empty identifiers for delegate params and args.)
 - #139626 (Remove unnecessary `mut` in test.)
 - #139630 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-10 17:10:16 +00:00
Matthias Krüger
c9613f87ef
Rollup merge of #139630 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`

a sync is needed to fix the miri-test-libstd failures
2025-04-10 17:27:17 +02:00
Matthias Krüger
9b9d098e1d
Rollup merge of #139626 - m-ou-se:mut, r=lqd
Remove unnecessary `mut` in test.

The value is moved in `pin!()`, so the binding doesn't need to be `mut` itself.

(Rustc doesn't warn about this due to the current hacky implementation of `pin!()`. That is fixed by https://github.com/rust-lang/rust/pull/139114.)
2025-04-10 17:27:17 +02:00
Matthias Krüger
7fbd7bdfa8
Rollup merge of #139614 - nnethercote:fix-139512, r=oli-obk
Avoid empty identifiers for delegate params and args.

Details in individual commits.

r? `@oli-obk`
2025-04-10 17:27:16 +02:00
Matthias Krüger
362c0f2711
Rollup merge of #139609 - jieyouxu:compiletest-path-misc, r=Kobzol
compiletest: don't use stringly paths for `compose_and_run`

Eventually I'd like to fully migrate to `camino`'s `{Utf8Path,Utf8PathBuf}` because compiletest assumes UTF-8 paths all over the place, so this is an precursor change to make the migration diff cleaner.

r? `@Kobzol` (or bootstrap/compiler)
2025-04-10 17:27:15 +02:00
Matthias Krüger
af3b892ca3
Rollup merge of #139606 - jieyouxu:compiletest-edition2024, r=compiler-errors
Update compiletest to Edition 2024

r? bootstrap (or compiler)

try-job: x86_64-apple-1
try-job: x86_64-msvc-1
try-jbo: x86_64-mingw-1
2025-04-10 17:27:15 +02:00
Matthias Krüger
79f357e63d
Rollup merge of #139510 - nnethercote:name-to-ident, r=fee1-dead
Rename some `name` variables as `ident`.

It bugs me when variables of type `Ident` are called `name`. It leads to silly things like `name.name`. `Ident` variables should be called `ident`, and `name` should be used for variables of type `Symbol`.

This commit improves things by by doing `s/name/ident/` on a bunch of `Ident` variables. Not all of them, but a decent chunk.

r? `@fee1-dead`
2025-04-10 17:27:14 +02:00
Matthias Krüger
0e9c4fbf23
Rollup merge of #139502 - yaahc:still-mutable-ice, r=bjorn3
fix "still mutable" ice while metrics are enabled

Resolves "still mutable" ICE discovered by `@matthiaskrgr` here: [#t-docs-rs > metrics intitiative @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/356853-t-docs-rs/topic/metrics.20intitiative/near/510490790)

This was caused by invoking `crate_hash` before the `definitions` struct was frozen here: e643f59f6d/compiler/rustc_interface/src/passes.rs (L951)

resolved by moving metrics dumping to occur after `analysis` freezes the definitions

I'm guessing we didn't discover this in CI because the problem only occurs when you try to calculate the crash hash with incremental compilation enabled when it tries to freeze the definitions here: e643f59f6d/compiler/rustc_middle/src/hir/map.rs (L1172)

my understanding is that this causes us to freeze the definitions too early in compilation, then we subsequently try to mutate them, likely during `analysis`, and this causes the ICE.

r? `@bjorn3`
2025-04-10 17:27:13 +02:00
Alex Macleod
f740326216 Allow drivers to supply a list of extra symbols to intern 2025-04-10 13:39:23 +00:00
Ralf Jung
955d92fb1b update lockfile 2025-04-10 15:19:59 +02:00
Ralf Jung
1347cc8f15
Merge pull request #4264 from RalfJung/rustup
Rustup
2025-04-10 12:50:10 +00:00
Ralf Jung
f69ea4d82f Merge from rustc 2025-04-10 14:24:19 +02:00
Ralf Jung
830c58be89 Preparing for merge from rustc 2025-04-10 14:24:14 +02:00
bors
69b3959afe Auto merge of #139622 - matthiaskrgr:rollup-8ri1vid, r=matthiaskrgr
Rollup of 13 pull requests

Successful merges:

 - #138167 (Small code improvement in rustdoc hidden stripper)
 - #138605 (Clean up librustdoc::html::render to be better encapsulated)
 - #139423 (Suppress missing field error when autoderef bottoms out in infer)
 - #139449 (match ergonomics: replace `peel_off_references` with a recursive call)
 - #139507 (compiletest: Trim whitespace from environment variable names)
 - #139530 (Remove some dead or leftover code related to rustc-intrinsic abi removal)
 - #139560 (fix title of offset_of_enum feature)
 - #139563 (emit a better error message for using the macro incorrectly)
 - #139568 (Don't use empty trait names)
 - #139580 (Temporarily leave the review rotation)
 - #139589 (saethlin is back from vacation)
 - #139592 (rustdoc: Enable Markdown extensions when looking for doctests)
 - #139599 (Tracking issue template: fine-grained information on style update status)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-10 12:18:24 +00:00
Ralf Jung
7da4440012
Merge pull request #4262 from RalfJung/win-path
path: add more Windows tests
2025-04-10 11:12:21 +00:00
Ralf Jung
dc3843b70e make GetFullPathNameW more correct on non-Windows hosts 2025-04-10 12:48:00 +02:00
Mara Bos
95613e3dbc Remove unnecessary mut.
The value is moved in pin!().
2025-04-10 12:40:27 +02:00
Matthias Krüger
b14671e1bd
Rollup merge of #139599 - joshtriplett:style-tracking, r=traviscross
Tracking issue template: fine-grained information on style update status

Inspired by some of the communication issues around the stabilization of
`let`-chains, give more fine-grained information about the status of
updating style for any new syntax.

This does not change the process or blockers in any way; it only
*documents* the current state in the tracking issue. For instance, in
the case of `let`-chains, we would have checked the boxes for "Style
team decision" and "(non-blocking) Formatting has been implemented", and
not checked the box for the style guide. That would have then provided
better supporting information for any decisions.
2025-04-10 11:10:20 +02:00
Matthias Krüger
d7171bc8ce
Rollup merge of #139592 - camelid:doctest-md-opts, r=notriddle
rustdoc: Enable Markdown extensions when looking for doctests

Fixes #139064.

We should enable these to avoid misinterpreting uses of the extended
syntax as code blocks. This happens in practice with multi-paragraph
footnotes, as discovered in #139064.
2025-04-10 11:10:19 +02:00
Matthias Krüger
e3bcfbf3cf
Rollup merge of #139589 - saethlin:vacation, r=camelid
saethlin is back from vacation
2025-04-10 11:10:19 +02:00
Matthias Krüger
c100846574
Rollup merge of #139580 - fmease:unrotate, r=fmease
Temporarily leave the review rotation

r? ghost
2025-04-10 11:10:18 +02:00
Matthias Krüger
7509b4652c
Rollup merge of #139568 - nnethercote:empty-trait-name, r=compiler-errors
Don't use empty trait names

Helps with #137978. Details in individual commits.

r? ```@davidtwco```
2025-04-10 11:10:17 +02:00
Matthias Krüger
e8994abe52
Rollup merge of #139563 - EnzymeAD:better-autodiff-err, r=jieyouxu
emit a better error message for using the macro incorrectly

fixing: https://github.com/EnzymeAD/rust/issues/185
I feel like it's not a perfect message either, so I'm open to suggestions.
But at the end of the day users will need to read the docs anyway, and emitting
multi-line errors each time this gets triggered can probably become annoying?

r? ``@jieyouxu`` since you've reviewed my frontend work back in the days.

Tracking:

- https://github.com/rust-lang/rust/issues/124509
2025-04-10 11:10:17 +02:00
Matthias Krüger
12172ebf70
Rollup merge of #139560 - programmerjake:patch-5, r=jieyouxu
fix title of offset_of_enum feature

tracking issue #120141
2025-04-10 11:10:16 +02:00
Matthias Krüger
c808b20360
Rollup merge of #139530 - oli-obk:rustc-intrinsic-cleanup, r=RalfJung
Remove some dead or leftover code related to rustc-intrinsic abi removal

r? ```@RalfJung```

PR that removed the ABI: https://github.com/rust-lang/rust/pull/139455

tracking issue: https://github.com/rust-lang/rust/issues/132735
2025-04-10 11:10:16 +02:00
Matthias Krüger
2b0e47eb4c
Rollup merge of #139507 - Zalathar:trim-env-name, r=jieyouxu
compiletest: Trim whitespace from environment variable names

When a test contains a directive like `//@ exec-env: FOO=bar`, compiletest currently includes that leading space in the name of the environment variable, so it is defined as ` FOO` instead of `FOO`.

This is an annoying footgun that is pretty much never intended, especially since most other directives *do* trim whitespace. So let's get rid of it by trimming the environment variable name.

Values remain untrimmed, since there could conceivably be a use-case for values with leading space, but perhaps we'll end up trimming values too in the future.

Recently observed in https://github.com/rust-lang/rust/pull/138603#issuecomment-2783709359.

Fixes #132990.
Supersedes #133148.

---

try-job: test-various
2025-04-10 11:10:15 +02:00
Matthias Krüger
7f08e638c4
Rollup merge of #139449 - Nadrieril:peel-recursive, r=lcnr
match ergonomics: replace `peel_off_references` with a recursive call

This makes it imo quite a bit easier to follow how the binding mode gets calculated.

cc ```@dianne```
2025-04-10 11:10:14 +02:00