Commit Graph

13954 Commits

Author SHA1 Message Date
Aleksey Kladov
2465fa02b7 Cleaup imports
ide should re-export everything it needs.
2020-12-18 18:02:11 +03:00
bors[bot]
03c177af89
Merge #6927
6927: Do not merge imports with different attributes r=lnicola a=Jesse-Bakker

Fixes #6925 

Co-authored-by: Jesse Bakker <github@jessebakker.com>
2020-12-18 14:32:53 +00:00
Jesse Bakker
700034bd5a Do not merge imports with different attributes 2020-12-18 15:29:37 +01:00
bors[bot]
f4929fa9cc
Merge #6901
6901: Temp fixes panic caused by no ast for proc-macro r=maklad a=edwin0cheng

There are some panic when hover/goto definition for proc-macro. It is because in current design, we don't have `ast-node` for proc-macro and then it trigger [this](479d1f7eec/crates/hir/src/has_source.rs (L116)) line to panic.

This PR is a temp fix for all of these similar to bd4c352831/crates/completion/src/render/macro_.rs (L42)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-12-18 02:30:51 +00:00
Edwin Cheng
60a3785ac2 Temp fixes panic caused by no ast for proc-macro 2020-12-18 10:26:17 +08:00
bors[bot]
37e5f19373
Merge #6924
6924: Refactor attributes API to allow handling cfg_attr later r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-18 01:25:27 +00:00
Jonas Schievink
4f07d8dd58 Refactor attributes API to allow handling cfg_attr 2020-12-18 02:24:14 +01:00
bors[bot]
a4e17a5a96
Merge #6922
6922: Show first fuzzy completions fully containing the input r=matklad a=SomeoneToIgnore



Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-12-17 21:19:31 +00:00
Kirill Bulatov
9d2cbf05e3 Show first fuzzy completions fully containing the input 2020-12-17 23:10:18 +02:00
bors[bot]
b55cb897e5
Merge #6912
6912: Default to host platform for cargo metadata r=jonhoo a=jonhoo

This modifies the logic for calling cargo metadata so that it will use
the host platform if no explicit target platform is given. This is
needed since cargo metadata defaults to outputting information for _all_
targets.

Fixes #6908.

Co-authored-by: Jon Gjengset <jongje@amazon.com>
Co-authored-by: Jon Gjengset <jon@thesquareplanet.com>
2020-12-17 18:32:13 +00:00
Jon Gjengset
faed47b3d3 Fun times with rustfmt 2020-12-17 10:24:58 -08:00
Jon Gjengset
71478e067b
Update crates/project_model/src/cargo_workspace.rs
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-17 13:18:23 -05:00
bors[bot]
b0e5d1efdb
Merge #6920
6920: Minor API cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-17 17:18:50 +00:00
Aleksey Kladov
30216880c4 Minor API cleanup 2020-12-17 20:14:13 +03:00
bors[bot]
ce3db6c927
Merge #6919
6919: Rewrite doctest runnables r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-17 17:12:09 +00:00
Aleksey Kladov
c888f1de6f Rewrite doctest runnables
Handle more cases in a generic way without copy-pasting code.
2020-12-17 20:11:40 +03:00
Aleksey Kladov
0da1532ef2 Minor code style 2020-12-17 20:10:39 +03:00
bors[bot]
4368a3bceb
Merge #6779
6779: Latest LSP 3.16 r=kjeremy a=kjeremy

Companion to gluon-lang/lsp-types#192

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-12-17 16:35:11 +00:00
kjeremy
d828bd794b LSP 3.16 - Released 2020-12-17 11:33:35 -05:00
bors[bot]
763824e775
Merge #6916
6916: Make `Attrs::from_attrs_owner` private r=matklad a=jonas-schievink

It is only meant for use inside `hir` crates.

Removes `docs_from_symbol`, which didn't seem to have any visible effect in VS Code.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-17 14:57:51 +00:00
Jonas Schievink
9231821c03 Make Attrs::from_attrs_owner private 2020-12-17 15:45:26 +01:00
bors[bot]
3f6077ffe7
Merge #6915
6915: Add `AttrDefId::krate` r=jonas-schievink a=jonas-schievink

Access to the containing crate will be needed to handle `cfg_attr`.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-17 13:30:09 +00:00
Jonas Schievink
eaeabbb815 Add AttrDefId::krate
Access to the containing crate will be needed to handle `cfg_attr`
2020-12-17 14:29:29 +01:00
bors[bot]
ce8ec28638
Merge #6914
6914: Rename ImplDef -> Impl r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-17 11:37:34 +00:00
Aleksey Kladov
2ae31e34b1 Rename ImplDef -> Impl
We used to have `Def` suffix for all symbols, but we moved off from
that. `FunctionDef` isn't better than `Function`. Looks like we've
forgot to change `Impl` though!
2020-12-17 14:36:15 +03:00
bors[bot]
d641bccb0f
Merge #6907
6907: Lifetime reference search  r=matklad a=Veykril

PR #6787 but rewritten to make use of the HIR now. This only applies to Lifetimes, not labels. Also Higher-Ranked Trait Bounds aren't supported yet, but I feel like this PR is big enough as is which is why I left them out after noticing I forgot about them.

Supporting renaming required slight changes in the renaming module as lifetime names aren't allowed for anything but lifetimes(and labels) and vice versa for normal names.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-17 11:00:39 +00:00
bors[bot]
d21f5f7d6e
Merge #6911
6911: decl_check: don't pass `db` around so often r=matklad a=jonas-schievink

