diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 3026b5c24c1..854b8b9ba77 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -3931,6 +3931,7 @@ impl<'a> Resolver<'a> { item.id, ItemRibKind), |this| { + this.resolve_type_parameters(&generics.ty_params); visit::walk_item(this, item, ()); }); } diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 742d22cc379..d1d76734941 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -488,7 +488,9 @@ pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt, generics: &ast::Generics, thing: &'static str) { for ty_param in generics.ty_params.iter() { - for bound in ty_param.bounds.iter() { + let bounds = ty_param.bounds.iter(); + let mut bounds = bounds.chain(ty_param.unbound.iter()); + for bound in bounds { match *bound { ast::TraitTyParamBound(..) | ast::UnboxedFnTyParamBound(..) => { // According to accepted RFC #XXX, we should @@ -1076,9 +1078,10 @@ fn add_unsized_bound(ccx: &CrateCtxt, desc: &str, span: Span) { let kind_id = ccx.tcx.lang_items.require(SizedTraitLangItem); + match unbound { &Some(ast::TraitTyParamBound(ref tpb)) => { - // #FIXME(8559) currently requires the unbound to be built-in. + // FIXME(#8559) currently requires the unbound to be built-in. let trait_def_id = ty::trait_ref_to_def_id(ccx.tcx, tpb); match kind_id { Ok(kind_id) if trait_def_id != kind_id => { diff --git a/src/test/run-pass/unsized.rs b/src/test/run-pass/unsized.rs index 0530c8a6ab3..141d6c88dd9 100644 --- a/src/test/run-pass/unsized.rs +++ b/src/test/run-pass/unsized.rs @@ -24,6 +24,7 @@ struct S1; enum E {} impl T1 for S1 {} fn f() {} +type TT = T; pub fn main() { }