Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign updon't ask what edition we are in; ask what edition a span is in #50999
Conversation
rust-highfive
assigned
petrochenkov
May 23, 2018
rust-highfive
added
the
S-waiting-on-review
label
May 23, 2018
nikomatsakis
force-pushed the
nikomatsakis:issue-50172-macro-edition-hygiene
branch
from
e32d992
to
24529d9
May 23, 2018
This comment has been minimized.
This comment has been minimized.
oh, my. |
This comment has been minimized.
This comment has been minimized.
|
Hmm, I'm not sure this is behaving right in some of the corner cases. I'll come back to it in a bit. But for example, when I add a macro to the Rust 2015 helper like this: #[macro_export]
macro_rules! print_me {
($p:path) => {
{
use $p as V;
println!("{}", V);
}
}
}I expect the paths supplied to the macro from the Rust 2018 crate to use Rust 2018 semantics. I'm not 100% sure if they are or not yet :p I have to dig into the output a bit deeper. |
This comment has been minimized.
This comment has been minimized.
|
(Obviously once you start concatenating paths and things it becomes less clear what is right -- I wanted to add some tests where we build paths like |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
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 |
petrochenkov
reviewed
May 23, 2018
| /// particular span: that way, when you are looking at code | ||
| /// creating a macro from a Rust 2015 crate, you will use the Rust | ||
| /// 2015 Edition rules. | ||
| pub fn local_edition(&self) -> Edition { |
This comment has been minimized.
This comment has been minimized.
petrochenkov
May 23, 2018
Contributor
We can probably just implement Default for Edition.
"Local edition" needs to be kept in global data anyway because it's an "edition of SyntaxContext(0) aka not-a-macro-expansion" and it's set from default-default Edition2015 to self.opts.edition immediately after options are parsed.
This comment has been minimized.
This comment has been minimized.
nikomatsakis
May 30, 2018
Author
Contributor
Hmm. True, though I'm not wild about the fact that we rely so heavily on global / TLS data for this stuff.
This comment has been minimized.
This comment has been minimized.
Paths currently have spans from the "concatenation context" (see In general, we can strictly rely only on spans of "atomic" tokens, for multi-token things like paths there are always multiple choices (#50122). |
petrochenkov
added
S-waiting-on-author
and removed
S-waiting-on-review
labels
May 23, 2018
This comment has been minimized.
This comment has been minimized.
|
|
nikomatsakis
referenced this pull request
May 30, 2018
Closed
How to determine hygienic context for the "crate root" in absolute-by-default paths #50376
TimNN
added
S-blocked
and removed
S-waiting-on-author
labels
Jun 5, 2018
pietroalbini
added
S-blocked
and removed
S-blocked
labels
Jun 25, 2018
nrc
added
the
A-edition-2018-lints
label
Jul 2, 2018
pietroalbini
added
S-blocked
and removed
S-blocked
labels
Jul 9, 2018
alexcrichton
added this to the Rust 2018 Preview 2 milestone
Jul 11, 2018
alexcrichton
modified the milestones:
Rust 2018 Preview 2,
Rust 2018 RC
Jul 31, 2018
petrochenkov
referenced this pull request
Aug 2, 2018
Closed
Path resolution semantics should be hygenic #53007
This comment has been minimized.
This comment has been minimized.
|
I've written up a comment about a recent chat @nikomatsakis and I had where the conclusion was to basically punt on this PR for now. It's not clear whether this is the right strategy amongst alternatives, so we're going to not worry about solving this for the edition (as it doesn't seem all that pressing) and fix it if we uncover it later. As a result, I'm removing the milestone from this PR. |
alexcrichton
removed this from the Rust 2018 RC milestone
Aug 24, 2018
alexcrichton
added
S-waiting-on-author
and removed
S-blocked
labels
Aug 24, 2018
This comment has been minimized.
This comment has been minimized.
Does this mean this PR can just be closed for now? |
This comment has been minimized.
This comment has been minimized.
|
Heh if I recall right @nikomatsakis felt bad closing the PR himself so I mentioned we can let normal triage processes close the PR. I'll perhaps preempt that slightly by closing it myself... |
alexcrichton
closed this
Aug 28, 2018
This comment has been minimized.
This comment has been minimized.
|
I'm of two minds because I do still want to see this reach some conclusion =) but keeping this PR open serves no real purpose. |
nikomatsakis commentedMay 23, 2018
•
edited
We now track the edition of each span. Using that info when gating the Rust 2018 interpretation means that macros from Rust 2015 crates "just work" when used in Rust 2018 crates (at least in the case of
usepaths).Fixes #50172
r? @petrochenkov
cc @Manishearth @alexcrichton