Skip to content

Commit 8ad3d27

Browse files
author
Keegan McAllister
committed
---
yaml --- r: 133883 b: refs/heads/snap-stage3 c: 5b42f79 h: refs/heads/master i: 133881: 736ab67 133879: c0ebdf3 v: v3
1 parent 90ee475 commit 8ad3d27

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0e784e16840e8a0c623cc6166de26da9334db3d6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f85e4f75b9b60e2ce4b2ade8f04e2537e48f7095
4+
refs/heads/snap-stage3: 5b42f79ff088bf3f9136f6f668a481097e22bed9
55
refs/heads/try: 777654cfccbfa39bc7f671d8e9629018ed8ca12d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libsyntax/ext/expand.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,10 @@ fn expand_method(m: P<ast::Method>, fld: &mut MacroExpander) -> SmallVector<P<as
897897
};
898898

899899
// expand again if necessary
900-
new_methods.into_iter().flat_map(|m| fld.fold_method(m).into_iter()).collect()
900+
let new_methods = new_methods.move_iter()
901+
.flat_map(|m| fld.fold_method(m).into_iter()).collect();
902+
fld.cx.bt_pop();
903+
new_methods
901904
}
902905
})
903906
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
// forbid-output: in expansion of
12+
13+
#![feature(macro_rules)]
14+
15+
macro_rules! make_method ( ($name:ident) => (
16+
fn $name(&self) { }
17+
))
18+
19+
struct S;
20+
21+
impl S {
22+
// We had a bug where these wouldn't clean up macro backtrace frames.
23+
make_method!(foo1)
24+
make_method!(foo2)
25+
make_method!(foo3)
26+
make_method!(foo4)
27+
make_method!(foo5)
28+
make_method!(foo6)
29+
make_method!(foo7)
30+
make_method!(foo8)
31+
32+
// Cause an error. It shouldn't have any macro backtrace frames.
33+
fn bar(&self) { }
34+
fn bar(&self) { } //~ ERROR duplicate definition
35+
}
36+
37+
fn main() { }

0 commit comments

Comments
 (0)