38326 Commits

Author SHA1 Message Date
Stuart Cook
85646c8488
Rollup merge of #152664 - Embers-of-the-Fire:fix-152601, r=GuillaumeGomez
Fix mis-constructed `file_span` when generating scraped examples

Fixes rust-lang/rust#152601. Seemingly relative with rust-lang/rust#147399 but I could not reproduce the original ICE.

This PR removes the `file_span` logic from scraped example generation. The original implementation did not read or write items using `file_span`; it only used it to locate a source file, `context.href_from_span`. However, the span was validated against the wrong file, which could trigger ICEs on inputs such as multibyte characters due to an incorrectly constructed span. Since scraped examples do not use the span and the `url` is already given, the safest and simplest fix is to remove it.

Tested against the crate and MCVE documented in the original issue.

P.S. there seems to be some bug when rendering call sites, but since fixing mis-behavior is a change rather than a bug-fix that would be implemented in another PR.
2026-02-17 13:02:24 +11:00
Stuart Cook
c3a4e3c500
Rollup merge of #152206 - tshepang:misc, r=davidtwco
misc doc improvements

These are things I collected as I was looking at code and docs
2026-02-17 13:02:23 +11:00
Stuart Cook
b594957688
Rollup merge of #152703 - nnethercote:rm-rustc_query_system, r=Zalathar
Remove `rustc_query_system`

The end point of the PR sequence rust-lang/rust#152160, rust-lang/rust#152419, rust-lang/rust#152516.

r? @Zalathar
2026-02-17 13:02:23 +11:00
Stuart Cook
120d823efc
Rollup merge of #152661 - BartSimpson001:fix-next-solver-from-ice, r=petrochenkov
Avoid ICE in From/TryFrom diagnostic under -Znext-solver

Fixes rust-lang/rust#152518.

Under `-Znext-solver=globally`, `trait_ref.args` may contain fewer
elements than expected. The diagnostic logic in
`fulfillment_errors.rs` assumed at least two elements and
unconditionally called `type_at(1)`, which could lead to an
index out-of-bounds panic during error reporting.

This change adds a defensive check before accessing the second
argument to avoid the ICE. A UI regression test has been added.
2026-02-17 13:02:22 +11:00
Stuart Cook
30c4baafb3
Rollup merge of #152512 - okaneco:exact_integer, r=tgross35
core: Implement feature `float_exact_integer_constants`

Accepted ACP - https://github.com/rust-lang/libs-team/issues/713#issuecomment-3880122239
Tracking issue - https://github.com/rust-lang/rust/issues/152466

Implement accepted ACP for `MAX_EXACT_INTEGER` and `MIN_EXACT_INTEGER` on `f16`, `f32`, `f64`, and `f128`
Add tests to `coretests/tests/floats/mod.rs`
2026-02-17 13:02:22 +11:00
Stuart Cook
4fc94eb558
Rollup merge of #151783 - mu001999-contrib:impl/final-method, r=fee1-dead
Implement RFC 3678: Final trait methods

Tracking: https://github.com/rust-lang/rust/issues/131179

This PR is based on rust-lang/rust#130802, with some minor changes and conflict resolution.

Futhermore, this PR excludes final methods from the vtable of a dyn Trait.

And some excerpt from the original PR description:
> Implements the surface part of https://github.com/rust-lang/rfcs/pull/3678.
>
> I'm using the word "method" in the title, but in the diagnostics and the feature gate I used "associated function", since that's more accurate.

