diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-03-10 02:02:39 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-03-17 22:12:21 +0300 |
| commit | e5fb13897d947e13a1322a055b71632e30357eff (patch) | |
| tree | a9368805b050be3852c321648bcba5eea6b86087 /src/libsyntax/ext | |
| parent | b057c554ab9c7615ebdb3c920010a164ec5bf3ed (diff) | |
| download | rust-e5fb13897d947e13a1322a055b71632e30357eff.tar.gz rust-e5fb13897d947e13a1322a055b71632e30357eff.zip | |
AST: Keep distinction between `path` and `::path` in imports and visibilities
Add the root segment for name resolution purposes only
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/build.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 97f784dd617..ee646dc9174 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -329,9 +329,13 @@ impl<'a> AstBuilder for ExtCtxt<'a> { None }; segments.push(ast::PathSegment { identifier: last_identifier, span, parameters }); - let path = ast::Path { span, segments }; - - if global { path.default_to_global() } else { path } + let mut path = ast::Path { span, segments }; + if global { + if let Some(seg) = path.make_root() { + path.segments.insert(0, seg); + } + } + path } /// Constructs a qualified path. |
