Commit graph

292 commits

Author SHA1 Message Date
bors[bot]
4b997b8663
Merge #8156
8156: Correctly lower TraitRefs with default params r=flodiebold a=Veykril

Fixes #5685

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-22 20:39:58 +00:00
Lukas Wirth
0aa4ac362d Correctly lower TraitRefs with default params 2021-03-22 19:13:43 +01:00
Jonas Schievink
2633e23f2b resolver: manually traverse nested block scopes 2021-03-22 18:55:51 +01:00
bors[bot]
3af1885bd2
Merge #8144
8144: bail out early for source code closures r=Veykril a=hi-rustin

close https://github.com/rust-analyzer/rust-analyzer/issues/8084

Co-authored-by: hi-rustin <rustin.liu@gmail.com>
2021-03-22 12:35:44 +00:00
bors[bot]
e220d3d507
Merge #8139
8139: Align `Canonical` and `InEnvironment` with the Chalk versions r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-22 12:25:53 +00:00
bors[bot]
6f1f91cdcf
Merge #8136 #8146
8136: Introduce QuantifiedWhereClause and DynTy analogous to Chalk r=flodiebold a=flodiebold

This introduces a bunch of new binders in lots of places, which we have to be careful about, but we had to add them at some point. There's a lot of skipping of the binders; once we're done with the Chalk move, we should review the remaining ones.

8146: Document patch policy r=matklad a=matklad

bors r+
🤖

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-22 12:08:25 +00:00
hi-rustin
2e09714dfe bail out early for source code closures
add closure error
2021-03-22 19:40:07 +08:00
bors[bot]
858ad55437
Merge #8137
8137: Fix box pattern inference panic r=flodiebold a=Veykril

Fixes #6560

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-21 19:25:14 +00:00
Florian Diebold
c4fd3f47f5 Align InEnvironment with Chalk
This in particular means storing a chalk_ir::Environment, not our
TraitEnvironment. This makes InEnvironment not usable for Type, where we
need to keep the full TraitEnvironment.
2021-03-21 20:19:07 +01:00
Florian Diebold
f7be314579 Align Canonical more with Chalk's version
In particular, use chalk_ir::CanonicalVarKinds.
2021-03-21 20:05:38 +01:00
bors[bot]
31ed164161
Merge #8134
8134: Correct the paths of submodules from the include! macro r=edwin0cheng a=sticnarf

This PR should fix #7846. It mostly follows the instructions from @edwin0cheng in that issue.

Co-authored-by: Yilin Chen <sticnarf@gmail.com>
2021-03-21 17:57:45 +00:00
Lukas Wirth
af50e8d955 Fix box pattern inference panic 2021-03-21 18:25:00 +01:00
Florian Diebold
1d5c4a77fb Use QuantifiedWhereClause in generic_predicates as well
Still far too much binder skipping going on; I find it hard to imagine
this is all correct, but the tests pass.
2021-03-21 18:01:14 +01:00
Florian Diebold
590c416359 Introduce QuantifiedWhereClause and DynTy analogous to Chalk
This introduces a bunch of new binders in lots of places, which we have
to be careful about, but we had to add them at some point.
2021-03-21 18:01:14 +01:00
bors[bot]
35868c4f7d
Merge #8133
8133: Ignore type bindings in generic_predicates_for_param (fix panic on ena and crates depending on it) r=flodiebold a=flodiebold

This allows us to handle more cases without a query cycle, which includes certain cases that rustc accepted. That in turn means we avoid triggering salsa-rs/salsa#257 on valid code (it will still happen if the user writes an actual cycle).

We actually accept more definitions than rustc now; that's because rustc only ignores bindings when looking up super traits, whereas we now also ignore them when looking for predicates to disambiguate associated type shorthand. We could introduce a separate query for super traits if necessary, but for now I think this should be fine.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-21 16:42:08 +00:00
Yilin Chen
3bb9efb6b7
use the included file as the source of expanded include macro
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2021-03-21 23:02:01 +08:00
Florian Diebold
d8f8b495ad Ignore type bindings in generic_predicates_for_param
This allows us to handle more cases without a query cycle, which
includes certain cases that rustc accepted. That in turn means we avoid
triggering salsa-rs/salsa#257 on valid code (it will still happen if the
user writes an actual cycle).

We actually accept more definitions than rustc now; that's because rustc
only ignores bindings when looking up super traits, whereas we now also
ignore them when looking for predicates to disambiguate associated type
shorthand. We could introduce a separate query for super traits if
necessary, but for now I think this should be fine.
2021-03-21 15:29:03 +01:00
Florian Diebold
0623bb4d71 Test for a Salsa bug 2021-03-21 13:33:06 +01:00
Matthias Krüger
ae7e55c1dd clippy::complexity simplifications related to Iterators 2021-03-21 13:13:34 +01:00
Matthias Krüger
3d9b3a8575 remove more redundant clones (clippy::redundant_clone()) 2021-03-21 12:10:39 +01:00
Florian Diebold
7ec3b66f7a Turn Obligation into something similar to chalk_ir::DomainGoal
This includes starting to make use of Chalk's `Cast` trait.
2021-03-20 12:47:12 +01:00
Florian Diebold
8e7e405f6a Remove WhereClause::Error
Chalk doesn't have it, and judging from the removed code, it wasn't
useful anyway.
2021-03-20 10:51:00 +01:00
Florian Diebold
7a5fb37cf1 Rename GenericPredicate -> WhereClause 2021-03-20 10:46:36 +01:00
Lukas Wirth
8996b1a235 Replace Projection variant in GenericPredicate with AliasEq 2021-03-19 12:12:18 +01:00
Florian Diebold
7a7e47eab7 Chalkify TraitRef 2021-03-18 21:53:19 +01:00
Jonas Schievink
ebd4c8c5df Fix infinite recursion when computing diagnostics for inner items 2021-03-18 20:15:06 +01:00
bors[bot]
d3da042a62
Merge #8082
8082: Proper handle inner recursive macro rules cases r=edwin0cheng a=edwin0cheng

Fixes #7645

cc @jonas-schievink 

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-18 12:25:44 +00:00
Edwin Cheng
13f30e9ef5 Handle inner recursive macro rules cases 2021-03-18 20:19:15 +08:00
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