Skip to content

Commit 6b84cee

Browse files
committed
add a few measly comments, remove some dead code
1 parent f5edb5e commit 6b84cee

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

src/rustc/middle/infer.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ impl methods for ures {
8585
}
8686
}
8787

88+
// Most of these methods, like tys() and so forth, take two parameters
89+
// a and b and they are tasked with "ensuring that a is a subtype of
90+
// b". They return success or failure. They make changes in-place to
91+
// the variable bindings: these changes are recorded in the `bindings`
92+
// array, which then allows the changes to be rolled back if needed.
93+
//
94+
// The merge() and merge_bnds() methods are somewhat different in that
95+
// they compute a new type range for a variable (generally a subset of
96+
// the old range). They therefore return a result.
8897
impl unify_methods for infer_ctxt {
8998
fn uok() -> ures {
9099
#debug["Unification OK"];
@@ -177,18 +186,8 @@ impl unify_methods for infer_ctxt {
177186
}
178187
}
179188

180-
// Take bound a if it is set, else take bound b.
181-
fn aelseb(a: bound, b: bound) -> bound {
182-
alt (a, b) {
183-
(none, none) { none }
184-
(some(_), none) { a }
185-
(none, some(_)) { b }
186-
(some(_), some(_)) { a }
187-
}
188-
}
189-
190189
// Combines the two bounds. Returns a bounds r where (r.lb <:
191-
// a,b) and (a,b <: r.ub).
190+
// a,b) and (a,b <: r.ub) (if such a bounds exists).
192191
fn merge_bnds(a: bound, b: bound) -> result<bounds, ty::type_err> {
193192
alt (a, b) {
194193
(none, none) {
@@ -215,10 +214,14 @@ impl unify_methods for infer_ctxt {
215214
}
216215
}
217216

218-
// Given a variable with bounds `a`, returns a new set of bounds
219-
// such that `a` <: `b`. The new bounds will always be a subset
220-
// of the old bounds. If this cannot be achieved, the result is
221-
// failure.
217+
// Updates the bounds for the variable `v_id` to be the intersection
218+
// of `a` and `b`. That is, the new bounds for `v_id` will be
219+
// a bounds c such that:
220+
// c.ub <: a.ub
221+
// c.ub <: b.ub
222+
// a.lb <: c.lb
223+
// b.lb <: c.lb
224+
// If this cannot be achieved, the result is failure.
222225
fn merge(v_id: uint, a: bounds, b: bounds) -> ures {
223226
// Think of the two diamonds, we want to find the
224227
// intersection. There are basically four possibilities (you

src/rustc/middle/typeck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ mod collect {
11291129
// Type unification
11301130
mod unify {
11311131
fn unify_with_region_bindings(fcx: @fn_ctxt,
1132-
rb: @ty::unify::region_bindings,
1132+
_rb: @ty::unify::region_bindings,
11331133
expected: ty::t,
11341134
actual: ty::t)
11351135
-> result<(), ty::type_err> {

0 commit comments

Comments
 (0)