35264 Commits

Author SHA1 Message Date
Matthias Krüger
64282ebc90
Rollup merge of #143663 - dillona:fix-typo, r=jdonszelmann
fix: correct typo in attr_parsing_previously_accepted message key
2025-07-10 15:19:32 +02:00
Matthias Krüger
51b7c257e8
Rollup merge of #143659 - GrigorenkoPV:attributes/inner-outer, r=jdonszelmann
Use "Innermost" & "Outermost" terminology for `AttributeOrder`

Follow-up to rust-lang/rust#143603.

https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/attribute.20parsing.20rework/near/527768926

Also remove some outdated comments. cc `@jdonszelmann`
2025-07-10 15:19:31 +02:00
Matthias Krüger
22205b60f3
Rollup merge of #143657 - LorrensP-2158466:split-macro-map, r=petrochenkov
Resolver: refact macro map into external and local maps

Puts `MacroData` inside of the `ResolverArena` and splits `macro_map` into 2 maps: `local_macro_map` and `external_macro_map`. This way `get_macro_by_def_id` can take a `&Resolver` instead of a mutable one.

Part of [#gsoc > Project: Parallel Macro Expansion](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Parallel.20Macro.20Expansion/with/516965603)

r? `@petrochenkov`
2025-07-10 15:19:31 +02:00
Matthias Krüger
28f4ae318a
Rollup merge of #143652 - moulins:doc-unsize-trait-upcasting, r=compiler-errors
docs: document trait upcasting rules in `Unsize` trait

The trait upcasting feature stabilized in 1.86 added new `Unsize` implementation, but this wasn't reflected in the trait's documentation.
2025-07-10 15:19:30 +02:00
Matthias Krüger
b86999e93e
Rollup merge of #136906 - chenyukang:yukang-fix-136741-closure-body, r=oli-obk
Add checking for unnecessary delims in closure body

Fixes #136741
2025-07-10 15:19:29 +02:00
yukang
c37949c628 remove unnecessary parens in rust-analyzer 2025-07-10 13:50:02 +08:00
bors
816b4a6b52 Auto merge of #143405 - tgross35:update-builtins, r=tgross35
Update the `compiler-builtins` subtree

Update the Josh subtree to https://github.com/rust-lang/compiler-builtins/commit/8aba4c899ee8.

r? `@ghost`
2025-07-09 22:42:11 +00:00
bors
57b64a7d1a Auto merge of #143538 - compiler-errors:instantiate-auto-trait, r=lcnr
Instantiate auto trait/`Copy`/`Clone`/`Sized` before computing constituent types binder

This makes the binder logic w.r.t. coroutines a bit simpler.

r? lcnr
2025-07-09 19:38:39 +00:00
bors
d64ef7403c Auto merge of #143502 - scottmcm:aggregate-simd, r=oli-obk
Let `rvalue_creates_operand` return true for *all* `Rvalue::Aggregate`s

~~Draft for now because it's built on Ralf's rust-lang/rust#143291~~

Inspired by https://github.com/rust-lang/rust/pull/138759#discussion_r2156375342 where I noticed that we were nearly at this point, plus the comments I was writing in rust-lang/rust#143410 that reminded me a type-dependent `true` is fine.

This PR splits the `OperandRef::builder` logic out to a separate type, with the updates needed to handle SIMD as well.  In doing so, that makes the existing `Aggregate` path in `codegen_rvalue_operand` capable of handing SIMD values just fine.

As a result, we no longer need to do layout calculations for aggregate result types when running the analysis to determine which things can be SSA in codegen.
2025-07-09 16:37:20 +00:00
bors
3a5e13a8b3 Auto merge of #143472 - dianne:deref-pat-column-check, r=Nadrieril
`rustc_pattern_analysis`: always check that deref patterns don't match on the same place as normal constructors

In rust-lang/rust#140106, deref pattern validation was tied to the `deref_patterns` feature to temporarily avoid affecting perf. However:
- As of rust-lang/rust#143414, box patterns are represented as deref patterns in `rustc_pattern_analysis`. Since they can be used by enabling `box_patterns` instead of `deref_patterns`, it was possible for them to skip validation, resulting in an ICE. This fixes that and adds a regression test.
- External tooling (e.g. rust-analyzer) will also need to validate matches containing deref patterns, which was not possible. This fixes that by making `compute_match_usefulness` validate deref patterns by default.

In order to avoid doing an extra pass for anything with patterns, the second commit makes `RustcPatCtxt` keep track of whether it encounters a deref pattern, so that it only does the check if so. This is purely for performance. If the perf impact of the first commit is negligible and the complexity cost introduced by the second commit is significant, it may be worth dropping the latter.

r? `@Nadrieril`
2025-07-09 09:45:36 +00:00
bors
d0188bdb3d Auto merge of #142707 - ashivaram23:drop_wildcard, r=dianqk
Apply effects to `otherwise` edge in dataflow analysis

This allows `ElaborateDrops` to remove drops when a `match` wildcard arm covers multiple no-Drop enum variants. It modifies dataflow analysis to update the `MaybeUninitializedPlaces` and `MaybeInitializedPlaces` data for a block reached through an `otherwise` edge.

Fixes rust-lang/rust#142705.
2025-07-09 03:42:01 +00:00
bors
82c8efd2c8 Auto merge of #134628 - estebank:const-default, r=oli-obk
Make `Default` const and add some `const Default` impls

Full list of `impl const Default` types:

- ()
- bool
- char
- std::ascii::Char
- usize
- u8
- u16
- u32
- u64
- u128
- i8
- i16
- i32
- i64
- i128
- f16
- f32
- f64
- f128
- std::marker::PhantomData<T>
- Option<T>
- std::iter::Empty<T>
- std::ptr::Alignment
- &[T]
- &mut [T]
- &str
- &mut str
- String
- Vec<T>
2025-07-08 14:04:40 +00:00
bors
bd73e9e1fb Auto merge of #143540 - yotamofek:pr/library/simplify-num-fmt, r=tgross35
Simplify num formatting helpers

Noticed `ilog10` was being open-coded when looking at this diff: 85d6768f4c..76d9775912 (diff-6be9b44b52d946ccac652ddb7c98146a01b22ea0fc5737bc10db245a24796a45)
That, and two other small cleanups 😁

(should probably go through perf just to make sure it doesn't regress formatting)
2025-07-08 10:54:22 +00:00
bors
766712c269 Auto merge of #142869 - nnethercote:join_path-mini, r=camelid
Use `join_with_double_colon` in `write_shared.rs`.

For consistency. Also, it's faster because `join_with_double_colon` does a better job estimating the allocation size than `join` from `itertools`.

r? `@camelid`
2025-07-08 06:32:37 +00:00
bors
d0a4543f88 Auto merge of #143433 - oli-obk:ty_span_qry, r=compiler-errors
Add `ty_span` query

r? `@compiler-errors`

fixes diagnostic regressions from https://github.com/rust-lang/rust/pull/142030

Also uses the new query in `check_const_item`
2025-07-08 00:11:13 +00:00
bors
af15612448 Auto merge of #143601 - matthiaskrgr:rollup-9iw2sqk, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#132469 (Do not suggest borrow that is already there in fully-qualified call)
 - rust-lang/rust#143340 (awhile -> a while where appropriate)
 - rust-lang/rust#143438 (Fix the link in `rustdoc.md`)
 - rust-lang/rust#143539 (Regression tests for repr ICEs)
 - rust-lang/rust#143566 (Fix `x86_64-unknown-netbsd` platform support page)
 - rust-lang/rust#143572 (Remove unused allow attrs)
 - rust-lang/rust#143583 (`loop_match`: fix 'no terminator on block')
 - rust-lang/rust#143584 (make `Machine::load_mir` infallible)
 - rust-lang/rust#143591 (Fix missing words in future tracking issue)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-07 20:30:53 +00:00
Matthias Krüger
5b0bebbdad
Rollup merge of #143591 - ehuss:future-typos, r=jieyouxu
Fix missing words in future tracking issue

Fixes some sloppy editing on my part.
2025-07-07 19:55:37 +02:00
Matthias Krüger
dbadd94323
Rollup merge of #143584 - fee1-dead-contrib:push-skswvrwsrmll, r=RalfJung
make `Machine::load_mir` infallible

it doesn't need to return an `InterpResult`.
2025-07-07 19:55:36 +02:00
Matthias Krüger
d08465b50e
Rollup merge of #143583 - folkertdev:loop-match-no-terminator-on-block, r=bjorn3
`loop_match`: fix 'no terminator on block'

tracking issue: https://github.com/rust-lang/rust/issues/132306
fixes https://github.com/rust-lang/rust/issues/143435

The argument `block` was not properly closed on an error path.

r? `@bjorn3`
2025-07-07 19:55:35 +02:00
Matthias Krüger
1693eac9a4
Rollup merge of #143572 - yotamofek:pr/unused-allow-attrs, r=fee1-dead
Remove unused allow attrs

These `#[allow]`s seem to be unused (at least according to `x check`, didn't run `x test` locally). Let's clean them up! 🧹
2025-07-07 19:55:35 +02:00
Matthias Krüger
18612f8670
Rollup merge of #143566 - jieyouxu:fix-x86_64-unknown-netbsd, r=fee1-dead
Fix `x86_64-unknown-netbsd` platform support page

`x86_64-unknown-netbsd` is Tier 2 with host tools, not Tier 3.

cc `@he32.`

r? compiler
2025-07-07 19:55:34 +02:00
Matthias Krüger
d6dc3d9825
Rollup merge of #143539 - JonathanBrouwer:ice-regression-tests, r=oli-obk
Regression tests for repr ICEs

Closes https://github.com/rust-lang/rust/issues/143522
Closes https://github.com/rust-lang/rust/issues/143479

Both issues were already (accidentally) fixed in this PR, but having the tests is nice https://github.com/rust-lang/rust/pull/143252

r? `@jdonszelmann`
2025-07-07 19:55:33 +02:00
Matthias Krüger
818b0d76e0
Rollup merge of #143438 - makai410:rustdoc-fix, r=ehuss
Fix the link in `rustdoc.md`
2025-07-07 19:55:33 +02:00
Matthias Krüger
23584a4666
Rollup merge of #143340 - nabijaczleweli:awhile, r=mati865
awhile -> a while where appropriate
2025-07-07 19:55:32 +02:00
Matthias Krüger
36929fb177
Rollup merge of #132469 - estebank:issue-132041, r=Nadrieril
Do not suggest borrow that is already there in fully-qualified call

When encountering `&str::from("value")` do not suggest `&&str::from("value")`.

Fix #132041.
2025-07-07 19:55:31 +02:00
bors
b00b4ea65b Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubilee
Allow custom default address spaces and parse `p-` specifications in the datalayout string

Some targets, such as CHERI, use as default an address space different from the "normal" default address space `0` (in the case of CHERI, [200 is used](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-877.pdf)). Currently, `rustc` does not allow to specify custom address spaces and does not take into consideration [`p-` specifications in the datalayout string](https://llvm.org/docs/LangRef.html#langref-datalayout).

This patch tries to mitigate these problems by allowing targets to define a custom default address space (while keeping the default value to address space `0`) and adding the code to parse the `p-` specifications in `rustc_abi`. The main changes are that `TargetDataLayout` now uses functions to refer to pointer-related informations, instead of having specific fields for the size and alignment of pointers in the default address space; furthermore, the two `pointer_size` and `pointer_align` fields in `TargetDataLayout` are replaced with an `FxHashMap` that holds info for all the possible address spaces, as parsed by the `p-` specifications.

The potential performance drawbacks of not having ad-hoc fields for the default address space will be tested in this PR's CI run.

r? workingjubilee
2025-07-07 17:28:14 +00:00
bors
7d6f447a4d Auto merge of #143035 - ywxt:less-work-steal, r=oli-obk
Only work-steal in the main loop for rustc_thread_pool

This PR is a replica of <https://github.com/rust-lang/rustc-rayon/pull/12> that only retained work-steal in the main loop for rustc_thread_pool.

r? `@oli-obk`

cc `@SparrowLii` `@Zoxc` `@cuviper`

Updates rust-lang/rust#113349
2025-07-07 11:16:16 +00:00
bors
1bc1f34608 Auto merge of #143565 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2025-07-07 08:14:30 +00:00
Edoardo Marangoni
54507d88b4
compiler: Parse p- specs in datalayout string, allow definition of custom default data address space 2025-07-07 09:04:53 +02:00
bors
17de9984d5 Auto merge of #141829 - dvdsk:sleep_until_linux, r=cuviper,RalfJung
Specialize sleep_until implementation for unix (except mac)

related tracking issue: https://github.com/rust-lang/rust/issues/113752
Supersedes https://github.com/rust-lang/rust/pull/118480 for the reasons see: https://github.com/rust-lang/rust/issues/113752#issuecomment-2902594469

Replaces the generic catch all implementation with target_os specific ones for: linux/netbsd/freebsd/android/solaris/illumos etc. Other platforms like wasi, macos/ios/tvos/watchos and windows will follow in later separate PR's (once this is merged).
2025-07-06 23:00:51 +00:00
Lukas Wirth
0ac65592a8
Merge pull request #20184 from Veykril/push-ywpynxnltpok
chore: Remove dead field from `InferenceContext`
2025-07-07
2025-07-06 09:08:36 +00:00
Lukas Wirth
c86d83219b chore: Remove dead field from InferenceContext 2025-07-06 10:57:06 +02:00
Lukas Wirth
2691c11104
Merge pull request #20132 from A4-Tacks/asmut-borrow-minicore
Add AsMut, Borrow and BorrowMut to minicore and famous_defs
2025-07-06 08:01:54 +00:00
Lukas Wirth
fce1f41462
Merge pull request #20126 from Wilfred/no_unwrap_in_discover_projects
fix: Avoid .unwrap() when running the discover command
2025-07-06 08:01:10 +00:00
Lukas Wirth
ef3e52b6eb
Merge pull request #20179 from ChayimFriedman2/destructuring-assignment-never
fix: Fix diverging destructuring assignments
2025-07-06 07:01:40 +00:00
Chayim Refael Friedman
694cd75f50
Merge pull request #20175 from dianne/match-check-box-cleanup
`hir_ty::match_check` cleanup: remove special handling for box patterns
2025-07-06 02:32:49 +00:00
Chayim Refael Friedman
2d518c73d9
Merge pull request #20172 from vxpm/syntax-tree-extension
remove `rust-analyzer/syntaxTree` from docs
2025-07-05 19:43:19 +00:00
Chayim Refael Friedman
3ec0d80ae1 Fix diverging destructuring assignments
They need to return `!`, unlike diverging ordinary assignments. See the comment in the code.
2025-07-05 22:35:22 +03:00
A4-Tacks
439f2d24cd
Fix Borrow and BorrowMut define from beta std 2025-07-05 21:49:56 +08:00
dianne
127a4eff71 always check for mixed deref pattern and normal constructors
This makes it work for box patterns and in rust-analyzer.
2025-07-04 23:47:31 -07:00
dianne
8dc54f4d33 hir_ty::match_check: remove special handling for box patterns 2025-07-04 23:43:49 -07:00
vinícius x
6e86abc99a remove syntaxTree from docs 2025-07-04 14:27:03 -03:00
Wilfred Hughes
a50b7b6b4e fix: Avoid .unwrap() when running the discover command
Previously, the following configuration in settings.json:

    "rust-analyzer.workspace.discoverConfig": {
        "command": [
            "oops",
            "develop-json",
            "{arg}"
        ],
        "progressLabel": "rust-analyzer",
        "filesToWatch": [
            "BUCK",
            "TARGETS"
        ]
    },

Would previously cause a crash in rust-analyzer:

    thread 'LspServer' panicked at crates/rust-analyzer/src/main_loop.rs:776:84:
    called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }

Instead, use more specific panic messages.
2025-07-04 16:55:53 +01:00
Laurențiu Nicola
3816d0ae53
Merge pull request #20170 from Veykril/push-vtsmzopsunsw
Improve flycheck and build script progress reporting
2025-07-04 13:46:09 +00:00
bors
849b884684 Auto merge of #143247 - cjgillot:metadata-no-red, r=petrochenkov
Avoid depending on forever-red DepNode when encoding metadata.

Split from https://github.com/rust-lang/rust/pull/114669 for perf

r? `@petrochenkov`
2025-07-04 10:23:18 +00:00
Lukas Wirth
4ee90e97f6 Improve flycheck and build script progress reporting 2025-07-04 11:52:09 +02:00
Lukas Wirth
b7fc040576
Merge pull request #20169 from Veykril/push-quvvsupnqqwv
Skip unnecessary `eq` work in `BodySourceMap`
2025-07-04 09:47:36 +00:00
Lukas Wirth
638e49b0fc Skip unnecessary eq work in BodySourceMap 2025-07-04 11:36:06 +02:00
Lukas Wirth
da1888a75c
Merge pull request #20031 from jnyfah/some-branch
Fix: Resolve HIR display length issues and improve adjustment tooltips
2025-07-04 09:20:14 +00:00
Lukas Wirth
37a7734af6
Merge pull request #20168 from Veykril/push-wsozylrmsyns
minor: Handle match arm commas in `make::match_arm`
2025-07-04 09:19:22 +00:00