cc @joshtriplett
2026-02-17 13:02:21 +11:00
Stuart Cook
a38e31898b
Rollup merge of #152715 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to c97b011f91.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-02-17 13:02:21 +11:00
Laurențiu Nicola
c97b011f91
Merge pull request #21643 from Shourya742/2026-02-13-migrate-generate-impl-to-use-astnodeedit
migrate generate_impl assist to use AstNodeEdit
2026-02-16 11:11:40 +00:00
Laurențiu Nicola
744b554ce7
Merge pull request #21653 from rust-lang/rustc-pull
minor: Rustc pull update
2026-02-16 09:03:05 +00:00
The rustc-josh-sync Cronjob Bot
0f35173e50 Merge ref '139651428df8' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@139651428d
Filtered ref: rust-lang/rust-analyzer@3efb0c2db4
Upstream diff: ba284f468c...139651428d

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-16 04:54:45 +00:00
The rustc-josh-sync Cronjob Bot
4d34bb5680 Prepare for merging from rust-lang/rust
This updates the rust-version file to 139651428df86cf88443295542c12ea617cbb587.
2026-02-16 04:49:19 +00:00
Chayim Refael Friedman
00a9173e57
Merge pull request #21648 from alexanderkjall/borsh-error-compilation-failure
fix smol_str compilation error
2026-02-16
2026-02-15 16:42:02 +00:00
Chayim Refael Friedman
4d29f32409
Merge pull request #21649 from Albab-Hasan/fix/assignment-rhs-never-coercion
fix: use `ExprIsRead::Yes` for rhs of ordinary assignments
2026-02-15 14:16:24 +00:00
bors
3efb0c2db4 Auto merge of #152605 - scottmcm:box-drop-alignment, r=Mark-Simulacrum
Pass alignments through the shim as `Alignment` (not `usize`)

We're using `Layout` on both sides, so might as well skip the transmutes back and forth to `usize`.

The mir-opt test shows that doing so allows simplifying the boxed-slice drop slightly, for example.
2026-02-15 13:38:45 +00:00
Albab-Hasan
c0d8e3445f fix: use ExprIsRead::Yes for rhs of ordinary assignments
the rhs of an ordinary assignment `x = *never_ptr` was inferred with
`ExprIsRead::No`, which prevented `NeverToAny` coercion for place
expressions of type `!`. this caused false type mismatches and missing
divergence detection. the destructuring assignment path and let binding
path both correctly use `ExprIsRead::Yes` for the rhs value, since the
value is always consumed (read). this makes the ordinary assignment path
consistent with both.
2026-02-15 17:37:51 +06:00
Chayim Refael Friedman
b03c8420d9
Merge pull request #21647 from Albab-Hasan/fix/contains-explicit-ref-binding-missing-refmut
fix: handle `ref mut` bindings in `contains_explicit_ref_binding`
2026-02-15 11:36:30 +00:00
bors
a23e343452 Auto merge of #152375 - Zoxc:rayon-scope-loops, r=jieyouxu,lqd
Use `scope` for `par_slice` instead of `join`

This uses `scope` instead of nested `join`s in `par_slice` so that each group of items are independent and do not end up blocking on another.
2026-02-15 09:55:40 +00:00
Alexander Kjäll
f9ca8b23d8
gate borsh tests on std also, as they depend on both 2026-02-15 10:28:47 +01:00
bors
7e7aa26900 Auto merge of #151380 - ShoyuVanilla:shallow-resolve-to-root-var, r=lcnr
Shallow resolve ty and const vars to their root vars

Continuation of https://github.com/rust-lang/rust/pull/147193
2026-02-15 03:04:28 +00:00
Albab-Hasan
a78e87329d fix: handle ref mut bindings in contains_explicit_ref_binding
the standalone `contains_explicit_ref_binding` function only checked for
`BindingAnnotation::Ref`, missing `BindingAnnotation::RefMut`. this caused
`let ref mut x = expr` to incorrectly take the coercion path instead of
preserving the exact type of the rhs expression. the method version used
for match arms already handles both `Ref` and `RefMut` correctly.
2026-02-15 04:21:34 +06:00
Alexander Kjäll
3f8230687b
fix smol_str compilation error
the command 'cargo build --no-default-features --features borsh' failed with:
error[E0599]: no function or associated item named 'other' found for struct 'borsh::io::Error' in the current scope
   --> lib/smol_str/src/borsh.rs:33:39
    |
 33 |                 .ok_or_else(|| Error::other("u8::vec_from_reader unexpectedly returned None"))?;
    |                                       ^^^^^ function or associated item not found in 'borsh::io::Error'
    |
