diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2016-06-13 20:46:08 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2016-08-17 05:50:57 +0300 |
| commit | 77dc61b5c68aacce4ab5d115b14825699ea6302b (patch) | |
| tree | 56684529f36dec17de0989d22335d5c318af2f47 | |
| parent | b354ae95a29a7f78059a1a9fc867dd2e8639671a (diff) | |
rustc: force all raw accesses to VecPerParamSpace through as_full_slice.
| -rw-r--r-- | src/librustc/traits/fulfill.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ty/flags.rs | 4 | ||||
| -rw-r--r-- | src/librustc/ty/mod.rs | 13 | ||||
| -rw-r--r-- | src/librustc/ty/structural_impls.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ty/sty.rs | 8 | ||||
| -rw-r--r-- | src/librustc/ty/subst.rs | 43 | ||||
| -rw-r--r-- | src/librustc/ty/walk.rs | 10 | ||||
| -rw-r--r-- | src/librustc/ty/wf.rs | 2 | ||||
| -rw-r--r-- | src/librustc_metadata/encoder.rs | 4 | ||||
| -rw-r--r-- | src/librustc_trans/back/symbol_names.rs | 2 | ||||
| -rw-r--r-- | src/librustc_trans/debuginfo/mod.rs | 4 | ||||
| -rw-r--r-- | src/librustc_trans/debuginfo/type_names.rs | 2 | ||||
| -rw-r--r-- | src/librustc_trans/monomorphize.rs | 2 | ||||
| -rw-r--r-- | src/librustc_trans/trans_item.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 5 | ||||
| -rw-r--r-- | src/librustc_typeck/check/regionck.rs | 15 | ||||
| -rw-r--r-- | src/librustc_typeck/check/wfcheck.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/collect.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/variance/constraints.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 5 |
20 files changed, 52 insertions, 85 deletions
diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 5ba7b914d65..1ee1dc50b71 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -142,7 +142,7 @@ impl<'a, 'gcx, 'tcx> DeferredObligation<'tcx> { // Auto trait obligations on `impl Trait`. if tcx.trait_has_default_impl(predicate.def_id()) { let substs = predicate.skip_binder().trait_ref.substs; - if substs.types.as_slice().len() == 1 && substs.regions.is_empty() { + if substs.types.as_full_slice().len() == 1 && substs.regions.is_empty() { if let ty::TyAnon(..) = predicate.skip_binder().self_ty().sty { return true; } diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs index 0997d6c1a75..3a5f3d421ea 100644 --- a/src/librustc/ty/flags.rs +++ b/src/librustc/ty/flags.rs @@ -209,8 +209,8 @@ impl FlagComputation { } fn add_substs(&mut self, substs: &subst::Substs) { - self.add_tys(substs.types.as_slice()); - for &r in &substs.regions { + self.add_tys(substs.types.as_full_slice()); + for &r in substs.regions.as_full_slice() { self.add_region(r); } } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 4f39a711010..708dcb30f1b 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -971,7 +971,7 @@ impl<'tcx> TraitPredicate<'tcx> { } pub fn input_types(&self) -> &[Ty<'tcx>] { - self.trait_ref.substs.types.as_slice() + self.trait_ref.substs.types.as_full_slice() } pub fn self_ty(&self) -> Ty<'tcx> { @@ -1113,7 +1113,7 @@ impl<'tcx> Predicate<'tcx> { pub fn walk_tys(&self) -> IntoIter<Ty<'tcx>> { let vec: Vec<_> = match *self { ty::Predicate::Trait(ref data) => { - data.0.trait_ref.substs.types.as_slice().to_vec() + data.0.trait_ref.substs.types.as_full_slice().to_vec() } ty::Predicate::Rfc1592(ref data) => { return data.walk_tys() @@ -1128,7 +1128,8 @@ impl<'tcx> Predicate<'tcx> { vec![] } ty::Predicate::Projection(ref data) => { - let trait_inputs = data.0.projection_ty.trait_ref.substs.types.as_slice(); + let trait_inputs = data.0.projection_ty.trait_ref.substs + .types.as_full_slice(); trait_inputs.iter() .cloned() .chain(Some(data.0.ty)) @@ -1220,7 +1221,7 @@ impl<'tcx> TraitRef<'tcx> { // now this is all the types that appear in the // trait-reference, but it should eventually exclude // associated types. - self.substs.types.as_slice() + self.substs.types.as_full_slice() } } @@ -2864,7 +2865,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { free_id_outlive: CodeExtent) -> Substs<'gcx> { // map T => T let mut types = VecPerParamSpace::empty(); - for def in generics.types.as_slice() { + for def in generics.types.as_full_slice() { debug!("construct_parameter_environment(): push_types_from_defs: def={:?}", def); types.push(def.space, self.global_tcx().mk_param_from_def(def)); @@ -2872,7 +2873,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // map bound 'a => free 'a let mut regions = VecPerParamSpace::empty(); - for def in generics.regions.as_slice() { + for def in generics.regions.as_full_slice() { let region = ReFree(FreeRegion { scope: free_id_outlive, bound_region: def.to_bound_region() }); diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 83413d16ffb..b0f8e2e13f7 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -433,7 +433,7 @@ impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for VecPerParamSpace<T> { } fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool { - self.iter().any(|elem| elem.visit_with(visitor)) + self.as_full_slice().iter().any(|elem| elem.visit_with(visitor)) } } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 9680632ec4d..098943dfce2 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1211,19 +1211,19 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { TyTrait(ref obj) => { let mut v = vec![obj.bounds.region_bound]; v.extend_from_slice(obj.principal.skip_binder() - .substs.regions.as_slice()); + .substs.regions.as_full_slice()); v } TyEnum(_, substs) | TyStruct(_, substs) | TyAnon(_, substs) => { - substs.regions.as_slice().to_vec() + substs.regions.as_full_slice().to_vec() } TyClosure(_, ref substs) => { - substs.func_substs.regions.as_slice().to_vec() + substs.func_substs.regions.as_full_slice().to_vec() } TyProjection(ref data) => { - data.trait_ref.substs.regions.as_slice().to_vec() + data.trait_ref.substs.regions.as_full_slice().to_vec() } TyFnDef(..) | TyFnPtr(_) | diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 0fe8d096640..10e7f3ad0d1 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -19,9 +19,6 @@ use ty::fold::{TypeFoldable, TypeFolder}; use serialize::{Encodable, Encoder, Decodable, Decoder}; use std::fmt; -use std::iter::IntoIterator; -use std::slice::Iter; -use std::vec::{Vec, IntoIter}; use syntax_pos::{Span, DUMMY_SP}; /////////////////////////////////////////////////////////////////////////// @@ -365,26 +362,14 @@ impl<T> VecPerParamSpace<T> { &self.get_slice(space)[index] } - pub fn iter<'a>(&'a self) -> Iter<'a,T> { - self.content.iter() - } - - pub fn into_iter(self) -> IntoIter<T> { - self.content.into_iter() - } - pub fn iter_enumerated<'a>(&'a self) -> EnumeratedItems<'a,T> { EnumeratedItems::new(self) } - pub fn as_slice(&self) -> &[T] { + pub fn as_full_slice(&self) -> &[T] { &self.content } - pub fn into_vec(self) -> Vec<T> { - self.content - } - pub fn all_vecs<P>(&self, mut pred: P) -> bool where P: FnMut(&[T]) -> bool, { @@ -392,11 +377,11 @@ impl<T> VecPerParamSpace<T> { } pub fn all<P>(&self, pred: P) -> bool where P: FnMut(&T) -> bool { - self.iter().all(pred) + self.as_full_slice().iter().all(pred) } pub fn any<P>(&self, pred: P) -> bool where P: FnMut(&T) -> bool { - self.iter().any(pred) + self.as_full_slice().iter().any(pred) } pub fn is_empty(&self) -> bool { @@ -404,7 +389,7 @@ impl<T> VecPerParamSpace<T> { } pub fn map<U, P>(&self, pred: P) -> VecPerParamSpace<U> where P: FnMut(&T) -> U { - let result = self.iter().map(pred).collect(); + let result = self.as_full_slice().iter().map(pred).collect(); VecPerParamSpace::new_internal(result, self.self_limit, self.type_limit) @@ -478,29 +463,11 @@ impl<'a,T> Iterator for EnumeratedItems<'a,T> { } fn size_hint(&self) -> (usize, Option<usize>) { - let size = self.vec.as_slice().len(); + let size = self.vec.as_full_slice().len(); (size, Some(size)) } } -impl<T> IntoIterator for VecPerParamSpace<T> { - type Item = T; - type IntoIter = IntoIter<T>; - - fn into_iter(self) -> IntoIter<T> { - self.into_vec().into_iter() - } -} - -impl<'a,T> IntoIterator for &'a VecPerParamSpace<T> { - type Item = &'a T; - type IntoIter = Iter<'a, T>; - - fn into_iter(self) -> Iter<'a, T> { - self.as_slice().into_iter() - } -} - /////////////////////////////////////////////////////////////////////////// // Public trait `Subst` diff --git a/src/librustc/ty/walk.rs b/src/librustc/ty/walk.rs index 9c1f9d9537a..3f87d80e337 100644 --- a/src/librustc/ty/walk.rs +++ b/src/librustc/ty/walk.rs @@ -79,10 +79,10 @@ fn push_subtypes<'tcx>(stack: &mut Vec<Ty<'tcx>>, parent_ty: Ty<'tcx>) { stack.push(mt.ty); } ty::TyProjection(ref data) => { - push_reversed(stack, data.trait_ref.substs.types.as_slice()); + push_reversed(stack, data.trait_ref.substs.types.as_full_slice()); } ty::TyTrait(box ty::TraitTy { ref principal, ref bounds }) => { - push_reversed(stack, principal.substs().types.as_slice()); + push_reversed(stack, principal.substs().types.as_full_slice()); push_reversed(stack, &bounds.projection_bounds.iter().map(|pred| { pred.0.ty }).collect::<Vec<_>>()); @@ -90,17 +90,17 @@ fn push_subtypes<'tcx>(stack: &mut Vec<Ty<'tcx>>, parent_ty: Ty<'tcx>) { ty::TyEnum(_, ref substs) | ty::TyStruct(_, ref substs) | ty::TyAnon(_, ref substs) => { - push_reversed(stack, substs.types.as_slice()); + push_reversed(stack, substs.types.as_full_slice()); } ty::TyClosure(_, ref substs) => { - push_reversed(stack, substs.func_substs.types.as_slice()); + push_reversed(stack, substs.func_substs.types.as_full_slice()); push_reversed(stack, &substs.upvar_tys); } ty::TyTuple(ref ts) => { push_reversed(stack, ts); } ty::TyFnDef(_, substs, ref ft) => { - push_reversed(stack, substs.types.as_slice()); + push_reversed(stack, substs.types.as_full_slice()); push_sig_subtypes(stack, &ft.sig); } ty::TyFnPtr(ref ft) => { diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index bfc2e11d9fb..009e3e24334 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -261,7 +261,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { let cause = self.cause(traits::MiscObligation); self.out.extend( trait_ref.substs.types - .as_slice() + .as_full_slice() .iter() .filter(|ty| !ty.has_escaping_regions()) .map(|ty| traits::Obligation::new(cause.clone(), diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 288fb74cc18..d19eb639182 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -515,7 +515,7 @@ fn encode_generics<'a, 'tcx>(rbml_w: &mut Encoder, { rbml_w.start_tag(tag); - for param in &generics.types { + for param in generics.types.as_full_slice() { rbml_w.start_tag(tag_type_param_def); tyencode::enc_type_param_def(rbml_w.writer, &ecx.ty_str_ctxt(), param); rbml_w.mark_stable_position(); @@ -523,7 +523,7 @@ fn encode_generics<'a, 'tcx>(rbml_w: &mut Encoder, } // Region parameters - for param in &generics.regions { + for param in generics.regions.as_full_slice() { rbml_w.start_tag(tag_region_param_def); tyencode::enc_region_param_def(rbml_w.writer, &ecx.ty_str_ctxt(), param); rbml_w.mark_stable_position(); diff --git a/src/librustc_trans/back/symbol_names.rs b/src/librustc_trans/back/symbol_names.rs index 5e2c0805c2e..bb27a308f71 100644 --- a/src/librustc_trans/back/symbol_names.rs +++ b/src/librustc_trans/back/symbol_names.rs @@ -252,7 +252,7 @@ impl<'a, 'tcx> Instance<'tcx> { // and should not matter anyhow. let instance_ty = scx.tcx().erase_regions(&instance_ty.ty); - let hash = get_symbol_hash(scx, &def_path, instance_ty, substs.types.as_slice()); + let hash = get_symbol_hash(scx, &def_path, instance_ty, substs.types.as_full_slice()); let mut buffer = SymbolPathBuffer { names: Vec::with_capacity(def_path.data.len()) diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs index d6a4ce3c43a..1aae3b3127f 100644 --- a/src/librustc_trans/debuginfo/mod.rs +++ b/src/librustc_trans/debuginfo/mod.rs @@ -358,7 +358,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, name_to_append_suffix_to: &mut String) -> DIArray { - let actual_types = param_substs.types.as_slice(); + let actual_types = param_substs.types.as_full_slice(); if actual_types.is_empty() { return create_DIArray(DIB(cx), &[]); @@ -381,7 +381,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, // Again, only create type information if full debuginfo is enabled let template_params: Vec<_> = if cx.sess().opts.debuginfo == FullDebugInfo { - generics.types.as_slice().iter().enumerate().map(|(i, param)| { + generics.types.as_full_slice().iter().enumerate().map(|(i, param)| { let actual_type = cx.tcx().normalize_associated_type(&actual_types[i]); let actual_type_metadata = type_metadata(cx, actual_type, syntax_pos::DUMMY_SP); let name = CString::new(param.name.as_str().as_bytes()).unwrap(); diff --git a/src/librustc_trans/debuginfo/type_names.rs b/src/librustc_trans/debuginfo/type_names.rs index 73b1c828663..4bca091ef95 100644 --- a/src/librustc_trans/debuginfo/type_names.rs +++ b/src/librustc_trans/debuginfo/type_names.rs @@ -181,7 +181,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, output.push('<'); - for &type_parameter in &substs.types { + for &type_parameter in substs.types.as_full_slice() { push_debuginfo_type_name(cx, type_parameter, true, output); output.push_str(", "); } diff --git a/src/librustc_trans/monomorphize.rs b/src/librustc_trans/monomorphize.rs index e9aacaa0f95..663c5167d14 100644 --- a/src/librustc_trans/monomorphize.rs +++ b/src/librustc_trans/monomorphize.rs @@ -181,7 +181,7 @@ impl<'tcx> fmt::Display for Instance<'tcx> { impl<'tcx> Instance<'tcx> { pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> Instance<'tcx> { - assert!(substs.regions.iter().all(|&r| r == ty::ReErased)); + assert!(substs.regions.as_full_slice().iter().all(|&r| r == ty::ReErased)); Instance { def: def_id, substs: substs } } pub fn mono<'a>(scx: &SharedCrateContext<'a, 'tcx>, def_id: DefId) -> Instance<'tcx> { diff --git a/src/librustc_trans/trans_item.rs b/src/librustc_trans/trans_item.rs index 90058f0b832..c1149279b4d 100644 --- a/src/librustc_trans/trans_item.rs +++ b/src/librustc_trans/trans_item.rs @@ -570,7 +570,7 @@ fn push_type_params<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, output.push('<'); - for &type_parameter in types { + for &type_parameter in types.as_full_slice() { push_unique_type_name(tcx, type_parameter, output); output.push_str(", "); } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 76b9052af68..b82ce2f5bc4 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -888,7 +888,8 @@ fn check_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, // `{Self}` is allowed Position::ArgumentNamed(s) if s == "Self" => (), // So is `{A}` if A is a type parameter - Position::ArgumentNamed(s) => match types.iter().find(|t| { + Position::ArgumentNamed(s) => match types.as_full_slice() + .iter().find(|t| { t.name.as_str() == s }) { Some(_) => (), @@ -1895,7 +1896,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// Registers obligations that all types appearing in `substs` are well-formed. pub fn add_wf_bounds(&self, substs: &Substs<'tcx>, expr: &hir::Expr) { - for &ty in &substs.types { + for &ty in substs.types.as_full_slice() { self.register_wf_obligation(ty, expr.span, traits::MiscObligation); } } diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 22ffcfbaae1..6f3d48282e2 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -1445,11 +1445,11 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { let origin = infer::ParameterInScope(origin, expr_span); - for ®ion in &substs.regions { + for ®ion in substs.regions.as_full_slice() { self.sub_regions(origin.clone(), expr_region, region); } - for &ty in &substs.types { + for &ty in substs.types.as_full_slice() { let ty = self.resolve_type(ty); self.type_must_outlive(origin.clone(), ty, expr_region); } @@ -1571,18 +1571,15 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { // the problem is to add `T: 'r`, which isn't true. So, if there are no // inference variables, we use a verify constraint instead of adding // edges, which winds up enforcing the same condition. - let needs_infer = { - projection_ty.trait_ref.substs.types.iter().any(|t| t.needs_infer()) || - projection_ty.trait_ref.substs.regions.iter().any(|r| r.needs_infer()) - }; + let needs_infer = projection_ty.trait_ref.needs_infer(); if env_bounds.is_empty() && needs_infer { debug!("projection_must_outlive: no declared bounds"); - for &component_ty in &projection_ty.trait_ref.substs.types { + for &component_ty in projection_ty.trait_ref.substs.types.as_full_slice() { self.type_must_outlive(origin.clone(), component_ty, region); } - for &r in &projection_ty.trait_ref.substs.regions { + for &r in projection_ty.trait_ref.substs.regions.as_full_slice() { self.sub_regions(origin.clone(), region, r); } @@ -1600,7 +1597,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { if !env_bounds.is_empty() && env_bounds[1..].iter().all(|b| *b == env_bounds[0]) { let unique_bound = env_bounds[0]; debug!("projection_must_outlive: unique declared bound = {:?}", unique_bound); - if projection_ty.trait_ref.substs.regions + if projection_ty.trait_ref.substs.regions.as_full_slice() .iter() .any(|r| env_bounds.contains(r)) { diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 4bb9f4fd332..678c102a4de 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -621,7 +621,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Trait impl: take implied bounds from all types that // appear in the trait reference. let trait_ref = self.instantiate_type_scheme(span, free_substs, trait_ref); - trait_ref.substs.types.as_slice().to_vec() + trait_ref.substs.types.as_full_slice().to_vec() } None => { diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 22da4ab9c43..69545aefb44 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1550,7 +1550,7 @@ fn convert_typed_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, // Debugging aid. if tcx.has_attr(ccx.tcx.map.local_def_id(it.id), "rustc_object_lifetime_default") { let object_lifetime_default_reprs: String = - scheme.generics.types.iter() + scheme.generics.types.as_full_slice().iter() .map(|t| match t.object_lifetime_default { ty::ObjectLifetimeDefault::Specific(r) => r.to_string(), d => format!("{:?}", d), diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index a4faee8f633..1e342d4b819 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -302,8 +302,8 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.add_constraints_from_substs( generics, trait_ref.def_id, - trait_def.generics.types.as_slice(), - trait_def.generics.regions.as_slice(), + trait_def.generics.types.as_full_slice(), + trait_def.generics.regions.as_full_slice(), trait_ref.substs, variance); } @@ -388,8 +388,8 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.add_constraints_from_substs( generics, trait_ref.def_id, - trait_def.generics.types.as_slice(), - trait_def.generics.regions.as_slice(), + trait_def.generics.types.as_full_slice(), + trait_def.generics.regions.as_full_slice(), trait_ref.substs, variance); } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 0da833d147e..284e0d4dbdd 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -788,8 +788,9 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> { impl<'tcx> Clean<Option<Vec<TyParamBound>>> for subst::Substs<'tcx> { fn clean(&self, cx: &DocContext) -> Option<Vec<TyParamBound>> { let mut v = Vec::new(); - v.extend(self.regions.iter().filter_map(|r| r.clean(cx)).map(RegionBound)); - v.extend(self.types.iter().map(|t| TraitBound(PolyTrait { + v.extend(self.regions.as_full_slice().iter().filter_map(|r| r.clean(cx)) + .map(RegionBound)); + v.extend(self.types.as_full_slice().iter().map(|t| TraitBound(PolyTrait { trait_: t.clean(cx), lifetimes: vec![] }, hir::TraitBoundModifier::None))); |
