Commit Graph

24629 Commits

Author SHA1 Message Date
Waffle Lapkin 9b1f20d20d deny-by-default & report in deps uninhabited_static 2026-04-05 20:37:18 +02:00
bors 009a6c1e8b Auto merge of #154308 - ShoyuVanilla:undo-fudge-iv, r=jieyouxu
Revert #151380 and #153869

cc https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports/topic/.23153869.3A.20beta-nominated/with/581306395

r? ghost
2026-04-02 00:09:59 +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 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 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
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 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
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
yukang ebf22f83f1 fix unit test 2026-03-31 22:19:49 +08: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
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 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 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 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
Trevor Gross 44faca9d94 Rollup merge of #154577 - ferrocene:jyn/bless-mir-opt, r=jieyouxu
Update `mir-opt` 64-bit panic-abort tests for `Alignment` rename

These seem to have been missed when the PR originally merged.

cc https://github.com/rust-lang/rust/pull/154004, @GrigorenkoPV
2026-03-31 05:08:26 -04:00
Trevor Gross 66c7f9d9af Rollup merge of #154574 - cyrgani:less-const-tests, r=Kivooeo
delete several `ui/consts` tests

* `tests/ui/consts/const.rs`: meaningless
* `tests/ui/consts/const-bound.rs`: has nothing to do with const bounds or const at all (anymore?)
* `tests/ui/consts/const-enum-tuplestruct2.rs`, `tests/ui/consts/const-enum-tuple2.rs`, `tests/ui/consts/const-enum-tuple.rs`: duplicates of `tests/ui/consts/const-enum-tuplestruct.rs`
r? @Kivooeo
2026-03-31 05:08:25 -04:00
Trevor Gross 472c531d7a Rollup merge of #154551 - chenyukang:yukang-fix-146204-assert-ne-suggestion-span, r=JohnTitor
Skip suggestions pointing to macro def for assert_eq

Fixes rust-lang/rust#146204

It's better to suggest:
```console
help: consider borrowing here
 --> src/main.rs:3:16
  |
 3|      assert_ne!(&buf, b"----");
  |                 +
```
but i don't want to give a too heuristic but not general enough fix, let suppress them.
2026-03-31 05:08:25 -04:00
Trevor Gross 68d2666fc2 Rollup merge of #153790 - zedddie:transmutation-regression, r=jdonszelmann
Fix regression when dealing with generics/values with unresolved inference

Follow up for rust-lang/rust#151703, fixing regression caused in rollup rust-lang/rust#152825

Forgot to handle generics & unresolved inference variables (as in `get_safe_transmute_error_and_reason`) in my previous PR. This followup checks for them before trying to normalize.

I am not completely sure its right approach to have this check cloned but as `select_transmute_obligation_for_reporting` fn just chooses obligation and doesn't actually return an error, this check shouldn't be removed from `get_safe_transmute_error_and_reasnon`. If there is any better solution, let me kmow.

Fixes: rust-lang/rust#153755

r? @jdonszelmann
2026-03-31 05:08:24 -04:00
Trevor Gross 3479a1d553 Rollup merge of #153574 - TaKO8Ki:self-referential-param-env-normalization-ice, r=lcnr
Avoid ICE when param-env normalization leaves unresolved inference variables

Fixes rust-lang/rust#153354

Because the impl is already ill-formed, those variables are not fully constrained, so zfully_resolve` fails. We previously treated that as an immediate compiler bug with `span_bug!`, which caused an ICE on invalid input.
2026-03-31 05:08:23 -04:00
Eddy (Eduard) Stefes f39fa9e4c0 add rustc option -Zpacked-stack
this enables packed-stack just as -mpacked-stack in clang and gcc.
packed-stack is needed on s390x for kernel development.

Co-authored-by: Ralf Jung <post@ralfj.de>
2026-03-31 09:06:31 +02:00
bors 37cfa179be Auto merge of #154053 - khyperia:generalize-unevaluated, r=BoxyUwU
Properly generalize unevaluated consts



- fixes https://github.com/rust-lang/rust/issues/153831
- fixes a `// FIXME(ogca)` (I am unaware of an issue for this) added in https://github.com/rust-lang/rust/pull/150823

r? @BoxyUwU
2026-03-31 05:35:09 +00:00
Redddy 8cef68aafa Pluralize hidden lifetime labels 2026-03-31 04:27:49 +00:00
Redddy 25dbba03a2 Fix mismatched_lifetime_syntaxes suggestions for hidden path lifetimes 2026-03-31 04:27:44 +00:00
Peter Jaszkowiak 620e92f016 stabilize new Range type and iterator
stabilizes `core::range::Range`
stabilizes `core::range::RangeIter`
stabilizes `std::range` which was missed in prior PRs

Updates docs to reflect stabilization (removed "experimental")

`RangeIter::remainder` is excluded from stabilization
2026-03-30 22:17:27 -06:00
Jacob Adam 2d87df1269 Add a test for a now fixed ICE with offset_of!() 2026-03-31 00:15:49 +01:00
cyrgani 6cd26567db add more FIXMEs and details to ui/README.md 2026-03-30 20:40:27 +00:00
cyrgani d24ebcb47c rename some issues-* tests 2026-03-30 20:40:15 +00:00
cyrgani 61ea83db41 delete some duplicated tests 2026-03-30 20:39:42 +00:00
yukang 6518de37d4 Skip suggestions pointing to extern macro def for assert_eq 2026-03-30 22:58:03 +08:00
Takayuki Maeda d29c489599 add self-referential param-env normalization regression
avoid ICE on invalid param-env normalization