2026-02-14 21:06:34 +01:00
bors
e187c30070 Auto merge of #152627 - JonathanBrouwer:rollup-wjHXhK0, r=JonathanBrouwer
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#152618 (stdarch subtree update)
 - rust-lang/rust#152001 (mGCA: Validate const literal against expected type)
 - rust-lang/rust#152120 (Don't ICE on layout error in vtable computation)
 - rust-lang/rust#152531 (`proc_macro::bridge`: simplify `ExecutionStrategy` and `DispatcherTrait`)
 - rust-lang/rust#152577 (Port #[rustc_proc_macro_decls] to the new attribute parser.)
 - rust-lang/rust#152570 (Port #[rustc_test_marker] to the attribute parser)
 - rust-lang/rust#152590 (DepGraphQuery: correctly skip adding edges with not-yet-added nodes)
 - rust-lang/rust#152612 (Rename `inline_fluent!` to `msg!`)
2026-02-14 17:56:54 +00:00
Jonathan Brouwer
657b06d655
Rollup merge of #152612 - JonathanBrouwer:rename_to_msg, r=jdonszelmann
Rename `inline_fluent!` to `msg!`

This was the most popular name for the macro as voted in [#t-compiler > Bikeshed the new `inline_fluent!` macro @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Bikeshed.20the.20new.20.60inline_fluent!.60.20macro/near/572751863)
2026-02-14 18:55:38 +01:00
Jonathan Brouwer
80d0fa75ed
Rollup merge of #152590 - petrochenkov:skipedge, r=mati865
DepGraphQuery: correctly skip adding edges with not-yet-added nodes

Fixes https://github.com/rust-lang/rust/issues/142152.

The current logic already skips some edges, so I'm not sure how critical it is to have *all* the edges recorded, the logic seems to only be used for debug dumping.
Recording all edges requires supporting holes in the `LinkedGraph` data structure, to add nodes and edges out of order, https://github.com/rust-lang/rust/pull/151821 implements that at cost of complicating the data structure.
2026-02-14 18:55:38 +01:00
Jonathan Brouwer
a0ebafff86
Rollup merge of #152570 - Ozzy1423:attr-parse, r=JonathanBrouwer
Port #[rustc_test_marker] to the attribute parser

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

Targets:
Const is for normal tests (const test::TestDescAndFn is inserted before the test fn)
Const/Static/Fn is for custom_test_framework's #[test_case] e.g. tests/ui/custom_test_frameworks/full.rs

r? @JonathanBrouwer

Again I left the use-sites as is since they are early uses.
2026-02-14 18:55:37 +01:00
Jonathan Brouwer
fca52a30a2
Rollup merge of #152577 - Ozzy1423:macro-attr, r=JonathanBrouwer
Port #[rustc_proc_macro_decls] to the new attribute parser.

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

r? @JonathanBrouwer
2026-02-14 18:55:36 +01:00
Jonathan Brouwer
923cfb056f
Rollup merge of #152531 - cyrgani:pm-yet-another-cleanup, r=petrochenkov
`proc_macro::bridge`: simplify `ExecutionStrategy` and `DispatcherTrait`

Also includes another tiny cleanup (functions can only have one return type).
2026-02-14 18:55:36 +01:00
Jonathan Brouwer
030c7bc39b
Rollup merge of #152618 - folkertdev:stdarch-sync-2026-02-14, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to 1239a9f83a.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-02-14 18:55:34 +01:00
bors
7b4dcb503a Auto merge of #150681 - meithecatte:always-discriminate, r=JonathanBrouwer,Nadrieril
Make operational semantics of pattern matching independent of crate and module

The question of "when does matching an enum against a pattern of one of its variants read its discriminant" is currently an underspecified part of the language, causing weird behavior around borrowck, drop order, and UB.

Of course, in the common cases, the discriminant must be read to distinguish the variant of the enum, but currently the following exceptions are implemented:

1. If the enum has only one variant, we currently skip the discriminant read.
     - This has the advantage that single-variant enums behave the same way as structs in this regard.
     - However, it means that if the discriminant exists in the layout, we can't say that this discriminant being invalid is UB. This makes me particularly uneasy in its interactions with niches – consider the following example ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=5904a6155cbdd39af4a2e7b1d32a9b1a)), where miri currently doesn't detect any UB (because the semantics don't specify any):

        <details><summary>Example 1</summary>

        ```rust
        #![allow(dead_code)]
        use core::mem::{size_of, transmute};
        
        #[repr(u8)]
        enum Inner {
            X(u8),
        }
        
        enum Outer {
            A(Inner),
            B(u8),
        }
        
        fn f(x: &Inner) {
            match x {
                Inner::X(v) => {
                    println!("{v}");
                }
            }
        }
        
        fn main() {
            assert_eq!(size_of::<Inner>(), 2);
            assert_eq!(size_of::<Outer>(), 2);
            let x = Outer::B(42);
            let y = &x;
            f(unsafe { transmute(y) });
        }
        ```

      </details>

2. For the purpose of the above, enums with marked with `#[non_exhaustive]` are always considered to have multiple variants when observed from foreign crates, but the actual number of variants is considered in the current crate.
    - This means that whether code has UB can depend on which crate it is in: https://github.com/rust-lang/rust/issues/147722
    - In another case of `#[non_exhaustive]` affecting the runtime semantics, its presence or absence can change what gets captured by a closure, and by extension, the drop order: https://github.com/rust-lang/rust/issues/147722#issuecomment-3674554872
    - Also at the above link, there is an example where removing `#[non_exhaustive]` can cause borrowck to suddenly start failing in another crate.
3. Moreover, we currently make a more specific check: we only read the discriminant if there is more than one *inhabited* variant in the enum.
    - This means that the semantics can differ between `foo<!>`, and a copy of `foo` where `T` was manually replaced with `!`: rust-lang/rust#146803
    - Moreover, due to the privacy rules for inhabitedness, it means that the semantics of code can depend on the *module* in which it is located.
    - Additionally, this inhabitedness rule is even uglier due to the fact that closure capture analysis needs to happen before we can determine whether types are uninhabited, which means that whether the discriminant read happens has a different answer specifically for capture analysis.
    - For the two above points, see the following example ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=a07d8a3ec0b31953942e96e2130476d9)):

        <details><summary>Example 2</summary>

        ```rust
        #![allow(unused)]
        
        mod foo {
            enum Never {}
            struct PrivatelyUninhabited(Never);
            pub enum A {
                V(String, String),
                Y(PrivatelyUninhabited),
            }
            
            fn works(mut x: A) {
                let a = match x {
                    A::V(ref mut a, _) => a,
                    _ => unreachable!(),
                };
                
                let b = match x {
                    A::V(_, ref mut b) => b,
                    _ => unreachable!(),
                };
            
                a.len(); b.len();
            }
            
            fn fails(mut x: A) {
                let mut f = || match x {
                    A::V(ref mut a, _) => (),
                    _ => unreachable!(),
                };
                
                let mut g = || match x {
                    A::V(_, ref mut b) => (),
                    _ => unreachable!(),
                };
            
                f(); g();
            }
        }
        
        use foo::A;
        
        fn fails(mut x: A) {
            let a = match x {
                A::V(ref mut a, _) => a,
                _ => unreachable!(),
            };
            
            let b = match x {
                A::V(_, ref mut b) => b,
                _ => unreachable!(),
            };
        
            a.len(); b.len();
        }
        
        
        fn fails2(mut x: A) {
            let mut f = || match x {
                A::V(ref mut a, _) => (),
                _ => unreachable!(),
            };
            
            let mut g = || match x {
                A::V(_, ref mut b) => (),
                _ => unreachable!(),
            };
        
            f(); g();
        }
        ```

        </details>

