38464 Commits

Author SHA1 Message Date
Laurențiu Nicola
566fe415d1
Merge pull request #21722 from rust-lang/dependabot/npm_and_yarn/editors/code/minimatch-3.1.5
build(deps-dev): bump minimatch from 3.1.2 to 3.1.5 in /editors/code
2026-03-02
2026-03-01 12:04:20 +00:00
Chayim Refael Friedman
a96b6a9b88
Merge pull request #21654 from Albab-Hasan/fix/binop-rhs-never-coercion
fix: use `ExprIsRead::Yes` for rhs of binary operators
2026-02-28 20:25:33 +00:00
Albab-Hasan
ab44d8263e fix: use compound assignment in binop_lhs_never_place_diverges test 2026-03-01 00:04:13 +06:00
Lukas Wirth
d5d00a364a
Merge pull request #21725 from Veykril/push-skvpqzkooolm
fix: Fix wrong confiditon in `Visibility::min`
2026-02-28 17:09:40 +00:00
Lukas Wirth
d85bc7ccf2 fix: Fix wrong confiditon in Visibility::min 2026-02-28 18:00:32 +01:00
Lukas Wirth
fbc7b76b27
Merge pull request #21669 from Shourya742/2026-02-18-add-span-parent
Implement Span::SpanParent for proc-macro-srv
2026-02-28 07:25:41 +00:00
A4-Tacks
6e0c2683af
Merge pull request #21720 from SpiZeak/migrate-generate-derive
Migrate `generate_derive` assist to SyntaxEditor
2026-02-28 04:58:40 +00:00
dependabot[bot]
e35f608e1f
build(deps-dev): bump minimatch from 3.1.2 to 3.1.5 in /editors/code
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.1.2 to 3.1.5.
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.1.2...v3.1.5)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 3.1.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-28 02:14:32 +00:00
SpiZeak
fa0e4ed012 fix: migrate to SyntaxEditor in generate_derive assist 2026-02-27 11:09:44 +01:00
Shoyu Vanilla (Flint)
8494a8b3b7
Merge pull request #21710 from SpiZeak/migrate-fix-visibility
Migrate fix_visibility assist to use SyntaxEditor
2026-02-27 07:55:59 +00:00
SpiZeak
dd8e886398 feat: migrate fix_visibility assist to SyntaxEditor 2026-02-27 08:19:56 +01:00
Shoyu Vanilla (Flint)
5a7ae4de04
Merge pull request #21716 from lnicola/lockfile-path-nightly
fix: Use -Zlockfile-path on every 1.95 nightly
2026-02-27 07:03:40 +00:00
Laurențiu Nicola
ba09b3315e Use -Zlockfile-path on every 1.95 nightly 2026-02-27 08:53:39 +02:00
Shoyu Vanilla (Flint)
df080dbbd5
Merge pull request #21706 from A4-Tacks/redundant-enum-variant-pat
fix: no complete enum variant qualifier in pat
2026-02-27 02:17:11 +00:00
Shoyu Vanilla (Flint)
d33510122b
Merge pull request #21698 from A4-Tacks/indent-iflet-with-match
fix: Fix scrutinee expr indent for replace_if_let_with_match
2026-02-27 02:12:58 +00:00
Shoyu Vanilla (Flint)
d3ea35e498
Merge pull request #21699 from Albab-Hasan/fix/ptr-cast-add-auto-trait-not-detected
fix: Detect E0804 when casting raw ptr-to-dyn adds auto traits
2026-02-27 02:11:49 +00:00
Lukas Wirth
56b59a8328
Merge pull request #21708 from lnicola/no-invalid-notification-panic
fix: Don't panic on invalid LSP notifications
2026-02-26 08:27:07 +00:00
Laurențiu Nicola
26186144e7 Don't panic on invalid notifications 2026-02-25 21:06:33 +02:00
A4-Tacks
423c466df5
fix: no complete enum variant qualifier in pat
Example
---
```rust
enum Enum { TupleV(u32), RecordV { field: u32 }, UnitV }
use Enum::*;
fn func() {
    if let $0 = unknown {}
}
```

