Commit Graph

39 Commits

Author SHA1 Message Date
Lukas Wirth
4ec81230db Remove usages of Span::DUMMY 2023-12-20 12:53:46 +01:00
Lukas Wirth
66e29be1bd internal: Split out a span crate 2023-12-18 14:08:33 +01:00
Lukas Wirth
9083017c9d Remove ModuleId from TypeOwnerId 2023-12-14 14:11:57 +01:00
bors
e91fdf7860 Auto merge of #15959 - Veykril:macro-shower3, r=lnicola
TokenMap -> SpanMap rewrite

Opening early so I can have an overview over the full diff more easily, still very unfinished and lots of work to be done.

The gist of what this PR does is move away from assigning IDs to tokens in arguments and expansions and instead gives the subtrees the text ranges they are sourced from (made relative to some item for incrementality). This means we now only have a single map per expension, opposed to map for expansion and arguments.

A few of the things that are not done yet (in arbitrary order):
- [x] generally clean up the current mess
- [x] proc-macros, have been completely ignored so far
- [x] syntax fixups, has been commented out for the time being needs to be rewritten on top of some marker SyntaxContextId
- [x] macro invocation syntax contexts are not properly passed around yet, so $crate hygiene does not work in all cases (but most)
  - [x] builtin macros do not set spans properly, $crate basically does not work with them rn (which we use)
~~- [ ] remove all uses of dummy spans (or if that does not work, change the dummy entries for dummy spans so that tests will not silently pass due to havin a file id for the dummy file)~~
  - [x] de-queryfy `macro_expand`, the sole caller of it is `parse_macro_expansion`, and both of these are lru-cached with the same limit so having it be a query is pointless
- [x] docs and more docs
- [x] fix eager macro spans and other stuff
  - [x] simplify include! handling
- [x] Figure out how to undo the sudden `()` expression wrapping in expansions / alternatively prioritize getting invisible delimiters working again
- [x] Simplify InFile stuff and HirFIleId extensions
~~- [ ] span crate containing all the file ids, span stuff, ast ids. Then remove the dependency injection generics from tt and mbe~~

Fixes https://github.com/rust-lang/rust-analyzer/issues/10300
Fixes https://github.com/rust-lang/rust-analyzer/issues/15685
2023-12-04 19:59:53 +00:00
Lukas Wirth
ab8f12e169 Rename hygiene vars and fields to span_map 2023-11-28 10:55:40 +01:00
Lukas Wirth
30093a6d81 spans always come from real file 2023-11-28 10:55:39 +01:00
Lukas Wirth
05f375eae2 hygiene 2.0 2023-11-28 10:55:39 +01:00
Lukas Wirth
890eb17b4e Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
Sarrus1
97dea2c699
remove unused PhantomData 2023-11-16 18:39:36 +01:00
Lukas Wirth
e21d21a8fb Diagnose incorrect unsafety for trait impls 2023-11-14 21:05:27 +01:00
Lukas Wirth
2b9dde14ab Allocate ast ids for parameters 2023-09-28 13:16:11 +02:00
Lukas Wirth
e243a03da1 Desugar builtin#format_args 2023-09-06 15:21:41 +02:00
Lukas Wirth
eb6244c5f9 Record import aliases in symbol index 2023-08-18 11:46:35 +02:00
Lukas Wirth
9adff006e8 Simplify 2023-08-10 20:10:19 +02:00
Lukas Wirth
bfad781a77 Memoize block_item_tree_query 2023-08-10 19:24:39 +02:00
Lukas Wirth
e5b23e3bc1 Derive block attributes from block item tree 2023-08-10 18:52:27 +02:00
Lukas Wirth
7e04142f25 Fix pinned version of lsp-types 2023-08-09 20:06:08 +02:00
bors
f98d654ddf Auto merge of #15350 - max-heller:issue-11756, r=Veykril
Handle `#[cfg]`s on generic parameters

Records attributes on generic parameters in the item tree and filters out generic parameters disabled by `#[cfg]`s in `generic_params_query`.

Closes #11756
2023-08-08 13:05:26 +00:00
Lukas Wirth
f86f6a89eb Change terminology, do not name use items and use trees as imports 2023-08-02 14:19:38 +02:00
Max Heller
008b639ef5 handle #[cfg]s on generic parameters 2023-07-27 21:17:10 -04:00
Lukas Wirth
8886d707b8 Stronger typing for AstId and AstIdMap 2023-07-04 09:16:15 +02:00
Lukas Wirth
cf178cba8f internal: Add a CrateRootModuleId that encodes a module id that is always a crate root 2023-06-14 15:41:06 +02:00
Lukas Wirth
c7ef6c25b7 internal: Replace Display impl for Name 2023-05-24 20:55:12 +02:00
Laurențiu Nicola
7197a27028 Use triomphe Arc 2023-05-02 20:02:43 +03:00
Laurențiu Nicola
160ab88bb9 Bump bitflags 2023-04-17 18:42:59 +03:00
Lukas Wirth
a2a3fecae3 Option begone part 2 2023-04-16 19:20:48 +02:00
Lukas Wirth
0f4ffaa5af Fix duplicate eager expansion errors 2023-04-16 19:20:35 +02:00
Lukas Wirth
79c4c4fb48 Remove parameter names from function item tree 2023-04-07 09:57:19 +02:00
Lukas Wirth
f742943a4b Don't recreate Hygiene unnecessarily 2023-04-06 21:16:11 +02:00
hkalbasi
8a6ca86247 Use async block in async fn type inference 2023-04-01 04:35:28 +03:30
Lukas Wirth
675fc88afd internal: Only intern blocks that declare items 2023-03-25 20:44:12 +01:00
Ryo Yoshida
29c957f973
Lower and handle trait aliases in HIR 2023-03-04 00:24:07 +09:00
Lukas Wirth
c6e7917d6e Fix up token_tree_to_syntax_node float split handling 2023-02-07 15:21:37 +01:00
Lukas Wirth
68723043db Split out hir-def attribute handling parts into hir-expand 2023-01-09 19:29:28 +01:00
Yuri Astrakhan
e16c76e3c3 Inline all format arguments where possible
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.

The change was automatically created with, so there are far less change
of an accidental typo.

```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Lukas Wirth
6674bd898e fix: Add trait alias grammar to rust.ungram 2022-11-11 15:25:15 +01:00
unexge
89107d5469 Emit unconfigured code diagnostics for fields 2022-09-26 19:04:57 +01:00
Jonas Schievink
bd7dfac5eb Fix r-a spelling in some places 2022-08-01 13:47:09 +02:00
Peh
1f011fa4a3 style: rename crates to kebab case 2022-05-01 10:48:58 +00:00