Skip to content

Commit 068d828

Browse files
committed
auto merge of #11660 : sfackler/rust/quote-unused-sp, r=huonw
The provided span isn't used in all cases (namely primitives).
2 parents e83e576 + dac3c53 commit 068d828

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/libsyntax/ext/quote.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ fn mk_tt(cx: &ExtCtxt, sp: Span, tt: &ast::TokenTree) -> ~[@ast::Stmt] {
530530
match *tt {
531531

532532
ast::TTTok(sp, ref tok) => {
533-
let e_sp = cx.expr_ident(sp, id_ext("sp"));
533+
let e_sp = cx.expr_ident(sp, id_ext("_sp"));
534534
let e_tok = cx.expr_call_ident(sp,
535535
id_ext("TTTok"),
536536
~[e_sp, mk_token(cx, sp, tok)]);
@@ -628,7 +628,7 @@ fn expand_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::TokenTree])
628628
~[]);
629629

630630
let stmt_let_sp = cx.stmt_let(sp, false,
631-
id_ext("sp"),
631+
id_ext("_sp"),
632632
e_sp);
633633

634634
let stmt_let_tt = cx.stmt_let(sp, true,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// xfail-fast
12+
13+
#[deny(unused_variable)];
14+
15+
extern mod syntax;
16+
17+
use syntax::ext::base::ExtCtxt;
18+
19+
fn test(cx: &mut ExtCtxt) {
20+
let foo = 10i;
21+
let _e = quote_expr!(cx, $foo);
22+
}
23+
24+
pub fn main() { }

0 commit comments

Comments
 (0)