**Before this PR**

```text
...
ev RecordV
ev TupleV
ev UnitV
bn RecordV {…} RecordV { field$1 }$0
bn TupleV(…)            TupleV($1)$0
bn UnitV                     UnitV$0
kw mut
kw ref
```

**After this PR**

```text
...
bn RecordV {…} RecordV { field$1 }$0
bn TupleV(…)            TupleV($1)$0
bn UnitV                     UnitV$0
kw mut
kw ref
```
2026-02-25 20:52:50 +08:00
Laurențiu Nicola
ff041aa337
Merge pull request #21681 from Wilfred/skip_test_on_nightly
internal: Skip rustfmt test if nightly toolchain is missing
2026-02-24 19:56:34 +00:00
Wilfred Hughes
57527228ad internal: Skip rustfmt test if nightly toolchain is missing
Currently the rustfmt slow test fails if you don't have a nightly
toolchain installed. We install a nightly toolchain on CI, but it's a
little confusing that tests can fail on a fresh checkout on a new
laptop.

Instead, skip this test if there's no nightly toolchain.
2026-02-24 14:26:32 -05:00
Albab-Hasan
da7b8bbec2 fix: detect E0804 when casting raw ptr-to-dyn adds auto traits
the `check_ptr_ptr_cast` function had an early return when the source and
destination dyn trait objects shared the same principal trait def id:

    if src_principal == dst_principal {
        return Ok(());
    }

this bypassed all three remaining checks that the code comment explicitly
listed as required: generic argument equality, projection equality, and
the auto-trait superset check. as a result, casts like
`*mut dyn Trait as *mut (dyn Trait + Send)` were silently accepted
instead of emitting E0804.

the fix removes the early return. `CastError::PtrPtrAddingAutoTraits` and
its diagnostic were already implemented — they just couldn't be reached.
the supertrait case (`trait Trait: Send`) continues to work correctly
because the auto-trait check already accounts for implied auto traits via
supertrait elaboration.
2026-02-24 18:59:02 +06:00
A4-Tacks
bc5e169317
fix: Fix scrutinee expr indent for replace_if_let_with_match
- Remove some redundant `.clone_for_update()` and `.indent(IndentLevel::single())`

Example
---
```rust
fn main() {
    if true {
        $0if true
            && false
        {
            foo()
        }
    }
}
```

**Before this PR**

```rust
fn main() {
    if true {
        match true
                    && false {
            true => foo(),
            _ => (),
        }
    }
}
```

**After this PR**

```rust
fn main() {
    if true {
        match true
            && false {
            true => foo(),
            _ => (),
        }
    }
}
```
2026-02-24 19:12:51 +08:00
Laurențiu Nicola
05da4cf3c4
Merge pull request #21694 from rust-lang/rustc-pull
minor: Rustc pull update
2026-02-23 07:04:48 +00:00
The rustc-josh-sync Cronjob Bot
2ee47149d1 Merge ref 'c78a29473a68' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@c78a29473a
Filtered ref: rust-lang/rust-analyzer@d21f4bf288
Upstream diff: 139651428d...c78a29473a

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-23 04:45:13 +00:00
The rustc-josh-sync Cronjob Bot
8289ede8c7 Prepare for merging from rust-lang/rust
This updates the rust-version file to c78a29473a68f07012904af11c92ecffa68fcc75.
2026-02-23 04:45:04 +00:00
Shoyu Vanilla (Flint)
0c746f6990
Merge pull request #21692 from ChayimFriedman2/builtin-derive-param
fix: Fix another case where we forgot to put the type param for `PartialOrd` and `PartialEq` in builtin derives
2026-02-23
2026-02-22 16:55:23 +00:00
Chayim Refael Friedman
807f591315 Fix another case where we forgot to put the type param for PartialOrd and PartialEq in builtin derives 2026-02-22 16:58:09 +02:00
bors
d21f4bf288 Auto merge of #152965 - JonathanBrouwer:rollup-QnrcBRx, r=JonathanBrouwer
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing)
 - rust-lang/rust#151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts)
 - rust-lang/rust#151871 (don't use env with infer vars)
 - rust-lang/rust#152591 (Simplify internals of `{Rc,Arc}::default`)
 - rust-lang/rust#152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned)
 - rust-lang/rust#147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls)
 - rust-lang/rust#152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7)
 - rust-lang/rust#152767 (fix typo in `carryless_mul` macro invocation)
 - rust-lang/rust#152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`)
 - rust-lang/rust#152871 (Fix warnings in rs{begin,end}.rs files)
 - rust-lang/rust#152879 (Remove `impl IntoQueryParam<P> for &'a P`.)
 - rust-lang/rust#152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint)
 - rust-lang/rust#152937 (remove unneeded reboxing)
 - rust-lang/rust#152953 (Fix typo in armv7a-vex-v5.md)
