Skip to content

Commit 90d3f0f

Browse files
committed
Ensure method names in iface and impl items are unique
Closes #2114
1 parent fabd49b commit 90d3f0f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/rustc/middle/infer.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,10 +1341,6 @@ impl of combine for glb {
13411341
ok(ty::mk_bot(self.infcx().tcx))
13421342
}
13431343

1344-
fn c_regions(a: ty::region, _b: ty::region) -> cres<ty::region> {
1345-
ok(a) // FIXME
1346-
}
1347-
13481344
fn c_mts(a: ty::mt, b: ty::mt) -> cres<ty::mt> {
13491345
let tcx = self.infcx().tcx;
13501346

src/rustc/middle/resolve.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,13 +1727,21 @@ fn check_item(e: @env, i: @ast::item, &&x: (), v: vt<()>) {
17271727
alt i.node {
17281728
ast::item_fn(decl, ty_params, _) {
17291729
check_fn(*e, i.span, decl);
1730-
ensure_unique(*e, i.span, typaram_names(ty_params), ident_id,
1730+
ensure_unique(*e, i.span, ty_params, {|tp| tp.ident},
17311731
"type parameter");
17321732
}
17331733
ast::item_enum(_, ty_params) {
1734-
ensure_unique(*e, i.span, typaram_names(ty_params), ident_id,
1734+
ensure_unique(*e, i.span, ty_params, {|tp| tp.ident},
17351735
"type parameter");
17361736
}
1737+
ast::item_iface(_, methods) {
1738+
ensure_unique(*e, i.span, methods, {|m| m.ident},
1739+
"method");
1740+
}
1741+
ast::item_impl(_, _, _, methods) {
1742+
ensure_unique(*e, i.span, methods, {|m| m.ident},
1743+
"method");
1744+
}
17371745
_ { }
17381746
}
17391747
}
@@ -1871,8 +1879,6 @@ fn add_name(ch: checker, sp: span, name: ident) {
18711879
ch.seen += [name];
18721880
}
18731881

1874-
fn ident_id(&&i: ident) -> ident { ret i; }
1875-
18761882
fn ensure_unique<T>(e: env, sp: span, elts: [T], id: fn(T) -> ident,
18771883
kind: str) {
18781884
let ch = checker(e, kind);

0 commit comments

Comments
 (0)