From 9cc847d8c3cb156a2765a6be962209acd472b8aa Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 9 Jan 2015 13:26:21 -0800 Subject: syntax: Add #[allow(unstable)] to --test expansion This will temporarily prevent warnings generated from expanding to code that the test harness itself uses. This solution will require tweaking around the beta cycle, but it will prevent spurious warnings for now. Closes #20823 --- src/libsyntax/test.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index bacfa0bbfce..895268f96c8 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -439,13 +439,19 @@ fn mk_test_module(cx: &mut TestCtxt) -> (P, Option) { let item_ = ast::ItemMod(testmod); let mod_ident = token::gensym_ident("__test"); + let allow_unstable = { + let unstable = P(nospan(ast::MetaWord(InternedString::new("unstable")))); + let allow = P(nospan(ast::MetaList(InternedString::new("allow"), + vec![unstable]))); + attr::mk_attr_inner(attr::mk_attr_id(), allow) + }; let item = ast::Item { ident: mod_ident, - attrs: Vec::new(), id: ast::DUMMY_NODE_ID, node: item_, vis: ast::Public, span: DUMMY_SP, + attrs: vec![allow_unstable], }; let reexport = cx.reexport_test_harness_main.as_ref().map(|s| { // building `use = __test::main` -- cgit 1.4.1-3-g733a5