Commit Graph

55678 Commits

Author SHA1 Message Date
bors 9620eae30a Auto merge of #155339 - JonathanBrouwer:rollup-2nyGW0a, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#155331 (Reformat `top_level_options!` and `options!` macro declarations)
 - rust-lang/rust#155332 (bump std libc to `0.2.185`)
 - rust-lang/rust#155286 (attribute cleanup: rustc_confusables)
 - rust-lang/rust#155306 (`CValue::zst()` - add missing "ZST" in docs)
 - rust-lang/rust#155311 (various small `rustc_expand` cleanups)
2026-04-15 14:53:37 +00:00
Jonathan Brouwer 439410f68a Rollup merge of #155311 - cyrgani:expand-clean, r=Kivooeo,petrochenkov
various small `rustc_expand` cleanups

Each commit should be reviewable on its own.
2026-04-15 14:39:09 +02:00
Jonathan Brouwer 420eec616f Rollup merge of #155306 - DanielEScherzer:cvalue-zst-article, r=JohnTitor
`CValue::zst()` - add missing "ZST" in docs
2026-04-15 14:39:08 +02:00
Jonathan Brouwer 1de718c323 Rollup merge of #155286 - mejrs:confusables, r=JonathanBrouwer
attribute cleanup: rustc_confusables

r? @jdonszelmann
2026-04-15 14:39:07 +02:00
Jonathan Brouwer e4eff63647 Rollup merge of #155331 - Zalathar:options-fmt, r=petrochenkov
Reformat `top_level_options!` and `options!` macro declarations

These macros are already tricky, and having weird formatting doesn't help. Using a more regular style makes it easier to see where nesting begins and ends.

Extracted from https://github.com/rust-lang/rust/pull/154501 after the changes in https://github.com/rust-lang/rust/pull/149357 made rebasing very difficult.

There should be no change to compiler behaviour.
2026-04-15 14:39:06 +02:00
bors 32e4c0ecbd Auto merge of #155256 - cuviper:hashbrown-0.17, r=Mark-Simulacrum
compiler: update hashbrown to 0.17

See library's rust-lang/rust#155154 for the bug fixes this brings.
This PR also updates `indexmap` in the compiler as a direct dependent.
2026-04-15 11:01:30 +00:00
Zalathar 4506131794 Reformat top_level_options! and options! macro declarations 2026-04-15 18:33:48 +10:00
bors 57cb10ae1e Auto merge of #155324 - jhpratt:rollup-BNB8Pcb, r=jhpratt
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#154882 (Gate tuple const params behind `min_adt_const_params` feature)
 - rust-lang/rust#155259 (explicit-tail-calls: disable two tests on LoongArch)
 - rust-lang/rust#155293 (fix arch names in cfg pretty printer)
 - rust-lang/rust#155314 (`BorrowedBuf`: Update outdated safety comments in `set_init` users.)
 - rust-lang/rust#153469 (docs: clarify path search behavior in std::process::Command::new)
 - rust-lang/rust#154765 (Clarify ascii whitespace exclusion of vertical tab in the doc)
 - rust-lang/rust#155172 (Some small nits for supertrait_item_shadowing, and additional testing)
 - rust-lang/rust#155279 (Test/lexer unicode pattern white space)
 - rust-lang/rust#155280 (Tests for precise-capture through RPIT and TAIT)
 - rust-lang/rust#155301 (Delete unused `rustc_trait_selection` errors.)
 - rust-lang/rust#155303 (remove ibraheemdev from review rotation)
 - rust-lang/rust#155304 (remove PointeeParser)
 - rust-lang/rust#155319 (Remove dead diagnostic structs.)
2026-04-15 05:15:32 +00:00
Jacob Pratt aeaa84995e Rollup merge of #155319 - nnethercote:rm-dead-error-structs, r=Kivooeo
Remove dead diagnostic structs.

One of these has a "FIXME(autodiff): I should get used somewhere" comment, but I figure YAGNI applies and it's so small that reinstating it if necessary would be trivial.

r? @Kivooeo
2026-04-14 23:02:37 -04:00
Jacob Pratt e20fc9c303 Rollup merge of #155304 - Bryntet:remove-pointee-parser, r=JonathanBrouwer
remove PointeeParser

this parser does nothing currently, as the current scope of `rustc_attr_parsing` only includes builtin attributes, and not derive macros

it isn't defined in `compiler/rustc_feature/src/builtin_attrs.rs`

all the actual parsing for `#[pointee]` is actually handled in `compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs`

r? @JonathanBrouwer
2026-04-14 23:02:37 -04:00
Jacob Pratt 3002472a77 Rollup merge of #155301 - mejrs:dead, r=nnethercote
Delete unused `rustc_trait_selection` errors.

