23930 Commits

Author SHA1 Message Date
Rémy Rakic 524789f8ab Revert "Rollup merge of #149904 - ShoyuVanilla:ns-remove-sg-hack, r=lcnr"
This reverts commit c108ad5617, reversing
changes made to 485f76b835.

(cherry picked from commit 22faa52629)
2026-04-09 08:36:12 -07:00
Oli Scherer 2c2e33ac59 Revert performing basic const checks in typeck on stable 2026-04-09 08:34:04 -07:00
Josh Stone d0b5e61fe7 Revert "Stabilize assert_matches"
This reverts commit 2f3b952349.
2026-04-08 14:10:50 -07:00
Josh Stone cb5a91376e Revert "don't drop arguments' temporaries in dbg!"
This reverts commit 4f50466be4.
2026-04-08 09:45:57 -07:00
Josh Stone bca08d8c93 Revert "update diagnostic for variables moved by dbg!"
This reverts commit 1374038f80.
2026-04-08 09:45:54 -07:00
Wesley Wiser 5dacf5d54d Revert "Fix: On wasm targets, call panic_in_cleanup if panic occurs in cleanup"
This reverts commit acbfd79acf.

(cherry picked from commit c9d3a00cd1)
2026-04-02 11:39:06 -07:00
Trevor Gross f68f5980c3 core: Move {RangeIter, RangeFromIter}::remainder to new_range_remainder
Split the remainder functions from the rest of `std::range`.

(cherry picked from commit 0bb3fe315e)
2026-04-02 11:38:37 -07:00
Trevor Gross b7bdc7aee2 core: Destabilize beta-stable RangeInclusiveIter::remainder
As discussed, make this portion of the range API unstable again. This
will now be tracked under `new_range_remainder`.

Discussion: https://rust-lang.zulipchat.com/#narrow/channel/327149-t-libs-api.2Fapi-changes/topic/.60RangeFrom.3A.3Aremainder.60.20possible.20panic/with/582108913
(cherry picked from commit cbc94349d0)
2026-04-02 11:28:50 -07:00
mu001999 195f9764c0 Init self_decl with a correct vis
(cherry picked from commit 01795c3eab)
2026-04-02 11:07:33 -07:00
dianne 1374038f80 update diagnostic for variables moved by dbg!
(cherry picked from commit 7d1b41cbb3)
2026-04-02 11:05:25 -07:00
dianne 4f50466be4 don't drop arguments' temporaries in dbg!
(cherry picked from commit 51816efcc0)
2026-04-02 11:05:25 -07:00
Folkert de Vries 73caca416f add neon load/store assembly test
(cherry picked from commit 35f9cb6eee)
2026-04-02 10:43:00 -07:00
bors 8ebd005178 Auto merge of #154307 - ShoyuVanilla:beta-fix, r=jieyouxu
[beta] Revert #151380 in beta

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

r? ghost
2026-04-01 20:23:34 +00:00
Jonathan Brouwer 470cb0754e Rollup merge of #153763 - nikic:target-cpu-native-fix, r=lqd
Don't add empty target features for target-cpu=native on macOS

LLVM does not support host feature detection (only host cpu detection) on apple platforms. As such, the returned feature string will be empty. Adding this empty string to the target-features attribute results in a verifier error on LLVM 22.

Fix this by not adding the empty string to the target features. The reason why this was not caught by the target-cpu-native test is that it requires a function that adds *some* target features, otherwise the attribute is omitted entirely. We achieve this with a somewhat peculiar construction that enables `neon` if it's already enabled. (This is to avoid enabling it on softfloat targets.)

