Skip to content

Commit 17e30d6

Browse files
committed
Change each_bound_trait_and_supertraits to take a vec of TraitRefs.
1 parent 387df4e commit 17e30d6

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

src/librustc/middle/ty.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -4348,9 +4348,9 @@ pub fn determine_inherited_purity(parent: (ast::purity, ast::node_id),
43484348
// relation on the supertraits from each bounded trait's constraint
43494349
// list.
43504350
pub fn each_bound_trait_and_supertraits(tcx: ctxt,
4351-
bounds: &ParamBounds,
4351+
bounds: &[@TraitRef],
43524352
f: &fn(@TraitRef) -> bool) -> bool {
4353-
for bounds.trait_bounds.iter().advance |&bound_trait_ref| {
4353+
for bounds.iter().advance |&bound_trait_ref| {
43544354
let mut supertrait_set = HashMap::new();
43554355
let mut trait_refs = ~[];
43564356
let mut i = 0;
@@ -4392,7 +4392,8 @@ pub fn count_traits_and_supertraits(tcx: ctxt,
43924392
type_param_defs: &[TypeParameterDef]) -> uint {
43934393
let mut total = 0;
43944394
for type_param_defs.iter().advance |type_param_def| {
4395-
for each_bound_trait_and_supertraits(tcx, type_param_def.bounds) |_| {
4395+
for each_bound_trait_and_supertraits(
4396+
tcx, type_param_def.bounds.trait_bounds) |_| {
43964397
total += 1;
43974398
}
43984399
}

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ impl<'self> LookupContext<'self> {
413413
};
414414

415415
self.push_inherent_candidates_from_bounds(
416-
rcvr_ty, &*type_param_def.bounds, param_numbered(param_ty.idx));
416+
rcvr_ty, type_param_def.bounds.trait_bounds,
417+
param_numbered(param_ty.idx));
417418
}
418419

419420

@@ -423,18 +424,13 @@ impl<'self> LookupContext<'self> {
423424
let tcx = self.tcx();
424425

425426
let trait_ref = ty::lookup_trait_def(tcx, did).trait_ref;
426-
let bounds = ParamBounds {
427-
builtin_bounds: EmptyBuiltinBounds(),
428-
trait_bounds: ~[trait_ref]
429-
};
430-
431427
self.push_inherent_candidates_from_bounds(
432-
self_ty, &bounds, param_self);
428+
self_ty, &[trait_ref], param_self);
433429
}
434430

435431
pub fn push_inherent_candidates_from_bounds(&self,
436432
self_ty: ty::t,
437-
bounds: &ParamBounds,
433+
bounds: &[@TraitRef],
438434
param: param_index) {
439435
let tcx = self.tcx();
440436
let mut next_bound_idx = 0; // count only trait bounds

src/librustc/middle/typeck/check/vtable.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn lookup_vtables_for_param(vcx: &VtableContext,
132132
let mut param_result = ~[];
133133

134134
for ty::each_bound_trait_and_supertraits(
135-
tcx, type_param_bounds) |trait_ref|
135+
tcx, type_param_bounds.trait_bounds) |trait_ref|
136136
{
137137
// ...and here trait_ref is each bound that was declared on A,
138138
// expressed in terms of the type parameters.
@@ -249,7 +249,7 @@ fn lookup_vtable(vcx: &VtableContext,
249249
let mut n_bound = 0;
250250
let type_param_def = tcx.ty_param_defs.get(&did.node);
251251
for ty::each_bound_trait_and_supertraits(
252-
tcx, type_param_def.bounds) |bound_trait_ref|
252+
tcx, type_param_def.bounds.trait_bounds) |bound_trait_ref|
253253
{
254254
debug!("checking bounds trait %s", bound_trait_ref.repr(vcx.tcx()));
255255

0 commit comments

Comments
 (0)