Commit graph

10923 commits

Author SHA1 Message Date
Lukas Wirth
d9554c258b Add manual ops::Add impls to test::traits::closure_2 2021-04-10 17:16:35 +02:00
Lukas Wirth
252eb78dc3 Implement more precise binary op return type prediction 2021-04-10 16:56:32 +02:00
Aleksey Kladov
e012efca27 Let's try testing for "is not quadratic" condition 2021-04-10 12:43:07 +03: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
d6187de4cd Use name![derive] 2021-04-09 14:50:42 +02: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
bors[bot]
972e1f4b8c
Merge #8445
8445: `hir_ty` cleanup r=flodiebold a=flodiebold

Move lots of things around within `hir_ty`. Most notably, all the Chalk-related stuff moves from within `traits/` to the top-level, since Chalk isn't purely a "traits thing" anymore.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-09 12:43:48 +00:00
Florian Diebold
fbe98047d4 More cleanups / module docs 2021-04-09 14:40:58 +02:00
Florian Diebold
8a2c482082 More cleanups 2021-04-09 14:33:31 +02:00
Florian Diebold
2f02977e56 More moving stuff around 2021-04-09 14:28:04 +02:00
Jonas Schievink
c51213c2e7 Use pub(crate) 2021-04-09 14:24:31 +02:00
Jonas Schievink
ac980e96e5 Shrink unlinked-file diagnostic to 3 characters 2021-04-09 14:22:38 +02:00
Florian Diebold
9fba7cf827 Move some more stuff to better places 2021-04-09 14:18:58 +02:00
Florian Diebold
5ca481bbdc Move ToChalk -> mapping 2021-04-09 14:15:26 +02:00
Florian Diebold
743faa21e7 Reorganize hir_ty modules
Chalk isn't really a 'traits' thing anymore, so it doesn't make sense to
have all the Chalk-related stuff in submodules of `traits`.
2021-04-09 14:11:37 +02:00
Jonas Schievink
7e78aebc8f Rewrite #[derive] removal to be based on AST 2021-04-09 14:10:54 +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
bors[bot]
99ed68a109
Merge #8406
8406: Improve indexing of impls r=flodiebold a=flodiebold

Store impls for e.g. &Foo with the ones for Foo instead of the big "other" bucket. This can improve performance and simplifies the HIR impl search a bit.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-04-09 10:45:34 +00:00
Florian Diebold
fdd721e9ef Improve indexing of impls
Store impls for e.g. &Foo with the ones for Foo instead of the big
"other" bucket. This can improve performance and simplifies the HIR impl
search a bit.
2021-04-09 11:21:31 +02:00
Florian Diebold
272a8dce4f Fix crash on syn involving lifetimes returned by Chalk
If we get lifetime variables back in autoderef, just immediately replace
them by static lifetimes for now. Method resolution doesn't really deal
correctly with new variables being introduced (this needs to be fixed
more properly).

This fixes `rust-analyzer analysis-stats --with-deps` crashing in the RA
repo.
2021-04-09 11:17:07 +02:00
bors[bot]
354151df35
Merge #8429
8429: 8425: Added documentation for on enter covering //! doc comments. r=jonas-schievink a=chetankhilosiya

Also added passing test case.

Co-authored-by: Chetan Khilosiya <chetan.khilosiya@gmail.com>
2021-04-08 23:33:36 +00:00
Florian Diebold
37ff15ad83 Cleanup 2021-04-08 22:49:10 +02:00
Florian Diebold
417473aa3d Intern Variances
This may be a slight performance improvement.
2021-04-08 22:48:47 +02:00
Florian Diebold
f778e50b71 Don't intern ProgramClause at all
This seems to work best performance/memory-wise.
2021-04-08 22:48:47 +02:00
Florian Diebold
566200342a Intern QuantifiedWhereClauses
Slight performance and memory usage improvement.
2021-04-08 22:48:47 +02:00
Florian Diebold
15b0b55b4e Intern ProgramClauses 2021-04-08 22:48:47 +02:00
Florian Diebold
317c4b972f Intern CanonicalVarKinds
Slight savings in performance and memory.
2021-04-08 22:48:47 +02:00
Florian Diebold
90656f8674 Intern consts & lifetimes
Slight memory usage reduction.
2021-04-08 22:48:47 +02:00
Florian Diebold
37cb6805af Intern types
Performance about the same, memory reduced by ~5%.
2021-04-08 22:48:47 +02:00
Florian Diebold
be03db0e3a Intern Substitutions
(Costs a bit of performance, reduces memory usage on RA by ~10%.)
2021-04-08 22:48:47 +02:00
Florian Diebold
a169fa6a83 Intern VariableKinds 2021-04-08 22:48:47 +02:00
Chetan Khilosiya
4a9dd149aa 8024: Added the trait modifier for assoc types. 2021-04-09 01:00:35 +05:30
Chetan Khilosiya
a8b5400cc6 8425: Added documentation for on enter covering //! doc comments.
Also added passing test case.
2021-04-09 00:31:07 +05:30
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
bors[bot]
94d9fc2a28
Merge #8421
8421: Reduce allocations in "Expand macro" formatter r=edwin0cheng a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-08 15:43:30 +00:00
bors[bot]
72ad5cbe16
Merge #8419 #8423
8419: Move hir_ty to Chalk IR r=flodiebold a=flodiebold

Closes #8313.

There's some further cleanups to do:
 - we're still using our `TypeWalk` in lots of places (not for mutating/folding though, just for walking)
 - we're still using our own canonicalization and unification and our `InferenceTable`
 - ~`ToChalk` still exists and gets called, it's just the identity in most cases now (I'll probably clean those up before merging this)~

8423: Bump lsp-types and syn r=kjeremy a=kjeremy

This lsp-types now supports a default InsertTextMode for completion and a per-completion item commit_characters

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-04-08 15:00:53 +00:00
kjeremy
3634b2145c Bump lsp-types and syn
This lsp-types now supports a default InsertTextMode for completion and a per-completion item commit_characters
2021-04-08 10:57:47 -04:00
Laurențiu Nicola
48b946bde1 Reduce allocations in Expand macro 2021-04-08 17:37:43 +03:00
Florian Diebold
d992736e79 Remove unused 2021-04-08 14:36:14 +02:00
Florian Diebold
8040f4a5e3 Replace make_binders by the now equivalent make_only_type_binders 2021-04-08 14:23:17 +02:00
Florian Diebold
8ce6fea325 Remove identity impls for ToChalk 2021-04-08 14:23:17 +02:00
Florian Diebold
a163554857 Fix Canonicalized::apply_solution
Now that we're using Chalk's `substitute` which actually knows about
lifetimes, the hack doesn't work anymore, but we can put in a proper
lifetime.
2021-04-08 14:23:17 +02:00
Florian Diebold
a838a60caa Fix missing match arms 2021-04-08 14:23:17 +02:00