Fixes https://github.com/rust-lang/rust/issues/153397.
2026-03-24 18:16:01 -07:00
Shoyu Vanilla 63cd511300 Revert "Auto merge of #151380 - ShoyuVanilla:shallow-resolve-to-root-var, r=lcnr"
This reverts commit 75b9d89c68, reversing
changes made to 7bee525095.
2026-03-24 20:57:08 +09:00
León Orell Valerian Liehr bdc1b3ffa8 [beta] Don't look for non-type-level assoc consts when checking trait object types 2026-03-17 01:54:26 +01:00
bors 67aec36df7 Auto merge of #153183 - JonathanBrouwer:rollup-APFHc2s, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#151143 (explicit tail calls: support indirect arguments)
 - rust-lang/rust#153012 (Stop using `LinkedGraph` in `lexical_region_resolve`)
 - rust-lang/rust#153175 (Clarify a confusing green-path function)
 - rust-lang/rust#153179 (Force a CI LLVM stamp bump)
 - rust-lang/rust#150828 (Improved security section in rustdoc for `current_exe`)
 - rust-lang/rust#152673 (rustc_public: rewrite `bridge_impl` to reduce boilerplate)
 - rust-lang/rust#152674 (rustc_public: remove the `CrateDefItems` trait)
 - rust-lang/rust#153073 (Fix mem::conjure_zst panic message to use any::type_name instead)
 - rust-lang/rust#153117 (Remove mutation from macro path URL construction)
 - rust-lang/rust#153128 (Recover feature lang_items for emscripten)
 - rust-lang/rust#153138 (Print path root when printing path)
 - rust-lang/rust#153159 (Work around a false `err.emit();` type error in rust-analyzer)
2026-02-27 22:04:20 +00:00
Jonathan Brouwer f433c13b48 Rollup merge of #153138 - mu001999-contrib:print-path-root, r=petrochenkov
Print path root when printing path

Extracted from https://github.com/rust-lang/rust/pull/152996.

r? petrochenkov
2026-02-27 14:05:37 +01:00
Jonathan Brouwer 1b897d4f18 Rollup merge of #151143 - folkertdev:tail-call-indirect, r=WaffleLapkin
explicit tail calls: support indirect arguments

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

After discussion in https://github.com/rust-lang/rust/issues/144855, I was wrong and it is actually possible to support tail calls with `PassMode::Indirect { on_stack: false, .. }` arguments.

Normally an indirect argument with `on_stack: false` would be passed as a pointer into the caller's stack frame. For tail calls, that would be unsound, because the caller's stack frame is overwritten by the callee's stack frame.

Therefore we store the argument for the callee in the corresponding caller's slot. Because guaranteed tail calls demand that the caller's signature matches the callee's, the corresponding slot has the correct type.

To handle cases like the one below, the tail call arguments must first be copied to a temporary, and can only then be copied to the caller's argument slots.

```rust
// A struct big enough that it is not passed via registers.
pub struct Big([u64; 4]);

fn swapper(a: Big, b: Big) -> (Big, Big) {
    become swapper_helper(b, a);
}
```

---

I'm not really familiar with MIR and what tricks/helpers we have, so I'm just cobbling this together. Hopefully we can arrive at something more elegant.
2026-02-27 14:05:30 +01:00
bors 3a70d0349f Auto merge of #152702 - oli-obk:nonnulltransmute, r=scottmcm
Prepare NonNull for pattern types



Pull out the changes that affect some tests, but do not require pattern types.

See https://github.com/rust-lang/rust/pull/136006#discussion_r2806740338 for what triggered this PR

r? @scottmcm
2026-02-27 13:04:46 +00:00
Folkert de Vries e6cf5a22e7 test u128 passing on linux and windows 2026-02-27 10:51:55 +01:00
Folkert de Vries 31ae3d2be8 guaranteed tail calls: support indirect arguments 2026-02-27 10:24:39 +01:00
bors 6f54d591c3 Auto merge of #151247 - chenyukang:yukang-fix-const-recover-151149, r=estebank
Try to recover from over-parsing in const item with missing semicolon

Fixes rust-lang/rust#151149

r? @estebank
2026-02-27 09:09:21 +00:00
bors 6a979b3e32 Auto merge of #153108 - alexcrichton:revert, r=joboet
Revert "Simplify internals of `{Rc,Arc}::default`"

