about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Neumann <mail@timnn.me>2016-10-12 12:10:39 +0200
committerTim Neumann <mail@timnn.me>2016-10-12 12:20:10 +0200
commit7badc32005648e7aebe982a076cc677c68937fe4 (patch)
tree60d0aa236e4076d41d808555f1f9a5fa2d5ac394
parenta29c49f5cca849cd5ac79b3cd70b934bb33cf4e6 (diff)
downloadrust-7badc32005648e7aebe982a076cc677c68937fe4.tar.gz
rust-7badc32005648e7aebe982a076cc677c68937fe4.zip
normalize tuple pair types
-rw-r--r--src/librustc_trans/common.rs3
-rw-r--r--src/test/run-pass/issue-37109.rs25
2 files changed, 27 insertions, 1 deletions
diff --git a/src/librustc_trans/common.rs b/src/librustc_trans/common.rs
index 6ae5fc1657a..9b893e19894 100644
--- a/src/librustc_trans/common.rs
+++ b/src/librustc_trans/common.rs
@@ -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
     }
diff --git a/src/test/run-pass/issue-37109.rs b/src/test/run-pass/issue-37109.rs
new file mode 100644
index 00000000000..1c893071d55
--- /dev/null
+++ b/src/test/run-pass/issue-37109.rs
@@ -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);
+}