The first two of these are duplicated elsewhere in some form or another, apparently they became orphaned during various moves and refactors. The third is just never used.
2026-04-14 23:02:35 -04:00
Jacob Pratt 5cff48a164 Rollup merge of #155172 - jackh726:supertrait-shadowing-cleanup, r=lcnr
Some small nits for supertrait_item_shadowing, and additional testing

cc rust-lang/rust#89151

r? types
2026-04-14 23:02:33 -04:00
Jacob Pratt c6363238fa Rollup merge of #154882 - zedddie:gate-tuple-const-params, r=BoxyUwU
Gate tuple const params behind `min_adt_const_params` feature

r? BoxyUwU
2026-04-14 23:02:30 -04:00
bors bd1e7c7948 Auto merge of #153815 - GokhanKabar:fix-ice-enum-discr-generic-self, r=BoxyUwU
Fix ICE when Self is used in enum discriminant of a generic enum



Fixes rust-lang/rust#153756
Let discriminant AnonConst inherit parent generics via Node::Variant in generics_of, and emit a proper error instead of span_bug! for the TooGeneric case in wfcheck.
2026-04-15 01:58:56 +00:00
Nicholas Nethercote f093767036 Remove dead diagnostic structs.
One of these has a "FIXME(autodiff): I should get used somewhere"
comment, but I figure YAGNI applies and it's so small that reinstating
it if necessary would be trivial.
2026-04-15 08:54:46 +10:00
cyrgani 2e3036dc54 merge if and while conditions 2026-04-14 20:45:04 +00:00
Daniel Scherzer bd712bd224 CValue::zst() - add missing "ZST" in docs 2026-04-14 13:22:50 -07:00
cyrgani 3dcd8ffe88 deduplicate internal feature check 2026-04-14 19:58:15 +00:00
cyrgani 6e458a5fca simplify make_stmts_default! 2026-04-14 19:48:17 +00:00
Edvin Bryntesson 2598b50f92 remove PointeeParser 2026-04-14 20:25:43 +02:00
mejrs c8c4f02d00 Delete unused rustc_trait_selection errors. 2026-04-14 19:33:36 +02:00
GokhanKabar aacac7e2e3 Fix ICE when Self is used in enum discriminant of a generic enum
* Fix ICE when Self is used in enum discriminant of a generic enum

Move the validation into the existing `check_param_uses_if_mcg` machinery
in HIR ty lowering instead of adding a new check in wfcheck. After the
`AnonConstKind` refactoring, `ForbidMCGParamUsesFolder` was only gated on
`AnonConstKind::MCG`, causing discriminant anon consts (`NonTypeSystem`) to
bypass it entirely.

Add `anon_const_forbids_generic_params()` which returns the appropriate
`ForbidParamContext` for both MCG and enum discriminant contexts. Wire it
into `check_param_uses_if_mcg` so that `Self` aliasing a generic type is
caught before reaching `const_eval_poly`. Convert the `TooGeneric` span_bug
into a proper diagnostic as a fallback for anything slipping through
type-dependent path resolution.
* Address review comments

- Rename `ForbidMCGParamUsesFolder` to `ForbidParamUsesFolder`
- Rename `MinConstGenerics` variant to `ConstArgument` with updated doc
- Simplify doc comment on `anon_const_forbids_generic_params`
- Make match on `AnonConstKind` exhaustive
- Move `anon_const_def_id` inside the `if let` in `check_param_uses_if_mcg`
- Remove now-unreachable `TooGeneric` span_err in wfcheck
* Revert TooGeneric arm back to span_bug! as requested by reviewer
* Use generics_of to determine if NonTypeSystem anon consts allow generic params
* Also check InlineConst and Closure defs nested in enum discriminants
* Simplify logic for determining anonymous constant parent in generic contexts
* add test
2026-04-14 14:32:11 +00:00
Jonathan Brouwer 2d27fe6a5e Rollup merge of #155281 - folkertdev:revert-154840, r=folkertdev
Revert "allow `windows-gnu` targets to embed gdb visualizer scripts"

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

This reverts commit 472b966548.

This was merged as https://github.com/rust-lang/rust/pull/154840, but causes linker errors in the wild.

cc @Walnut356 @mati865
r? @ghost
2026-04-14 16:29:37 +02:00
Jonathan Brouwer 960a56fc4c Rollup merge of #155276 - jdonszelmann:must-match-exhaustively-let-else, r=JonathanBrouwer
`#[rustc_must_match_exhaustively]` detect let else

Extension of https://github.com/rust-lang/rust/pull/155047, I forgor to lint on let-else :3
2026-04-14 16:29:36 +02:00
Jonathan Brouwer aed02c58fc Rollup merge of #155218 - jakubadamw:issue-139570, r=tiif
coroutines: Skip the closure signature annotation check for tainted bodies

