bors[bot] [Sun, 10 Nov 2019 21:35:19 +0000 (21:35 +0000)]
Merge #2201
2201: Resolve core types r=matklad a=Matthias247
This adds support for completion and goto definition of
types defined within the "core" crate. The core crate is
added as a dependency to each crate in the project.
The core crate exported it's own prelude. This caused
now all crates to inherit the core crates prelude instead
of the std crates. In order to avoid the problem the
prelude resolution has been changed to overwrite
an already resolved prelude if this was set to a crate
named core - in order to pick a better prelude like std.
Matthias Einwag [Sun, 10 Nov 2019 21:15:47 +0000 (13:15 -0800)]
Overwrite the prelude with one defined in a later dependency
This removes the special casing for the "core" prelude.
Whenever a later dependency also exports a prelude, it will replace
the formerly imported prelude. The utilized prelude then depends
purely on import order.
Matthias Einwag [Sat, 9 Nov 2019 23:22:19 +0000 (15:22 -0800)]
Resolve core types
This adds support for completion and goto definition of
types defined within the "core" crate. The core crate is
added as a dependency to each crate in the project.
The core crate exported it's own prelude. This caused
now all crates to inherit the core crates prelude instead
of the std crates. In order to avoid the problem the
prelude resolution has been changed to overwrite
an already resolved prelude if this was set to a crate
named core - in order to pick a better prelude like std.
bors[bot] [Sat, 9 Nov 2019 09:13:14 +0000 (09:13 +0000)]
Merge #2169
2169: MBE: Mapping spans for goto definition r=matklad a=edwin0cheng
Currently, go to definition gives the wrong span in MBE. This PR implement a mapping mechanism to fix it and it could be used for future MBE hygiene implementation.
The basic idea of the mapping is:
1. When expanding the macro, generated 2 `TokenMap` which maps the macro args and macro defs between tokens and input text-ranges.
2. Before converting generated `TokenTree` to `SyntaxNode`, generated a `ExpandedRangeMap` which is a mapping between token and output text-ranges.
3. Using these 3 mappings to construct an `ExpansionInfo` which can map between input text ranges and output text ranges.
bors[bot] [Wed, 6 Nov 2019 21:11:42 +0000 (21:11 +0000)]
Merge #2179
2179: Use HirDatabase to compute `is_deprecated` r=matklad a=martskins
This PR fixes #2167 by introducing `attributes_query` and adding `fn attrs(&self, def: crate::AttrDef) -> Option<Arc<[Attr]>>;` to the `DefDatabase` trait.
I'm a little concerned about the two spots in `attributes_query` where code is repeated, but I couldn't figure out a way to avoid that, so.. I welcome suggestions :smile:
Co-authored-by: Martin Asquino <martin.asquino@gmail.com>
bors[bot] [Mon, 4 Nov 2019 17:21:41 +0000 (17:21 +0000)]
Merge #2173
2173: MBE: Add TokenId shift in macro_rules r=matklad a=edwin0cheng
As discussed in #2169 , for fixing duplication TokenId during expansion :
> What we can do here is to re-number the tokens during expansion. Specifically:
> * when we create macro_rules, we note the highest id of the token we have as shift>
> * when we expand macro rules, if we need to output a token from definition, we just re-use its id
> * if we need to output a token from the argument, we increase its id by shift (so it's guaranteed to not to collide with anything from the definition)
> * finally, when we have a HirFileId of the expansion, we can look up the original value of shift and classify node to the arg/def by comparing it's id with shift.
>
This PR implement first 3 points of above solution.
Aleksey Kladov [Sat, 2 Nov 2019 19:19:59 +0000 (22:19 +0300)]
Remove forcing \n via rustfmt
The original idea here was to make sure, on CI, that line endings are
\n. Travis however uses autocrlf, so the check doesn't actually work,
and forcing \n otherwise makes lives of windows folks difficult
bors[bot] [Fri, 1 Nov 2019 19:03:05 +0000 (19:03 +0000)]
Merge #2151
2151: Resolve (and complete) trait calls like `Vec::default()` r=flodiebold a=flodiebold
Similar to rustc, we do this using the same code as the method call resolution, just without doing autoderef (and considering more potential candidates).
(Btw, we currently don't complete methods with `self` in path notation, even though they'd be legal to use, so maybe we should -- on the other hand, that will usually not be the most interesting completions...)