Skip to content

Commit 3d469c2

Browse files
committed
auto merge of #9162 : alexcrichton/rust/issue-9123, r=catamorphism
Closes #9123
2 parents f853f0b + 62ba835 commit 3d469c2

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

src/librustc/middle/trans/base.rs

+9
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ use syntax::parse::token::{special_idents};
8787
use syntax::print::pprust::stmt_to_str;
8888
use syntax::{ast, ast_util, codemap, ast_map};
8989
use syntax::abi::{X86, X86_64, Arm, Mips};
90+
use syntax::visit;
9091
use syntax::visit::Visitor;
9192

9293
pub use middle::trans::context::task_llcx;
@@ -2239,6 +2240,14 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) {
22392240
trans_struct_def(ccx, struct_def);
22402241
}
22412242
}
2243+
ast::item_trait(*) => {
2244+
// Inside of this trait definition, we won't be actually translating any
2245+
// functions, but the trait still needs to be walked. Otherwise default
2246+
// methods with items will not get translated and will cause ICE's when
2247+
// metadata time comes around.
2248+
let mut v = TransItemVisitor;
2249+
visit::walk_item(&mut v, item, ccx);
2250+
}
22422251
_ => {/* fall through */ }
22432252
}
22442253
}

src/test/auxiliary/issue_9123.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2013 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+
#[crate_type = "lib"];
12+
13+
pub trait X {
14+
fn x() {
15+
fn f() { }
16+
f();
17+
}
18+
}
19+

src/test/run-pass/issue-9123.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2013 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 windows doesn't like aux-build
12+
// aux-build:issue_9123.rs
13+
14+
extern mod issue_9123;
15+
16+
pub fn main() {}

0 commit comments

Comments
 (0)