]> git.lizzy.rs Git - rust.git/commit
Merge #1784
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Mon, 9 Sep 2019 08:04:00 +0000 (08:04 +0000)
committerGitHub <noreply@github.com>
Mon, 9 Sep 2019 08:04:00 +0000 (08:04 +0000)
commit1db08a54c20c244718e2378272c72ae5c6651f06
tree90fe99eb39d045d9bac34cc200a74d0410d51763
parent72259b67bf2393bec1faf6a9f95a575d6fe9cfea
parent9ed21d65fb6727f6de4961dfa440981864451af6
Merge #1784

1784: Support textual scoped macros r=matklad a=uHOOCCOOHu

Refactor the old simulation with `global_macro_scope`.

Now it is quite accurate to resolve textual scoped macros.
- Expand textual scoped macros in item and non-item place.
- Support `#[macro_use]` on `mod`.
- Textual scoped macros are collected into `nameres::ModuleScope`, so I think it makes #1727 easier to fix.
- It is implemented in a simple way to `clone()` current scoped macro ids into sub-modules. Though only indices are cloned, it will still increase some resolving time. Well, I've not bench-marked yet.

In my test with vscode extension, it can now successfully expand `dbg!` from `std` without `std::` prefix. "Goto definition" also works. Screenshot here:
<img width="281" alt="Screenshot_20190907_043442" src="https://user-images.githubusercontent.com/14816024/64458794-ddb47900-d128-11e9-95e3-1c8569978825.png">

Co-authored-by: uHOOCCOOHu <hooccooh1896@gmail.com>