1303 Commits

Author SHA1 Message Date
Lukas Wirth
9d1364b730 minor: Add a mbe test for parsing negative literals 2025-05-05 12:10:48 +02:00
Lukas Wirth
581646236e refactor: De-arc defmap queries 2025-05-05 09:04:52 +02:00
Lukas Wirth
9a62507f2e Fix incorrect handling of unresolved non-module imports in name resolution 2025-05-05 08:29:34 +02:00
Lukas Wirth
5d43e752ad refactor: Simplify macro call id construction 2025-05-02 17:26:48 +02:00
Matthias Krüger
573c47c9ba remove a couple of clones 2025-05-01 11:41:42 +02:00
Lukas Wirth
e0dca847ad fix: Improve parser recovery a bit 2025-04-30 16:40:01 +02:00
Lukas Wirth
996d6ed1a3 Split out salsa_macros
Does not do much yet due to tracing pulling syn but oh well
2025-04-29 19:43:36 +02:00
Lukas Wirth
d11dbf648f Cleanup cfg check handling in expression store lowering 2025-04-29 11:44:11 +02:00
Lukas Wirth
6355df9c57 refactor: De-arc lang item queries 2025-04-28 17:17:39 +02:00
Lukas Wirth
5adee2ad2c
Merge pull request #19706 from Veykril/push-nkpmknlvzyom
fix: Address minor FIXME
2025-04-28 10:12:20 +00:00
Lukas Wirth
48fb00c19d fix: Address minor FIXME 2025-04-28 11:55:26 +02:00
Lukas Wirth
0fee71065b
Merge pull request #19704 from Veykril/push-wrvznvvpvtvp
Add expression fill mode variant for filling with underscore expressions
2025-04-28 09:45:04 +00:00
Lukas Wirth
7e526b6be7 Add expression fill mode variant for filling with underscore expressions 2025-04-28 10:39:36 +02:00
Laurențiu Nicola
6225bb9c44 Merge from rust-lang/rust 2025-04-28 11:06:53 +03:00
Lukas Wirth
71a3888d07
Merge pull request #19688 from ChayimFriedman2/less-unused
internal: More `shrink_to_fit()` and upgrade dashmap and hashbrown
2025-04-25 10:19:38 +00:00
Chayim Refael Friedman
1fe060719a shrink_to_fit() in more places
This saves 18mb on `analysis-stats .`, without regressing speed.
2025-04-25 10:55:12 +03:00
Lukas Wirth
61df8ec4b8 Arena allocate LifetimeRefs 2025-04-24 09:55:06 +02:00
Lukas Wirth
99a7e423e2 Shrink WherePredicate by 8 bytes 2025-04-24 09:23:00 +02:00
Lukas Wirth
4a2eaddc77 refactor: Remove WherePredicateTypeTarget 2025-04-24 09:13:56 +02:00
Chayim Refael Friedman
adcf699ea3 Properly handle lifetimes when checking generic arguments len
And also, prepare for correct lowering of lifetime. We still don't handle most lifetimes correctly, but a bit more of the foundation to lifetime elision is now implemented.
2025-04-24 08:35:20 +03:00
Chayim Refael Friedman
57c019a3c5 Adapt for new cycle handling changing in Salsa 2025-04-22 15:20:05 +03:00
Chayim Refael Friedman
99ce53b1d7 Add two new diagnostics: one for mismatch in generic arguments count, and another for mismatch in their kind
Also known as E0747 and E0107.

And by the way, rewrite how we lower generic arguments and deduplicate it between paths and method calls. The new version is taken almost straight from rustc.

This commit also changes the binders of `generic_defaults()`, to only include the binders of the arguments up to (and not including) the current argument. This make it easier to handle it in the rewritten lowering of generic args. It's also how rustc does it.
2025-04-22 14:55:43 +03:00
Lukas Wirth
cb6ddbedb0 refactor: Fold hygiene map into bindings themselves
`HygieneId` fits into `Binding`'s padding.
2025-04-21 16:53:06 +02:00
Lukas Wirth
34e7d60e30
Merge pull request #19644 from ChayimFriedman2/const-syms
internal: Make predefined symbols `const` instead of `static`
2025-04-21 12:34:59 +00:00
Lukas Wirth
d16b862ea5 fix: Support unstable UnsafePinned struct in type layout calc 2025-04-21 09:35:30 +02:00
Chayim Refael Friedman
0f325c7ff8 Remove unnecessary predefined symbol clones
Now that they're const it's no longer needed.

Nothing manual was performed: only a regexp search of `sym::([\w][\w\d]*)\.clone\(\)` and replace by `sym::$1`.
2025-04-21 03:10:13 +03:00
Chayim Refael Friedman
9477e46bec Get rid of static predefined symbols
Make them all `const`.
2025-04-21 03:07:35 +03:00
Chayim Refael Friedman
c58ddafe90 Make HirFileId, EditionedFileId and macro files Salsa struct
And make more queries non-interned.

