Skip to content

Commit

Permalink
Auto merge of #27827 - w00ns:for-loop-expn-issue-27639, r=alexcrichton
Browse files Browse the repository at this point in the history
Fixes #27639
  • Loading branch information
bors committed Aug 15, 2015
2 parents 316f5e5 + ae68e90 commit 2945555
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
11 changes: 1 addition & 10 deletions src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,7 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
// expand <head>
let head = fld.fold_expr(head);

// create an hygienic ident
let iter = {
let ident = fld.cx.ident_of("iter");
let new_ident = fresh_name(&ident);
let rename = (ident, new_ident);
let mut rename_list = vec![rename];
let mut rename_fld = IdentRenamer{ renames: &mut rename_list };

rename_fld.fold_ident(ident)
};
let iter = token::gensym_ident("iter");

let pat_span = fld.new_span(pat.span);
// `::std::option::Option::Some(<pat>) => <body>`
Expand Down
19 changes: 19 additions & 0 deletions src/test/run-pass/issue-27639.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2015 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.

// ignore-pretty

fn main() {
const iter: i32 = 0;

for i in 1..10 {
println!("{}", i);
}
}

0 comments on commit 2945555

Please sign in to comment.