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 upRefactor global paths #38232
Conversation
rust-highfive
assigned
nrc
Dec 8, 2016
This comment has been minimized.
This comment has been minimized.
|
This is groundwork for hygiene 2.0, specifically hygienic global paths between crates. Since we will need the Alternatively, we could instead support hygienic global paths between crates by adding a field |
jseyfried
force-pushed the
jseyfried:refactor_global_paths
branch
2 times, most recently
from
156a9b9
to
74b8d67
Dec 8, 2016
This comment has been minimized.
This comment has been minimized.
jseyfried
force-pushed the
jseyfried:refactor_global_paths
branch
3 times, most recently
from
bcd5a06
to
47eac3f
Dec 8, 2016
This comment has been minimized.
This comment has been minimized.
|
I wanted to review this PR, but forgot, sorry. Is the intent to eliminate |
jseyfried
closed this
Dec 12, 2016
jseyfried
reopened this
Dec 12, 2016
This comment has been minimized.
This comment has been minimized.
Yeah, global paths should be hygienic by default for macros 2.0, so we won't need
This refactoring will allow us to use nearly the same logic to resolve
I haven't measured it, but I don't expect this to have a significant effect on hir stats. I could instead leave hir paths unchanged and just refactor ast paths -- IIRC refactoring hir paths only caused fallout in the lowerer and pretty printer.
|
jseyfried
force-pushed the
jseyfried:refactor_global_paths
branch
from
47eac3f
to
e8fe46a
Dec 15, 2016
This comment has been minimized.
This comment has been minimized.
|
|
jseyfried
force-pushed the
jseyfried:refactor_global_paths
branch
3 times, most recently
from
ae2f1a8
to
550b4e1
Dec 15, 2016
nrc
approved these changes
Dec 20, 2016
|
r=me with the minor refactoring |
| first = false | ||
| } else { | ||
| let mut segments = path.segments[..path.segments.len()-depth].iter(); | ||
| if defaults_to_global && path.segments[0].identifier.name == keywords::CrateRoot.name() { |
This comment has been minimized.
This comment has been minimized.
nrc
Dec 20, 2016
Member
I think I would like an is_global method on paths, rather than having checks like this (path.segments[0].identifier.name == keywords::CrateRoot.name()) scattered around the code. It will also make it easier for tools using the AST.
This comment has been minimized.
This comment has been minimized.
| try!(self.print_ident(segment.identifier)); | ||
|
|
||
| try!(self.print_path_parameters(&segment.parameters, colons_before_params)); | ||
| if segment.identifier.name != keywords::CrateRoot.name() { |
This comment has been minimized.
This comment has been minimized.
jseyfried
force-pushed the
jseyfried:refactor_global_paths
branch
2 times, most recently
from
e9b84d0
to
0bd6eab
Dec 20, 2016
This comment has been minimized.
This comment has been minimized.
|
|
jseyfried
force-pushed the
jseyfried:refactor_global_paths
branch
from
0bd6eab
to
be2a531
Dec 21, 2016
This comment has been minimized.
This comment has been minimized.
jseyfried
referenced this pull request
Dec 21, 2016
Closed
Eliminate $crate in --pretty=expanded #38016
This comment has been minimized.
This comment has been minimized.
|
r = me, but you have test failures now |
jseyfried
added some commits
Dec 5, 2016
jseyfried
force-pushed the
jseyfried:refactor_global_paths
branch
from
be2a531
to
8a1acb2
Dec 22, 2016
This comment has been minimized.
This comment has been minimized.
|
@bors r=nrc |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Dec 22, 2016
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@bors retry |
jseyfried commentedDec 8, 2016
•
edited
This PR removes the field
global: boolfromast::Pathandhir::Path, instead representing a global path::foo::baras{{root}}::foo::bar, where{{root}}is a virtual keywordkeywords::CrateRoot.Also, fixes #38016.
r? @nrc