Commit graph

45949 commits

Author SHA1 Message Date
Guillaume Gomez
84f582665e Fix compilation error in GCC backend 2025-04-18 22:46:43 +02:00
Guillaume Gomez
c123dc63ea Fix rustc_codegen_gcc/tests/run/return-tuple.rs test 2025-04-18 21:21:15 +02:00
Guillaume Gomez
e4ea67b3d7 Merge commit 'db1a31c243' into subtree-update_cg_gcc_2025-04-18 2025-04-18 21:20:11 +02:00
est31
d75f8cde2f Also allow let chains in match guards 2025-04-18 15:57:29 +02:00
bors
191df20fca Auto merge of #139996 - matthiaskrgr:rollup-0nka2hw, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #138528 (deref patterns: implement implicit deref patterns)
 - #139393 (rustdoc-json: Output target feature information)
 - #139553 (sync::mpsc: prevent double free on `Drop`)
 - #139615 (Remove `name_or_empty`)
 - #139853 (Disable combining LLD with external llvm-config)
 - #139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions))
 - #139942 (Ignore aix for tests/ui/erros/pic-linker.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-18 13:49:17 +00:00
est31
2e61af2fca Stabilize let chains on edition 2024 2025-04-18 14:21:14 +02:00
roblabla
1b39302571 Disable has_thread_local on i686-win7-windows-msvc
On Windows 7 32-bit, the alignment characteristic of the TLS Directory
don't appear to be respected by the PE Loader, leading to crashes. As
a result, let's disable has_thread_local to make sure TLS goes through
the emulation layer.
2025-04-18 13:30:26 +02:00
Matthias Krüger
68b439c63b
Rollup merge of #138599 - adwinwhite:recursive-overflow, r=wesleywiser
avoid overflow when generating debuginfo for expanding recursive types

Fixes #135093
Fixes #121538
Fixes #107362
Fixes #100618
Fixes #115994

The overflow happens because expanding recursive types keep creating new nested types when recurring into sub fields.
I fixed that by returning an empty stub node when expanding recursion is detected.
2025-04-18 05:17:53 +02:00
Matthias Krüger
484abe9f77
Rollup merge of #137881 - Jarcho:index_slice_ex, r=wesleywiser
Add `copy_within` to `IndexSlice`
2025-04-18 05:17:50 +02:00
Matthias Krüger
540fb228af
Rollup merge of #139615 - nnethercote:rm-name_or_empty, r=jdonszelmann
Remove `name_or_empty`

Another step towards #137978.

r? ``@jdonszelmann``
2025-04-18 05:16:29 +02:00
Matthias Krüger
c8a9095f0f
Rollup merge of #138528 - dianne:implicit-deref-patterns, r=Nadrieril
deref patterns: implement implicit deref patterns

This implements implicit deref patterns (per https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Implicit-deref-patterns) and adds tests and an unstable book chapter.

Best reviewed commit-by-commit. Overall there's a lot of additions, but a lot of that is tests, documentation, and simple(?) refactoring.

Tracking issue: #87121

r? ``@Nadrieril``
2025-04-18 05:16:28 +02:00
Michael Goulet
e882ff4e7e Don't assemble non-env/bound candidates if projection is rigid 2025-04-18 01:44:06 +00:00
Matthias Krüger
e5ba69b927
Rollup merge of #139974 - Patrick-6:change-visibility, r=RalfJung
Change `InterpCx::instantiate*` function visibility to pub

For some ongoing work in Miri we need to be able to access `instantiate_from_current_frame_and_normalize_erasing_regions` and `instantiate_from_frame_and_normalize_erasing_regions` on `InterpCx`.

r? `@RalfJung`
2025-04-17 21:53:27 +02:00
Matthias Krüger
8b7a2897c8
Rollup merge of #139498 - alexcrichton:wasm-zst-safe, r=wesleywiser
Ignore zero-sized types in wasm future-compat warning

This commit fixes a false positive of the warning triggered for #138762 and the fix is to codify that zero-sized types are "safe" in both the old and new ABIs.
2025-04-17 21:53:24 +02:00
Matthias Krüger
87a163523f
Rollup merge of #139351 - EnzymeAD:autodiff-batching2, r=oli-obk
Autodiff batching2

