Skip to content

Commit 1f056ed

Browse files
committed
rustc: Make the compiler no longer ICE on unused foreign constants
1 parent 65b05a6 commit 1f056ed

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/rustc/middle/trans/foreign.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,10 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
794794
}
795795
}
796796
}
797-
ast::foreign_item_const(*) => {}
797+
ast::foreign_item_const(*) => {
798+
let ident = ccx.sess.parse_sess.interner.get(foreign_item.ident);
799+
ccx.item_symbols.insert(foreign_item.id, copy *ident);
800+
}
798801
}
799802
}
800803
}

src/rustc/middle/typeck/check/method.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,10 @@ struct lookup {
306306
};
307307

308308
let trt_methods = ty::trait_methods(tcx, trait_id);
309-
match vec::position(*trt_methods, |m| m.ident == self.m_name) {
309+
let match_fn: &fn(m: ty::method) -> bool = |m| {
310+
m.self_ty != ast::sty_static && m.ident == self.m_name
311+
};
312+
match vec::position(*trt_methods, match_fn) {
310313
None => {
311314
/* check next bound */
312315
trait_bnd_idx += 1u;

0 commit comments

Comments
 (0)