Instead, store it in the `DeclValidator`.

Also pass the `CrateId` that defines the checked item along. This is not yet needed, but will be once I've refactored `Attrs` to handle `cfg_attr` internally.

We could also try to extract the crate from the "owner" `ModuleDefId` instead of passing it in, but then it might not be present for builtin types. Open to suggestions.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-17 10:27:28 +00:00
Jon Gjengset
9802c0ccd0 Default to host platform for cargo metadata
This modifies the logic for calling cargo metadata so that it will use
the host platform if no explicit target platform is given. This is
needed since cargo metadata defaults to outputting information for _all_
targets.

Fixes #6908.
2020-12-16 17:38:37 -08:00
Jonas Schievink
6615fda695 decl_check: don't pass db around so often 2020-12-17 01:19:56 +01:00
bors[bot]
554dd215c7
Merge #6910
6910: Remove `module_lang_items` r=jonas-schievink a=jonas-schievink

It isn't used anywhere except in `crate_lang_items`. Remove it to
slightly reduce memory usage and simplify the code.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-16 23:32:01 +00:00
Jonas Schievink
21b68a328c Remove module_lang_items
It isn't used anywhere except in `crate_lang_items`. Remove it to
slightly reduce memory usage and simplify the code.
2020-12-17 00:26:01 +01:00
bors[bot]
785860bd17
Merge #6909
6909: Avoid querying attributes in item tree lowering r=jonas-schievink a=jonas-schievink

ItemTree is per-file, so there is no unique crate associated with it.
This means that it cannot know the active CfgOptions and thus couldn't
handle `cfg_attr`.

Prepare it for `cfg_attr`s by avoiding accessing attributes.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-16 22:42:54 +00:00
Jonas Schievink
28b5334580 Avoid querying attributes in item tree lowering
ItemTree is per-file, so there is no unique crate associated with it.
This means that it cannot know the active CfgOptions and thus couldn't
handle `cfg_attr`.

Prepare it for `cfg_attr`s by avoiding accessing attributes.
2020-12-16 23:42:03 +01:00
Lukas Wirth
55faa2daa3 Lifetime reference search 2020-12-16 22:21:01 +01:00
bors[bot]
067067a6c1
Merge #6896
6896: Node-ify lifetimes r=jonas-schievink a=Veykril

Let's see if this passes the tests 🤞 

Depends on https://github.com/rust-analyzer/ungrammar/pull/15

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-16 17:08:03 +00:00
bors[bot]
63bbdb31e5
Merge #6897
6897: Basic support for macros 2.0 r=jonas-schievink a=jonas-schievink

This adds support for (built-in-only) macros 2.0, and removes some hacks used for builtin derives, which are declared via macros 2.0 in libcore.

First steps for https://github.com/rust-analyzer/rust-analyzer/issues/2248.

Blocked on https://github.com/rust-analyzer/ungrammar/pull/16.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-12-16 16:52:46 +00:00
bors[bot]
423f387224
Merge #6906
6906: Document new permissions r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-16 15:07:47 +00:00
Aleksey Kladov
675390e012
Update docs/dev/README.md
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-16 18:07:21 +03:00
Aleksey Kladov
6e9023c763 Document new permissions 2020-12-16 18:04:24 +03:00
Lukas Wirth
dd496223f5 Node-ify lifetimes 2020-12-16 14:16:09 +01:00
Jonas Schievink
d34611633b Unpatch ungrammar 2020-12-16 12:54:34 +01:00
bors[bot]
c1c36acb02
Merge #6861
6861: generate default implementation for an enum from an enum variant #6860 r=matklad a=bnjjj

close #6860

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-12-16 08:36:05 +00:00
bors[bot]
ece626fe81
Merge #6894
6894: Parenthesize composite if condition before inverting in invert-if assist r=matklad a=Jesse-Bakker

Fixes #6867

Co-authored-by: Jesse Bakker <github@jessebakker.com>
2020-12-16 08:20:11 +00:00
Benjamin Coenen
2c82a1aec7 generate default implementation for an enum from an enum variant #6860
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-12-15 21:35:41 +01:00
Jonas Schievink
b238ddd21a Make macro def krate mandatory
Refactors builtin derive support to go through proper name resolution
2020-12-15 20:33:05 +01:00
Jonas Schievink
c31c3246a8 Basic support for decl macros 2.0 2020-12-15 18:43:34 +01:00
bors[bot]
eb9ba457b0
Merge #6879
6879: Change HasChildSource::ChildId assoc item to generic param r=matklad a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-15 17:22:03 +00:00
Lukas Wirth
2c67a4abe4 Change HasChildSource::ChildId assoc item to generic param 2020-12-15 18:21:01 +01:00
Jesse Bakker
0f42a71806 Parenthesize composite if condition before inverting in invert-if assist 2020-12-15 16:25:57 +01:00
bors[bot]
bd4c352831
Merge #6893
6893: Move to upstream `macro_rules!` model r=matklad a=jonas-schievink

This changes `macro_rules!` from being treated as a macro invocation to being a first-class item. It also disallows using an additional ident argument for regular macros, so `m! ident(...);` now fails to parse.

This matches upstream Rust, and makes the code somewhat simpler by removing repeated "is this a `macro_rules!` call" checks. It will also simplify allowing visibilities on macros, which is currently being proposed in https://github.com/rust-lang/rust/pull/78166.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-15 14:45:09 +00:00