@@ -18,7 +18,7 @@ use middle::typeck::infer::{fixup_err_to_str, InferCtxt};
1818use middle:: typeck:: infer:: { resolve_and_force_all_but_regions, resolve_type} ;
1919use middle:: typeck:: infer;
2020use middle:: typeck:: { CrateCtxt , vtable_origin, vtable_param, vtable_res} ;
21- use middle:: typeck:: { vtable_static, vtable_trait } ;
21+ use middle:: typeck:: { vtable_static} ;
2222use util:: common:: indenter;
2323use util:: ppaux:: tys_to_str;
2424use util:: ppaux;
@@ -81,7 +81,6 @@ pub fn lookup_vtables(vcx: &VtableContext,
8181 location_info : & LocationInfo ,
8282 bounds : @~[ ty:: param_bounds ] ,
8383 substs : & ty:: substs ,
84- allow_unsafe : bool ,
8584 is_early : bool ) -> vtable_res {
8685 debug ! ( "lookup_vtables(location_info=%?,
8786 # bounds=%?, \
@@ -110,8 +109,7 @@ pub fn lookup_vtables(vcx: &VtableContext,
110109 debug ! ( "after subst: %?" ,
111110 ppaux:: ty_to_str( tcx, trait_ty) ) ;
112111
113- match lookup_vtable ( vcx, location_info, * ty, trait_ty,
114- allow_unsafe, is_early) {
112+ match lookup_vtable ( vcx, location_info, * ty, trait_ty, is_early) {
115113 Some ( vtable) => result. push ( vtable) ,
116114 None => {
117115 vcx. tcx ( ) . sess . span_fatal (
@@ -162,7 +160,6 @@ pub fn lookup_vtable(vcx: &VtableContext,
162160 location_info: &LocationInfo,
163161 ty: ty::t,
164162 trait_ty: ty::t,
165- allow_unsafe: bool,
166163 is_early: bool)
167164 -> Option<vtable_origin> {
168165 debug!(" lookup_vtable( ty=%s, trait_ty=%s) ",
@@ -224,30 +221,6 @@ pub fn lookup_vtable(vcx: &VtableContext,
224221 }
225222 }
226223
227- ty::ty_trait(did, ref substs, _) if trait_id == did => {
228- debug!(" ( checking vtable) @1 relating ty to trait ty with did %?",
229- did);
230-
231- relate_trait_tys(vcx, location_info, trait_ty, ty);
232- if !allow_unsafe && !is_early {
233- for vec::each(*ty::trait_methods(tcx, did)) |m| {
234- if ty::type_has_self(ty::mk_bare_fn(tcx, copy m.fty)) {
235- tcx.sess.span_err(
236- location_info.span,
237- ~" a boxed trait with self types may not be \
238- passed as a bounded type ");
239- } else if (*m.tps).len() > 0u {
240- tcx.sess.span_err(
241- location_info.span,
242- ~" a boxed trait with generic methods may not \
243- be passed as a bounded type ");
244-
245- }
246- }
247- }
248- return Some(vtable_trait(did, /*bad*/copy (*substs).tps));
249- }
250-
251224 _ => {
252225 let mut found = ~[];
253226
@@ -411,7 +384,7 @@ pub fn lookup_vtable(vcx: &VtableContext,
411384 trait_vstore);
412385 let subres = lookup_vtables(
413386 vcx, location_info, im_bs, &substs_f,
414- false, is_early);
387+ is_early);
415388
416389 // Finally, we register that we found a
417390 // matching impl, and record the def ID of
@@ -542,8 +515,7 @@ pub fn early_resolve_expr(ex: @ast::expr,
542515 }
543516 let vcx = VtableContext { ccx: fcx.ccx, infcx: fcx.infcx() };
544517 let vtbls = lookup_vtables(&vcx, &location_info_for_expr(ex),
545- item_ty.bounds, substs, false,
546- is_early);
518+ item_ty.bounds, substs, is_early);
547519 if !is_early {
548520 let vtable_map = cx.vtable_map;
549521 vtable_map.insert(ex.id, vtbls);
@@ -573,7 +545,7 @@ pub fn early_resolve_expr(ex: @ast::expr,
573545 let substs = fcx.node_ty_substs(callee_id);
574546 let vcx = VtableContext { ccx: fcx.ccx, infcx: fcx.infcx() };
575547 let vtbls = lookup_vtables(&vcx, &location_info_for_expr(ex),
576- bounds, &substs, false, is_early);
548+ bounds, &substs, is_early);
577549 if !is_early {
578550 insert_vtables(cx, callee_id, vtbls);
579551 }
@@ -607,7 +579,6 @@ pub fn early_resolve_expr(ex: @ast::expr,
607579 location_info,
608580 mt.ty,
609581 target_ty,
610- true,
611582 is_early);
612583 match vtable_opt {
613584 Some(vtable) => {
0 commit comments