Skip to content

Commit ad5c0d4

Browse files
committed
reintroduce inline to libsyntax test
1 parent 518bcff commit ad5c0d4

File tree

1 file changed

+1
-54
lines changed

1 file changed

+1
-54
lines changed

src/libsyntax/test.rs

+1-54
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ fn mk_reexport_mod(cx: &mut TestCtxt,
238238
})).collect();
239239

240240
let reexport_mod = ast::Mod {
241+
inline: true,
241242
inner: DUMMY_SP,
242243
items,
243-
inline: true,
244244
};
245245

246246
let sym = Ident::with_empty_ctxt(Symbol::gensym("__test_reexports"));
@@ -393,59 +393,6 @@ fn mk_main(cx: &mut TestCtxt) -> P<ast::Item> {
393393
tokens: None,
394394
})
395395

396-
let testmod = ast::Mod {
397-
inner: DUMMY_SP,
398-
items: vec![import, mainfn, tests],
399-
inline: true,
400-
};
401-
let item_ = ast::ItemKind::Mod(testmod);
402-
let mod_ident = Ident::with_empty_ctxt(Symbol::gensym("__test"));
403-
404-
let mut expander = cx.ext_cx.monotonic_expander();
405-
let item = expander.fold_item(P(ast::Item {
406-
id: ast::DUMMY_NODE_ID,
407-
ident: mod_ident,
408-
attrs: vec![],
409-
node: item_,
410-
vis: dummy_spanned(ast::VisibilityKind::Public),
411-
span: DUMMY_SP,
412-
tokens: None,
413-
})).pop().unwrap();
414-
let reexport = cx.reexport_test_harness_main.map(|s| {
415-
// building `use __test::main as <ident>;`
416-
let rename = Ident::with_empty_ctxt(s);
417-
418-
let use_path = ast::UseTree {
419-
span: DUMMY_SP,
420-
prefix: path_node(vec![mod_ident, Ident::from_str("main")]),
421-
kind: ast::UseTreeKind::Simple(Some(rename), ast::DUMMY_NODE_ID, ast::DUMMY_NODE_ID),
422-
};
423-
424-
expander.fold_item(P(ast::Item {
425-
id: ast::DUMMY_NODE_ID,
426-
ident: keywords::Invalid.ident(),
427-
attrs: vec![],
428-
node: ast::ItemKind::Use(P(use_path)),
429-
vis: dummy_spanned(ast::VisibilityKind::Inherited),
430-
span: DUMMY_SP,
431-
tokens: None,
432-
})).pop().unwrap()
433-
});
434-
435-
debug!("Synthetic test module:\n{}\n", pprust::item_to_string(&item));
436-
437-
(item, reexport)
438-
}
439-
440-
fn nospan<T>(t: T) -> codemap::Spanned<T> {
441-
codemap::Spanned { node: t, span: DUMMY_SP }
442-
}
443-
444-
fn path_node(ids: Vec<Ident>) -> ast::Path {
445-
ast::Path {
446-
span: DUMMY_SP,
447-
segments: ids.into_iter().map(|id| ast::PathSegment::from_ident(id)).collect(),
448-
}
449396
}
450397

451398
fn path_name_i(idents: &[Ident]) -> String {

0 commit comments

Comments
 (0)