2026-02-22 13:27:26 +00:00
Jonathan Brouwer
9714e99199
Rollup merge of #152953 - willschlitzer:patch-1, r=petrochenkov
Fix typo in armv7a-vex-v5.md

Remove duplicate "to" in armv7-vex-v5.md
2026-02-22 11:31:18 +01:00
Jonathan Brouwer
c9e811acfc
Rollup merge of #152937 - cyrgani:box-box, r=JonathanBrouwer
remove unneeded reboxing

Just a small thing I noticed while experimenting with replacing `box_syntax` with `deref_patterns` in the compiler.
2026-02-22 11:31:17 +01:00
Jonathan Brouwer
bab9c17aa3
Rollup merge of #152933 - GuillaumeGomez:start-migrating-lintdiag, r=JonathanBrouwer
Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint

This is more or less the same approach as https://github.com/rust-lang/rust/pull/152811, but in a much smaller size to make it reviewable. A lot of PRs will follow though. :)

This PR creates the equivalent of `lint_level` working with `Diagnostic` and add new methods on `MultiSpan` to make it work as well (in particular because we need to copy messages/spans from one context to another).

r? @JonathanBrouwer
2026-02-22 11:31:17 +01:00
Jonathan Brouwer
5a6f98013d
Rollup merge of #152879 - nnethercote:rm-impl-IntoQueryParam-ref-P, r=oli-obk
Remove `impl IntoQueryParam<P> for &'a P`.

`IntoQueryParam` is a trait that lets query callers be a bit sloppy with the passed-in key.
- Types similar to `DefId` will be auto-converted to `DefId`. Likewise for `LocalDefId`.
- Reference types will be auto-derefed.

The auto-conversion is genuinely useful; the auto-derefing much less so. In practice it's only used for passing `&DefId` to queries that accept `DefId`, which is an anti-pattern because `DefId` is marked with `#[rustc_pass_by_value]`.

This commit removes the auto-deref impl and makes the necessary sigil adjustments. (I generally avoid using `*` to deref manually at call sites, preferring to deref via `&` in patterns or via `*` in match expressions. Mostly because that way a single deref often covers multiple call sites.)

r? @cjgillot
2026-02-22 11:31:16 +01:00
Jonathan Brouwer
7489b5f344
Rollup merge of #152871 - mati865:fix-rs-begin-end-warnings, r=joboet
Fix warnings in rs{begin,end}.rs files

As can be seen locally and in CI logs (dist-i686-mingw) that code used to trigger `static_mut_refs` warning.
2026-02-22 11:31:16 +01:00
Jonathan Brouwer
b63331cd08
Rollup merge of #152837 - TKanX:bugfix/152340-codegen-fn-attrs-const-caller, r=dingxiangfei2009
fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`

### Summary:

#### Problem:

Coercing a `#[target_feature]` `const fn` to a function pointer inside a `const` body triggers an ICE (debug builds only):

```rust
#[target_feature(enable = "sse2")]
const fn with_target_feature() {}

const X: () = unsafe {
    let _: unsafe fn() = with_target_feature; // ICE
};
```