When a coroutine has too many parameters, `check_match` fails and `construct_error` builds a MIR body with only the coroutine's computed arguments (env + resume type). The user-provided signature, however, still reflects all the parameters the user wrote. `check_signature_annotation` then tries to `zip_eq` these two mismatched iterators, causing a panic. Checking `tainted_by_errors` and bailing early avoids this, since `construct_error` bodies cannot meaningfully be compared against user annotations.

Example currently ICEing:

```rust
fn main() {
    |(1, 42), ()| yield;
}
```

Closes rust-lang/rust#139570.
2026-04-14 16:29:34 +02:00
Jonathan Brouwer b7286260c8 Rollup merge of #155235 - folkertdev:fma4-target-feature, r=sayantn
add the `fma4` x86 target feature

tracking issue: https://github.com/rust-lang/rust/issues/155233

Implications are based on LLVM

https://github.com/llvm/llvm-project/blob/df6c82053c5e1f9814d130d423f34871bc6423c5/llvm/lib/Target/X86/X86.td#L201-L206

This feature adds a slightly better instruction encoding for fma. We might want to expose the intrinsics in `stdarch` with that target feature, but just adding the target feature in user code should already take advantage of this improved encoding.

This target feature is used in `libm`.

r? sayantn
2026-04-14 16:29:33 +02:00
Jonathan Brouwer 5da0b6cf1c Rollup merge of #155134 - thebabalola:fix/replace-trim-ascii-start-with-stdlib, r=mati865
Replace custom trim_ascii_start with the standard library method

The markdown parser in `rustc_errors` has a local `trim_ascii_start` function that strips leading ASCII whitespace from a byte slice. The standard library has had `<[u8]>::trim_ascii_start()` since Rust 1.80, which does the same thing.

This PR removes the custom function and calls the stdlib method directly in `parse_unordered_li` and `parse_ordered_li`. No behaviour change.

I also added a test covering the list item leading-whitespace trimming behaviour, including a tab case.

Fixes rustfoundation/interop-initiative#53
2026-04-14 16:29:32 +02:00
Jonathan Brouwer 49da27c336 Rollup merge of #154049 - petrochenkov:deleglobspan, r=jackh726
delegation: Track more precise spans for glob delegations

The last commit also fixes a macro hygiene issue with `self` in delegations found in https://github.com/rust-lang/rust/pull/154002.
2026-04-14 16:29:31 +02:00
mejrs f17ca97749 attribute cleanup: rustc_confusables 2026-04-14 14:24:26 +02:00
Folkert de Vries 17f5fa0dd4 Revert "allow windows-gnu targets to embed gdb visualizer scripts"
This reverts commit 472b966548.
2026-04-14 13:27:46 +02:00
cyrgani f4780504cd add and use PanicMessage::into_string 2026-04-14 11:16:33 +00:00
cyrgani a681f34d4b add helper for profiling calls 2026-04-14 11:16:33 +00:00
cyrgani e972232f27 reduce unnecessary allocations a bit 2026-04-14 11:16:32 +00:00
cyrgani 3fa55e721a clippy fixes 2026-04-14 11:16:32 +00:00
Jana Dönszelmann 26a0fdcdcd fixup let-else on typing mode in the compiler 2026-04-14 11:05:19 +02:00
Jana Dönszelmann 778d27441d also check let-else 2026-04-14 11:05:19 +02:00
bors 12f35ad39e Auto merge of #155209 - JonathanBrouwer:attr_cleanup2, r=jdonszelmann
Post-attribute ports cleanup pt. 1 (again)

This is a re-implementation of most (but not all) of https://github.com/rust-lang/rust/pull/154808

The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things.
I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless

r? @jdonszelmann
2026-04-14 08:59:40 +00:00
Vadim Petrochenkov 166c499a47 delegation: Give declaration of self syntax context of the delegation body
Instead of the last segment of the delegation path.
`self` is something that introduced by the whole delegation item, not some specific part of it, and the last segment may need to have a different context for path resolution purposes.
2026-04-14 11:32:34 +03:00
Vadim Petrochenkov 8114c5dc2e expand: More precise location for glob delegation
The span location of the last segment in the desugared path is inherited from the star symbol's span
2026-04-14 11:32:34 +03:00
Vadim Petrochenkov 7114404a26 ast: Preserve the star symbol span in glob delegation items 2026-04-14 11:32:33 +03:00
Jacob Pratt ec3a6b407f Rollup merge of #155230 - TaKO8Ki:fix-unused-features-doc-cfg, r=Kivooeo
Avoid linting `doc_cfg` as unused in rustc

Fixes rust-lang/rust#154487