~I will rebase it once my first PR landed.~ done.
This autodiff batch mode is more similar to scalar autodiff, since it still only takes one shadow argument.
However, that argument is supposed to be `width` times larger.

r? `@oli-obk`

Tracking:

- https://github.com/rust-lang/rust/issues/124509
2025-04-17 21:53:23 +02:00
Matthias Krüger
8281a54a1b
Rollup merge of #139961 - nnethercote:two-rustc_const_eval-cleanups, r=oli-obk
Two `rustc_const_eval` cleanups

r? ``@lcnr``
2025-04-17 17:40:31 +02:00
Matthias Krüger
67e2358fbb
Rollup merge of #139902 - lcnr:no-opaque-cast-projection, r=oli-obk
do not emit `OpaqueCast` projections with `-Znext-solver`

We normalize opaque types in their defining scope if the new solver is enabled. This means projections do not contain any 'revealable' opaque types we need to worry about. We either have a type which has been normalized by writeback or we need to normalize it anyways.

r? ```@compiler-errors``` ```@oli-obk```
2025-04-17 17:40:28 +02:00
Matthias Krüger
d2db1c1df9
Rollup merge of #139850 - xizheyin:issue-138698, r=jieyouxu
Hide unstable print kinds within emit_unknown_print_request_help in stable channel

Fixes #138698

We need to get the channel from `matches`. However, since `matches`(Line 1169) is constructed after `rustc_optgroups` (Line1165, where `RustcOptGroup::value_hint` is generated, i.e. what `rustc --print print` prints), I've left it unchanged here for now.

2da29dbe8f/compiler/rustc_driver_impl/src/lib.rs (L1161-L1169)

There is actually a way to manually parse the `--crate-name` parameter, but I'm afraid that's an unorthodox practice. So I conservatively just modified `emit_unknown_print_request_help` to print different parameters depending on whether they are nightly or not when passing the error parameter.

r? ```@jieyouxu```
2025-04-17 17:40:27 +02:00
Matthias Krüger
da43826398
Rollup merge of #139774 - compiler-errors:supertrait-alias, r=lcnr
Fix replacing supertrait aliases in `ReplaceProjectionWith`

The new solver has a procedure called `predicates_for_object_candidate`, which elaborates the super-bounds and item-bounds that are required to hold for a dyn trait to implement something via a built-in object impl.

In that procedure, there is a folder called `ReplaceProjectionWith` which is responsible for replacing projections that reference `Self`, so that we don't encounter cycles when we then go on to normalize those projections in the process of proving these super-bounds.

That folder had a few problems: Firstly, it wasn't actually checking that this was a super bound originating from `Self`. Secondly, it only accounted for a *single* projection type def id, but trait objects can have multiple (i.e. `trait Foo<A, B>: Bar<A, Assoc = A> + Bar<B, Assoc = B>`).

To fix the first, it's simple enough to just add an equality check for the self ty. To fix the second, I implemented a matching step that's very similar to the `projection_may_match` check we have for upcasting, since on top of having multiple choices, we need to deal with both non-structural matches and ambiguity.

This probably lacks a bit of documentation, but I think it works pretty well.

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/171

r? lcnr
2025-04-17 17:40:27 +02:00
Alex Crichton
f9091e24a0 Ignore zero-sized types in wasm future-compat warning
This commit fixes a false positive of the warning triggered for #138762
and the fix is to codify that zero-sized types are "safe" in both the
old and new ABIs.
2025-04-17 07:42:55 -07:00
Patrick-6
50cf102311 Change function visibility to pub 2025-04-17 16:23:44 +02:00
xizheyin
8562110e0d Hide unstable print kinds within emit_unknown_print_request_help in stable channel
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-17 22:02:31 +08:00
bors
883f9f72e8 Auto merge of #139949 - matthiaskrgr:rollup-pxc5tsx, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #138632 (Stabilize `cfg_boolean_literals`)
 - #139416 (unstable book; document `macro_metavar_expr_concat`)
 - #139782 (Consistent with treating Ctor Call as Struct in liveness analysis)
 - #139885 (document RUSTC_BOOTSTRAP, RUSTC_OVERRIDE_VERSION_STRING, and -Z allow-features in the unstable book)
 - #139904 (Explicitly annotate edition for `unpretty=expanded` and `unpretty=hir` tests)
 - #139932 (transmutability: Refactor tests for simplicity)
 - #139944 (Move eager translation to a method on Diag)
 - #139948 (git: ignore `60600a6fa4` for blame purposes)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-17 11:21:54 +00:00