```text
assertion failed: def_kind.has_codegen_attrs()
unexpected `def_kind` in `codegen_fn_attrs`: Const
```

#### Root Cause:

Introduced in rust-lang/rust#135504 (2025-01-14, commit `8fee6a77394`). `adjust_target_feature_sig` unconditionally calls `codegen_fn_attrs(caller)` to get the caller's target features. `codegen_fn_attrs` requires that the `DefId` satisfies `has_codegen_attrs()`. `DefKind::Const`, `AssocConst`, and `InlineConst` do not — they have no codegen attributes by design. The debug assertion fires.

In release builds the call "worked" accidentally: `codegen_fn_attrs` on a const would reach the query machinery and happen to return empty attributes, producing a correct (but unguaranteed) result. The bug was latent until debug builds exposed it.

#### Solution:

Replace `codegen_fn_attrs(caller)` with `body_codegen_attrs(caller)`. `body_codegen_attrs` exists precisely for this case: it delegates to `codegen_fn_attrs` for function-like `DefKind`s and returns `CodegenFnAttrs::EMPTY` for const items. A const body has no target features, so returning empty is semantically correct.

Also fix the pre-existing variable name `callee_features` → `caller_features` (the variable holds the *caller*'s features, not the callee's).

### Changes:

- `compiler/rustc_middle/src/ty/context.rs`: `adjust_target_feature_sig` — use `body_codegen_attrs` for `caller`; rename `callee_features` → `caller_features`.
- `tests/ui/target-feature/const-target-feature-fn-ptr-coercion.rs`: regression test covering `Const`, `AssocConst`, and `InlineConst` caller contexts.

Fixes rust-lang/rust#152340.
2026-02-22 11:31:15 +01:00
Jonathan Brouwer
177e0f28a4
Rollup merge of #152767 - folkertdev:clmul-rhs-lhs, r=joboet
fix typo in `carryless_mul` macro invocation

This wouldn't really impact anyone, but it's slightly confusing, so let's fix it.
2026-02-22 11:31:15 +01:00
Jonathan Brouwer
90f4230898
Rollup merge of #152705 - PaulDance:patches/skip-raw_attributes-doctest, r=joboet
Test(lib/win/proc): Skip `raw_attributes` doctest under Win7

The current doctest for `ProcThreadAttributeListBuilder::raw_attribute` uses `CreatePseudoConsole`, which is only available on Windows 10 October 2018 Update and above. On older versions of Windows, the test fails due to trying to link against a function that is not present in the kernel32 DLL. This therefore ensures the test is still built, but not run under the Win7 target.

@rustbot label T-libs A-process A-doctests O-windows-7
2026-02-22 11:31:14 +01:00
Jonathan Brouwer
b6dfc35417
Rollup merge of #147859 - cyrgani:nonfatal-tokenstream-parse, r=petrochenkov,JonathanBrouwer
reduce the amount of panics in `{TokenStream, Literal}::from_str` calls

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/147859)*

Before this PR, calling `TokenStream::from_str` or `Literal::from_str` with an invalid argument would always cause a compile error, even if the `TokenStream` is not used afterwards at all.
This PR changes this so it returns a `LexError` instead in some cases.

This is very theoretically a breaking change, but the doc comment on the impl already says
```
/// NOTE: some errors may cause panics instead of returning `LexError`. We reserve the right to
/// change these errors into `LexError`s later.
```

Fixes some cases of rust-lang/rust#58736.
2026-02-22 11:31:14 +01:00
Jonathan Brouwer
52fcdd6bec
Rollup merge of #152591 - alexcrichton:simplify-rc-arc-default, r=joboet
Simplify internals of `{Rc,Arc}::default`

