Commit Graph

322457 Commits

Author SHA1 Message Date
Wesley Wiser c9d3a00cd1 Revert "Fix: On wasm targets, call panic_in_cleanup if panic occurs in cleanup"
This reverts commit acbfd79acf.
2026-04-01 21:29:42 -05:00
bors 7e46c5f6fb Auto merge of #154292 - Zalathar:def-kind, r=petrochenkov
Don't use disk-cache for query `def_kind`



From what I can tell, the `def_kind` query has no local provider, and is always given its value via query feeding, usually from `TyCtxt::create_def`.

If that's the case, there should never be any opportunity for a previous value to be loaded from disk-cache, so serializing the current-session values is a waste of time.
2026-04-01 16:54:24 +00:00
bors 2bd7a97871 Auto merge of #154668 - jhpratt:rollup-ePnl7Di, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#154356 (    Add integer truncation and extension methods)
 - rust-lang/rust#154641 (build_helper: fix yarn locking, add check, and bump lockfile)
 - rust-lang/rust#154647 (change `c_double` to `f32` on `avr` targets)
 - rust-lang/rust#154655 (Fix associated type bound suggestion span issue)
2026-04-01 08:58:47 +00:00
Jacob Pratt 7f794c3463 Rollup merge of #154655 - chenyukang:yukang-fix-145586-deserializer-bound-syntax, r=jieyouxu
Fix associated type bound suggestion span issue

Fixes rust-lang/rust#145586
2026-04-01 03:35:11 -04:00
Jacob Pratt 1fb655c590 Rollup merge of #154647 - folkertdev:avr-c_double-f32, r=tgross35
change `c_double` to `f32` on `avr` targets

Extracted from https://github.com/rust-lang/rust/pull/152980. That version also makes this change for `msp430` but that is actually incorrect based on https://www.ti.com/lit/ug/slau132r/slau132r.pdf table 5-1 that specifies `double` as `f64`.

r? tgross35
cc @Patryk27 @workingjubilee
2026-04-01 03:35:11 -04:00
Jacob Pratt 6bbf210432 Rollup merge of #154641 - lolbinarycat:fix-yarn-locking, r=GuillaumeGomez,jieyouxu
build_helper: fix yarn locking, add check, and bump lockfile

fixes rust-lang/rust#154446

cc @aDotInTheVoid, @GuillaumeGomez

not sure if this needs review from t-rustdoc, t-bootstrap, or both.
2026-04-01 03:35:10 -04:00
Jacob Pratt 60e85c7ec3 Rollup merge of #154356 - joshtriplett:libs-api-integer-truncate-extend, r=jhpratt
Add integer truncation and extension methods

Tracking issue: https://github.com/rust-lang/rust/issues/154330

This provides `.truncate()`, `.saturating_truncate()`, `.checked_truncate()`, and `.extend()`.

These only work within the same signedness (use `.cast_signed()` and `.cast_unsigned()` to change sign).

The truncation methods only work to smaller (or equal) types. `.extend()` only works to larger (or equal) types.

For the purposes of truncation and extending, `u128` is considered larger than or equal to the size of `usize`, and `usize` is considered larger than `u16` or `u8`. We might, in the future, want to consider ways to expand this.

Much of this was pair-programmed with @Amanieu.

In order to seal the new traits, this PR also adds a `core::sealed::Sealed`, like the one in `std`. I didn't modify `std` to re-export the same one, since by definition it isn't nameable, and since doing that would require that it be nameable (even if it was `#[unstable]`).
2026-04-01 03:35:10 -04:00
bors 3ebe60c8c3 Auto merge of #154659 - chenyukang:rollup-D1UvH9O, r=chenyukang
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#152935 (c-variadic: error when we can't guarantee that the backend does the right thing)
 - rust-lang/rust#153207 (std::net: clamp linger timeout value to prevent silent truncation.)
 - rust-lang/rust#154592 (Fix `mismatched_lifetime_syntaxes` suggestions for hidden path lifetimes)
 - rust-lang/rust#154643 (fix pin docs)
 - rust-lang/rust#154648 (Clarify `ty::List`)
2026-04-01 05:47:55 +00:00
Yukang 18f8cd2c28 Rollup merge of #154648 - nnethercote:clarify-ty-List, r=cuviper
Clarify `ty::List`

`ty::List` is an unusual type. This commit clarifies some things about it. Details in individual commits.

r? @cuviper
2026-04-01 10:43:56 +08:00
Yukang 9344df3cdb Rollup merge of #154643 - AdinAck:fix-pin-docs, r=chenyukang
fix pin docs

