Skip to content

Commit 75a8480

Browse files
committed
De-@ ty::TypeParameterDef's bounds field
cc rust-lang#13231
1 parent 8fdf1e2 commit 75a8480

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/librustc/middle/typeck/collect.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,14 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt, trait_id: ast::NodeId) {
340340
// add in the "self" type parameter
341341
let self_trait_def = get_trait_def(ccx, local_def(trait_id));
342342
let self_trait_ref = self_trait_def.trait_ref.subst(tcx, &substs);
343+
let bounds = ty::ParamBounds {
344+
builtin_bounds: ty::EmptyBuiltinBounds(),
345+
trait_bounds: vec!(self_trait_ref)
346+
};
343347
new_type_param_defs.push(ty::TypeParameterDef {
344348
ident: special_idents::self_,
345349
def_id: dummy_defid,
346-
bounds: Rc::new(ty::ParamBounds {
347-
builtin_bounds: ty::EmptyBuiltinBounds(),
348-
trait_bounds: vec!(self_trait_ref)
349-
}),
350+
bounds: Rc::new(bounds),
350351
default: None
351352
});
352353

@@ -1035,7 +1036,7 @@ fn ty_generics(ccx: &CrateCtxt,
10351036
type_param_defs: Rc::new(ty_params.iter().enumerate().map(|(offset, param)| {
10361037
let existing_def_opt = {
10371038
let ty_param_defs = ccx.tcx.ty_param_defs.borrow();
1038-
ty_param_defs.find(&param.id).map(|def| def.clone())
1039+
ty_param_defs.find(&param.id).map(|def| (*def).clone())
10391040
};
10401041
existing_def_opt.unwrap_or_else(|| {
10411042
let param_ty = ty::param_ty {idx: base_index + offset,

0 commit comments

Comments
 (0)