This reverts rust-lang/rust#152591 following a [perf run being done](https://github.com/rust-lang/rust/pull/152591#issuecomment-3960081137). I'm not really positioned at this time to dive in further and understand the performance regressions, so I'll back away from `Rc`/`Arc` and leave them as-is.
2026-02-26 19:51:40 +00:00
bors 25396cf549 Auto merge of #153139 - JonathanBrouwer:rollup-QZ4yuaa, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#153055 ( Revert "Also duplicate `#[expect]` attribute in `#[derive]`-ed code")
 - rust-lang/rust#153095 (Revert "rustc_expand: improve diagnostics for non-repeatable metavars")
2026-02-26 16:39:20 +00:00
Jonathan Brouwer 3e1566da05 Rollup merge of #153095 - JonathanBrouwer:revert, r=lqd
Revert "rustc_expand: improve diagnostics for non-repeatable metavars"

Revert because of a perf regression in https://github.com/rust-lang/rust/pull/152679
Clean revert

r? @ghost
2026-02-26 16:44:42 +01:00
Jonathan Brouwer fd2950b691 Rollup merge of #153055 - Urgau:revert-152289, r=jdonszelmann
Revert "Also duplicate `#[expect]` attribute in `#[derive]`-ed code"

Turns out rust-lang/rust#152289 doesn't work, not because cloning an attribute doesn't keep the same attribute id, but because `#[cfg]` and `#[cfg_attr]` [re-parse items from scratch](https://github.com/rust-lang/rust/blob/859951e3c7c9d0322c39bad49221937455bdffcd/compiler/rustc_builtin_macros/src/cfg_eval.rs#L100-L109) bypassing any cloning on AST and forcing the creation of new attribute IDs. 😕

Fixes rust-lang/rust#153036
Fixes rust-lang/rust#152401
Reopens rust-lang/rust#150553
2026-02-26 16:44:42 +01:00
mu001999 dfd18b7e89 Print path root when printing path 2026-02-26 23:34:41 +08:00
Jonathan Brouwer c902bc1c7c Rollup merge of #153091 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Migration of `LintDiagnostic` - part 4

Follow-up of:
* https://github.com/rust-lang/rust/pull/152933
* https://github.com/rust-lang/rust/pull/153016
* rust-lang/rust#153051

More `LintDiagnostic` items being migrated to `Diagnostic`. Since there is no remaining `emit_node_span_lint` calls, I replaced the method with the code of `emit_diag_node_span_lint`.

r? @JonathanBrouwer
2026-02-26 09:57:04 +01:00
Jonathan Brouwer 81aa532b7f Rollup merge of #152651 - TaKO8Ki:fix-143872-compare-impl-item-diag-args, r=jdonszelmann
Avoid duplicate `requirement` diag args in `RegionOriginNote`

Fixes rust-lang/rust#143872

`RegionOriginNote::WithRequirement` can be emitted multiple times for one
  diagnostic. I fixed the ICE by scoping per note fluent args in `RegionOriginNote::WithRequirement` with `store_args` and `restore_args`.
2026-02-26 09:57:03 +01:00
Guillaume Gomez f9b70f0ef2 Migrate rustc_lint::EqInternalMethodImplemented to Diagnostic 2026-02-26 09:47:06 +01:00
Guillaume Gomez bca1cb4c2f Replace emit_span_lint with emit_span_diag_lint in rustc_lint 2026-02-26 09:32:23 +01:00
Jacob Pratt f8f444757d Rollup merge of #153029 - nnethercote:disallowed-pass-by-ref, r=Urgau
Rename `rustc::pass_by_value` lint as `rustc::disallowed_pass_by_ref`.

The name `pass_by_value` is completely wrong. The lint actually checks for the use of pass by reference for types marked with `rustc_pass_by_value`.

The hardest part of this was choosing the new name. The `disallowed_` part of the name closely matches the following clippy lints:
- `disallowed_macros`
- `disallowed_methods`
- `disallowed_names`
- `disallowed_script_idents`
- `disallowed_types`

The `pass_by_value` part of the name aligns with the following clippy lints:
- `needless_pass_by_value`
- `needless_pass_by_ref_mut`
- `trivially_copy_pass_by_ref`
- `large_types_passed_by_value` (less so)

