Fixes #2772
gcc/testsuite/ChangeLog:
* rust/compile/issue-2772-1.rs: New test.
* rust/compile/issue-2772-2.rs: New test.
--- /dev/null
+// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
+struct Pair<'a, T, U>
+where
+ T: 'a,
+ U: 'a,
+{
+ left: T,
+ right: U,
+}
+
+pub fn test<'a>() {
+ let a: i32 = 50;
+ let x = Pair {
+ left: &&a,
+ right: &a,
+ };
+}
--- /dev/null
+// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
+struct Pair<'a, T, U>
+where
+ T: 'a,
+ U: 'a,
+{
+ left: T,
+ right: U,
+}
+
+pub fn test<'a>() {
+ let a: i32 = 50;
+ let x = Pair::<&'_ _, &'_ _> {
+ left: &&a,
+ right: &a,
+ };
+}