1115 Commits

Author SHA1 Message Date
Lukas Wirth
e57f18480d
Merge pull request #20337 from ChayimFriedman2/double-inlay-hints
fix: When displaying a projection into a type parameter that has bounds as `impl Trait`, collect only the bounds of this projection
2025-07-29 11:52:03 +00:00
Chayim Refael Friedman
9b8c5cfb0c When displaying a projection into a type parameter that has bounds as impl Trait, collect only the bounds of this projection
It used to collect the bounds of them all.
2025-07-29 14:40:14 +03:00
Laurențiu Nicola
572a79fd66 Format and bump rustc crates 2025-07-28 20:31:22 +03:00
The rustc-josh-sync Cronjob Bot
5f45867ee6 Merge ref '733dab558992' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 733dab558992d902d6d17576de1da768094e2cf3
Filtered ref: 8f0faf94fb41d4e2a85ef2d23e5495f6bea1f31d

This merge was created using https://github.com/rust-lang/josh-sync.
2025-07-28 06:31:02 +00:00
Lukas Wirth
afee0710e1 Ignore Destruct bounds again 2025-07-27 22:39:01 +02:00
Oli Scherer
31b88819c7 Remove dead code and extend test coverage and diagnostics around it
We lost the following comment during refactorings:

The current code for niche-filling relies on variant indices instead of actual discriminants, so enums with explicit discriminants (RFC 2363) would misbehave.
2025-07-24 10:21:20 +00:00
Shoyu Vanilla
e587367b4d fix: Apply adjusts to pats and exprs when doing pat analysis 2025-07-22 01:18:48 +09:00
Laurențiu Nicola
0e2e6e7a8a Format and bump rustc crates 2025-07-15 17:41:08 +03:00
Laurențiu Nicola
f373437c22 Merge from rust-lang/rust 2025-07-15 17:27:46 +03:00
Chayim Refael Friedman
f19c89da36 Infer lifetimes for GATs in expression/pattern position
We should not only in type position.
2025-07-15 01:15:33 +03:00
Shoyu Vanilla (Flint)
a489123e80
Merge pull request #20232 from ShoyuVanilla/issue-20225
fix: Normalize projection types before calculating memory maps
2025-07-11 19:32:53 +00:00
Shoyu Vanilla
f6e11e8248 Add a memory map bound check assertion on rendering const slice 2025-07-11 23:44:49 +09:00
Chayim Refael Friedman
4b29a9d6ea
Merge pull request #20219 from ChayimFriedman2/expr-store-mem
perf: Put the expression stuff in the expression store behind an `Option<Box>`
2025-07-11 14:25:39 +00:00
Shoyu Vanilla
4b2593085d fix: Normalize projection types before calculating memory maps 2025-07-11 23:10:03 +09:00
Chayim Refael Friedman
e2c8cefa63
Merge pull request #20228 from ChayimFriedman2/fix-use-display
fix: Fix display of `use<>` syntax
2025-07-10 21:19:38 +00:00
Chayim Refael Friedman
1d3ca1d6f3 Fix display of use<> syntax 2025-07-11 00:08:24 +03:00
Shoyu Vanilla (Flint)
e9968fc555
Merge pull request #20210 from ChayimFriedman2/naked-asm-safe
fix: Inline asm fixes
2025-07-10 06:28:49 +00:00
Chayim Refael Friedman
ad708fdbd1 Put the expression stuff in the expression store behind an Option<Box>
And leave only the type stuff without it.

This is because most expression stores don't have anything but types (e.g. generics, fields, signatures) so this saves a lot of memory.

This saves 58mb on `analysis-stats .`.
2025-07-10 05:18:43 +03:00
Chayim Refael Friedman
bd8087e86e Differentiate between asm!(), global_asm!() and naked_asm!(), and make only asm!() unsafe 2025-07-09 17:37:27 +03: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
Chayim Refael Friedman
43644ca4fe
Revert "Re-enable fixpoint iteration for variance computation" 2025-07-08 23:41:22 +03: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
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
Lukas Wirth
0ac65592a8
Merge pull request #20184 from Veykril/push-ywpynxnltpok
chore: Remove dead field from `InferenceContext`
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
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
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
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
Shoyu Vanilla
f3eb22edd0 fix: Closure capturing for let exprs, again 2025-07-03 22:51:16 +09:00
Lukas Wirth
f14bf95931
Merge pull request #20160 from Veykril/push-pqvskktpnylu
fix: Improve diagnostic ranges for `macro_calls!`
2025-07-03 12:23:23 +00:00
Lukas Wirth
2480a42ff4 fix: Improve diagnostic ranges for macro_calls!
We used to point to the entire macro call including its token tree if we couldn't upmap the diagnostic to the input
This generally makes things very noisy as the entire macro call will turn red on errors.
Instead, we now macro the path and `!` (bang) token as the error source range which is a lot nicer on the eyes.
2025-07-03 14:12:27 +02:00
Lukas Wirth
a3dc41bf97 Re-enable fixpoint iteration for variance computation 2025-07-03 10:48:09 +02:00
Lukas Wirth
8029c731ed Bump salsa 2025-07-03 10:05:16 +02:00
zachs18
0eb3ee8eb1
Remove last use of rustc_pat_analysis::Captures
It's not necessary anymore due to Rust 2024 lifetime capture rules.
2025-06-29 22:36:53 -05:00
Lukas Wirth
968d2467a8 ci: Fix up release workflow 2025-06-28 11:35:55 +02:00
Chayim Refael Friedman
a6c1fa01d9
Merge pull request #20100 from ShoyuVanilla/ignore-sized-hierarchy
Backport new sized-hierarchy trait bounds in old ways
2025-06-26 20:37:18 +00:00
Shoyu Vanilla
953e9d1c36 Backport new sized-hierarchy trait bounds in old ways 2025-06-26 23:22:26 +09:00
Lukas Wirth
468726178f Bring back the firewall query 2025-06-26 14:12:57 +02:00
Lukas Wirth
889d84a1be Salsa idiomize VariantFields query 2025-06-26 12:55:55 +02:00
Lukas Wirth
ad3a2d7280
Merge pull request #20088 from Veykril/push-qrslvzzlqqoz
De-arc trait items query
2025-06-25 08:19:32 +00:00
Lukas Wirth
f25912c6f9 De-arc trait items query 2025-06-25 10:09:21 +02:00
Lukas Wirth
c43e7c71de Short circuit a couple hir-ty/lower queries 2025-06-24 20:04:43 +02:00
Lukas Wirth
b50d527931
Merge pull request #20036 from Veykril/push-yquvoyrxkksx
Do not default to 'static for trait object lifetimes
2025-06-24 06:59:54 +00:00
Lukas Wirth
2b05bd7d7e Do not default to 'static for trait object lifetimes
We lack trait object default lifetime elision, so `'static` can be wrong at times, confusing the user
2025-06-24 08:49:24 +02:00
Lukas Wirth
95dce2be51
Merge pull request #20062 from ChayimFriedman2/doctests
minor: Don't run doctests
2025-06-24 06:47:24 +00:00
Shoyu Vanilla
254c6ec8e1 fix: Use ROOT hygiene for args inside new format_args! expansion 2025-06-24 01:10:32 +09:00
Laurențiu Nicola
b9ae87d586 Merge from rust-lang/rust 2025-06-23 12:17:31 +03:00
Chayim Refael Friedman
de312d0c71 Don't run doctests 2025-06-23 00:50:22 +03:00
Zachary S
55968213fc rust-analyzer: Rename LayoutS to LayoutData in comments 2025-06-20 12:50:55 -05:00