Skip to content

Commit 7badc32

Browse files
committed
normalize tuple pair types
1 parent a29c49f commit 7badc32

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/librustc_trans/common.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ pub fn type_pair_fields<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>)
114114
if tys.len() != 2 {
115115
return None;
116116
}
117-
Some([tys[0], tys[1]])
117+
Some([ccx.tcx().normalize_associated_type(&tys[0]),
118+
ccx.tcx().normalize_associated_type(&tys[1])])
118119
}
119120
_ => None
120121
}

src/test/run-pass/issue-37109.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait ToRef<'a> {
12+
type Ref: 'a;
13+
}
14+
15+
impl<'a, U: 'a> ToRef<'a> for U {
16+
type Ref = &'a U;
17+
}
18+
19+
fn example<'a, T>(value: &'a T) -> (<T as ToRef<'a>>::Ref, u32) {
20+
(value, 0)
21+
}
22+
23+
fn main() {
24+
example(&0);
25+
}

0 commit comments

Comments
 (0)