lcnr
289a23e0e2 do not emit OpaqueCast projections with -Znext-solver 2025-04-17 12:15:04 +02:00
bors
15c4ccef03 Auto merge of #139940 - matthiaskrgr:rollup-rd4d3fn, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #135340 (Add `explicit_extern_abis` Feature and Enforce Explicit ABIs)
 - #139440 (rustc_target: RISC-V: feature addition batch 2)
 - #139667 (cfi: Remove #[no_sanitize(cfi)] for extern weak functions)
 - #139828 (Don't require rigid alias's trait to hold)
 - #139854 (Improve parse errors for stray lifetimes in type position)
 - #139889 (Clean UI tests 3 of n)
 - #139894 (Fix `opt-dist` CLI flag and make it work without LLD)
 - #139900 (stepping into impls for normalization is unproductive)
 - #139915 (replace some #[rustc_intrinsic] usage with use of the libcore declarations)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-17 04:52:34 +00:00
Matthias Krüger
059b7d07ef
Rollup merge of #139944 - shepmaster:eager-diagnostics, r=nnethercote
Move eager translation to a method on Diag

This will allow us to eagerly translate messages on a top-level diagnostic, such as a `LintDiagnostic`. As a bonus, we can remove the awkward closure passed into Subdiagnostic and make better use of `Into`.

r? `@nnethercote`
2025-04-17 06:25:18 +02:00
Matthias Krüger
a7af610058
Rollup merge of #139932 - joshlf:transmute-simplify-tests, r=jswrenn
transmutability: Refactor tests for simplicity

r? `@jswrenn`
2025-04-17 06:25:18 +02:00
Matthias Krüger
0757d24f71
Rollup merge of #139782 - xizheyin:issue-139627, r=wesleywiser
Consistent with treating Ctor Call as Struct in liveness analysis

Fixes #139627

When `ExprKind::Call` is a `Ctor`, skips the checking of `expr` and only checks the arguments, thus being consistent with `ExprKind::Struct`.

r? compiler
2025-04-17 06:25:16 +02:00
Matthias Krüger
0de803c38d
Rollup merge of #138632 - clubby789:stabilize-cfg-boolean-lit, r=davidtwco,Urgau,traviscross
Stabilize `cfg_boolean_literals`

Closes #131204
`@rustbot` labels +T-lang +I-lang-nominated
This will end up conflicting with the test in #138293 so whichever doesn't land first will need updating

--

# Stabilization Report

## General design

### What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized?