Also flip the default for queries, now the default is to not intern and to intern a query you need to say `invoke_interned`.
2025-04-19 22:10:52 +03:00
Lukas Wirth
40076b577f internal: Render sigantures with view hir command 2025-04-13 12:13:28 +02:00
Lukas Wirth
8df812f14d fix: Walk const block expressions for unsafety checking 2025-04-10 16:10:30 +02:00
Lukas Wirth
4fdc2507c6 fix: Fix invalid signature bitflags 2025-04-10 15:39:27 +02:00
Lukas Wirth
f880acd18c
Merge pull request #19461 from Hmikihiro/shadow_by_module
fix: shadow type by module
2025-04-10 12:20:14 +00:00
Lukas Wirth
55efab890b
Merge pull request #19559 from ChayimFriedman2/rust-186
internal: Switch to Rust 1.86.0
2025-04-10 08:33:14 +00:00
Chayim Refael Friedman
8a9a1e3345 Remove all upcasts!
It turns out there were a lot redundant too.
2025-04-10 11:08:38 +03:00
Hayashi Mikihiro
b75a3388f1 Update crates/hir-def/src/resolver.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2025-04-10 16:29:10 +09:00
Hayashi Mikihiro
1b471ebfd5 TypeNs contain module
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2025-04-10 16:29:10 +09:00
Hayashi Mikihiro
a7dc60a2c4 return single option
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2025-04-10 16:29:10 +09:00
Hayashi Mikihiro
2854ad9a41 fix: shadow type by module
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2025-04-10 16:29:10 +09:00
Chayim Refael Friedman
2ae3e4c879
Fix a small bug with catastrophic effects
The tiny bug was that `FnFlags::DEPRECTAED_SAFE_2024` and `FnFlags::RUSTC_ALLOW_INCOHERENT_IMPLS` were assigned the same value.

The catastrophic effect was that every function marked as `#[rustc_allow_incoherent_impl]` was considered safe-deprecated for edition 2024, which caused it to be considered unsafe to call when called from edition 2024. And that includes `<[_]>::into_vec()`, which is called by the `vec![]` macro. So, catastrophic effect.

This innocent-looking bug probably arose from the item tree rewrite. No review would've catch that!
2025-04-10 09:37:37 +03:00
Lukas Wirth
07212140db refactor: Turn LifetimeRef into an enum
This makes things more structured
2025-04-09 15:58:06 +02:00
Lukas Wirth
1fd9520c92 refactor: Lower type-refs before type inference
This refactors how we deal with items in hir-def lowering.

- It now lowers all of them through an "ExpressionStore" (kind of a misnomer as this point) as their so called *Signatures.
- We now uniformly lower type AST into TypeRefs before type inference.
- Likewise, this moves macro expansion out of type inference, resulting in a single place where we do non-defmap macro expansion.
- Finally, this PR removes a lot of information from ItemTree, making the DefMap a lot less likely to be recomputed and have it only depend on actual early name resolution related information (not 100% true, we still have ADT fields in there but thats a follow up removal).
2025-04-09 10:43:23 +02:00
Lukas Wirth
7e00f91a72
Merge pull request #19531 from Veykril/push-kxyrpznnllkx
fix: Fix `format_args` lowering for >=1.87
2025-04-06 08:18:23 +00:00
Lukas Wirth
e7ce86ddea fix: Fix format_args lowering for >=1.87 2025-04-06 10:05:56 +02:00
Lukas Wirth
1d1771c15f
Merge pull request #19501 from ChayimFriedman2/macro-expansion
fix: Fix a bug in MBE expansion that arose from incorrect fixing of an older bug in MBE
2025-04-05 13:00:30 +00:00
BenjaminBrienen
2462624a7d prefer default over new 2025-04-04 15:49:50 +02:00
Chayim Refael Friedman
3953b604ce Fix a bug in MBE expansion that arose from incorrect fixing of an older bug in MBE
Specifically, #18744 was the PR that was supposed to fix the old bug, but it fixed it incorrectly (and didn't add a test!) The underlying reason was that we marked metavariables in expansions as joint if they were joint in the macro call, which is incorrect.

This wrong fix causes other bug, #19497, which this PR fixes by removing the old (incorrect) fix.
2025-04-01 21:05:51 +03:00
Lukas Wirth
1e1571e1c8 fix: Fix new nightly lints 2025-03-31 13:27:54 +02:00
Lukas Wirth
faf1b49a9a fix: Fix, clarify and require a value for proc_macro_cwd of CrateData 2025-03-29 08:08:48 +01:00
Lukas Wirth
2e1ff255ae
Merge pull request #19375 from ChayimFriedman2/do-not-complete
feat: Allow crate authors to control completion of their things
2025-03-28 09:06:19 +00:00
Chayim Refael Friedman
7b584ef9bf Allow crate authors to control completion of their things
Via the new `#[rust_analyzer::completions(...)]` attribute.

Also fix a bug with existing settings for that where the paths wouldn't resolve correctly.
2025-03-27 14:01:26 +02:00