Commit graph

474 commits

Author SHA1 Message Date
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
bors[bot]
72781085bb
Merge #8352
8352: Remove dead legacy macro expansion code r=lnicola a=brandondong

I was investigating some unrelated macro issue when I noticed this dead code. This legacy macro expansion logic was changed in https://github.com/rust-analyzer/rust-analyzer/pull/8128.

Co-authored-by: Brandon <brandondong604@hotmail.com>
2021-04-05 19:00:27 +00:00
Brandon
4dbec2d545 Remove dead legacy macro expansion code 2021-04-05 11:47:06 -07:00
Jonas Schievink
b57462d60d Interned<T>: Only hash the pointer 2021-04-05 17:07:53 +02:00
Jonas Schievink
a0b50bcf1e Make impl_internable! macro public 2021-04-05 16:59:13 +02:00
bors[bot]
c2be91dcd8
Merge #8245
8245: Properly resolve intra doc links in hover and goto_definition r=matklad a=Veykril

Unfortunately involves a bit of weird workarounds due to pulldown_cmark's incorrect lifetimes on `BrokenLinkCallback`... I should probably open an issue there asking for the fixes to be pushed to a release since they already exist in the repo for quite some time it seems.

Fixes #8258, Fixes #8238

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-05 12:30:20 +00:00
Jonas Schievink
6f1ee9a7f4 simplify visibility.rs 2021-04-05 04:27:57 +02:00
Jonas Schievink
7c0c713a10 Intern GenericParams
Also share the same instance between `ItemTree` and `generic_params`
query.
2021-04-05 03:50:10 +02:00
Jonas Schievink
adcf18e27d Add GenericParams::shrink_to_fit
Reduces memory usage by over 10 MB
2021-04-05 03:32:43 +02:00
Jonas Schievink
24e876b52e Intern more TypeRefs in generics
Saves ~3 MB
2021-04-05 02:03:37 +02:00
Aleksey Kladov
d1474ae518 Check if bitflags deps pulls its weight
Bitflags is generally a good dependency -- it's lightweight, well
maintained and embraced by the ecosystem.

I wonder, however, do we really need it? Doesn't feel like it adds much
to be honest.
2021-04-04 12:06:01 +03:00