https://github.com/rust-lang/rust/blob/af80b0f2cd0505bcc86eaa675d1ab403110d373a/src/librustdoc/passes/propagate_doc_cfg.rs#L19-L26
2026-04-14 00:37:25 -04:00
Jacob Pratt 803a7227fb Rollup merge of #155005 - folkertdev:simd-element-type-llvm, r=nnethercote
preserve SIMD element type information

Preserve the SIMD element type and provide it to LLVM for better optimization.

This is relevant for AArch64 types like `int16x4x2_t`, see also https://github.com/llvm/llvm-project/issues/181514. Such types are defined like so:

```rust
#[repr(simd)]
struct int16x4_t([i16; 4]);

#[repr(C)]
struct int16x4x2_t(pub int16x4_t, pub int16x4_t);
```

Previously this would be translated to the opaque `[2 x <8 x i8>]`, with this PR it is instead `[2 x <4 x i16>]`. That change is not relevant for the ABI, but using the correct type prevents bitcasts that can (indeed, do) confuse the LLVM pattern matcher.

This change will make it possible to implement the deinterleaving loads on AArch64 in a portable way (without neon-specific intrinsics), which means that e.g. Miri or the cranelift backend can run them without additional support.

discussion at [#t-compiler > loss of vector element type information](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/loss.20of.20vector.20element.20type.20information/with/584483611)
2026-04-14 00:37:24 -04:00
bors 0006519783 Auto merge of #155267 - jhpratt:rollup-fgQZJCS, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#149357 (Implement `-Z allow-partial-mitigations` (RFC 3855))
 - rust-lang/rust#154939 (Refactor: simplify report_selection_error)
 - rust-lang/rust#152688 (Trait aliases: Also imply default trait bounds on type params other than `Self`)
 - rust-lang/rust#154352 (rustdoc: dep-info for standalone markdown inputs)
 - rust-lang/rust#155195 (tidy: handle `#[cfg_attr(bootstrap, doc = "...")]` in `compiler/` comments)
2026-04-14 01:06:31 +00:00
Jacob Pratt 7e40efc366 Rollup merge of #152688 - fmease:implied-preds-default-bounds, r=jackh726
Trait aliases: Also imply default trait bounds on type params other than `Self`

Trait aliases already correctly imply default trait bounds on `Self` type params. However, due to an oversight, they didn't do that for normal type params.

Fixes rust-lang/rust#152687.
2026-04-13 20:12:06 -04:00
Jacob Pratt 2a0b5343df Rollup merge of #154939 - chenyukang:yukang-refactor-fn-pointer-cast-suggestion, r=davidtwco
Refactor: simplify report_selection_error

Split out `suggest_cast_to_fn_pointer` for better readability.
2026-04-13 20:12:05 -04:00
Jacob Pratt 7d1b042d45 Rollup merge of #149357 - arielb1:enforce-partial-mitigations, r=rcvalle
Implement `-Z allow-partial-mitigations` (RFC 3855)

This implements `-Z allow-partial-mitigations` as an unstable option, currently with support for control-flow-guard and stack-protector.

As a difference from the RFC, we have `-Z allow-partial-mitigations=!foo` rather than `-Z deny-partial-mitigations=foo`, since I couldn't find an easy way to have an allow/deny pair of flags where the latter flag wins.

To allow for stabilization, this is only enabled starting from the next edition. Maybe a better policy is possible (bikeshed).

r? @rcvalle
2026-04-13 20:12:05 -04:00
thebabalola fdfdb0837c Replace custom trim_ascii_start with the standard library method
The local trim_ascii_start function in the markdown parser duplicates
<[u8]>::trim_ascii_start() from the standard library (stable since 1.80).
Remove the custom function and call the stdlib method directly.

No behaviour change.

Fixes https://github.com/rustfoundation/interop-initiative/issues/53
2026-04-13 23:07:39 +01:00
thebabalola 1e02a2b10b Add test for list item leading whitespace trimming 2026-04-13 23:07:39 +01:00
bors 338dff3e3a Auto merge of #136006 - oli-obk:push-tzonluoyuwkq, r=wesleywiser
Start using pattern types in libcore



cc rust-lang/rust#135996

Replaces the innards of `NonNull` with `*const T is !null`.

This does affect LLVM's optimizations, as now reading the field preserves the metadata that the field is not null, and transmuting to another type (e.g. just a raw pointer), will also preserve that information for optimizations. This can cause LLVM opts to do more work, but it's not guaranteed to produce better machine code.

Once we also remove all uses of rustc_layout_scalar_range_start from rustc itself, we can remove the support for that attribute entirely and handle all such needs via pattern types
2026-04-13 21:54:46 +00:00
zedddie 9a9f5b5141 gate primitives behind min_adt_const_params; change suggestion to min_adt_const_params 2026-04-13 22:26:05 +02:00