Commit Graph

320661 Commits

Author SHA1 Message Date
Esteban Küber 73fe905f3c Detect inherent method behind deref being shadowed by trait method
```
error[E0277]: the trait bound `Rc<RefCell<S>>: Borrow<S>` is not satisfied
  --> $DIR/shadowed-intrinsic-method-deref.rs:16:22
   |
LL |     let sb : &S = &s.borrow();
   |                      ^^^^^^ the trait `Borrow<S>` is not implemented for `Rc<RefCell<S>>`
   |
help: the trait `Borrow<S>` is not implemented for `Rc<RefCell<S>>`
      but trait `Borrow<RefCell<S>>` is implemented for it
  --> $SRC_DIR/alloc/src/rc.rs:LL:COL
   = help: for that trait implementation, expected `RefCell<S>`, found `S`
   = note: there's an inherent method on `RefCell<S>` of the same name, which can be auto-dereferenced from `&RefCell<T>`
help: to access the inherent method on `RefCell<S>`, use the fully-qualified path
   |
LL -     let sb : &S = &s.borrow();
LL +     let sb : &S = &RefCell::borrow(&s);
   |
```

In the example above, method `borrow` is available both on `<RefCell<S> as Borrow<S>>` *and* on `RefCell<S>`. Adding the import `use std::borrow::Borrow;` causes `s.borrow()` to find the former instead of the latter. We now point out that the other exists, and provide a suggestion on how to call it.
2026-03-10 23:24:27 +00:00
bors 0c68443b0a Auto merge of #153642 - matthiaskrgr:rollup-IHw8KqK, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#148562 (In `Option::get_or_insert_with()`, forget the `None` instead of dropping it.)
 - rust-lang/rust#153325 (tests/ui/cfg: add annotations for reference rules)
 - rust-lang/rust#153621 (Remove `TyCtxt::node_span_lint` method)
 - rust-lang/rust#153627 (rustdoc-json: Improve docs for `ItemEnum::item_kind`)
2026-03-10 10:31:56 +00:00
Matthias Krüger b01e56d36d Rollup merge of #153627 - aDotInTheVoid:rustdocsdocs, r=GuillaumeGomez
rustdoc-json: Improve docs for `ItemEnum::item_kind`

Fixes https://github.com/rust-lang/rust/pull/153279#discussion_r2875219461

r? @GuillaumeGomez

CC @LukeMathWalker
2026-03-10 07:21:59 +01:00
Matthias Krüger 531dafd132 Rollup merge of #153621 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Remove `TyCtxt::node_span_lint` method

Part of https://github.com/rust-lang/rust/issues/153099.

One less obstacle before we can remove `lint_level` function. :)

r? @JonathanBrouwer
2026-03-10 07:21:59 +01:00
Matthias Krüger 4e0adfee0f Rollup merge of #153325 - DanielEScherzer:test-references-conditional-compilation, r=ehuss
tests/ui/cfg: add annotations for reference rules
2026-03-10 07:21:58 +01:00
Matthias Krüger ce972294a5 Rollup merge of #148562 - kpreid:get-init-drop, r=oli-obk
In `Option::get_or_insert_with()`, forget the `None` instead of dropping it.

Per https://github.com/rust-lang/rust/pull/148486#issuecomment-3493665688

In `Option::get_or_insert_with()`, after replacing the `None` with `Some`, forget the `None` instead of dropping it.

This allows eliminating the `T: [const] Destruct` bounds, making the functions more flexible in (unstable) const contexts, and avoids generating an implicit `drop_in_place::<Option<T>>()` that will never do anything (and which might even persist after optimization).
2026-03-10 07:21:58 +01:00
bors 3bc6ea5673 Auto merge of #152954 - Kmeakin:km/unicode-data/case-mapping, r=Mark-Simulacrum
Unicode data: reduce size of to_lower/to_upper tables

