Commit Graph

5336 Commits

Author SHA1 Message Date
Florian Diebold
d17c5416af Resolve Self::AssocTy in impls
To do this we need to carry around the original resolution a bit, because `Self`
gets resolved to the actual type immediately, but you're not allowed to write
the equivalent type in a projection. (I tried just comparing the projection base
type with the impl self type, but that seemed too dirty.) This is basically how
rustc does it as well.

Fixes #3249.
2020-03-06 18:14:39 +01:00
Aleksey Kladov
b33b843f40 Allow specifying additional info on call to profile 2020-03-06 17:36:51 +01:00
Aleksey Kladov
59f91f2f9b Less confusing profile names 2020-03-06 16:40:38 +01:00
bors[bot]
aa82b5915d
Merge #3494
3494: Implement include macro r=matklad a=edwin0cheng

This PR implement builtin `include` macro.

* It does not support include as expression yet.
* It doesn't consider `env!("OUT_DIR")` yet.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-06 15:08:41 +00:00
Edwin Cheng
0a06c7e6e6 Implment include macro 2020-03-06 22:58:45 +08:00
bors[bot]
4173645a71
Merge #3493
3493: make::use_item r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 14:56:52 +00:00
Aleksey Kladov
1f84c3b18f make::use_item 2020-03-06 15:56:25 +01:00
bors[bot]
995a92814f
Merge #3490
3490: Support aliases and Self in struct literals r=matklad a=flodiebold

Fixes #3306.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-03-06 14:46:03 +00:00
Florian Diebold
073a1ef834 Support aliases and Self in struct literals
Fixes #3306.
2020-03-06 15:43:14 +01:00
bors[bot]
13879afdd5
Merge #3492
3492: Simplify creation of `T[,]` r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 14:39:20 +00:00
Aleksey Kladov
85e2346b74 Simplify creation of T[,] 2020-03-06 15:38:48 +01:00
Aleksey Kladov
57da3df99a Explicitly remember desugard pats 2020-03-06 15:17:48 +01:00
Aleksey Kladov
5ffddc4b92 Explicitly remember desugard exprs 2020-03-06 15:11:05 +01:00
Aleksey Kladov
fb5891c433 Source map returns a result
cc #2236
2020-03-06 14:44:44 +01:00
Aleksey Kladov
ea0c124219 Rerail split_import API onto AST
The code is more verbose and less efficient now, but should be
reusable in add_import context as well
2020-03-06 14:08:43 +01:00
bors[bot]
d75577fcee
Merge #3483
3483: Unfold groups with single assists into plain assists r=matklad a=SomeoneToIgnore

A follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/3120/files#r378788698 , made to show more detailed label when the assist group contains a single element

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-03-06 10:10:16 +00:00
bors[bot]
670895a49c
Merge #3482
3482: Fix regression from #3451 r=matklad a=edwin0cheng

There is a regression from #3451 such that the following code has failed to parse in raw item collecting phase:

```rust
macro_rules! with_std { 
 	($($i:item)*) => ($(#[cfg(feature = "std")]$i)*) 
}

with_std! {
	mod macros;
	mod others;
}
```

### Rationale

We always assume the last token of an statement will not end with a whitespace, which is true. It is because in parsing phase,  we always emit `SyntaxNode` before any whitespace. Such that in various parts of RA code, we solely check the semi-colon by using `SyntaxNode::last_child_token() == ";"` . 

