diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2015-04-16 20:38:00 -0700 |
|---|---|---|
| committer | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2015-04-21 10:08:27 -0700 |
| commit | 855365895228a78041ae16946eeaef5e45a37a64 (patch) | |
| tree | ef127a3342c9ce82f7f58fccd61cb083f2f209c6 /src/libsyntax | |
| parent | bc6d990adbad6109cf096acc04cc5ab7dfd5b5ff (diff) | |
| download | rust-855365895228a78041ae16946eeaef5e45a37a64.tar.gz rust-855365895228a78041ae16946eeaef5e45a37a64.zip | |
syntax: remove #[feature(quote, unsafe_destructor)]
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/diagnostics/plugin.rs | 48 | ||||
| -rw-r--r-- | src/libsyntax/lib.rs | 1 |
2 files changed, 43 insertions, 6 deletions
diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index ac25a303182..6de4edafa0b 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -77,7 +77,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt, )); } }); - MacEager::expr(quote_expr!(ecx, ())) + MacEager::expr(ecx.expr_tuple(span, Vec::new())) } pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, @@ -128,7 +128,15 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, let sym = Ident::new(token::gensym(&( "__register_diagnostic_".to_string() + &token::get_ident(*code) ))); - MacEager::items(SmallVector::many(vec![quote_item!(ecx, mod $sym {}).unwrap()])) + MacEager::items(SmallVector::many(vec![ + ecx.item_mod( + span, + span, + sym, + Vec::new(), + Vec::new() + ) + ])) } pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, @@ -153,7 +161,37 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, (descriptions.len(), ecx.expr_vec(span, descriptions)) }); - MacEager::items(SmallVector::many(vec![quote_item!(ecx, - pub static $name: [(&'static str, &'static str); $count] = $expr; - ).unwrap()])) + let static_ = ecx.lifetime(span, ecx.name_of("'static")); + let ty_str = ecx.ty_rptr( + span, + ecx.ty_ident(span, ecx.ident_of("str")), + Some(static_), + ast::MutImmutable, + ); + + let ty = ecx.ty( + span, + ast::TyFixedLengthVec( + ecx.ty( + span, + ast::TyTup(vec![ty_str.clone(), ty_str]) + ), + ecx.expr_usize(span, count), + ), + ); + + MacEager::items(SmallVector::many(vec![ + P(ast::Item { + ident: name.clone(), + attrs: Vec::new(), + id: ast::DUMMY_NODE_ID, + node: ast::ItemStatic( + ty, + ast::MutImmutable, + expr, + ), + vis: ast::Public, + span: span, + }) + ])) } diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index deb3e158bb5..8d77894a549 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -28,7 +28,6 @@ #![feature(collections)] #![feature(core)] #![feature(libc)] -#![feature(quote, unsafe_destructor)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(unicode)] |