In light of the above, and following the discussion at rust-lang/rust#138961 and rust-lang/rust#147722, this PR ~~makes it so that, operationally, matching on an enum *always* reads its discriminant.~~ introduces the following changes to this behavior:

 - matching on a `#[non_exhaustive]` enum will always introduce a discriminant read, regardless of whether the enum is from an external crate
 - uninhabited variants now count just like normal ones, and don't get skipped in the checks

As per the discussion below, the resolution for point (1) above is that it should land as part of a separate PR, so that the subtler decision can be more carefully considered.

Note that this is a breaking change, due to the aforementioned changes in borrow checking behavior, new UB (or at least UB newly detected by miri), as well as drop order around closure captures. However, it seems to me that the combination of this PR with rust-lang/rust#138961 should have smaller real-world impact than rust-lang/rust#138961 by itself.

Fixes rust-lang/rust#142394 
Fixes rust-lang/rust#146590
Fixes rust-lang/rust#146803 (though already marked as duplicate)
Fixes parts of rust-lang/rust#147722
Fixes rust-lang/miri#4778

r? @Nadrieril @RalfJung 

@rustbot label +A-closures +A-patterns +T-opsem +T-lang
2026-02-14 12:53:09 +00:00
Lukas Wirth
b7d3e7bc4e
Merge pull request #21639 from rust-lang/dependabot/npm_and_yarn/editors/code/qs-6.14.2
build(deps): bump qs from 6.14.1 to 6.14.2 in /editors/code
2026-02-14 07:55:56 +00:00
Lukas Wirth
bbc84d335f
Merge pull request #21644 from Veykril/push-zrzoswxlqlqq
Revert "fix: Stale diagnostics with rust-project.json and rustc JSON"
2026-02-13 18:28:52 +00:00
Lukas Wirth
6d550d341f Revert "fix: Stale diagnostics with rust-project.json and rustc JSON"
This reverts commit 2cefe47e6d55c186b68687bf677bf0d5eb65a922.
2026-02-13 19:19:26 +01:00
bit-aloo
ec1d872aad
migrate generate_impl to use AstNodeEdit 2026-02-13 22:58:11 +05:30
Lukas Wirth
5db21f169d
Merge pull request #21640 from Veykril/push-rutrqvxousks
minor: Remove incorrect warning log
2026-02-13 15:33:46 +00:00
Lukas Wirth
3202861785 Remove incorrect warning log 2026-02-13 16:24:28 +01:00
dependabot[bot]
2bdc080a90
build(deps): bump qs from 6.14.1 to 6.14.2 in /editors/code
Bumps [qs](https://github.com/ljharb/qs) from 6.14.1 to 6.14.2.
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.14.1...v6.14.2)

