Commit graph

484 commits

Author SHA1 Message Date
Jonas Schievink
da08198bc9 Rewrite attr.rs to allow using syntax-based indices 2021-05-10 21:50:42 +02:00
Jonas Schievink
a87bec5148 Move AttrId back into hir_def 2021-05-10 16:35:06 +02:00
Jonas Schievink
fd5a1d1765 Test that none of the macros are reparsed 2021-05-09 16:39:47 +02:00
Jonas Schievink
9cf8d325a2 Precompute macro fragment kind 2021-05-09 01:36:06 +02:00
Jonas Schievink
20ae41c1a1 Reuse database in LowerCtx 2021-05-06 23:23:50 +02:00
Aleksey Kladov
c4f9cb9b53 Update crates/hir_def/src/nameres/tests/incremental.rs
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-06 20:00:43 +02:00
Aleksey Kladov
548e5a5c29 internal: add failing incremental test 2021-05-06 20:00:11 +02:00
Jonas Schievink
976a3226fe Don't store call-site text offsets in hygiene info 2021-05-06 19:59:54 +02:00
Lukas Tobias Wirth
5a78d96d0e Fix block comment intra doc link injection ranges 2021-05-04 13:51:57 +02:00
Jonas Schievink
6873920c4f find_path: check only crate-level prelude 2021-04-30 18:41:18 +02:00
Jonas Schievink
0414b65319 Remove ItemTree::all_inner_items 2021-04-21 18:10:25 +02:00
Jonas Schievink
7b7d051e81 Add failing local items test 2021-04-21 17:57:45 +02:00
Jonas Schievink
59630977a5 Fix some find_path bugs around inner items 2021-04-19 19:50:11 +02:00
Aleksey Kladov
5f89a60f1a fix: false positive about inner attrs in docs
closes #8541
2021-04-19 17:11:49 +03:00
bors[bot]
e4f7f1e1bd
Merge #8462
8462: Expand macros at type position r=jonas-schievink a=cynecx



Co-authored-by: cynecx <me@cynecx.net>
2021-04-19 13:01:30 +00:00
Jonas Schievink
b777d46ae6 Fix visibility of items in block modules 2021-04-19 01:06:04 +02:00
cynecx
6ed2fd233b hir_ty: keep body::Expander in TyLoweringContext 2021-04-18 19:56:13 +02:00
cynecx
3d39e77003 hir_def: various cleanups 2021-04-18 18:35:45 +02:00
cynecx
7ed42a3a52 hir_def: refactor expand_macro_type and cleanups 2021-04-17 17:38:45 +02:00
cynecx
14918a3870 hir_def: ignore ast::Type in file_item_tree query 2021-04-17 16:24:56 +02:00
cynecx
cf3b4f1e20 hir_ty: Expand macros at type position 2021-04-17 16:24:56 +02:00
Jonas Schievink
9e8feeb94a Fix TestDB::module_at_position with submodules 2021-04-17 03:34:05 +02:00
bors[bot]
2009556472
Merge #8542
8542: Include path in `unresolved-macro-call` diagnostic r=matklad a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-16 20:52:56 +00:00
Jonas Schievink
543d4ef7c5 Fix primitive shadowing with inner items 2021-04-16 19:28:22 +02:00
Jonas Schievink
ff858376aa Include path in unresolved-macro-call diagnostic 2021-04-16 15:48:03 +02:00
Jonas Schievink
d073c3e56d Remove unneeded annotations from find_path tests 2021-04-15 19:24:09 +02:00
Jonas Schievink
6acd0ac51a Make find_path tests adhere to style guide 2021-04-15 18:32:19 +02:00
bors[bot]
9beed98f2a
Merge #8432
8432: decl_check: consider outer scopes' allows r=jonas-schievink a=lf-

Fix #8417. Also makes it less noisy about no_mangle annotated stuff the
user can do nothing about.

Note: this still is broken with bitfield! macros. A repro in an ignore
test is included here. I believe this bug is elsewhere, and I don't
think I can work around it here.

I would like help filing the remaining bug, as it does actually affect
users, but I don't know how to describe the behaviour (or even if it
is unintended).

