diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-12-05 03:51:11 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-12-22 06:14:35 +0000 |
| commit | f10f50b42639718b2580d10802f05f2b6ff209d5 (patch) | |
| tree | 19b61435b37e14f97a74e18b6db32c507e7b1a58 /src/libsyntax/ext | |
| parent | 164619a8cfe6d376d25bd3a6a9a5f2856c8de64d (diff) | |
| download | rust-f10f50b42639718b2580d10802f05f2b6ff209d5.tar.gz rust-f10f50b42639718b2580d10802f05f2b6ff209d5.zip | |
Refactor how global paths are represented (for both ast and hir).
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/build.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/placeholders.rs | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index c3dc64f9124..7584fa3916d 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -322,7 +322,12 @@ impl<'a> AstBuilder for ExtCtxt<'a> { bindings: Vec<ast::TypeBinding> ) -> ast::Path { let last_identifier = idents.pop().unwrap(); - let mut segments: Vec<ast::PathSegment> = idents.into_iter().map(Into::into).collect(); + let mut segments: Vec<ast::PathSegment> = Vec::new(); + if global { + segments.push(ast::PathSegment::crate_root()); + } + + segments.extend(idents.into_iter().map(Into::into)); let parameters = if lifetimes.is_empty() && types.is_empty() && bindings.is_empty() { None } else { @@ -335,7 +340,6 @@ impl<'a> AstBuilder for ExtCtxt<'a> { segments.push(ast::PathSegment { identifier: last_identifier, parameters: parameters }); ast::Path { span: sp, - global: global, segments: segments, } } diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index eb4b6144c8d..66555d7d95d 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -25,7 +25,7 @@ use std::mem; pub fn placeholder(kind: ExpansionKind, id: ast::NodeId) -> Expansion { fn mac_placeholder() -> ast::Mac { dummy_spanned(ast::Mac_ { - path: ast::Path { span: DUMMY_SP, global: false, segments: Vec::new() }, + path: ast::Path { span: DUMMY_SP, segments: Vec::new() }, tts: Vec::new(), }) } |