---
updated-dependencies:
- dependency-name: qs
  dependency-version: 6.14.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-13 11:43:39 +00:00
Lukas Wirth
797b1f61e5
Merge pull request #21609 from Veykril/push-qknzslvkmtyt
internal: Use rayon for proc-macro loading
2026-02-13 11:33:11 +00:00
cyrgani
72f3833a9a inline SameThread and CrossThread 2026-02-13 11:24:50 +00:00
Lukas Wirth
7d3705a43f internal: Use rayon for proc-macro loading 2026-02-13 12:24:47 +01:00
Shoyu Vanilla (Flint)
4dba1b4042
Merge pull request #21633 from ChayimFriedman2/proc-macro-is-not-fn
fix: Do not resolve proc macros in value ns (as functions), only in macro ns, outside their defining crate
2026-02-13 08:47:17 +00:00
Shoyu Vanilla (Flint)
50863f4113
Merge pull request #21636 from Shourya742/2026-02-13-remove-edit-in-place-in-migrated-handlers
Remove mutable edit in place with edit::AstNodeEdit in migrated  assist handlers
2026-02-13 08:45:05 +00:00
bit-aloo
eef6d70d1d
remove edit_in_place from generate_new assist with edit::AstNodeEdit 2026-02-13 13:14:06 +05:30
bit-aloo
d880ac6138
remove edit_in_place from convert_bool_to_enum assist with edit::AstNodeEdit 2026-02-13 13:11:46 +05:30
bit-aloo
219dbcfee9
remove edit_in_place from generate_trait_from_impl assist with edit::AstNodeEdit 2026-02-13 13:09:27 +05:30
bit-aloo
680135f15f
remove edit_in_place from replace_if_let_with_match assist with edit::AstNodeEdit 2026-02-13 13:01:50 +05:30
bit-aloo
4f4848b763
remove edit_in_place from convert_let_else_to_match assist with edit::AstNodeEdit 2026-02-13 12:20:42 +05:30
bit-aloo
97cf27865a
remove edit_in_place from generate_getter_or_setter assist with edit::AstNodeEdit 2026-02-13 12:16:50 +05:30
bit-aloo
b9ad6d657f
remove edit_in_place from generate_mut_trait_impl assist with edit::AstNodeEdit 2026-02-13 12:15:47 +05:30
bit-aloo
37dd2d6b13
remove edit_in_place from bind_unused_param assist with edit::AstNodeEdit 2026-02-13 12:13:35 +05:30
bit-aloo
82f059b82b
remove edit_in_place from move_const_to_impl assist with edit::AstNodeEdit 2026-02-13 12:11:19 +05:30