[RFC 3695](https://github.com/rust-lang/rfcs/pull/3695), none.

### What behavior are we committing to that has been controversial? Summarize the major arguments pro/con.

None

### Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those?

None

## Has a call-for-testing period been conducted? If so, what feedback was received?

Yes; only positive feedback was received.

## Implementation quality

### Summarize the major parts of the implementation and provide links into the code (or to PRs)

Implemented in [#131034](https://github.com/rust-lang/rust/pull/131034).

### Summarize existing test coverage of this feature

- [Basic usage, including `#[cfg()]`, `cfg!()` and `#[cfg_attr()]`](6d71251cf9/tests/ui/cfg/true-false.rs)
- [`--cfg=true/false` on the command line being accessible via `r#true/r#false`](6d71251cf9/tests/ui/cfg/raw-true-false.rs)
- [Interaction with the unstable `#[doc(cfg(..))]` feature](6d71251/tests/rustdoc-ui/cfg-boolean-literal.rs)
- [Denying `--check-cfg=cfg(true/false)`](6d71251/tests/ui/check-cfg/invalid-arguments.rs)
- Ensuring `--cfg false` on the command line doesn't change the meaning of `cfg(false)`: `tests/ui/cfg/cmdline-false.rs`
- Ensuring both `cfg(true)` and `cfg(false)` on the same item result in it being disabled: `tests/ui/cfg/both-true-false.rs`

### What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking?

The above mentioned issue; it should not block as it interacts with another unstable feature.

### What FIXMEs are still in the code for that feature and why is it ok to leave them there?

None

### Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization
- `@clubby789` (RFC)
- `@Urgau` (Implementation in rustc)

### Which tools need to be adjusted to support this feature. Has this work been done?

`rustdoc`'s  unstable`#[doc(cfg(..)]` has been updated to respect it. `cargo` has been updated with a forward compatibility lint to enable supporting it in cargo once stabilized.

## Type system and execution rules

### What updates are needed to the reference/specification? (link to PRs when they exist)

A few lines to be added to the reference for configuration predicates, specified in the RFC.
2025-04-17 06:25:15 +02:00
Nicholas Nethercote
99a60eb97f intern_with_temp_alloc is for DummyMachine only. 2025-04-17 13:08:31 +10:00
Nicholas Nethercote
675360ae4e Remove some unnecessary lifetimes.
`FlowSensitiveAnalysis` is only instantiated with the first two
lifetimes being the same.
2025-04-17 13:07:40 +10:00
Jake Goulding
0117884917 Move eager translation to a method on Diag
This will allow us to eagerly translate messages on a top-level
diagnostic, such as a `LintDiagnostic`. As a bonus, we can remove the
awkward closure passed into Subdiagnostic and make better use of
`Into`.
2025-04-16 21:38:59 -04:00
bors
79a272c640 Auto merge of #139938 - matthiaskrgr:rollup-19ddpus, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #139084 (hygiene: Rename semi-transparent to semi-opaque)
 - #139236 (Use a session counter to make anon dep nodes unique)
 - #139650 (Fix `register_group_alias` for tools)
 - #139770 (Rename `LifetimeName` as `LifetimeKind`.)
 - #139846 (Remove `kw::Empty` uses in rustdoc)
 - #139891 (Include optional dso_local marker for functions in `enum-match.rs`)
 - #139908 (parser: Remove old diagnostic notes for type ascription syntax)
 - #139917 (fix for multiple `#[repr(align(N))]` on functions)

Failed merges:

 - #139615 (Remove `name_or_empty`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-17 01:38:17 +00:00
Nicholas Nethercote
846c10fecf Avoid an unwrap in RustcMirAttrs::set_field. 2025-04-17 09:51:32 +10:00
Nicholas Nethercote
2fef0a30ae Replace infallible name_or_empty methods with fallible name methods.
I'm removing empty identifiers everywhere, because in practice they
always mean "no identifier" rather than "empty identifier". (An empty
identifier is impossible.) It's better to use `Option` to mean "no
identifier" because you then can't forget about the "no identifier"
possibility.

Some specifics:
- When testing an attribute for a single name, the commit uses the
  `has_name` method.
- When testing an attribute for multiple names, the commit uses the new
  `has_any_name` method.
- When using `match` on an attribute, the match arms now have `Some` on
  them.

In the tests, we now avoid printing empty identifiers by not printing
the identifier in the `error:` line at all, instead letting the carets
point out the problem.
2025-04-17 09:50:52 +10:00
Nicholas Nethercote
400e8e5dc8 Fix attribute printing in an error.
The current code assumes that the attribute is just an identifier, and
so misprints paths.
2025-04-17 09:50:52 +10:00
dianne
ff0d4bc743 upvar inference for implicit deref patterns 2025-04-16 15:42:12 -07:00
dianne
977c9ab7a2 respect the tcx's recursion limit when peeling 2025-04-16 15:42:12 -07:00
dianne
923d95cc9f don't peel ADTs the pattern could match
This is the use for the previous commits' refactors; see the messages
there for more information.
2025-04-16 15:42:12 -07:00
Joshua Liebow-Feeser
b7fbf20fe1 transmutability: Refactor tests for simplicity 2025-04-16 15:27:18 -07:00
Matthias Krüger
9e0be6c15b
Rollup merge of #139900 - lcnr:normalizes-to-where-bounds-unproductive, r=compiler-errors
stepping into impls for normalization is unproductive

See the inline comment. This builds on the reasoning from #136824 (https://gist.github.com/lcnr/c49d887bbd34f5d05c36d1cf7a1bf5a5). Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/176.

Looking at the end of the gist:
> The only ways to project out of a constructor are the following:
> - accessing an associated item, either its type or its item bounds
> - accessing super predicates

Detecting cases where we accessing the type of an associated item is easy, it's simply when we normalize. I don't yet know how to detect whether we step out of an impl by accessing item bounds. Once we also detect these cases we should be able to soundly support arbitrary coinductive traits. Luckily this does not matter for this PR :>

r? `@compiler-errors` cc `@nikomatsakis`
2025-04-17 00:16:24 +02:00
Matthias Krüger
7ab385e2e1
Rollup merge of #139854 - fmease:modern-diag-for-lt-in-ty, r=davidtwco
Improve parse errors for stray lifetimes in type position

While technically & syntactically speaking lifetimes do begin[^1] types in type contexts (this essentially excludes generic argument lists) and require a following `+` to form a complete type (`'a +` denotes a bare trait object type), the likelihood that a user meant to write a lifetime-prefixed bare trait object type in *modern* editions (Rust ≥2021) when placing a lifetime into a type context is incredibly low (they would need to add at least three tokens to turn it into a *semantically* well-formed TOT: `'a` → `dyn 'a + Trait`).

Therefore let's *lie* in modern editions (just like in PR https://github.com/rust-lang/rust/pull/131239, a precedent if you will) by stating "*expected type, found lifetime*" in such cases which is a lot more a approachable, digestible and friendly compared to "*lifetime in trait object type must be followed by `+`*" (as added in PR https://github.com/rust-lang/rust/pull/69760).

I've also added recovery for "ampersand-less" reference types (e.g., `'a ()`, `'a mut Ty`) in modern editions because it was trivial to do and I think it's not unlikely to occur in practice.

Fixes #133413.

[^1]: For example, in the context of decl macros, this implies that a lone `'a` always matches syntax fragment `ty` ("even if" there's a later macro matcher expecting syntax fragment `lifetime`). Rephrased, lifetimes (in type contexts) *commit* to the type parser.
2025-04-17 00:16:22 +02:00
Matthias Krüger
c594a88f43
Rollup merge of #139828 - compiler-errors:rigid-trait, r=lcnr
Don't require rigid alias's trait to hold

See test for write-up. TL;DR is that we don't need the trait bound to hold, since we enforce it during WF.

I think this is preferable to introducing (if we even could do so) a more specific hack around coroutine interiors, higher ranked types, etc, since this is just a manifestation of more pervasive issues w/ lifetime erasure in coroutines. This just doesn't manifest in the old solver b/c it doesn't try to prove `T: Trait` holds when rigidly projecting `<T as Trait>::Assoc`.

It's pretty clear that this affects quite a few traits (https://github.com/rust-lang/rust/pull/139763), so I think this needs fixing.

r? lcnr

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/177
2025-04-17 00:16:22 +02:00
Matthias Krüger
ff55f2af75
Rollup merge of #139440 - a4lg:riscv-feature-addition-batch-2, r=Amanieu
rustc_target: RISC-V: feature addition batch 2

Of ratified RISC-V extensions, this commit adds ones satisfying following criteria:

1.  Either discoverable through a `riscv_hwprobe` system call on Linux 6.14
    or should be very helpful even on basic needs (the `B` extension),
2.  Does not disrupt current Rust's feature handling mechanism and
3.  Not too OS-dependent (the `Supm` extension)

Due to 2., the author excluded `Zcf` (RV32 only) and `Zcd` from the list despite that they are discoverable from Linux 6.14.

Due to 3., the author excluded the `Supm` extension on the PR version 2.

This is based on the specification:
*   [The latest ratified ISA Manuals (version 20240411)](16154769/RISC-V+Technical+Specifications)

Linux Definition: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/include/uapi/asm/hwprobe.h

LLVM Definitions:

*   [`B`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L507-L510)
*   [`Zca`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L395-L398)
*   [`Zcb`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L407-L410)
*   [`Zcmop`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L460-L463)
*   [`Zfa`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L335-L338)
*   [`Zicboz`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L89-L92)
*   [`Zicond`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L125-L128)
*   [`Zihintntl`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L148-L151)
*   [`Zimop`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L161-L162)
*   [`Ztso`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L214-L217)

The author also adds required implication: `C` implies `Zca`.

Android RISC-V target is also updated to include the `B` extension (this is just a shorthand combination of `Zba`, `Zbb` and `Zbs` extensions but possibly simplifies `target_feature` handling).

# History

## Version 1 → 2

*   Remove the `Supm` extension from the Rust target features (thanks, `@Amanieu).`

--------

Related:
*   #44839
    (`riscv_target_feature`)
*   #138823
    (my previous batch)
*   #132618
    (stabilization of the `Zfa` extension is blocked by this)

`@rustbot` r? `@Amanieu`
`@rustbot` label +T-compiler +O-riscv +A-target-feature
2025-04-17 00:16:21 +02:00
Matthias Krüger
bb3e156f62
Rollup merge of #135340 - obeis:explicit-extern-abis, r=traviscross,nadrieril
Add `explicit_extern_abis` Feature and Enforce Explicit ABIs

The unstable `explicit_extern_abis` feature is introduced, requiring explicit ABIs in `extern` blocks. Hard errors will be enforced with this feature enabled in a future edition.

RFC rust-lang/rfcs#3722

Update #134986
2025-04-17 00:16:20 +02:00
Matthias Krüger
cbe469a8b1
Rollup merge of #139917 - folkertdev:fn-align-multiple, r=jdonszelmann
fix for multiple `#[repr(align(N))]` on functions

tracking issue: https://github.com/rust-lang/rust/issues/82232
fixes https://github.com/rust-lang/rust/issues/132464

The behavior of align is specified at https://doc.rust-lang.org/reference/type-layout.html#r-layout.repr.alignment.align

> For align, if the specified alignment is less than the alignment of the type without the align modifier, then the alignment is unaffected.

So in effect that means that the maximum of the specified alignments should be chosen. That is also the current behavior for `align` on ADTs:

```rust
#![feature(fn_align)]

#[repr(C,  align(32), align(64))]
struct Foo {
    x: u64,
}

const _: () = assert!(core::mem::align_of::<Foo>() == 64);

// See the godbolt LLVM output: the alignment of this function is 32
#[no_mangle]
#[repr(align(32))]
#[repr(align(64))]
fn foo() {}

// The current logic just picks the first alignment: the alignment of this function is 64
#[no_mangle]
#[repr(align(64))]
#[repr(align(32))]
fn bar() {}
```

https://godbolt.org/z/scco435jE

afa859f812/compiler/rustc_middle/src/ty/mod.rs (L1529-L1532)

The https://github.com/rust-lang/rust/issues/132464 issue is really about parsing/representing the attribute, which has already been improved and now uses the "parse, don't validate" attribute approach. That means the behavior is already different from what the issue describes: on current `main`, the first value is chosen. This PR fixes a logic error, where we just did not check for the effect of two or more `align` modifiers. In combination, that fixes the issue.

cc ``@jdonszelmann`` if you do have further thoughs here
2025-04-17 00:14:28 +02:00
Matthias Krüger
082073f8ff
Rollup merge of #139908 - Zalathar:no-ascription, r=jieyouxu
parser: Remove old diagnostic notes for type ascription syntax

Type ascription syntax was removed by #109128 in 2023, so “remove this again in a few months” is long overdue.

Happily, this also reduces the amount of parser diagnostic code that cares whether the compiler is unstable.

---

See also the recent #138898, which removed some other related dead code but declined to touch the diagnostics.

It's possible that some of these parser tests are no longer useful at all, but I haven't investigated them for this PR.
2025-04-17 00:14:27 +02:00
Matthias Krüger
8e5df28a6a
Rollup merge of #139770 - nnethercote:rename-LifetimeName, r=BoxyUwU
Rename `LifetimeName` as `LifetimeKind`.

It's a much better name, more consistent with how we name such things.

Also rename `Lifetime::res` as `Lifetime::kind` to match. I suspect this field used to have the type `LifetimeRes` and then the type was changed but the field name remained the same.

r? ``@BoxyUwU``
2025-04-17 00:14:26 +02:00
Matthias Krüger
5c963a4cb3
Rollup merge of #139650 - Alexendoo:group-alias, r=davidtwco
Fix `register_group_alias` for tools

In clippy we're looking at renaming `clippy::all` and registering an alias for it but currently that doesn't work for tools

The `lint_ids` of the alias are now populated at the time of registration to make it easier to handle
2025-04-17 00:14:25 +02:00
Matthias Krüger
844b7c7935
Rollup merge of #139236 - Zoxc:anon-counter, r=davidtwco
Use a session counter to make anon dep nodes unique

This changes the unique session hash used to ensure unique anon dep nodes per session from a timestamp to a counter.

This is nicer for debugging as it makes the dep graph deterministic.
2025-04-17 00:14:24 +02:00