Skip to content

Commit 74c85f3

Browse files
committed
gccrs: add test cases to prove type inference is working
Fixes #2772 gcc/testsuite/ChangeLog: * rust/compile/issue-2772-1.rs: New test. * rust/compile/issue-2772-2.rs: New test.
1 parent 838eab4 commit 74c85f3

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// { dg-options "-w" }
2+
#[lang = "sized"]
3+
pub trait Sized {}
4+
5+
struct Pair<'a, T, U>
6+
where
7+
T: 'a,
8+
U: 'a,
9+
{
10+
left: T,
11+
right: U,
12+
}
13+
14+
pub fn test<'a>() {
15+
let a: i32 = 50;
16+
let x = Pair {
17+
left: &&a,
18+
right: &a,
19+
};
20+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// { dg-options "-w" }
2+
#[lang = "sized"]
3+
pub trait Sized {}
4+
5+
struct Pair<'a, T, U>
6+
where
7+
T: 'a,
8+
U: 'a,
9+
{
10+
left: T,
11+
right: U,
12+
}
13+
14+
pub fn test<'a>() {
15+
let a: i32 = 50;
16+
let x = Pair::<&'_ _, &'_ _> {
17+
left: &&a,
18+
right: &a,
19+
};
20+
}

0 commit comments

Comments
 (0)