Commit Graph

14622 Commits

Author SHA1 Message Date
Jonas Schievink f8f44cfb9b Fall back to parent DefMaps when resolving paths 2021-01-21 15:24:15 +01:00
Jonas Schievink 896dfacfc4 Add name resolution query for block expressions 2021-01-21 15:22:17 +01:00
bors[bot] 0045d7c6db Merge #7370
7370: fix mega bug r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-21 13:38:28 +00:00
Aleksey Kladov feb252138d Fix mega bug
https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Manual.20content.20is.20duplicated
2021-01-21 16:37:46 +03:00
bors[bot] 64a92e2328 Merge #7368
7368: Clarify enabled features and defined features in PackageData r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-21 11:30:38 +00:00
Edwin Cheng ac3ec18f4b Added defined_features in PackageData 2021-01-21 19:12:19 +08:00
bors[bot] cc53252e87 Merge #7367
7367: Bump chalk r=lnicola a=lnicola

Fixes #6945
Fixes #6812

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-21 08:33:25 +00:00
Laurențiu Nicola e42dfd7a40 Bump chalk 2021-01-21 10:29:19 +02:00
bors[bot] 70f7a10013 Merge #7366
7366: Treat BlockExpr as a potential module origin r=jonas-schievink a=jonas-schievink

A block containing inner items acts like the root module of a crate, so it needs to be representable as a `ModuleSource` and `ModuleOrigin`.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-20 22:07:38 +00:00
Jonas Schievink 82146737ac Treat BlockExpr as a potential module origin 2021-01-20 20:05:48 +01:00
bors[bot] 7d5ed18c42 Merge #7365
7365: chalk 0.49.0 r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-20 17:35:15 +00:00
kjeremy 1e0b163860 chalk 0.49.0 2021-01-20 12:31:03 -05:00
bors[bot] 42c5979fe5 Merge #7364
7364: DefMap: hide remaining crate-visible fields r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-20 17:18:44 +00:00
Jonas Schievink 5f319ca7ee DefMap: hide remaining crate-visible fields 2021-01-20 18:17:48 +01:00
bors[bot] e62533c3ec Merge #7359
7359: ItemTree: store a mapping from blocks to inner items r=jonas-schievink a=jonas-schievink

To do name resolution within block expressions, we need to know which inner items are located inside each block expression. This adds such a mapping to `ItemTree`, replacing the previous one, which was seemingly unused other than to access all the inner items.

This also assigns `AstId`s to block expressions, which is needed to store the mapping in salsa.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-20 16:09:22 +00:00
bors[bot] 9d10aa0972 Merge #7361
7361: bump serde r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-20 14:55:53 +00:00
bors[bot] 15b59fe434 Merge #7360
7360: Make public DefMap fields private r=jonas-schievink a=jonas-schievink

This gives us more freedom to change the implementation for name resolution within block expressions.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-20 14:44:49 +00:00
kjeremy 46359ae841 bump serde 2021-01-20 09:44:48 -05:00
Jonas Schievink 0587b99fde Make public DefMap fields private 2021-01-20 15:41:18 +01:00
Jonas Schievink c5ed2284b5 Create a mapping from blocks to inner items 2021-01-20 15:00:28 +01:00
bors[bot] de5aabd48b Merge #7350
7350: Update pico-args r=matklad a=kjeremy

Should maintain existing behavior

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-20 12:28:10 +00:00
bors[bot] 6cf3d669e2 Merge #7357
7357: Dont show runnables from nested mods r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-20 11:49:59 +00:00
Aleksey Kladov 74f8201586 Avoid intermediate collections 2021-01-20 14:49:29 +03:00
Aleksey Kladov 724059569b Don't show runnable suggestions for other files
It't be actually great to have these once we have run anything dialog,
but for run the thing at point it makes sense to show a limited set.
2021-01-20 14:30:50 +03:00
bors[bot] b28c903b18 Merge #7355
7355: ⬆️ rowan r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-20 11:08:00 +00:00
Aleksey Kladov 3429b32ad1 ⬆️ rowan
It now stores text inline with tokens
2021-01-20 14:04:53 +03:00
Aleksey Kladov 46b4f89c92 . 2021-01-20 01:56:11 +03:00
bors[bot] 63f509f492 Merge #7352
7352: ⬆️ rowan r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-19 19:19:24 +00:00
Aleksey Kladov cd21b0e9c1 ⬆️ rowan 2021-01-19 22:11:42 +03:00
bors[bot] f647e134a7 Merge #7351
7351: Show const params in completions r=Veykril a=Veykril

