1373 Commits

Author SHA1 Message Date
David Barsky
74620e64ec internal: port rust-analyzer to new Salsa 2025-03-10 13:30:51 -04:00
Mara Bos
70e1d84a26 Fix rust-analyzer for 16-bit fmt width and precision. 2025-03-10 12:20:05 +01:00
Lukas Wirth
cf255a61d5
Merge pull request #19079 from ChayimFriedman2/rename-conflict
feat: Warn the user when a rename will change the meaning of the program
2025-03-10 08:59:43 +00:00
¨Florian
5335d8cbc5 Fix syntax fixup producing invalid punctuation
Fixes #19206.
Fixes #18244.
2025-03-08 13:21:00 +01:00
Chayim Refael Friedman
62e7d2851b Warn the user when a rename will change the meaning of the program
Specifically, when a rename of a local will change some code that refers it to refer another local, or some code that refer another local to refer to it.

We do it by introducing a dummy edit with an annotation. I'm not a fond of this approach, but I don't think LSP has a better way.
2025-03-06 21:07:10 +02:00
Thalia Archibald
0811ca0a61 Use size_of from the prelude instead of imported
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the
prelude instead of importing or qualifying them.

These functions were added to all preludes in Rust 1.80.
2025-03-05 00:48:44 -08:00
Lukas Wirth
9200f77068 More precise macro modifiers for syntax highlighting 2025-03-01 17:23:51 +01:00
BenjaminBrienen
b19ef6b046 fix doc tests 2025-02-27 14:58:46 +01:00
Laurențiu Nicola
f641813e07 Format code 2025-02-24 10:28:46 +02:00
Laurențiu Nicola
a5bf2d5604 Add rustc_hashes and bump the others 2025-02-24 10:10:51 +02:00
Laurențiu Nicola
807aa45e0a Merge from rust-lang/rust 2025-02-24 09:42:57 +02:00
Lukas Wirth
0b2e8166a1 Remove limit crate in favor usize 2025-02-23 17:35:09 +01:00
Matthias Krüger
447b34760d
Rollup merge of #137173 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2025-02-17 17:06:14 +01:00
Lukas Wirth
09db657439
Merge pull request #19127 from ChayimFriedman2/different-generic-args
feat: Refactor path lowering and serve a new path diagnostic
2025-02-17 08:30:10 +00:00
Ben Kimock
b4b1e778c9 Move hashes from rustc_data_structure to rustc_hashes so they can be shared with rust-analyzer 2025-02-16 16:18:30 -05:00
Chayim Refael Friedman
55c04ab371 Refactor path lowering
And add a new diagnostic for non-`Fn` parenthesized generic args.

