From 12d7be9a283d6b57682bbaa1da3db91b636583a7 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 23 Jan 2015 20:05:04 -0500 Subject: [PATCH] make `walk_ty` walk over a trait projections closes #21363 --- src/librustc/middle/ty_walk.rs | 5 ++++- src/test/run-pass/issue-21363.rs | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/test/run-pass/issue-21363.rs diff --git a/src/librustc/middle/ty_walk.rs b/src/librustc/middle/ty_walk.rs index 28975c73416..ff3a308d7d3 100644 --- a/src/librustc/middle/ty_walk.rs +++ b/src/librustc/middle/ty_walk.rs @@ -37,8 +37,11 @@ impl<'tcx> TypeWalker<'tcx> { ty::ty_projection(ref data) => { self.push_reversed(data.trait_ref.substs.types.as_slice()); } - ty::ty_trait(box ty::TyTrait { ref principal, .. }) => { + ty::ty_trait(box ty::TyTrait { ref principal, ref bounds }) => { self.push_reversed(principal.substs().types.as_slice()); + self.push_reversed(bounds.projection_bounds.iter().map(|pred| { + pred.0.ty + }).collect::>().as_slice()); } ty::ty_enum(_, ref substs) | ty::ty_struct(_, ref substs) | diff --git a/src/test/run-pass/issue-21363.rs b/src/test/run-pass/issue-21363.rs new file mode 100644 index 00000000000..2fc1d9fd643 --- /dev/null +++ b/src/test/run-pass/issue-21363.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![no_implicit_prelude] + +trait Iterator { + type Item; +} + +impl<'a, T> Iterator for &'a mut (Iterator + 'a) { + type Item = T; +} + +fn main() {}