Commit graph

264 commits

Author SHA1 Message Date
Jonas Schievink
94b3b32c98 Support #[cfg] on all associated items 2021-03-18 01:28:55 +01:00
Jonas Schievink
a85b32abdc Add test for self-calling inner function 2021-03-17 22:30:09 +01:00
Jonas Schievink
9436436d20 Improve test 2021-03-17 18:35:17 +01:00
Jonas Schievink
6356ea24dd Add test for #[cfg] on function params 2021-03-17 18:28:27 +01:00
Jonas Schievink
cb530e7c97 Handle #[cfg] on call arguments 2021-03-17 15:10:46 +01:00
Matthias Krüger
966c23f529 avoid converting types into themselves via .into() (clippy::useless-conversion)
example: let x: String = String::from("hello world").into();
2021-03-17 01:27:56 +01:00
Florian Diebold
ce2cae45b5 Rename Substs -> Substitution 2021-03-16 17:58:17 +01:00
bors[bot]
1a82af3527
Merge #7900 #8000
7900: show function params in completion detail r=matklad a=JoshMcguigan

This resolves #7842 by updating the detail for function completions from `-> T` to `fn(T, U) -> V`. I added an expicit unit test for this, `ide_completion::render::fn_detail_includes_args_and_return_type`, which passes.

Lots of other unit tests fail (~60 of them) due to this change, although I believe the failures are purely cosmetic (they were testing the exact format of this output). I'm happy to go update those tests, but before I do that I'd like to make sure this is in fact the format we want for the detail?

edit - I realized `UPDATE_EXPECT=1 cargo test` automatically updates `expect!` tests. Big 👍 to whoever worked on that! So I'll go ahead and update all these tests soon. But I still would like to confirm `fn(T, U) -> V` is the desired content in the `detail` field. 

8000: Use hir formatter for hover text r=matklad a=oxalica

Fix #2765 , (should) fix #4665

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
Co-authored-by: oxalica <oxalicc@pm.me>
2021-03-16 08:05:24 +00:00
Edwin Cheng
8e07b23b84 Fix macro expansion for statements w/o semicolon 2021-03-16 13:44:50 +08:00
Florian Diebold
455e755bb0 Use SmallVec for Substs
Doesn't help as much as I hoped, but it helps a bit and I also did some
refactorings that were necessary anyway.
2021-03-15 19:48:03 +01:00
Florian Diebold
287e9a870c Fix unification logic 2021-03-15 19:14:10 +01:00
oxalica
87171238c6
Use hir formatter more 2021-03-16 01:04:33 +08:00
oxalica
ef416e0154
Impl HirDisplay for function hover message 2021-03-16 01:04:20 +08:00
oxalica
2bb8956a10
Introduce FunctionQualifier for hir::FunctionData 2021-03-16 01:03:07 +08:00
bors[bot]
5f6d71cf0c
Merge #8029
8029: Enable thread-local coverage marks r=JoshMcguigan a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-15 14:42:26 +00:00
bors[bot]
f2c39d0cdf
Merge #8020
8020: Power up goto_implementation r=matklad a=Veykril

by allowing it to be invoked on references of names, now showing all (trait)
implementations of the given type in all crates instead of just the defining
crate as well as including support for builtin types

