Commit Graph

469 Commits

Author SHA1 Message Date
cynecx
6ed2fd233b hir_ty: keep body::Expander in TyLoweringContext 2021-04-18 19:56:13 +02:00
cynecx
7ed42a3a52 hir_def: refactor expand_macro_type and cleanups 2021-04-17 17:38:45 +02:00
cynecx
28ef7c20d7 hir_ty: deal with TypeRef::Macro in HirFormatter 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
bors[bot]
5274eb12dd
Merge #8539
8539:  fix: Do not propose inherent traits in flyimports and import assists r=flodiebold a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8520

I've went with a separate method approach, since the [highlighted code](https://github.com/rust-analyzer/rust-analyzer/issues/8520#issuecomment-819856337) has not`Type` and uses `Ty` to get his data, but the code I had to change has no access to `Ty` and has `Type` only.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-04-16 17:54:47 +00:00
Jonas Schievink
543d4ef7c5 Fix primitive shadowing with inner items 2021-04-16 19:28:22 +02:00
Kirill Bulatov
739edfd5cf Exclude inherent traits from flyimports 2021-04-16 11:13:17 +03:00
Kirill Bulatov
af8a6049a5 Profile trait solving for all invocations 2021-04-14 19:11:17 +03:00
Kirill Bulatov
75a2605361 Better places for spans 2021-04-14 17:15:37 +03:00
Kirill Bulatov
3390e73816 We need to go deeper 2021-04-14 16:59:08 +03:00
Kirill Bulatov
d1fc9d727b Add a missing span 2021-04-14 15:52:56 +03:00
Jonas Schievink
31594bcd01 decl_check: follow test style guide 2021-04-13 14:13:35 +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
Jade
26d2653dd6 address review feedback 2021-04-13 01:21:03 -07:00
Florian Diebold
97d6e36dbe Remove assertion in impl collection
This condition should always be true for *valid* code, but of course
there might be invalid code or things that we can't currently resolve.

Fixes #8464.
2021-04-11 12:07:58 +02:00
bors[bot]
5b40342d2d
Merge #8465
8465: Include more info in assert r=jonas-schievink a=jonas-schievink

This helped find https://github.com/rust-analyzer/rust-analyzer/issues/8464

changelog skip

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-10 23:42:26 +00:00
Jonas Schievink
5f2efae3ba Include more info in assert 2021-04-11 01:41:40 +02:00
Jonas Schievink
e2c1da36f5 Support macros in pattern position 2021-04-11 01:25:50 +02:00
Lukas Wirth
8113c3a914 Respect test style guidelines in tests::traits 2021-04-10 18:03:27 +02:00
Lukas Wirth
a15b8136ee Add test for binary op return ty with adt 2021-04-10 17:52:24 +02:00
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
Jonas Schievink
75614b126b Resolve prelude and crate root names in the root DefMap 2021-04-09 15:29:42 +02: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
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
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
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
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
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
Florian Diebold
f43edb2151 Fix remaining interned_mut call 2021-04-08 14:08:55 +02:00
Florian Diebold
0f058d61ce Replace remaining fold calls 2021-04-08 14:08:55 +02:00