Skip to content

Commit

Permalink
normalize tuple pair types
Browse files Browse the repository at this point in the history
  • Loading branch information
TimNN committed Oct 12, 2016
1 parent a29c49f commit 7badc32
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/librustc_trans/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ pub fn type_pair_fields<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>)
if tys.len() != 2 {
return None;
}
Some([tys[0], tys[1]])
Some([ccx.tcx().normalize_associated_type(&tys[0]),
ccx.tcx().normalize_associated_type(&tys[1])])
}
_ => None
}
Expand Down
25 changes: 25 additions & 0 deletions src/test/run-pass/issue-37109.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2016 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

trait ToRef<'a> {
type Ref: 'a;
}

impl<'a, U: 'a> ToRef<'a> for U {
type Ref = &'a U;
}

fn example<'a, T>(value: &'a T) -> (<T as ToRef<'a>>::Ref, u32) {
(value, 0)
}

fn main() {
example(&0);
}

0 comments on commit 7badc32

Please sign in to comment.