about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorTinco Andringa <mail@tinco.nl>2018-09-10 15:19:27 +0200
committerTinco Andringa <mail@tinco.nl>2018-09-10 15:19:27 +0200
commitad5c0d49ffb271608e1e3ddbf0898d7005601cd6 (patch)
tree9efff1fe9981e4dd6b2f6f1d8e6f47937f0ca7f9 /src/libsyntax
parent518bcffa317db45e437a5e425fb3d7f29e6cab0c (diff)
downloadrust-ad5c0d49ffb271608e1e3ddbf0898d7005601cd6.tar.gz
rust-ad5c0d49ffb271608e1e3ddbf0898d7005601cd6.zip
reintroduce inline to libsyntax test
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/test.rs55
1 files changed, 1 insertions, 54 deletions
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index 408f250fd45..c0c03b46ec7 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -238,9 +238,9 @@ fn mk_reexport_mod(cx: &mut TestCtxt,
     })).collect();
 
     let reexport_mod = ast::Mod {
+        inline: true,
         inner: DUMMY_SP,
         items,
-        inline: true,
     };
 
     let sym = Ident::with_empty_ctxt(Symbol::gensym("__test_reexports"));
@@ -393,59 +393,6 @@ fn mk_main(cx: &mut TestCtxt) -> P<ast::Item> {
         tokens: None,
     })
 
-    let testmod = ast::Mod {
-        inner: DUMMY_SP,
-        items: vec![import, mainfn, tests],
-        inline: true,
-    };
-    let item_ = ast::ItemKind::Mod(testmod);
-    let mod_ident = Ident::with_empty_ctxt(Symbol::gensym("__test"));
-
-    let mut expander = cx.ext_cx.monotonic_expander();
-    let item = expander.fold_item(P(ast::Item {
-        id: ast::DUMMY_NODE_ID,
-        ident: mod_ident,
-        attrs: vec![],
-        node: item_,
-        vis: dummy_spanned(ast::VisibilityKind::Public),
-        span: DUMMY_SP,
-        tokens: None,
-    })).pop().unwrap();
-    let reexport = cx.reexport_test_harness_main.map(|s| {
-        // building `use __test::main as <ident>;`
-        let rename = Ident::with_empty_ctxt(s);
-
-        let use_path = ast::UseTree {
-            span: DUMMY_SP,
-            prefix: path_node(vec![mod_ident, Ident::from_str("main")]),
-            kind: ast::UseTreeKind::Simple(Some(rename), ast::DUMMY_NODE_ID, ast::DUMMY_NODE_ID),
-        };
-
-        expander.fold_item(P(ast::Item {
-            id: ast::DUMMY_NODE_ID,
-            ident: keywords::Invalid.ident(),
-            attrs: vec![],
-            node: ast::ItemKind::Use(P(use_path)),
-            vis: dummy_spanned(ast::VisibilityKind::Inherited),
-            span: DUMMY_SP,
-            tokens: None,
-        })).pop().unwrap()
-    });
-
-    debug!("Synthetic test module:\n{}\n", pprust::item_to_string(&item));
-
-    (item, reexport)
-}
-
-fn nospan<T>(t: T) -> codemap::Spanned<T> {
-    codemap::Spanned { node: t, span: DUMMY_SP }
-}
-
-fn path_node(ids: Vec<Ident>) -> ast::Path {
-    ast::Path {
-        span: DUMMY_SP,
-        segments: ids.into_iter().map(|id| ast::PathSegment::from_ident(id)).collect(),
-    }
 }
 
 fn path_name_i(idents: &[Ident]) -> String {