However, in #3451, we insert some whitespaces between puncts such that we broke above assumption. This PR fixed this bug by make sure we don't add any whitespace if it is a semicolon.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-06 10:03:54 +00:00
Kirill Bulatov
0ff8c55246 Unfold groups with single assists into plain assists 2020-03-06 00:17:26 +02:00
Edwin Cheng
0563cc8291 fix regression from #3451 2020-03-06 04:32:08 +08:00
Aleksey Kladov
381ace587e Add with_use_tree 2020-03-05 18:38:52 +01:00
Aleksey Kladov
b96da48809 Add profiling calls 2020-03-05 14:22:31 +01:00
bors[bot]
f3f39b4327
Merge #3475
3475: Fix options for analysis-bench r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-05 12:58:41 +00:00
Aleksey Kladov
17876d79e4 Fix options for analysis-bench 2020-03-05 13:58:11 +01:00
Aleksey Kladov
fc970d188e Prime open files on load 2020-03-05 13:40:53 +01:00
Aleksey Kladov
b6819c2595
Merge pull request #3451 from edwin0cheng/fix-mbe-composited
Fix mbe composited token bug
2020-03-05 11:16:45 +01:00
Aleksey Kladov
7d873fcfa1 Move PathResolution 2020-03-05 11:08:31 +01:00
Aleksey Kladov
7b6716e50e Remove dead code 2020-03-05 11:06:23 +01:00
Edwin Cheng
0c79e1d304 Add comment for parents logging 2020-03-05 03:02:51 +08:00
Edwin Cheng
c7b0c72dd7 Fix whitespace in tests 2020-03-05 00:12:39 +08:00
Edwin Cheng
6794d50a9b Fixed whitespace bug 2020-03-04 23:41:14 +08:00
Edwin Cheng
028595548b Fix #3436 2020-03-04 23:41:14 +08:00
Edwin Cheng
e76dddd610 Add more log 2020-03-04 23:41:04 +08:00
Aleksey Kladov
c21babc58b Minor cleanup 2020-03-04 14:39:51 +01:00
Aleksey Kladov
f57682c0b3 Remove old find refs infra 2020-03-04 14:25:22 +01:00
bors[bot]
94189d0a1c
Merge #3442
3442: Skip self param when completing methods r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-04 12:02:06 +00:00
Aleksey Kladov
7d2ddfd3c8 Skip self param when completing methods 2020-03-04 13:01:16 +01:00
Aleksey Kladov
4f50a37187 Fix docs 2020-03-04 12:48:50 +01:00
Aleksey Kladov
98d68fa6be Cleanup API 2020-03-04 12:46:40 +01:00
Aleksey Kladov
072ec1a8ae Fix tests 2020-03-04 12:24:28 +01:00
Aleksey Kladov
994000b5dd Use method instead of a free function 2020-03-04 12:22:47 +01:00
Aleksey Kladov
e839d793ae Drop one once_cell dep 2020-03-04 12:22:47 +01:00
Aleksey Kladov
f79719b8ae Move find_refs_to_def 2020-03-04 12:22:47 +01:00
Aleksey Kladov
2638bec66c Merge refs_to_def and process_def 2020-03-04 12:22:06 +01:00
Aleksey Kladov
1874b6738a Move ReferenceKind 2020-03-04 12:22:06 +01:00
Aleksey Kladov
a549da7e3e Move SearchScope 2020-03-04 12:22:06 +01:00
bors[bot]
66ec6bdfb0
Merge #3432
3432: Feature/snippet completions r=matklad a=iTZAvishay

This PR implements #1705 and is based on #3430 to avoid future conflicts.

The completions are placing default values with the names of the parameters, demo: 
![call_me_demo](https://user-images.githubusercontent.com/5567310/75828341-461ca400-5db4-11ea-88d8-88e59ac1a197.gif)


Co-authored-by: Avishay Matayev <me@avishay.dev>
2020-03-04 11:05:14 +00:00
Aleksey Kladov
5095573139 Remove stray FIXME 2020-03-04 11:55:25 +01:00
Aleksey Kladov
19115e9fab Support cross-crate marks 2020-03-04 11:55:25 +01:00
Avishay Matayev
fb34a5ba06 Support function's completion snippet
Note that `detail` was replced with `function_signature` to avoid
calling `from` on FunctionSignature twice.

I didn't add new tests because the current ones seem enough.
2020-03-04 11:03:32 +02:00
bors[bot]
437329d3f5
Merge #3429
3429: Fix panic on eager expansion r=matklad a=edwin0cheng

When lazy expanding inside an eager macro, its *parent* file of that lazy macro call must be already exists such that a panic is occurred because that parent file is the eager macro we are processing.

This PR fix this bug by store the argument syntax node as another eager macro id for that purpose.

Personally I don't know if it is a good answer for this bug. 




Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-04 00:05:10 +00:00