bors r+
![image](https://user-images.githubusercontent.com/3757771/105080872-bba76680-5a91-11eb-91cd-0910da4c8312.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-19 19:07:33 +00:00
Lukas Wirth bed12833cc Show const params in completions 2021-01-19 20:06:39 +01:00
Jonas Schievink 52fe50a97b Record FileAstIds for block expressiosn
Every block expression may contain inner items, so we need to be able
to refer to any block expression and use it as a salsa key.
2021-01-19 19:49:19 +01:00
kjeremy db0aaeca33 Update pico-args
Should maintains existing behavior
2021-01-19 11:56:45 -05:00
bors[bot] 02edb4b31b Merge #7347
7347: Reduce TokenMap size r=edwin0cheng a=edwin0cheng

Reduces HygieneFrameQuery's memory usage by to another 10 MB.

cc #7331

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-19 11:28:58 +00:00
Edwin Cheng 7b3e960d94 Reduce TokenMap size 2021-01-19 19:26:53 +08:00
bors[bot] 8935106b39 Merge #7321
7321: Support runnables in macros r=matklad a=edwin0cheng

fixes  #4771

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-19 09:27:45 +00:00
bors[bot] 08aa0bec95 Merge #7346
7346: ⬆️ rowan r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-19 09:05:53 +00:00
Aleksey Kladov 4d510dfc56 ⬆️ rowan 2021-01-19 12:05:27 +03:00
Edwin Cheng 8b03b58ad7 Support runnables in macros 2021-01-19 16:58:11 +08:00
bors[bot] 00680a5d7c Merge #7342
7342: Show deprecated completions for deprecated traits r=kjeremy a=SomeoneToIgnore

TIL that there are two kinds of deprecation tags and a few details about String methods.

<img width="472" alt="Screenshot 2021-01-19 at 01 11 38" src="https://user-images.githubusercontent.com/2690773/104970200-569d3380-59f3-11eb-9ee3-627b3c8a5c9d.png">


Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-01-19 01:33:49 +00:00
bors[bot] 5231f4b270 Merge #7341
7341: Fix warnings when running `cargo doc --document-private-items` r=Veykril a=jyn514

These were the warnings previously:

<details>

```
warning: could not parse code block as Rust code
   --> crates/stdx/src/lib.rs:137:9
    |
137 |   ///     ∀ x in slice[..idx]:  pred(x)
    |  _________^
138 | | ///  && ∀ x in slice[idx..]: !pred(x)
    | |____^
    |
    = note: error from rustc: unknown start of token: \u{2200}

warning: 1 warning emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted
```

</details>

This does *not* fix the following warning, because it is actually rust
code and rustdoc is being over eager:

```
warning: Rust code block is empty
  --> crates/parser/src/grammar.rs:16:5
   |
16 |   //! ```
   |  _____^
17 | | //! // test function_with_zero_parameters
18 | | //! // fn foo() {}
19 | | //! ```
   | |_______^
   |
help: mark blocks that do not contain Rust code as text
   |
16 | //! ```text
   |     ^^^^^^^
```

https://github.com/rust-lang/rust/pull/79816 should make this
configurable so the warning can be `allow`ed.

Co-authored-by: Joshua Nelson <jyn514@gmail.com>
2021-01-18 23:19:53 +00:00
Kirill Bulatov ca65488276 Show deprecated completions for deprecated traits 2021-01-19 01:08:59 +02:00
Kirill Bulatov cc663a7b0c Consider rustc_deprecated attr when checking for deprecation 2021-01-19 00:04:24 +02:00
Joshua Nelson e7d1f30cb3 Fix warnings when running cargo doc --document-private-items
These were the warnings previously:

```
warning: could not parse code block as Rust code
   --> crates/stdx/src/lib.rs:137:9
    |
137 |   ///     ∀ x in slice[..idx]:  pred(x)
    |  _________^
138 | | ///  && ∀ x in slice[idx..]: !pred(x)
    | |____^
    |
    = note: error from rustc: unknown start of token: \u{2200}

warning: 1 warning emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted
```

This does *not* fix the following warning, because it is actually rust
code and rustdoc is being over eager:

```
warning: Rust code block is empty
  --> crates/parser/src/grammar.rs:16:5
   |
16 |   //! ```
   |  _____^
17 | | //! // test function_with_zero_parameters
18 | | //! // fn foo() {}
19 | | //! ```
   | |_______^
   |
help: mark blocks that do not contain Rust code as text
   |
16 | //! ```text
   |     ^^^^^^^
```

https://github.com/rust-lang/rust/pull/79816 should make this
configurable so the warning can be `allow`ed.
2021-01-18 16:44:40 -05:00
bors[bot] bf889bcf3b Merge #7340
7340: Remove obsolete RangeInfo usage in references r=Veykril a=Veykril

Didn't even realize these were only here for renaming as well!

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 20:25:26 +00:00
bors[bot] 0791c8e44c Merge #7336
7336: Rename `CrateDefMap` to `DefMap` r=matklad a=jonas-schievink

I propose handling local items by computing a `DefMap` for every block expression, using the regular (early) name resolution algorithm. The result of that will be a `DefMap` that has a reference to the parent `DefMap`, which is either the one computed for the containing block expression, or the crate's root `DefMap`. Name resolution will fall back to a name in the parent `DefMap` if it cannot be resolved in the inner block.

The `DefMap`s computed for block expressions will go through a separate query that can be garbage-collected much more aggressively, since these `DefMap`s should be cheap to compute and are never part of a crate's public API.

The first step towards that is to make `CrateDefMap` not specific to crates anymore, hence this rename (if this plans sounds reasonable).

cc https://github.com/rust-analyzer/rust-analyzer/issues/7325 and https://github.com/rust-analyzer/rust-analyzer/issues/1165

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-18 20:12:11 +00:00
Lukas Wirth e31420fbe2 Remove obsolete RangeInfo usage in references 2021-01-18 21:10:01 +01:00
bors[bot] 8164e2ea31 Merge #7339
7339: Delete optional arg for inline attr and add doc alias attr completion r=lnicola a=bnjjj

close #7167

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-01-18 19:54:40 +00:00
Benjamin Coenen 52bce6bf5d Delete optional arg for inline attr and add doc alias attr completion #7167
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-01-18 20:50:45 +01:00
bors[bot] 342bf41022 Merge #7297 #7338
7297: Propose trait associated items and autoimport traits on completion r=matklad a=SomeoneToIgnore

![trait_imports](https://user-images.githubusercontent.com/2690773/104819998-6faeb480-583a-11eb-8b45-b7351b51b90e.gif)

Closes #7248

7338: Parse `impl const Trait` r=Veykril a=Veykril

Closes #7313

bors r+

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 19:40:11 +00:00