![image](https://user-images.githubusercontent.com/3757771/111144403-52bb0700-8587-11eb-9205-7a2a5b8b75a3.png)
Example screenshot of `impl`s of Box in `log`, `alloc`, `std` and the current crate. Before you had to invoke it on the definition where it would only show the `impls` in `alloc`.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-15 14:08:26 +00:00
Laurențiu Nicola
88cee24c6c Enable thread-local coverage marks 2021-03-15 16:02:50 +02:00
bors[bot]
6139bd7649
Merge #8018
8018: Make Ty wrap TyKind in an Arc r=flodiebold a=flodiebold

... to further move towards Chalk.

This is a bit of a slowdown (218ginstr vs 213ginstr for inference on RA), even though it allows us to unwrap the Substs in `TyKind::Ref` etc..

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-15 12:51:27 +00:00
Lukas Wirth
6241567948 Speedup trait impl search for goto_implementation 2021-03-15 13:49:21 +01:00
Aleksey Kladov
f7156cb0ae Simplify source maps for fields 2021-03-15 15:38:50 +03:00
Florian Diebold
42217738e0 Don't use Substs for Ref/Raw/Array/Slice 2021-03-14 20:21:05 +01:00
Florian Diebold
af466f8542 Make Ty wrap TyKind in an Arc
... like it will be in Chalk. We still keep `interned_mut` and
`into_inner` methods that will probably not exist with Chalk.

This worsens performance slightly (5ginstr inference on RA), but doesn't
include other simplifications we can do yet.
2021-03-14 17:31:08 +01:00
Florian Diebold
1954147834 More renaming 2021-03-14 16:33:27 +01:00
Florian Diebold
eea777c714 Use chalk_ir::FnSig 2021-03-14 16:30:43 +01:00
Florian Diebold
3411fe3e84 Rename some fields to their Chalk names 2021-03-14 16:30:43 +01:00
Florian Diebold
3743ede404 Move type lowering methods to TyLoweringContext 2021-03-13 22:44:36 +01:00
Florian Diebold
c82d1823a1 Create TraitEnvironment through a query 2021-03-13 20:38:45 +01:00
Florian Diebold
b035c314b4 Use chalk_ir::OpaqueTyId 2021-03-13 20:05:47 +01:00
Florian Diebold
1bf6b7360c Use chalk_ir::PlaceholderIndex 2021-03-13 19:47:34 +01:00
Florian Diebold
2d69eb131f Use chalk_ir::ClosureId 2021-03-13 19:27:09 +01:00
Florian Diebold
9719ce9fc7 Use chalk_ir::FnDefId 2021-03-13 17:56:48 +01:00
Florian Diebold
19664e276a Use chalk_ir::AssocTypeId 2021-03-13 17:56:48 +01:00
Florian Diebold
dfafcd926a Use chalk_ir::ForeignDefId 2021-03-13 17:56:48 +01:00
Florian Diebold
6c32bbf3ca Separate Ty and TyKind like in Chalk
Currently `Ty` just wraps `TyKind`, but this allows us to change most
places to already use `intern` / `interned`.
2021-03-13 16:17:15 +01:00
Jonas Schievink
8447f101ac Remove ItemTree::source
`HasSource` should be used instead
2021-03-12 23:54:29 +01:00
Florian Diebold
784636f1c1 Simplify a bit 2021-03-12 20:51:29 +01:00
Florian Diebold
ec70387a4c Use Chalk Environment more directly 2021-03-12 19:12:17 +01:00
Jonas Schievink
c2622c9228 Prefer names from outer DefMap over extern prelude 2021-03-10 16:33:18 +01:00
Aleksey Kladov
842d8ad9c8 Compilation speed 2021-03-09 22:30:58 +03:00
Jonas Schievink
b885e6bdee Delete ContainerId 2021-03-09 19:09:02 +01:00
Jonas Schievink
a430549aa6 Stop using ContainerId in AssocContainerId 2021-03-09 18:27:23 +01:00
Jonas Schievink
12f6bdcfd9 Check ancestor maps when computing traits in scope 2021-03-09 18:27:23 +01:00
Jonas Schievink
1da0a27626 Use body.block_scopes in hir_ty tests 2021-03-09 18:27:23 +01:00
Jonas Schievink
0cb46a9e8d Use body.block_scopes to validate inner items 2021-03-09 18:27:23 +01:00
Laurențiu Nicola
fc9eed4836 Use upstream cov-mark 2021-03-08 22:19:44 +02:00
kjeremy
e13ac349b5 Cargo update
Chalk changes just a version # bump. There are no actual commits.
2021-03-08 10:39:11 -05:00
Laurențiu Nicola
d3ca22876c Make two calls virtual 2021-03-05 20:25:24 +02:00
Lukas Wirth
50e01d2bc7 Use chalk_ir::AdtId 2021-03-04 19:38:02 +01:00
bors[bot]
a6ee8e9e76
Merge #7829 #7833
7829: Bump deps r=matklad a=lnicola

Unfortunately, this brings a bunch of proc macros dep because `cargo-metadata` went full-in on `derive-builder`. I'm not sure what we can do here..

7833: Use chalk_ir::Mutability r=Veykril a=Veykril



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-01 19:31:01 +00:00
Lukas Wirth
7072f59fc6 Use chalk_ir::Mutability 2021-03-01 19:57:36 +01:00