Reduces the combined size of to_lower and to_upper from 25,364 bytes to 3,110 bytes. Explained in detail in the doc comments
2026-03-10 06:20:10 +00:00
bors 595f14b022 Auto merge of #153631 - matthiaskrgr:rollup-XDRwIkE, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#149931 (rustdoc: don't give depreciation notes special handling)
 - rust-lang/rust#153608 (ast_passes: unsupported arch w/ scalable vectors)
 - rust-lang/rust#153609 (Add missing `Diag::with_span_suggestion_with_style` method)
 - rust-lang/rust#153610 (Only lint unused features if they are unstable)
 - rust-lang/rust#153616 (Update `sysinfo` version to `0.38.4`)
 - rust-lang/rust#153619 (Update books)
 - rust-lang/rust#153624 (Ping fmease on parser modifications)
2026-03-10 03:12:20 +00:00
Matthias Krüger 9b45a3c7a8 Rollup merge of #153624 - fmease:ping-me-on-parser-changes, r=fmease
Ping fmease on parser modifications

From time to time innocuous-seeming PRs get submitted and sometimes even approved that unbeknownst to their author and to reviewers change the grammar of (stable) Rust which would be a breaking change; often they only meant to tweak diagnostics.

I sometimes catch such PRs before they get merged but I want to make it a lot harder for them to slip through the cracks going forward.

I'm going to list recent examples to paint a picture (note: this is not about blame!):

1. https://github.com/rust-lang/rust/pull/149728#pullrequestreview-3916816500 (2026)
   * caught before merge but after approval
   * PR unapproved for now
2. https://github.com/rust-lang/rust/issues/152501 (2026)
   * caught after merge of rust-lang/rust#149489
   * fixed & backported
3. https://github.com/rust-lang/rust/issues/152499 (2026)
   * caught after merge of rust-lang/rust#149667
   * fixed & backported
4. https://github.com/rust-lang/rust/pull/151960#discussion_r2751649272 (2026)
   * caught right after submission
   * the approach was thus changed
5. rust-lang/rust#148238 (2025)
   * caught after merge of rust-lang/rust#118947
   * still unaddressed
6. https://github.com/rust-lang/rust/pull/144386#pullrequestreview-3052288562 (2025)
   * caught right after submission
   * crater & T-lang were activated by me
7. https://github.com/rust-lang/rust/pull/119042#discussion_r1429189817 (2023)
   * caught right after submission
   * the approach was thus changed
8. https://github.com/rust-lang/rust/issues/103534 (2022)
   * caught way later
   * partially addressed

Why not just post a note without pinging me? Well, due to them not failing CI and generally due to (friendly) botspam, such comments just get lost or sometimes even actively ignored.

Of course, I'm not able to catch everything. E.g., I didn't notice issue https://github.com/rust-lang/rust/issues/146417 before PR https://github.com/rust-lang/rust/pull/139858 was merged despite having skimmed its diff and more importantly, I as a reviewer missed the blatantly obvious https://github.com/rust-lang/rust/issues/144958 before merge.