Co-authored-by: Jade <software@lfcode.ca>
2021-04-13 12:02:26 +00:00
Jonas Schievink
e2c1da36f5 Support macros in pattern position 2021-04-11 01:25:50 +02:00
Jonas Schievink
30ce8b20ec Avoid an unnecessary collect 2021-04-09 22:52:13 +02:00
bors[bot]
343b14f7e0
Merge #8450
8450: Don't ignore unnamed consts when looking for definitions r=Veykril a=Veykril

Fixes #8448
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-09 15:16:36 +00:00
Lukas Wirth
ec2895e956 Insert unnamed consts to ChildBySource DynMap 2021-04-09 17:14:48 +02:00
Jonas Schievink
75614b126b Resolve prelude and crate root names in the root DefMap 2021-04-09 15:29:42 +02:00
bors[bot]
3b1692c3e8
Merge #8443 #8446
8443: Rewrite `#[derive]` removal code to be based on AST r=jonas-schievink a=jonas-schievink

We now remove any `#[derive]` before and including the one we want to expand, in the `macro_arg` query.

The same infra will be needed by attribute macros (except we only remove the attribute we're expanding, not any preceding ones).

Part of https://github.com/rust-analyzer/rust-analyzer/issues/8434 (doesn't implement the cfg-expansion yet, because that's more difficult)

8446: Undo path resolution hack for extern prelude r=jonas-schievink a=jonas-schievink

Reverts the change made in https://github.com/rust-analyzer/rust-analyzer/pull/7959

We don't populate the extern prelude for block DefMaps anymore,
so this is unnecessary

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-09 12:53:49 +00:00
Jonas Schievink
4ea5f690bc Undo path resolution hack for extern prelude
We don't populate the extern prelude for block DefMaps anymore,
so this is unnecessary
2021-04-09 14:46:52 +02:00
Jonas Schievink
c0dd36fd42 Store #[derive] attribute ID along macro invoc 2021-04-09 13:38:01 +02:00
Jonas Schievink
546da15972 Rename Attrs index field to id 2021-04-09 13:36:22 +02:00
Jonas Schievink
3fcdd1bcdf Add AttrId to track attribute sources 2021-04-09 13:32:03 +02:00
Jade
4529f1be81 decl_check: consider outer scopes' allows
Fix #8417. Also makes it less noisy about no_mangle annotated stuff the
user can do nothing about.

Note: this still is broken with bitfield! macros. A repro in an ignore
test is included here. I believe this bug is elsewhere, and I don't
think I can work around it here.
2021-04-08 14:43:19 -07:00
Jonas Schievink
86b7861612 Use named fields in MacroCallKind 2021-04-08 20:43:07 +02:00
Jonas Schievink
014774764a Track recursion limit when expanding custom derive 2021-04-08 18:49:30 +02:00
Jonas Schievink
053dac88ca Update OUT_DIR diagnostic to match setting 2021-04-07 20:19:28 +02:00
Jonas Schievink
7c1c0e6fea Collect trait impls inside unnamed consts 2021-04-07 03:33:22 +02:00
Jonas Schievink
f04f38d3d7 nameres: collect unnamed consts 2021-04-07 03:12:40 +02:00
Jonas Schievink
035d84558c Avoid O(n²) when constructing AttrSourceMap 2021-04-06 22:25:44 +02:00
Jonas Schievink
0d4c931416 Lower attributes on tuple fields 2021-04-06 20:19:53 +02:00
Jonas Schievink
e9752308bb infer: remove record_field_resolutions field
It stores no useful data, since we can derive all fields from
`variant_resolutions`
2021-04-06 17:59:18 +02:00
Jonas Schievink
a25fbdb30a Intern TypeRefs stored in Body
Minor improvement to memory usage (1 MB or so)
2021-04-06 16:07:45 +02:00
Alexandru Macovei
32304d14a1 Use Box'es to reduce the size of hir_def::expr::Pat from 112 to 64 bytes on 64bit 2021-04-06 16:01:31 +03:00
Alexandru Macovei
fb1f544e24 Use Box'es to reduce size of hir_def::expr::Expr from 128 to 72 bytes (on 64bit systems)
Rationale: only a minority of variants used almost half the size.
By keeping large members (especially in Option) behind a box
the memory cost is only payed when the large variants are needed.

This reduces the size Vec<Expr> needs to allocate.
2021-04-06 16:01:31 +03:00