Path lowering started to look like a mess, with each function carrying additional parameters for the diagnostic callback (since paths can occur both in type and in expression/pattern position, and their diagnostic handling is different) and the segment index, for the diagnostics report. So I refactored it from stateless functions on `TyLoweringContext` into stateful struct, `PathLoweringContext`, that tracks the process of lowering a path from resolution til assoc types selection.
2025-02-16 19:44:50 +02:00
Lukas Wirth
12d87252ac
Merge pull request #18928 from roife/fix-18918
fix: handle character boundary in search mode
2025-02-12 14:07:51 +00:00
Lukas Wirth
8e81cc0772
Merge pull request #19109 from Veykril/push-nzpuuqommpnq
fix: Do not show safety hints for extern items lacking semantics
2025-02-12 13:58:56 +00:00
roife
608d7e14d7 fix: handle character boundary in search mode 2025-02-12 14:47:28 +01:00
Lukas Wirth
e0814742f0 fix: Do not show safety hints for extern items lacking semantics 2025-02-12 14:43:51 +01:00
Lukas Wirth
b636cf93e5
Merge pull request #19125 from ChayimFriedman2/cfg-attr-fast
fix: Censor cfg_attr for attribute macros
2025-02-12 13:38:24 +00:00
Lukas Wirth
622ef64f93
Merge pull request #18995 from alibektas/12210
fix: Lower range pattern bounds to expressions
2025-02-12 11:58:33 +00:00
Laurențiu Nicola
bf51af1a6d Merge from rust-lang/rust 2025-02-10 07:49:43 +02:00
Chayim Refael Friedman
933832008b Censor cfg_attr for attribute macros
This is not documented (and I discovered that from experimenting and looking at the compiler's source code), but cfg_attrs *on the same level* as the attribute macro should be processed before it is expanded. cfg_attrs *below* should not (and this is contrary to what happens with derive macros, where both should be processed).
2025-02-10 01:28:28 +02:00
Ali Bektas
97251b3e28 Check if PatPtr resolves to ExprId 2025-02-09 17:31:45 +01:00
Ali Bektas
76b93c0d1f Fix clippy errors 2025-02-09 17:31:09 +01:00
Ali Bektas
419231c79d Remove fixme and add a missing test attribute 2025-02-09 17:31:09 +01:00
Ali Bektas
18f90a9d2a resolve_bind_pat_to_const does not early return if expr 2025-02-09 17:31:09 +01:00
Ali Bektas
574ea0296c make SourceAnalyzer::pat_id return ExprOrPatId
Not all patterns are mapped to Pats. As such, it was necessary to change
the ret type Option<PatId> to Option<ExprOrPatId>
2025-02-09 17:31:09 +01:00
Ali Bektas
8956b1e1ba Lower ast::Ident to hir::Path when lowering RangePats 2025-02-09 17:31:09 +01:00
Lukas Wirth
0fd4fc3522
Merge pull request #19084 from Veykril/push-muworpzpzqup
Split cache priming into distinct phases
2025-02-04 13:57:39 +00:00
Lukas Wirth
ab5e821d97 Expose symbol of CrateName 2025-02-04 14:38:58 +01:00
Lukas Wirth
d6645d11da Fix some mir eval/lowerings 2025-02-03 14:42:41 +01:00
Ali Bektas
94b00c210c Add a test to monitor whats going on 2025-02-03 12:14:13 +01:00
Ali Bektas
06097c3388 Make Pat::Range's start and end Option<ExprId> 2025-02-03 12:14:11 +01:00
Bastian Kersting
8196d260e8 Insert null checks for pointer dereferences when debug assertions are enabled
Similar to how the alignment is already checked, this adds a check
for null pointer dereferences in debug mode. It is implemented similarly
to the alignment check as a MirPass.

This is related to a 2025H1 project goal for better UB checks in debug
mode: https://github.com/rust-lang/rust-project-goals/pull/177.
2025-01-31 11:13:34 +00:00
bors
702da50daa Auto merge of #136117 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2025-01-29 08:43:30 +00:00
Marijn Schouten
e766255067 parse_format optimize import use 2025-01-28 19:33:00 +01:00
David Barsky
be3307450f Back out "feat: Implement default-field-values"
This backs out commit 7de0b2e75a541b98f735ee6fcd12d326be38d23f.
2025-01-27 17:30:35 -05:00
David Barsky
35f6123059 Back out "Handle missing fields diagnostics"
This backs out commit e6a103ae50699db1dbb0676d075a4bcda2247939.
2025-01-27 17:30:35 -05:00
David Barsky
f3451d54d6 Back out "Merge record lit's ellipsis into pre-existing spread's variant"
This backs out commit c134b20c9cbc88a36e77acb8522e8dc4573bd906.
2025-01-27 17:30:35 -05:00
David Barsky
77c1507048 Back out "Compute diagnostics of a field body iff it has one"
This backs out commit b4d4d02db8a95f5507fbd0aa90904d7b774f0027.
2025-01-27 17:30:35 -05:00
David Barsky
e1b9a01c69 Back out "Implement HasResolver and HasModule for FieldId"
This backs out commit ce9da9063097c26006886b3f403a0c50790c285a.
2025-01-27 17:30:34 -05:00
David Barsky
52ee4ee1df Back out "Add a test for field default value body as defining usage of TAIT"
This backs out commit 4fe18a6fb5a1181a04c47391f558ebab5b8b0f39.
2025-01-27 17:30:34 -05:00
David Barsky
55d3851820 Back out "Remove has_default from FieldId"
This backs out commit 8aa6c09fcee6270c787a6f00615d76343fbe5c07.
2025-01-27 17:30:34 -05:00
Chayim Refael Friedman
55c63abc59 Fix #[rustc_deprecated_safe_2024]
It should be considered by the edition of the caller, not the callee.

Technically we still don't do it correctly - we need the span of the method name (if it comes from a macro), but we don't keep it and this is good enough for now.
2025-01-27 14:35:20 +02:00
Shoyu Vanilla
8aa6c09fce Remove has_default from FieldId 2025-01-27 19:41:58 +09:00
Shoyu Vanilla
4fe18a6fb5 Add a test for field default value body as defining usage of TAIT 2025-01-27 19:41:58 +09:00
Shoyu Vanilla
ce9da90630 Implement HasResolver and HasModule for FieldId 2025-01-27 19:41:58 +09:00
Shoyu Vanilla
b4d4d02db8 Compute diagnostics of a field body iff it has one 2025-01-27 19:41:57 +09:00