Uh oh!
There was an error while loading. Please reload this page.
resolve: Implement prelude search for macro paths, implement tool attributes - #52841
Conversation
rust-highfive
commented
Jul 30, 2018
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
petrochenkov
commented
Jul 30, 2018
r? @alexcrichton |
There was a problem hiding this comment.
FIXME: account for no_implicit_prelude.
Done.
rust-highfive
commented
Jul 30, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
alexcrichton
commented
Jul 30, 2018
Looks great to me, thanks for the detailed comments! It looks like tool attributes like |
petrochenkov
commented
Jul 30, 2018
@bors r=alexcrichton |
bors
commented
Jul 30, 2018
📌 Commit dd93535e028ece7f01491fd25c8369d375026f69 has been approved by |
Mark-Simulacrum
commented
Jul 31, 2018
@bors p=1 edition critical |
bors
commented
Aug 1, 2018
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message |
emilyalbini
commented
Aug 1, 2018
This is also blocking edition crater runs. |
resolve/expansion: Implement tool attributes
petrochenkov
commented
Aug 1, 2018
@bors r=alexcrichton |
bors
commented
Aug 1, 2018
📌 Commit c3e5421 has been approved by |
bors
commented
Aug 1, 2018
⌛ Testing commit c3e5421 with merge e53bca8baf30e0686c3b2b82af3db0be0d592a64... |
bors
commented
Aug 2, 2018
📌 Commit c3e5421 has been approved by |
emilyalbini
commented
Aug 2, 2018
@bors p=1 |
alexcrichton
commented
Aug 2, 2018
@bors: rollup- |
bors
commented
Aug 2, 2018
resolve: Implement prelude search for macro paths, implement tool attributes When identifier is macro path is resolved in scopes (i.e. the first path segment - `foo` in `foo::mac!()` or `foo!()`), scopes are searched in the same order as for non-macro paths - items in modules, extern prelude, tool prelude (see later), standard library prelude, language prelude, but with some extra shadowing restrictions (names from globs and macro expansions cannot shadow names from outer scopes). See the comment in `fn resolve_lexical_macro_path_segment` for more details. "Tool prelude" currently contains two "tool modules" `rustfmt` and `clippy`, and is searched immediately after extern prelude. This makes the [possible long-term solution](https://github.com/rust-lang/rfcs/blob/master/text/2103-tool-attributes.md#long-term-solution) for tool attributes exactly equivalent to the existing extern prelude scheme, except that `--extern=my_crate` making crate names available in scope is replaced with something like `--tool=my_tool` making tool names available in scope. The `tool_attributes` feature is still unstable and `#![feature(tool_attributes)]` now implicitly enables `#![feature(use_extern_macros)]`. `use_extern_macros` is a prerequisite for `tool_attributes`, so their stabilization will happen in the same order. If `use_extern_macros` is not enabled, then tool attributes are treated as custom attributes (this is temporary, anyway). Fixes#52576Fixes#52512Fixes#51277 cc #52269
bors
commented
Aug 2, 2018
☀️ Test successful - status-appveyor, status-travis |
Manishearth
commented
Aug 3, 2018
This breaks Servo in a weird way. I'm unable to reproduce this out of tree https://travis-ci.org/servo/servo-with-rust-nightly/jobs/411851355 any idea what's going on? seems like a regression |
Manishearth
commented
Aug 3, 2018
cc @pietroalbini might want to be careful about that regression before cutting a beta ^^ |
petrochenkov
commented
Aug 3, 2018
I'll look what happens. |
petrochenkov
commented
Aug 5, 2018
@Manishearth In this case macro expanded name (macro_rules macro Minimized reproduction: macro_rules! my_include {() => {
#[macro_use] extern crate log;}}my_include!();fnmain(){warn!("");}In this case, since breakage affects stable channel, built-in attributes can be somehow special-cased to avoid the error, or perhaps some more general solution can be found, but I'd prefer to see crater results before proceeding with a fix. |
petrochenkov
commented
Aug 5, 2018
Since #53072 doesn't include this PR, we need a separate crater run for it. |
Mark-Simulacrum
commented
Aug 5, 2018
Queued a crater run for this PR (check only) here: #53089 |
nnethercote
commented
Aug 17, 2018
Good news! This PR improved compile speed on a few benchmarks, the best by 3.7%: |
Stabilize a few secondary macro features - `tool_attributes` - closesrust-lang#44690 - `proc_macro_path_invoc` - this feature was created due to issues with tool attributes (rust-lang#51277), those issues are now fixed (rust-lang#52841) - partially `proc_macro_gen` - this feature was created due to issue rust-lang#50504, the issue is now fixed (rust-lang#51952), so proc macros can generate modules. They still can't generate `macro_rules` items though due to unclear hygiene interactions.
Stabilize a few secondary macro features - `tool_attributes` - closes#44690 - `proc_macro_path_invoc` - this feature was created due to issues with tool attributes (#51277), those issues are now fixed (#52841) - partially `proc_macro_gen` - this feature was created due to issue #50504, the issue is now fixed (#51952), so proc macros can generate modules. They still can't generate `macro_rules` items though due to unclear hygiene interactions.
Resolves rustc error E0659 in the base.rs example caused by [rust-lang/rust](https://github.com/rust-lang/rust) pull request [#52841](rust-lang/rust#52841) "resolve: Implement prelude search for macro paths, implement tool attributes."
Resolves nightly rustc error E0659 in the base.rs example caused by [rust-lang/rust](https://github.com/rust-lang/rust) pull request [#52841](rust-lang/rust#52841) "resolve: Implement prelude search for macro paths, implement tool attributes."
When identifier is macro path is resolved in scopes (i.e. the first path segment -
fooinfoo::mac!()orfoo!()), scopes are searched in the same order as for non-macro paths - items in modules, extern prelude, tool prelude (see later), standard library prelude, language prelude, but with some extra shadowing restrictions (names from globs and macro expansions cannot shadow names from outer scopes). See the comment infn resolve_lexical_macro_path_segmentfor more details."Tool prelude" currently contains two "tool modules"
rustfmtandclippy, and is searched immediately after extern prelude.This makes the possible long-term solution for tool attributes exactly equivalent to the existing extern prelude scheme, except that
--extern=my_cratemaking crate names available in scope is replaced with something like--tool=my_toolmaking tool names available in scope.The
tool_attributesfeature is still unstable and#![feature(tool_attributes)]now implicitly enables#![feature(use_extern_macros)].use_extern_macrosis a prerequisite fortool_attributes, so their stabilization will happen in the same order.If
use_extern_macrosis not enabled, then tool attributes are treated as custom attributes (this is temporary, anyway).Fixes#52576
Fixes#52512
Fixes#51277
cc #52269