remove 120033 crash test

fix comments

use rustc_no_implicit_bounds

set #![allow(incomplete_features)]
2026-03-30 22:50:31 +09:00
khyperia 75eeece98c Properly generalize unevaluated consts 2026-03-30 15:47:49 +02:00
Jynn Nelson e61842d378 Update mir-opt 64-bit panic-abort tests for Alignment rename
These seem to have been missed when the PR originally merged.
2026-03-30 10:56:57 +00:00
cyrgani bf42a53bf7 delete several ui/consts tests 2026-03-30 09:15:22 +00:00
Jacob Pratt 7275f7e2e3 Rollup merge of #154564 - estebank:tweak-wf-errors, r=Kivooeo
Tweak wording of E0275 WF errors

Modify the main error message to read better:

```
error[E0275]: overflow evaluating whether `&'a mut Bar` is well-formed
```
2026-03-30 05:13:18 -04:00
Jacob Pratt a2cc7a9f0a Rollup merge of #154563 - estebank:multiline-binop, r=TaKO8Ki
Point at binop lhs and rhs when expression is multiline

```
error[E0277]: cannot add `()` to `u32`
  --> $DIR/multiline-span-simple.rs:13:18
   |
LL |       foo(1 as u32 +
   |           -------- ^ no implementation for `u32 + ()`
LL |
LL | /         bar(x,
LL | |
LL | |             y),
   | |______________-
```
2026-03-30 05:13:17 -04:00
Jacob Pratt e97324a04f Rollup merge of #154548 - jeanibarz:fix/add-test-150457, r=jieyouxu
Add regression test for TransmuteFrom ICE with min_generic_const_args

Regression test for rust-lang/rust#150457.

The wfcheck ICE with TransmuteFrom + min_generic_const_args was fixed by rust-lang/rust#150707 but didn't get a test.

Closes rust-lang/rust#150457
2026-03-30 05:13:17 -04:00
yukang 785b511360 fix where clause rustfix suggestion spacing 2026-03-30 13:07:49 +08:00
bors 80ad55752e Auto merge of #154559 - JonathanBrouwer:rollup-Iut0qjN, r=JonathanBrouwer
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#154074 (don't drop arguments' temporaries in `dbg!`)
 - rust-lang/rust#154328 (rustdoc: add missing {os,target,target_env} values for cfg pretty printer)
 - rust-lang/rust#154540 (Fix invalid type suggestion for item nested in function)
 - rust-lang/rust#154549 (Add regression test for recursive lazy type alias normalization ICE)
 - rust-lang/rust#153373 (Fix LegacyKeyValueFormat report from docker build: powerpc)
 - rust-lang/rust#154322 (feat: reimplement `hash_map!` macro)
 - rust-lang/rust#154416 (Add `IoSplit` diagnostic item for `std::io::Split`)
 - rust-lang/rust#154486 (std_detect on AArch64 Darwin: Detect FEAT_SVE_B16B16)
 - rust-lang/rust#154508 (Fix ambiguous parsing in bootstrap.py)
 - rust-lang/rust#154518 (Panic in Hermit clock_gettime)
 - rust-lang/rust#154530 (update zulip link in `std` documentation)
2026-03-29 22:49:44 +00:00
Esteban Küber 0740609ea3 Point at binop lhs and rhs when expression is multiline
```
error[E0277]: cannot add `()` to `u32`
  --> $DIR/multiline-span-simple.rs:13:18
   |
LL |       foo(1 as u32 +
   |           -------- ^ no implementation for `u32 + ()`
LL |
LL | /         bar(x,
LL | |
LL | |             y),
   | |______________-
```
2026-03-29 21:07:54 +00:00
Jonathan Brouwer 59e6f0d826 Rollup merge of #154549 - jeanibarz:fix/add-test-152633, r=chenyukang
Add regression test for recursive lazy type alias normalization ICE

Regression test for rust-lang/rust#152633.

The normalization ICE with recursive lazy_type_alias + min_generic_const_args was fixed by rust-lang/rust#152040 but didn't get a test. Compiler now reports E0275 instead of crashing.

Closes rust-lang/rust#152633
2026-03-29 21:39:28 +02:00
Jonathan Brouwer 883eda3a72 Rollup merge of #154540 - chenyukang:yukang-fix-146786-unusable-path-suggestion, r=estebank
Fix invalid type suggestion for item nested in function

Fixes rust-lang/rust#146786

I also tried to add the `omit_parent` logic in pretty formatter here:
https://github.com/chenyukang/rust/blob/69b6d26d05006dca7556abc555fb0e029ecf1f4e/compiler/rustc_middle/src/ty/print/pretty.rs#L2240-L2295
so that we don't need to add `should_omit_parent_def_path` and `reset_path`.

but seems there will be duplicate print code with `default_print_def_path`.

maybe r? @estebank
2026-03-29 21:39:27 +02:00
Jonathan Brouwer 880c9e01ed Rollup merge of #154328 - scrabsha:push-tkozopuzoorz, r=lolbinarycat
rustdoc: add missing {os,target,target_env} values for cfg pretty printer
2026-03-29 21:39:27 +02:00
Jonathan Brouwer 2a18b885ce Rollup merge of #154074 - dianne:dbg-temp-scopes, r=Mark-Simulacrum
don't drop arguments' temporaries in `dbg!`

Fixes rust-lang/rust#153850

Credit to @theemathas for help with macro engineering ^^

r? libs
2026-03-29 21:39:26 +02:00