about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-02-24 08:55:41 -0800
committerManish Goregaokar <manishsmail@gmail.com>2018-02-24 12:47:58 -0800
commitb52b33a38626306ec2f622f101e7edc2964abfe4 (patch)
tree4b27672436eb209ea15241c131367efa67881eb1 /src/libsyntax/ext
parenta79e5e210e5e20077b2a5cf6c0c8d2bdc11e6066 (diff)
parent10f7c110928ee7d3db7fef15fd7dce776b17e161 (diff)
downloadrust-b52b33a38626306ec2f622f101e7edc2964abfe4.tar.gz
rust-b52b33a38626306ec2f622f101e7edc2964abfe4.zip
Rollup merge of #48143 - nikomatsakis:termination_trait_in_tests, r=eddyb
Termination trait in tests

Support the `Termination` trait in unit tests (cc https://github.com/rust-lang/rust/issues/43301)

Also, a drive-by fix for #47075.

This is joint work with @bkchr.
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/build.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 7681f55bd8c..b88e064e7e5 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -319,14 +319,8 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
                 types: Vec<P<ast::Ty>>,
                 bindings: Vec<ast::TypeBinding> )
                 -> ast::Path {
-        use syntax::parse::token;
-
         let last_identifier = idents.pop().unwrap();
         let mut segments: Vec<ast::PathSegment> = Vec::new();
-        if global &&
-           !idents.first().map_or(false, |&ident| token::Ident(ident).is_path_segment_keyword()) {
-            segments.push(ast::PathSegment::crate_root(span));
-        }
 
         segments.extend(idents.into_iter().map(|i| ast::PathSegment::from_ident(i, span)));
         let parameters = if !lifetimes.is_empty() || !types.is_empty() || !bindings.is_empty() {
@@ -335,7 +329,9 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
             None
         };
         segments.push(ast::PathSegment { identifier: last_identifier, span, parameters });
-        ast::Path { span, segments }
+        let path = ast::Path { span, segments };
+
+        if global { path.default_to_global() } else { path }
     }
 
     /// Constructs a qualified path.