r? @Urgau
2026-02-25 21:42:57 -05:00
Jacob Pratt 7a883469fd Rollup merge of #149978 - cyrgani:no-eq-assert-receiver-method, r=madsmtm
deprecate `Eq::assert_receiver_is_total_eq` and emit FCW on manual impls

The `Eq::assert_receiver_is_total_eq` method is purely meant as an implementation detail by `#[derive(Eq)]` to add checks that all fields of the type the derive is applied to also implement `Eq`.
The method is already `#[doc(hidden)]` and has a comment saying `// This should never be implemented by hand.`.
Unfortunately, it has been stable since 1.0 and there are some cases on GitHub (https://github.com/search?q=assert_receiver_is_total_eq&type=code) where people have implemented this method manually, sometimes even with actual code in the method body (example: https://github.com/Shresht7/codecrafters-redis-rust/blob/31f0ec453c504b4ab053a7b1c3ff548ff36a9db5/src/parser/resp/types.rs#L255).
To prevent further confusion from this, this PR is deprecating the method and adds a FCW when it is manually implemented (this is necessary as the deprecation warning is not emitted when the method is implemented, only when it is called).
This is similar to what was previously done with the `soft_unstable` lint (https://github.com/rust-lang/rust/issues/64266).

See also https://github.com/rust-lang/libs-team/issues/704.
2026-02-25 21:42:56 -05:00
Jacob Pratt cd09c56e45 Rollup merge of #153075 - reddevilmidzy:mgca-neg, r=BoxyUwU
mGCA: Lower negated literals directly and reject non-integer negations

follow up rust-lang/rust#152001
resolve: rust-lang/rust#152246

r? BoxyUwU
2026-02-25 21:42:54 -05:00
Jacob Pratt cb78bc4dd4 Rollup merge of #151771 - hoodmane:wasm-double-panic, r=bjorn3
Fix: On wasm targets, call `panic_in_cleanup` if panic occurs in cleanup

Previously this was not correctly implemented. Each funclet may need its own terminate block, so this changes the `terminate_block` into a `terminate_blocks` `IndexVec` which can have a terminate_block for each funclet. We key on the first basic block of the funclet -- in particular, this is the start block for the old case of the top level terminate function.

I also fixed the `terminate` handler to not be invoked when a foreign exception is raised, mimicking the behavior from msvc. On wasm, in order to avoid generating a `catch_all` we need to call `llvm.wasm.get.exception` and `llvm.wasm.get.ehselector`.
2026-02-25 21:42:53 -05:00
Alex Crichton 57d20c1d14 Revert "Simplify internals of {Rc,Arc}::default"
This reverts commit ce4c17f615.
2026-02-25 13:09:14 -08:00
Jonathan Brouwer fe3b3a4246 Revert "rustc_expand: improve diagnostics for non-repeatable metavars"
This reverts commit 93b997356a.
2026-02-25 17:20:18 +01:00
cyrgani f1ec10ecbd deprecate Eq::assert_receiver_is_total_eq and emit a FCW on manual impls 2026-02-25 09:12:42 +00:00
Nicholas Nethercote 8eed8bd7bb Rename pass_by_value lint as disallowed_pass_by_ref.
The name `pass_by_value` is completely wrong. The lint actually checks
for the use of pass by reference for types marked with
`rustc_pass_by_value`.

The hardest part of this was choosing the new name. The `disallowed_`
part of the name closely matches the following clippy lints:
- `disallowed_macros`
- `disallowed_methods`
- `disallowed_names`
- `disallowed_script_idents`
- `disallowed_types`

The `pass_by_value` part of the name aligns with the following clippy
lints:
- `needless_pass_by_value`
- `needless_pass_by_ref_mut`
- `trivially_copy_pass_by_ref`
- `large_types_passed_by_value` (less so)
2026-02-25 15:10:14 +11:00
Redddy 5127108400 mGCA: drop literal anon-const special case in parser 2026-02-25 04:05:12 +00:00
Jacob Pratt 6929f76311 Rollup merge of #153051 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Migration of `LintDiagnostic` - part 3

Follow-up of https://github.com/rust-lang/rust/pull/152933 and of https://github.com/rust-lang/rust/pull/153016.

More `LintDiagnostic` items being migrated to `Diagnostic`. Since there is no remaining `emit_node_span_lint` calls, I replaced the method with the code of `emit_diag_node_span_lint`.

r? @JonathanBrouwer
2026-02-24 22:51:42 -05:00
Jacob Pratt 9765a8b02e Rollup merge of #153032 - nnethercote:fix-attribute-names, r=JonathanBrouwer
Fix attribute parser and kind names.

For the attribute `FooBar` the parser is generally called `FooBarParser` and the kind is called `AttributeKind::FooBar`. This commit renames some cases that don't match that pattern. The most common cases:
- Adding `Rustc` to the front of the parser name for a `rustc_*` attribute.
- Adding `Parser` to the end of a parser name.
- Slight word variations, e.g. `Deprecation` instead of `Deprecated`, `Pointer` instead of `Ptr`, `Stability` instead of `Stable`.

r? @JonathanBrouwer
2026-02-24 22:51:42 -05:00
Jacob Pratt 2f44f61b12 Rollup merge of #152868 - cyrgani:no-trivial-box-tests, r=Kivooeo
delete some very old trivial `Box` tests

There's still lots more of these tests; these are just a few duplicated ones I found. None of the tests really test for something interesting except that `Deref{Mut}` trivially works with boxes, but there are still loads of more tests that do the same.
In the past, these tests presumably looked more different to each other than today, with `Box`-like pointers being primitives etc.

This PR is also to check whether such changes (deleting of useless tests) are wanted in general.

Part of rust-lang/rust#133895.
2026-02-24 22:51:41 -05:00
Jacob Pratt 989efb8423 Rollup merge of #153017 - makai410:di-unsafe-binder, r=wesleywiser
Implement debuginfo for unsafe binder types

Fixes: rust-lang/rust#139462

This treats an unsafe binder like a struct with a single field. This way we'd have the binder's distinct type name while keeping the wrapped value accessible.

Tracking:
- https://github.com/rust-lang/rust/issues/130516
2026-02-24 22:51:40 -05:00
Jacob Pratt 10edd16dcb Rollup merge of #152977 - arferreira:fix-extern-html-relative-depth, r=notriddle
Fix relative path handling for --extern-html-root-url

When `--extern-html-root-url` receives a relative path (like `../`), rustdoc uses it as a literal prefix regardless of page depth. This works at depth 1 (`crate/index.html`) but breaks at depth 2+ (`crate/module/struct.Foo.html`) because the relative path doesn't account for the extra nesting.

This patch detects relative vs absolute URLs in the `Remote` branch of `url_parts` and prepends the necessary `../` segments based on the current page depth. Absolute URLs (`https://...`) and server-absolute paths (`/docs/...`) are unchanged.

This makes relative paths a viable option for `--extern-html-root-url`, which they weren't before.

Related to rust-lang/rust#152917, which exposed that relative paths weren't handled correctly.

cc @eggyal
2026-02-24 22:51:40 -05:00
Jacob Pratt cc8a33aeaa Rollup merge of #152952 - zedddie:improve-diag, r=BoxyUwU
mGCA: improve ogca diagnostic message

r? BoxyUwU
2026-02-24 22:51:39 -05:00
Jacob Pratt 35391c8752 Rollup merge of #152679 - Unique-Usman:ua/decmacrounrepeatable, r=estebank
rustc_expand: improve diagnostics for non-repeatable metavars

Fix rust-lang/rust#47452.
2026-02-24 22:51:39 -05:00
Jacob Pratt 5d3f80aa20 Rollup merge of #150562 - Trivaxy:poll-doc-patch, r=apiraino
Fix doc link used in suggestion for pinning self

Fixes rust-lang/rust#147901

The old suggestion linked to a documentation page that [no longer exists](https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#pinning-in-practice). Presumably, [this](https://rust-lang.github.io/async-book/part-reference/pinning.html) is the better place to link to now
2026-02-24 22:51:37 -05:00
Redddy d13924caa7 mGCA: Reject negated non-integer literals in const args 2026-02-25 03:16:17 +00:00