This commit simplifies the internal implementation of `Default` for these two pointer types to have the same performance characteristics as before (a side effect of changes in rust-lang/rust#131460) while avoid use of internal private APIs of Rc/Arc. To preserve the same codegen as before some non-generic functions needed to be tagged as `#[inline]` as well, but otherwise the same IR is produced before/after this change.

The motivation of this commit is I was studying up on the state of initialization of `Arc` and `Rc` and figured it'd be nicer to reduce the use of internal APIs and instead use public stable APIs where possible, even in the implementation itself.
2026-02-22 11:31:13 +01:00
Jonathan Brouwer
55db7958e1
Rollup merge of #151628 - enthropy7:fix-simd-const-eval-ice, r=RalfJung
Fix ICE in const eval of packed SIMD types with non-power-of-two element counts

fixes rust-lang/rust#151537

const evaluation of packed SIMD types with non-power-of-two element counts (like `Simd<_, 3>`) was hitting an ICE. the issue was in `check_simd_ptr_alignment` - it asserted that `backend_repr` must be `BackendRepr::SimdVector`, but for packed SIMD types with non-power-of-two counts the compiler uses `BackendRepr::Memory` instead (as mentioned in `rustc_abi/src/layout.rs:1511`).

was fixed by making `check_simd_ptr_alignment` accept both `BackendRepr::SimdVector` and `BackendRepr::Memory` for SIMD types. added a check to ensure we're dealing with a SIMD type, and the alignment logic works the same for both representations.

also i added a test that reproduces the original ICE.
2026-02-22 11:31:11 +01:00
Jonathan Brouwer
ba9946d9a3
Rollup merge of #150468 - Gelbpunkt:rustc-target-callconv-spec-elf-abi, r=RalfJung
rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
2026-02-22 11:31:11 +01:00
A4-Tacks
5d00e459f8
Merge pull request #21688 from akashchakrabortymsc-cmd/fix/convert-if-to-bool-then-negation
fix: correctly parenthesize inverted condition in convert_if_to_bool_…
2026-02-22 08:05:42 +00:00
bors
cd38bcdd28 Auto merge of #152737 - scottmcm:box_new_uninit_layout, r=RalfJung
Just pass `Layout` directly to `box_new_uninit`

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152737)*

We have a constant for it already (used in `RawVec` for basically the same polymorphization) so let's use it.

This is a simple follow-up to rust-lang/rust#148190 from one of the comments.
2026-02-22 01:21:56 +00:00
protonblu
86e3e3fdbf fix: correctly parenthesize inverted condition in convert_if_to_bool_then
The convert_if_to_bool_then assist was producing incorrect code when
the Some branch was in the else arm and the condition was a method call
expression (e.g. is_empty()).

Before:
    if test.is_empty() { None } else { Some(()) }
was incorrectly rewritten to:
    test.is_empty().then(|| ())

After (correct):
    (!test.is_empty()).then(|| ())

Root cause: the parenthesization check ran on the original condition
before inversion. When invert_boolean_expression produced a PrefixExpr
(e.g. !test.is_empty()), it was not being parenthesized because the
check had already passed on the original MethodCallExpr.

Fix: move the parenthesization check to after the inversion step so it
correctly detects PrefixExpr and wraps it in parentheses.

A regression test has been added to cover this case.
2026-02-21 11:45:24 +05:30
A4-Tacks
af68fc6e78
Merge pull request #21684 from akashchakrabortymsc-cmd/fix/generate-method-wrong-impl-block
fix: generate method assist uses enclosing impl block instead of first found
2026-02-21 02:03:10 +00:00
protonblu
ab26b67215 fix: remove redundant comment 2026-02-21 07:24:22 +05:30
protonblu
c4c0ba4fa1 style: apply rustfmt 2026-02-20 19:21:24 +05:30
protonblu
f858569371 fix: generate method assist uses enclosing impl block instead of first found 2026-02-20 19:01:22 +05:30
Chayim Refael Friedman
46a214b5d3
Merge pull request #21389 from A4-Tacks/assist-try-enum-ref
Fix some TryEnum reference assists
2026-02-20 11:05:31 +00:00
A4-Tacks
bfdb0e7b41
Do strip references for desugar_try_expr 2026-02-20 18:19:51 +08:00