This PR fixes a small grammatical error in the projection section of the pin docs. There is probably more than one answer for the fix, but I felt that this correction was the *smallest*.
2026-04-01 10:43:56 +08:00
Yukang 1f5dcf30d7 Rollup merge of #154592 - reddevilmidzy:lifetime, r=chenyukang
Fix `mismatched_lifetime_syntaxes` suggestions for hidden path lifetimes

close: https://github.com/rust-lang/rust/issues/154493

r? shepmaster

cc: @chenyukang
2026-04-01 10:43:55 +08:00
Yukang 8296e03d86 Rollup merge of #153207 - devnexen:net_set_linger_fix, r=Amanieu
std::net: clamp linger timeout value to prevent silent truncation.

Duration::as_secs() returns u64 but l_linger field type is narrower, c_int on most unix platforms, c_ushort on cygwin and windows. clamping before the cast, consistent with how set_timeout handles this.
2026-04-01 10:43:55 +08:00
Yukang 9445be9bf5 Rollup merge of #152935 - folkertdev:c-variadic-disallow, r=tgross35
c-variadic: error when we can't guarantee that the backend does the right thing

tracking issue: https://github.com/rust-lang/rust/issues/44930
r? workingjubilee

as discussed in [#t-lang > stabilizing `c_variadic`](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/stabilizing.20.60c_variadic.60/with/574691397), display an error when we can't guarantee that the codegen backend (only LLVM is supported at the moment) does the right thing.
2026-04-01 10:43:55 +08:00
bors 12ab1cf1fd Auto merge of #154456 - chenyukang:yukang-fix-154434-unused-assignments, r=estebank
Label overwritten for never read assignments



Fixes rust-lang/rust#154434
Closes rust-lang/rust#144079
2026-04-01 02:38:14 +00:00
yukang 50c6679c0b fix unit test naming style 2026-04-01 10:12:05 +08:00
yukang 95d5ecf3ab Fix associated bound suggestion span issue 2026-04-01 09:21:45 +08:00
bors 700cfa8c93 Auto merge of #154649 - JonathanBrouwer:rollup-3KmleSY, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#154249 (Mention on which items the `missing_doc_code_examples` is not emitted)
 - rust-lang/rust#154266 (UdpSocket: document `recv/recv_from` differences)
2026-03-31 23:24:59 +00:00
Zalathar eb5a4000ff Don't use disk-cache for query def_kind
From what I can tell, the `def_kind` query has no local provider, and is always
given its value via query feeding, usually from `TyCtxt::create_def`.

If that's the case, there should never be any opportunity for a previous value
to be loaded from disk-cache, so serializing the current-session values is a
waste of time.
2026-04-01 09:49:49 +11:00
Folkert de Vries 1d0dcfab18 c-variadic: error when we can't guarantee that the backend does the right thing
specifically this emits an error when

- a custom target is used
- `RiscV32 if self.llvm_abiname == "ilp32e"` this abi is used for 32-bit
  embedded targets, and clang/llvm document that the ABI may change in
  the future.
2026-03-31 23:35:25 +02:00
Folkert de Vries dc9836e29c change c_double to f32 on avr targets 2026-03-31 22:39:18 +02:00
Jonathan Brouwer 807b9aec35 Rollup merge of #154266 - nia-e:udp-socket-docs, r=Mark-Simulacrum
UdpSocket: document `recv/recv_from` differences

Per libs-api consensus, fixes rust-lang/rust#149392 by documenting possible platform-specific behavior in `UdpSocket`.

r? libs
2026-03-31 22:18:34 +02:00
Jonathan Brouwer 5ac294bf66 Rollup merge of #154249 - GuillaumeGomez:missing_doc_code_examples-doc, r=lolbinarycat
Mention on which items the `missing_doc_code_examples` is not emitted

As mentioned in rust-lang/rust#154048, the lint's documentation didn't mention which items were ignored. This PR fixes that.

r? @lolbinarycat
2026-03-31 22:18:34 +02:00
bors 48cc71ee88 Auto merge of #154638 - JonathanBrouwer:rollup-oLBZ6Tr, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#150752 (Update libc to v0.2.183)
 - rust-lang/rust#152432 (add rustc option -Zpacked-stack)
 - rust-lang/rust#154634 (Use `Hcx`/`hcx` consistently for `StableHashingContext`.)
 - rust-lang/rust#154635 (./x run miri: default to edition 2021)
2026-03-31 20:16:05 +00:00
Nicholas Nethercote 64cf1ec685 Update Erasable impls for lists.
- Merge the `List` and `ListWithCachedTypeInfo` impls by referring to
  the shared underlying type, `RawList`. This required increasing the
  visibility of `RawList`.

- Explain why a separate impl is needed for `RawList`.

- Remove an incorrect FIXME comment. Fat reference types will always
  need a separate impl. (To be sure, one could use `T: ?Sized` to merge
  the impls for `&T` and `&[T]` and it would compile but it would behave
  incorrectly because `&T` needs one word of storage and `&[T]` needs
  two words of storage. I tried it and it did not go well.)
2026-04-01 07:04:08 +11:00
Nicholas Nethercote 0f159dc1ac Clarify use of extern type in RawList.
- Add some explanatory comments.
- Rename `OpaqueListContents` as `ExternTy`. I've always found both the
  "opaque" and "contents" parts of this name to be confusing. Calling it
  `ExternTy` makes it clear that all that matters is it's an extern
  type.
2026-04-01 06:58:37 +11:00
Nicholas Nethercote f334357e8c Add some size assertions for List/RawList.
Checking that they really do use thin pointers.
2026-04-01 06:57:08 +11:00
Josh Triplett 68c8339066 Make truncate and extend use const traits to work in const contexts 2026-03-31 09:56:33 -07:00
Josh Triplett ea421bf991 Add integer truncation and extension methods
This provides `.truncate()`, `.saturating_truncate()`,
`.checked_truncate()`, and `.extend()`.

These only work within the same signedness (use `.cast_signed()` and
`.cast_unsigned()` to change sign).

The truncation methods only work to smaller (or equal) types.
`.extend()` only works to larger (or equal) types.

For the purposes of truncation and extending, `usize` is considered
larger than `u16` or `u8`. This is consistent with `From`/`Into`
conversions.

Adding these methods results in needing to update the output of one test
that gets a new method-name similarity result.

Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2026-03-31 09:56:04 -07:00
bors 0e95a0f4c6 Auto merge of #154637 - JonathanBrouwer:rollup-fGsU36o, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#154419 (Take first task group for further execution)
 - rust-lang/rust#154569 (Fix  type alias where clause suggestion spacing issue)
 - rust-lang/rust#154617 (Update flate2 users to use zlib-rs)
 - rust-lang/rust#154618 (Fix AtomicPtr::update's cfg gate)
 - rust-lang/rust#154620 (stabilize new Range type and iterator)
 - rust-lang/rust#151932 (refactor: remove `Adjust::ReborrowPin`)
 - rust-lang/rust#153980 (refactor: move doc(rust_logo) check to parser)
 - rust-lang/rust#154134 (fix: guard paren-sugar pretty-printing on short trait args)
 - rust-lang/rust#154270 (Create `Ty` type alias in `rustc_type_ir`)
 - rust-lang/rust#154580 (Split AttributeParserError Diagnostic implementation into subfunctions)
 - rust-lang/rust#154606 (misc test cleanups)
 - rust-lang/rust#154612 (Add a test for a now fixed ICE with `offset_of!()`)
2026-03-31 16:44:16 +00:00
Adin Ackerman 9626ca2e3a fix pin docs 2026-03-31 09:38:59 -07:00
Guillaume Gomez f8a8b8f739 Mention on which items the missing_doc_code_examples is not emitted 2026-03-31 17:52:38 +02:00
binarycat f0c7cd28b8 build_helper: fix yarn locking, add check, and bump lockfile 2026-03-31 09:37:01 -05:00
yukang ebf22f83f1 fix unit test 2026-03-31 22:19:49 +08:00
Jonathan Brouwer c13822a584 Rollup merge of #154635 - RalfJung:miri-run-edition, r=Mark-Simulacrum
./x run miri: default to edition 2021

Fixes https://github.com/rust-lang/rust/issues/154630
2026-03-31 15:27:20 +02:00
Jonathan Brouwer 3cef5b54bc Rollup merge of #154634 - nnethercote:hcx, r=petrochenkov
Use `Hcx`/`hcx` consistently for `StableHashingContext`.

The `HashStable` and `ToStableHashKey` traits both have a type parameter that is sometimes called `CTX` and sometimes called `HCX`. (In practice this type parameter is always instantiated as `StableHashingContext`.) Similarly, variables with these types are sometimes called `ctx` and sometimes called `hcx`. This inconsistency has bugged me for some time.

The `HCX`/`hcx` form is more informative (the `H`/`h` indicates what type of context it is) and it matches other cases like `tcx`, `dcx`, `icx`.

Also, RFC 430 says that type parameters should have names that are "concise UpperCamelCase, usually single uppercase letter: T". In this case `H` feels insufficient, and `Hcx` feels better.

Therefore, this commit changes the code to use `Hcx`/`hcx` everywhere.

r? @petrochenkov
2026-03-31 15:27:19 +02:00
Jonathan Brouwer f883d62ea5 Rollup merge of #152432 - fneddy:s390x_packed_stack_attribute, r=nikic
add rustc option -Zpacked-stack

this enables `-Zpacked-stack` just as `-mpacked-stack` in clang and gcc. packed-stack is needed on s390x for kernel development.

For reference: rust-lang/rust#151154 and rust-lang/rust#150766

look at @uweigand s post for full explanation of what this does. Here a wrap-up:

https://github.com/rust-lang/rust/pull/150766#issuecomment-3729074303
> [...]
> packed-stack [...] modifies how the compiler-generated function prolog/epilog code makes use of the 160 byte register save area provided by a caller to the callee [...]  this variant is not actually incompatible with the ABI - packed-stack and regular functions can freely call each other without ABI issues.
> [...]
> combination of -mpacked-stack and -mbackchain [...]  the location in the stack frame where the backchain link ought to be stored is not available. [...] is not supported at all with the default ABI
> [...]
> However, in the special case of also using soft-float, our (implied) soft-float ABI provides a different location for the backchain that is compatible with -mpacked-stack, so that combination should be supported
> [...]
2026-03-31 15:27:18 +02:00
Jonathan Brouwer 470facce55 Rollup merge of #150752 - thesummer:update-libc-0.2.179, r=tgross35
Update libc to v0.2.183

Follow-up of https://github.com/rust-lang/rust/pull/150484.
This PR updates libc to include the latest patches to make rtems target (and probably others) compile again.
2026-03-31 15:27:18 +02:00
bors ba11b1e3f0 Auto merge of #154576 - Zalathar:cache-on-disk, r=nnethercote
Simplify the `cache_on_disk_if` modifier to just `cache_on_disk`



Thanks to https://github.com/rust-lang/rust/pull/154304, there is now only one remaining query with a non-trivial cache-on-disk condition (`check_liveness`). But prior experiments at https://github.com/rust-lang/rust/pull/153441#issuecomment-4009037104 indicate that `check_liveness` can also be made non-disk-caching with little or no measurable effect.

This PR takes advantage of those facts to replace the `cache_on_disk_if` modifier with a simpler `cache_on_disk` modifier:
- When combined with `separate_provide_extern`, only values for “local” keys are cached to disk.
- For any other query with `cache_on_disk`, values are cached to disk unconditionally.

r? nnethercote (or compiler)
2026-03-31 13:13:38 +00:00
yukang 86796ddaa0 Label overwritten assignments for never read assignments 2026-03-31 20:44:11 +08:00
Jonathan Brouwer bbeec421ea Rollup merge of #154612 - jakubadamw:issue-125805, r=Kivooeo
Add a test for a now fixed ICE with `offset_of!()`

Adds a test for rust-lang/rust#125805, which was an ICE with `offset_of!()` on a field with the type of a trait object missing `dyn` and a required lifetime parameter.

Closes rust-lang/rust#125805.
2026-03-31 13:58:44 +02:00
Jonathan Brouwer e9f6a7794c Rollup merge of #154606 - cyrgani:misc-test-cleanups, r=Kivooeo
misc test cleanups

These are some mixed cleanups to `tests/ui` that individually seemed too small for a PR of their own. Some duplicated tests are removed, `issues-*` tests are renamed and more FIXMEs are added to `ui/README.md`.
Reasoning for the deleted tests:
* `tests/ui/associated-types/issue-47814.rs`: duplicate of `tests/ui/associated-consts/issue-47814.rs`
* rename `tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs` to `.../nested-copy-drops-83176.rs` since rust-lang/rust#78720 was not the correct issue, rust-lang/rust#83176 was.
* `tests/ui/specialization/defaultimpl/specialization-feature-gate-default.rs`: duplicate of `tests/ui/specialization/specialization-feature-gate-default.rs`
* `fn/issue-1900.rs`: duplicate of `error-codes/E0131.rs`

r? @Kivooeo
2026-03-31 13:58:43 +02:00
Jonathan Brouwer 6188955b76 Rollup merge of #154580 - scrabsha:push-uzvmzwlqvqzr, r=jdonszelmann
Split AttributeParserError Diagnostic implementation into subfunctions
2026-03-31 13:58:43 +02:00
Jonathan Brouwer 286263335b Rollup merge of #154270 - Jamesbarford:chore/move-ty-pt1, r=lcnr
Create `Ty` type alias in `rustc_type_ir`

r? lcnr

Anywhere that required the use of the trait `Ty` I used `ty::Ty<I>` otherwise it should be `Ty<I>`
2026-03-31 13:58:42 +02:00
Jonathan Brouwer 29c210d5bd Rollup merge of #154134 - Embers-of-the-Fire:fix-153855, r=fmease
fix: guard paren-sugar pretty-printing on short trait args

Fix rust-lang/rust#153855 by adding a guard on trait with only one argument.
2026-03-31 13:58:42 +02:00
Jonathan Brouwer bfffbb6f41 Rollup merge of #153980 - mehdiakiki:pr-check_attrs-rust_logo, r=jdonszelmann
refactor: move doc(rust_logo) check to parser

Reducing `check_attr.rs` size by moving the `#[doc(rust_logo)]` feature gate into `DocParser`.
2026-03-31 13:58:41 +02:00
Jonathan Brouwer 3869a8e617 Rollup merge of #151932 - frank-king:refactor/pin-coerce-3, r=jackh726
refactor: remove `Adjust::ReborrowPin`

Followed by rust-lang/rust#149130, this PR removes `Adjust::ReborrowPin` and use an `Adjust::Deref(DerefAdjustKind::Pin)` followed by an `Adjust::Borrow(AutoBorrow::Pin)` instead.
2026-03-31 13:58:40 +02:00
Jonathan Brouwer 028a626a19 Rollup merge of #154620 - pitaj:stabilize-new_range_api, r=tgross35
stabilize new Range type and iterator

For rust-lang/rust#125687
Stabilizes `core::range::Range` and `core::range::RangeIter`, newly stable API:

```rust
// in core::range

pub struct Range<Idx> {
    pub start: Idx,
    pub end: Idx,
}

impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> { /* ... */ }

impl<Idx: PartialOrd<Idx>> Range<Idx> {
    pub const fn contains<U>(&self, item: &U) -> bool
    where
        Idx: [const] PartialOrd<U>,
        U: ?Sized + [const] PartialOrd<Idx>;

    pub const fn is_empty(&self) -> bool
    where
        Idx: [const] PartialOrd;
}

impl<Idx: Step> Range<Idx> {
    pub fn iter(&self) -> RangeIter<Idx>;
}

impl<T> const RangeBounds<T> for Range<T> { /* ... */ }
impl<T> const RangeBounds<T> for Range<&T> { /* ... */ }

impl<T> const From<Range<T>> for legacy::Range<T> { /* ... */ }
impl<T> const From<legacy::Range<T>> for Range<T> { /* ... */ }

pub struct RangeIter<A>(/* ... */);

// `RangeIter::remainder` not stabilized

impl<A: Step> Iterator for RangeIter<A> {
    type Item = A;
    /* ... */
}

impl<A: Step> DoubleEndedIterator for RangeIter<A> { /* ... */ }
impl<A: Step> FusedIterator for RangeIter<A> { }
impl<A: Step> IntoIterator for Range<A> {
    type Item = A;
    type IntoIter = RangeIter<A>;
    /* ... */
}

impl ExactSizeIterator for RangeIter<u8> { }
impl ExactSizeIterator for RangeIter<i8> { }

unsafe impl<T> const SliceIndex<[T]> for range::Range<usize> {
    type Output = [T];
    /* ... */
}
unsafe impl const SliceIndex<str> for range::Range<usize> {
    type Output = str;
    /* ... */
}
```

Updates docs to reflect stabilization (removed "experimental")
2026-03-31 13:58:40 +02:00
Jonathan Brouwer d304cd64f2 Rollup merge of #154618 - CAD97:atomicptr-update-cfg-is-not-eight, r=joshtriplett
Fix AtomicPtr::update's cfg gate

I'm *pretty* sure this is supposed to be `#[cfg(target_has_atomic = "ptr")]` like `AtomicPtr::try_update` is.

cc @GrigorenkoPV (author), @Noratrieb (r+ to rust-lang/rust#133829)
2026-03-31 13:58:39 +02:00
Jonathan Brouwer c91d04086a Rollup merge of #154617 - joshtriplett:flate2-zlib-rs, r=Mark-Simulacrum
Update flate2 users to use zlib-rs

flate2 is looking to make zlib-rs the default.

Go ahead and make build-manifest and rust-installer use it, to make sure it
doesn't introduce any issues.
2026-03-31 13:58:39 +02:00
Jonathan Brouwer 04987e7b67 Rollup merge of #154569 - chenyukang:yukang-fix-153567-where-clause-space, r=jackh726
Fix  type alias where clause suggestion spacing issue

Fixes rust-lang/rust#153567
2026-03-31 13:58:38 +02:00