mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-25 14:13:38 +00:00
Avoid unused variable warning in quote_*!
The provided span isn't used in all cases (namely primitives).
This commit is contained in:
parent
bf07c80838
commit
dac3c53ee1
@ -530,7 +530,7 @@ fn mk_tt(cx: &ExtCtxt, sp: Span, tt: &ast::TokenTree) -> ~[@ast::Stmt] {
|
||||
match *tt {
|
||||
|
||||
ast::TTTok(sp, ref tok) => {
|
||||
let e_sp = cx.expr_ident(sp, id_ext("sp"));
|
||||
let e_sp = cx.expr_ident(sp, id_ext("_sp"));
|
||||
let e_tok = cx.expr_call_ident(sp,
|
||||
id_ext("TTTok"),
|
||||
~[e_sp, mk_token(cx, sp, tok)]);
|
||||
@ -628,7 +628,7 @@ fn expand_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
~[]);
|
||||
|
||||
let stmt_let_sp = cx.stmt_let(sp, false,
|
||||
id_ext("sp"),
|
||||
id_ext("_sp"),
|
||||
e_sp);
|
||||
|
||||
let stmt_let_tt = cx.stmt_let(sp, true,
|
||||
|
24
src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs
Normal file
24
src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
|
||||
#[deny(unused_variable)];
|
||||
|
||||
extern mod syntax;
|
||||
|
||||
use syntax::ext::base::ExtCtxt;
|
||||
|
||||
fn test(cx: &mut ExtCtxt) {
|
||||
let foo = 10i;
|
||||
let _e = quote_expr!(cx, $foo);
|
||||
}
|
||||
|
||||
pub fn main() { }
|
Loading…
Reference in New Issue
Block a user