Auto merge of #338 - dtolnay:refs, r=oli-obk

Strip more references

Fixes #337.
This commit is contained in:
Homu 2016-05-20 02:45:31 +09:00
commit cc115ca43a
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>
// where T: Serialize { ... }
fn strip_reference(ty: &P<ast::Ty>) -> &P<ast::Ty> {
match ty.node {
ast::TyKind::Rptr(_, ref mut_ty) => &mut_ty.ty,
_ => ty
fn strip_reference(mut ty: &P<ast::Ty>) -> &P<ast::Ty> {
while let ast::TyKind::Rptr(_, ref mut_ty) = ty.node {
ty = &mut_ty.ty;
}
ty
}

View File

@ -49,6 +49,12 @@ enum EnumWith<T> {
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!() }