bors
6f3030f316
Auto merge of #17586 - ShoyuVanilla:tuple-arg-macro-rest, r=Veykril
...
Allow macro expansions into `RestPat` in tuple args work as ellipsis like plain `RestPat`
Fixes #17292
Currently, Rust Analyzer lowers `ast::Pat::RestPat` into `Pat::Missing` in general cases on the following lines;
ffbc5ad993/crates/hir-def/src/body/lower.rs (L1359-L1367)
And in some proper positions such as `TupleStruct(..)`, it is specially handed on the following lines;
ffbc5ad993/crates/hir-def/src/body/lower.rs (L1429-L1437)
This behavior is reasonable because rustc does similar things in
62c068feea/compiler/rustc_ast_lowering/src/pat.rs (L108-L111)
and
62c068feea/compiler/rustc_ast_lowering/src/pat.rs (L123-L142)
But this sometimes works differently because Rust Analyzer expands macros while ast lowering;
ffbc5ad993/crates/hir-def/src/body/lower.rs (L1386-L1398)
ffbc5ad993/crates/hir-def/src/body/lower.rs (L941-L963)
but rustc uses expanded ast in the corresponding tuple-handling process, so it does not have macro patterns there.
62c068feea/compiler/rustc_ast_lowering/src/pat.rs (L114)
So, if a macro expansion in a tuple arg results in `..`, rustc permits it like plain `..` pattern, but Rust Analyzer rejects it.
This is the root cause of #17292 and this PR allows macros expanded into `..` in a tuple arg position work as ellipsis like that.
2024-07-22 09:08:12 +00:00
Sydney Acksman
cdd7b18149
Fix more path resolution for included submodules
...
Now with much more comprehensive testing! This
adds tests for includes within modules.
2024-07-21 19:04:19 -05:00
bors
e88946ace8
Auto merge of #17655 - Veykril:std-find-path, r=Veykril
...
More `find_path` improvements
2024-07-21 11:21:25 +00:00
Lukas Wirth
733cb1e645
Optimize find_path
for sysroot library search some more
2024-07-21 13:20:12 +02:00
Lukas Wirth
4b2a123280
Fix visited module tracking not clearing itself on backtracking
2024-07-21 12:17:50 +02:00
Lukas Wirth
2a32976e90
Use out parameter instead of return value for find_path
choice
2024-07-21 11:32:48 +02:00
Lukas Wirth
9fd6d26e97
Fix using wrong length for max_len arg
2024-07-21 11:16:23 +02:00
Lukas Wirth
2564b69e1d
Specialize find_path
local search
2024-07-21 11:10:15 +02:00
Lukas Wirth
a6e4ac705c
Optimize find_path
choice selection
2024-07-21 10:53:33 +02:00
bors
88258b7fd2
Auto merge of #17653 - Veykril:std-find-path, r=Veykril
...
Prefer standard library paths over shorter extern deps re-exports
This should generally speed up path finding for std items as we no longer bother looking through all external dependencies. It also makes more sense to prefer importing std items from the std dependencies directly.
Fixes https://github.com/rust-lang/rust-analyzer/issues/17540
2024-07-21 07:24:38 +00:00
Lukas Wirth
40bbc684ad
Prefer standard library paths over shorter extern deps re-exports
2024-07-21 09:14:17 +02:00
bors
5f26438b5d
Auto merge of #17650 - ObsidianMinor:fix/17645, r=Veykril
...
Fix path resolution for child mods of those expanded by `include!`
Child modules wouldn't use the correct candidate paths due to a branch that doesn't seem to be doing what it's intended to do. Removing the branch fixes the problem and all existing test cases pass.
Having no knowledge of how any of this works, I believe this fixes #17645 . Using another test that writes the included mod directly into `lib.rs` instead, I found the difference can be traced to the candidate files we use to look up mods. A separate branch for if the file comes from an `include!` macro doesn't take into account the original mod we're contained within:
```rust
None if file_id.macro_file().map_or(false, |it| it.is_include_macro(db.upcast())) => {
candidate_files.push(format!("{}.rs", name.display(db.upcast())));
candidate_files.push(format!("{}/mod.rs", name.display(db.upcast())));
}
```
I'm not sure why this branch exists. Tracing the branch back takes us to 3bb9efb
but it doesn't say *why* the branch was added. The test case that was added in this commit passes with the branch removed, so I think it's just superfluous at this point.
2024-07-21 06:17:14 +00:00
Sydney Acksman
b9469f52a3
Fix path resolution for child mods of those expanded by include!
...
Child modules wouldn't use the correct candidate paths due to a branch that doesn't seem to be doing what it's intended to do. Removing the branch fixes the problem and all existing test cases pass.
2024-07-20 14:32:28 -05:00
Laurențiu Nicola
1075978bed
Fix some typos
2024-07-20 08:30:22 +03:00
Lukas Wirth
546eb6b530
Test macros doing edition dependent parsing
2024-07-19 16:43:58 +02:00
Lukas Wirth
5264f86242
Encode edition within FileId in the hir layer
2024-07-18 08:49:10 +02:00
Lukas Wirth
92268627a8
Support rustc_skip_during_method_dispatch
2024-07-17 11:46:36 +02:00
Lukas Wirth
7011094685
Add always disabled gen parse support
2024-07-17 10:49:12 +02:00
Lukas Wirth
2346a80ab4
Remove Name::to_smol_str
2024-07-16 12:43:58 +02:00
Lukas Wirth
df5f1777b8
More symbol usage
2024-07-16 12:05:16 +02:00
Lukas Wirth
93024ad411
Switch token trees to use Symbols
2024-07-16 10:11:59 +02:00
Lukas Wirth
dcfda55c82
Escape fetched env vars in env! expansion
2024-07-15 13:08:29 +02:00
Lukas Wirth
e846c04fbe
Encode ident rawness and literal kind separately in tt::Leaf
2024-07-15 12:24:40 +02:00
Lukas Wirth
cde0f69cae
Fix stable iteration ordering for Map<Name, ...>
usages
2024-07-15 11:25:46 +02:00
Lukas Wirth
f2d51073d2
Use statics + clone instead of const until const can access statics
2024-07-14 17:52:59 +02:00
Shoyu Vanilla
b238855892
Allow macro expansions into RestPat
in tuple args work as ellipsis like plain RestPat
2024-07-13 07:09:17 +09:00
Lukas Wirth
3fe815b0f3
Use Symbol in Name
2024-07-12 16:06:44 +02:00
beetrees
d5db933f9d
Add f16
and f128
support
2024-07-10 10:43:14 +01:00
beetrees
320022622c
fix: Fix double rounding of f32
literals
2024-07-08 16:31:32 +01:00
bors
a5b21ea0aa
Auto merge of #17555 - Veykril:grammar-inline, r=Veykril
...
internal: Inline generated syntax methods
2024-07-07 09:21:04 +00:00
Lukas Wirth
c08d419fba
HasGenericArgs syntax trait
2024-07-07 11:18:28 +02:00
bors
a494aaba87
Auto merge of #17523 - wada314:master, r=Veykril
...
Add an option to use "::" for the external crate prefix.
Fixes #11823 .
Hi I'm very new to rust-analyzer and not sure how the review process are. Can somebody take a look at this PR? thanks!
2024-07-07 08:32:46 +00:00
Lukas Wirth
90682c393d
Drop unused profile things
2024-07-07 08:24:10 +02:00
Shoyu Vanilla
4bb623decb
Disallow nested impl traits
2024-07-04 23:31:55 +09:00
Lukas Wirth
baa959fa99
Move lifetimes in front of type and const params but after self
2024-07-02 14:17:34 +02:00
Lukas Wirth
966798b7ba
Make GenericParams::lifetimes private
2024-07-02 13:45:53 +02:00
Lukas Wirth
be1ea4028b
Make GenericParams::where_predicates private
2024-07-02 13:45:50 +02:00
Lukas Wirth
372e2d22e6
Make GenericParams::type_or_consts private
2024-07-02 13:45:48 +02:00
Shohei Wada
3725ab3146
squash.
2024-07-02 01:52:34 +09:00
Lukas Wirth
21a3d01875
Remove inline rust_2018_idioms, unused_lifetimes
lint warn, Cargo.toml already enforces this
2024-06-30 15:23:54 +02:00
Lukas Wirth
882ae7105d
Simplify unresolved proc-macro handling
2024-06-30 13:26:13 +02:00
Lukas Wirth
8df034d453
Shrink mbe's Op
2024-06-24 10:07:32 +02:00
Lukas Wirth
e052b3e9a6
Intern ModPath within RawVisibility
2024-06-24 10:07:32 +02:00
Lukas Wirth
5548aecdca
Save a bit on empty item trees by deduplicating them
2024-06-24 10:07:32 +02:00
Lukas Wirth
3168ab5b99
Enum variants are not generic def ids
2024-06-24 10:07:31 +02:00
Lukas Wirth
c01f4cf902
Simplify
2024-06-21 18:27:05 +02:00
Lukas Wirth
480bfd5a7d
There can only be one self param
2024-06-21 17:55:16 +02:00
Lukas Wirth
f9bb5476c3
fix: Fix pat fragment parsers choking on <eoi>
2024-06-17 19:42:56 +02:00
bors
6b8b8ff4c5
Auto merge of #17417 - Wilfred:intern_macros_salsa, r=Veykril
...
refactor: Prefer plain trait definitions over macros for impl_intern_value_trivial
`impl_intern_value_trivial` can be defined with a trait directly, so prefer that over a macro definition.
2024-06-14 06:20:26 +00:00
Wilfred Hughes
3874681cb6
Prefer plain trait definitions over macros for salsa
2024-06-13 17:32:06 -07:00