Strip more references

This commit is contained in:
David Tolnay 2016-05-18 23:46:06 -07:00
parent 16d3e96b77
commit f1b4072444
2 changed files with 10 additions and 4 deletions

View File

@ -139,9 +139,9 @@ fn contains_generic(ty: &ast::Ty, generics: &ast::Generics) -> bool {
// //
// impl<'a, T> Serialize for Test<'a, T> // impl<'a, T> Serialize for Test<'a, T>
// where T: Serialize { ... } // where T: Serialize { ... }
fn strip_reference(ty: &P<ast::Ty>) -> &P<ast::Ty> { fn strip_reference(mut ty: &P<ast::Ty>) -> &P<ast::Ty> {
match ty.node { while let ast::TyKind::Rptr(_, ref mut_ty) = ty.node {
ast::TyKind::Rptr(_, ref mut_ty) => &mut_ty.ty, ty = &mut_ty.ty;
_ => ty
} }
ty
} }

View File

@ -49,6 +49,12 @@ enum EnumWith<T> {
i: i32 }, i: i32 },
} }
#[derive(Serialize)]
struct MultipleRef<'a, 'b, 'c, T> where T: 'c, 'c: 'b, 'b: 'a {
t: T,
rrrt: &'a &'b &'c T,
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
fn ser_i32<S: Serializer>(_: &i32, _: &mut S) -> Result<(), S::Error> { panic!() } fn ser_i32<S: Serializer>(_: &i32, _: &mut S) -> Result<(), S::Error> { panic!() }