Separately, off and on over the span of one year I've worked on a Rust parser that now has >99% accuracy/parity with rustc according to some metrics (this includes stable + unstable + internal syntax) and which I'm now using to detect such regressions and issues in general among other things (e.g., https://github.com/rust-lang/rust/issues/152499 and https://github.com/rust-lang/rust/issues/152820 were found this way, more to come). I'm pretty invested, let's say.

r? me
2026-03-09 23:47:04 +01:00
Matthias Krüger aab6313279 Rollup merge of #153619 - rustbot:docs-update, r=ehuss
Update books

## rust-embedded/book

4 commits in 99d0341ff4e06757490af8fceee790c4ede50bc0..e88aa4403b4bf2071c8df9509160477e40179099
2026-02-28 20:13:44 UTC to 2026-02-28 20:07:25 UTC

- Clarify that a mini usb cable is used on the STM32F3DISCOVERY (rust-embedded/book#381)
- Update outdated qemu documentation (rust-embedded/book#403)
- Add TRACE32 to Debuggers section (rust-embedded/book#406)
- Add a link to Rust for Zephyr (rust-embedded/book#407)

## rust-lang/nomicon

4 commits in b8f254a991b8b7e8f704527f0d4f343a4697dfa9..cc6a6bae8c3bfa389974e533c54694662c1a9de6
2026-02-27 23:27:18 UTC to 2026-02-26 22:57:03 UTC

- Fix `Vec::push_all` ptr code in exception-safety (rust-lang/nomicon#418)
- Clarify parameter and argument compatibility (rust-lang/nomicon#516)
- Improve grammar in Variance section (rust-lang/nomicon#515)
- Explicit `extern "C"` ABI for FFI (rust-lang/nomicon#520)

## rust-lang/reference

7 commits in 50a1075e879be75aeec436252c84eef0fad489f4..c49e89cc8c7c2c43ca625a8d5b7ad9a53a9ce978
2026-03-04 15:39:00 UTC to 2026-03-01 06:34:18 UTC

- Resolve grammar rules in link reference definitions (rust-lang/reference#2198)
- Support non-ASCII Unicode in grammar rule names (rust-lang/reference#2196)
- Fix grammar for block comments (rust-lang/reference#2191)
- Fix an EN grammar error & add an item to place expr context list (rust-lang/reference#2189)
- Align attribute template with applied conventions (rust-lang/reference#2194)
- Update shebang (rust-lang/reference#2192)
- Remove RESERVED_NUMBER (rust-lang/reference#2193)
2026-03-09 23:47:04 +01:00
Matthias Krüger b2265c796a Rollup merge of #153616 - GuillaumeGomez:update-sysinfo, r=lqd
Update `sysinfo` version to `0.38.4`

r? ghost
2026-03-09 23:47:03 +01:00
Matthias Krüger 1aeecf0dc8 Rollup merge of #153610 - mu001999-contrib:fix/unused-stable-features, r=JonathanBrouwer
Only lint unused features if they are unstable

Fixes rust-lang/rust#153523
2026-03-09 23:47:03 +01:00
Matthias Krüger 5b3d88dec0 Rollup merge of #153609 - GuillaumeGomez:with_span_suggestion_with_style, r=JonathanBrouwer
Add missing `Diag::with_span_suggestion_with_style` method

Uncovered while working on https://github.com/rust-lang/rust/pull/153509.

r? @jonathanbrouwer
2026-03-09 23:47:02 +01:00
Matthias Krüger 578d299fe7 Rollup merge of #153608 - davidtwco:sve-unsupported-architecture, r=lqd
ast_passes: unsupported arch w/ scalable vectors

Fixes rust-lang/rust#153593

Emit an error when attempting to compile a `#[rustc_scalable_vector]` type for a architecture that fundamentally doesn't support scalable vectors. Ultimately this is just a diagnostic improvement for an internal attribute as users should never be doing this.

r? @lqd
2026-03-09 23:47:02 +01:00
Matthias Krüger b60f58f505 Rollup merge of #149931 - lolbinarycat:rustdoc-depr-html-future, r=GuillaumeGomez
rustdoc: don't give depreciation notes special handling

based on discussion in rust-lang/rust#149741

we're currently using pre-wrap here which forces us to do a bunch of other hacky weird stuff, but getting rid of all that would likely break some existing docs, so i'm proposing we do it across an edition.

r? @GuillaumeGomez
2026-03-09 23:47:01 +01:00
Guillaume Gomez 4d7624e1d1 Remove TyCtxt::node_span_lint mention in docs 2026-03-09 22:50:10 +01:00
Guillaume Gomez 562e9812d4 Remove TyCtxt::node_span_lint method 2026-03-09 22:50:10 +01:00
Guillaume Gomez e54a3d33ef Remove usage of TyCtxt::node_span_lint in clippy 2026-03-09 22:50:10 +01:00
Guillaume Gomez a4a37ed163 Use Diag::with_span_suggestion_with_style method in librustdoc 2026-03-09 22:32:51 +01:00
Guillaume Gomez 744c50315d Add missing Diag::with_span_suggestion_with_style method 2026-03-09 22:18:58 +01:00
Alona Enraght-Moony ca9bd0d157 rustdoc-json: Improve docs for ItemEnum::item_kind
Fixes https://github.com/rust-lang/rust/pull/153279#discussion_r2875219461
2026-03-09 20:53:01 +00:00
León Orell Valerian Liehr c5c8d6bac7 Ping fmease on parser modifications 2026-03-09 18:22:39 +01:00
Guillaume Gomez 4c48a5bf5f Remove usage of TyCtxt::node_span_lint in librustdoc 2026-03-09 18:07:12 +01:00
bors 2d76d9bc76 Auto merge of #153617 - JonathanBrouwer:rollup-udG4Tzr, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#147834 (Always make tuple elements a coercion site)
 - rust-lang/rust#150446 (miri/const eval: support `MaybeDangling`)
 - rust-lang/rust#153053 (stop marking `deref_patterns` as an incomplete feature)
 - rust-lang/rust#153398 (fix ICE in `const_c_variadic` when passing ZSTs)
2026-03-09 17:03:26 +00:00
rustbot db5599bf29 Update books 2026-03-09 18:01:03 +01:00
Jonathan Brouwer 610ea1d75d Rollup merge of #153398 - folkertdev:const-c-variadic-trailing-zst, r=RalfJung
fix ICE in `const_c_variadic` when passing ZSTs

fixes https://github.com/rust-lang/rust/issues/153351
r? RalfJung

There was a mismatch between the caller and callee ABI where the caller does not pass ZST arguments, but the callee does expect them. Because ZSTs don't implement `VaArgSafe` the program must already be invalid if this comes up.
2026-03-09 17:56:16 +01:00
Jonathan Brouwer 8120cc4c49 Rollup merge of #153053 - cyrgani:deref-patterns-not-imcomplete, r=fee1-dead,Nadrieril
stop marking `deref_patterns` as an incomplete feature

This PR removes the `incomplete_feature` warning for `deref_patterns`. The reason given for this in the tracking issue (rust-lang/rust#87121) was
> Per policy, the `incomplete_feature` is supposed to stay on until the feature has an accepted RFC. We're slowly working on writing up that RFC so it'll take some more time unfortunately.
>
> I don't know of any compiler crashes it causes today. The feature should be pretty usable.

However, I could not find any evidence of such a policy. The [lint documentation](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#incomplete-features) for `incomplete_features` also only mentions features that are more likely to cause errors.
There are also many other features without an RFC that are not considered incomplete, e.g. `macro_metavar_expr_concat`, `negative_impls` or `yeet_expr`.
The feature does not cause any known ICEs either.

The concrete motivation is to use this feature to replace `box_patterns` in the compiler and pave the way towards removing that legacy feature.
2026-03-09 17:56:15 +01:00
Jonathan Brouwer 8fc4e47ee1 Rollup merge of #150446 - WaffleLapkin:miri-maybe-dangling, r=RalfJung
miri/const eval: support `MaybeDangling`

r? RalfJung
2026-03-09 17:56:14 +01:00
Jonathan Brouwer 3f1ddd5788 Rollup merge of #147834 - WaffleLapkin:tuple-coerce, r=BoxyUwU
Always make tuple elements a coercion site

Previously we only used `check_expr_coercible_to_type` if we had an expectation (using `check_expr_with_expectation(NoExpectation)` otherwise). Normally that'd be fine, because without an expectation we can't insert a coercion anyway. However, for the case of never-to-any coercion specifically, we _do_ insert it eagerly, so this prevents some code from compiling, for example:

```rust
((),) = (loop {},);
```

With this PR we are always using `check_expr_coercible_to_type` (using an infer var if there is no expectation), which allows slightly more code to compile.

Fixes rust-lang/rust#112856

r? BoxyUwU
2026-03-09 17:56:14 +01:00
Guillaume Gomez 28131e1b8f Update sysinfo version to 0.38.4 2026-03-09 17:27:17 +01:00
mu001999 dfd5e905c5 Bless other tests 2026-03-09 23:38:30 +08:00
mu001999 2c7690e1e6 Mark stable features as used to avoid trigger unused_features 2026-03-09 23:36:26 +08:00
David Wood 342ad0401a ast_passes: unsupported arch w/ scalable vectors
Emit an error when attempting to compile a `#[rustc_scalable_vector]`
type for a architecture that fundamentally doesn't support scalable
vectors. Ultimately this is just a diagnostic improvement for an internal
attribute as users should never be doing this.
2026-03-09 15:13:29 +00:00
bors 3945997aab Auto merge of #153605 - JonathanBrouwer:rollup-p3xMXMQ, r=JonathanBrouwer
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#152847 (Test for armv7 `get_unchecked(...)` inlining)
 - rust-lang/rust#153290 (tests: codegen-llvm: iter-repeat-n-trivial-drop: Allow non-zero lower bound to __rust_alloc size)
 - rust-lang/rust#153413 (std: organise `sys::pal::os`)
 - rust-lang/rust#139692 (Rustfmt now support use closures)
 - rust-lang/rust#152800 (Adds recursion limit into FindParamInClause)
 - rust-lang/rust#153244 (tools: remote-test-server: Add UEFI run support)
 - rust-lang/rust#153305 (Adapt codegen test to accept operand bundles)
 - rust-lang/rust#153340 (tweak r-a default settings)
 - rust-lang/rust#153509 (Cleanup unused diagnostic emission methods - part 2)
 - rust-lang/rust#153527 (Fix LegacyKeyValueFormat report from docker build: ohos)
 - rust-lang/rust#153594 (Move some ui tests)
2026-03-09 12:38:16 +00:00
Waffle Lapkin 76a750a531 miri/const eval: support MaybeDangling 2026-03-09 12:36:19 +01:00
Waffle Lapkin 3398ea27ce always make tuple elements a coercion site 2026-03-09 12:21:08 +01:00
Waffle Lapkin 36e5a99db0 add a test for tuple coercions 2026-03-09 12:21:08 +01:00
Folkert de Vries 225b7e0012 fix ICE in const_c_variadic when passing ZSTs 2026-03-09 11:52:09 +01:00
Jonathan Brouwer 2d9fde77a8 Rollup merge of #153594 - reddevilmidzy:ui-refactor, r=JohnTitor,Kivooeo
Move some ui tests

> [!NOTE]
> I split the commits to make the review easier and to keep the git history easier to trace.

Renamed issue-xxx tests

`tests/ui/dyn-drop` -> `tests/ui/dyn-keyword`
`tests/ui/missing-trait-bounds` -> `tests/ui/trait-bound/missing-trait-bounds`
`tests/ui/recursion_limit` -> `tests/ui/recursion/recursion_limit`
`tests/ui/version` -> `tests/ui/compile-flags`

Reorganize `tests/ui/empty`
2026-03-09 11:49:26 +01:00
Jonathan Brouwer 4ff5147f30 Rollup merge of #153527 - homersimpsons:chore/fix-LegacyKeyValueFormat-ohos, r=marcoieni
Fix LegacyKeyValueFormat report from docker build: ohos

Part of https://github.com/rust-lang/rust/pull/152305

r? @marcoieni
2026-03-09 11:49:26 +01:00
Jonathan Brouwer d4630f14eb Rollup merge of #153509 - GuillaumeGomez:migrate-diag2, r=JonathanBrouwer
Cleanup unused diagnostic emission methods - part 2

Part of https://github.com/rust-lang/rust/issues/153099.

r? @JonathanBrouwer
2026-03-09 11:49:25 +01:00
Jonathan Brouwer 3fdbbfbc84 Rollup merge of #153340 - WaffleLapkin:ra-settings-tweaks, r=Mark-Simulacrum
tweak r-a default settings

1. Explain that you need to make paths absolute in helix settings
2. Use the correct compiler (set `RUSTC` and `CARGO` to stage0, instead of `RUSTUP_TOOLCHAIN=nightly`)
3. Add comments to vscode and zed settings

NB: I only tested helix settings, but am pretty sure that the other changes shouldn't break anything.
2026-03-09 11:49:25 +01:00
Jonathan Brouwer 662798eb63 Rollup merge of #153305 - TimNN:bundle-assert, r=Mark-Simulacrum
Adapt codegen test to accept operand bundles

The updated test current fails when rustc is built with HEAD LLVM: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/44013/steps/canvas?sid=019cafec-3cca-44b2-aa9f-b41c0a940e8b

Likely as a result of https://github.com/llvm/llvm-project/pull/169923

Since the new codegen merges two lines into one, I couldn't figure out a way to make the test work on both LLVM versions without introducing revisions. (Though I could instead make the test run on only LLVM 23+).

@rustbot label llvm-main
2026-03-09 11:49:24 +01:00
Jonathan Brouwer 8b12e0a5c2 Rollup merge of #153244 - Ayush1325:uefi-run-test, r=Mark-Simulacrum
tools: remote-test-server: Add UEFI run support

Tested with OVMF on QEMU with Linux as the host running remote-test-client. The instructions for running tests are provided below:

1. Use rust-lld linker: `bootstrap.toml`

```toml
[rust]
lld = true

[target.x86_64-unknown-uefi]
linker = "rust-lld"
```

2. Use a custom startup.nsh script to auto-launch remote-test-server. This is optional.

```shell
fs1:
run.efi --sequential --bind "10.0.2.15:12345" --batch
```

3. Launch remote-test-server in QEMU. I am using uefi-run script [0].

```shell
uefi-run build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-uefi/release/remote-test-server.efi  -n --startup startup.nsh --tcp-port 12345
```

4. Run tests:

```shell
RUST_TEST_THREADS=1 TEST_DEVICE_ADDR="localhost:12345" ./x.py test tests/ui/abi --target x86_64-unknown-uefi --stage 1
```

Requires: https://github.com/rust-lang/rust/pull/151014
@rustbot label +O-UEFI
cc @nicholasbishop

[0]: https://github.com/Ayush1325/dotfiles/blob/2d13056bf8ca1931a234b72967d9e857c4afbf1a/uefi/.local/bin/uefi-run
2026-03-09 11:49:24 +01:00
Jonathan Brouwer fad370cc4a Rollup merge of #152800 - spirali:fix-FindParamInClause, r=lcnr
Adds recursion limit into FindParamInClause

Fixes rust-lang/rust#152716

r? lcnr
2026-03-09 11:49:23 +01:00
Jonathan Brouwer 9c09ff3dcd Rollup merge of #139692 - spastorino:do-not-rustfmt-ignore, r=Mark-Simulacrum
Rustfmt now support use closures

This should be merged when https://github.com/rust-lang/rustfmt/pull/6532 is used by CI's rustfmt.
2026-03-09 11:49:23 +01:00
Jonathan Brouwer b8e01edc24 Rollup merge of #153413 - joboet:organize-pal-os, r=Mark-Simulacrum
std: organise `sys::pal::os`

Continuing rust-lang/rust#153341, this moves around some functions in `sys::pal`, so that `pal::os` only contains standard-path-related code (which I'll move later as part of rust-lang/rust#117276).

Best reviewed commit-by-commit.
2026-03-09 11:49:22 +01:00
Jonathan Brouwer 2f5d672f46 Rollup merge of #153290 - Gelbpunkt:iter-repeat-n-trivial-drop-lower-bound-hermit, r=Mark-Simulacrum
tests: codegen-llvm: iter-repeat-n-trivial-drop: Allow non-zero lower bound to __rust_alloc size

LLVM emits a lower bound of 8 for the size parameter to `__rust_alloc` when targeting `x86_64-unknown-hermit`. Since that is also completely valid, relax the lower bound check.

I'm not really sure why LLVM is able to infer this - with the same setup targeting `x86_64-unknown-linux-gnu` I also see the lower bound of 0. Not that it's wrong, but I'd be curious to know which codegen options play into this.
2026-03-09 11:49:22 +01:00
Jonathan Brouwer a5bd6be835 Rollup merge of #152847 - Jamesbarford:chore/get_unchecked-inline-test, r=Mark-Simulacrum
Test for armv7 `get_unchecked(...)` inlining

Added test for `get_unchecked(...)` to be inlined on armv7.

closes https://github.com/rust-lang/rust/issues/131745
2026-03-09 11:49:21 +01:00
Guillaume Gomez d31a17fb0f Use DiagDecorator instead of derive(Diagnostic) in compiler/rustc_middle/src/mir/interpret/queries.rs 2026-03-09 11:35:33 +01:00