about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2020-06-29 22:15:11 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2020-10-06 11:19:30 +0100
commit042464f75ae1272260b24896b3266a5c1ba62c6b (patch)
treef1741138d142e2d05d4c458a70dc04916fdf3889 /src/test
parent2bdf723da7c465e052a1b1fc448c0014c46b9e51 (diff)
downloadrust-042464f75ae1272260b24896b3266a5c1ba62c6b.tar.gz
rust-042464f75ae1272260b24896b3266a5c1ba62c6b.zip
Fix tests and bootstrap
Diffstat (limited to 'src/test')
-rw-r--r--src/test/incremental/issue-54242.rs2
-rw-r--r--src/test/mir-opt/simplify_arm.id_try.SimplifyArmIdentity.diff14
-rw-r--r--src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff14
-rw-r--r--src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff2
-rw-r--r--src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff2
-rw-r--r--src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir2
-rw-r--r--src/test/ui/associated-types/param-env-normalize-cycle.rs39
-rw-r--r--src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs1
-rw-r--r--src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr34
-rw-r--r--src/test/ui/for/for-c-in-str.rs18
-rw-r--r--src/test/ui/for/for-c-in-str.stderr2
-rw-r--r--src/test/ui/generic-associated-types/auxiliary/foo_defn.rs8
-rw-r--r--src/test/ui/generic-associated-types/cross-crate-bounds.rs32
-rw-r--r--src/test/ui/generic-associated-types/cross-crate-bounds.stderr14
-rw-r--r--src/test/ui/traits/check-trait-object-bounds-3.rs1
-rw-r--r--src/test/ui/traits/check-trait-object-bounds-3.stderr19
16 files changed, 151 insertions, 53 deletions
diff --git a/src/test/incremental/issue-54242.rs b/src/test/incremental/issue-54242.rs
index 25dc7cdf129..a95cf776c2e 100644
--- a/src/test/incremental/issue-54242.rs
+++ b/src/test/incremental/issue-54242.rs
@@ -1,6 +1,6 @@
 // revisions: rpass cfail
 
-trait Tr {
+trait Tr where Self::Arr: Sized {
     type Arr;
 
     const C: usize = 0;
diff --git a/src/test/mir-opt/simplify_arm.id_try.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify_arm.id_try.SimplifyArmIdentity.diff
index 33245b65e8c..6ec2b98bf5b 100644
--- a/src/test/mir-opt/simplify_arm.id_try.SimplifyArmIdentity.diff
+++ b/src/test/mir-opt/simplify_arm.id_try.SimplifyArmIdentity.diff
@@ -1,6 +1,6 @@
 - // MIR for `id_try` before SimplifyArmIdentity
 + // MIR for `id_try` after SimplifyArmIdentity
-  
+
   fn id_try(_1: std::result::Result<u8, i32>) -> std::result::Result<u8, i32> {
       debug r => _1;                       // in scope 0 at $DIR/simplify-arm.rs:23:11: 23:12
       let mut _0: std::result::Result<u8, i32>; // return place in scope 0 at $DIR/simplify-arm.rs:23:34: 23:49
@@ -42,7 +42,7 @@
       scope 6 {
           debug self => _4;                // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
       }
-  
+
       bb0: {
           StorageLive(_2);                 // scope 0 at $DIR/simplify-arm.rs:24:9: 24:10
           StorageLive(_3);                 // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
@@ -53,7 +53,7 @@
           _5 = discriminant(_3);           // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
           switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
       }
-  
+
       bb1: {
 -         StorageLive(_10);                // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
 -         _10 = ((_3 as Ok).0: u8);        // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
@@ -69,11 +69,11 @@
           StorageDead(_2);                 // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
           goto -> bb4;                     // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
       }
-  
+
       bb2: {
           unreachable;                     // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
       }
-  
+
       bb3: {
 -         StorageLive(_6);                 // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
 -         _6 = ((_3 as Err).0: i32);       // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
@@ -94,9 +94,9 @@
           StorageDead(_2);                 // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
           goto -> bb4;                     // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
       }
-  
+
       bb4: {
           return;                          // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
       }
   }
-  
+
diff --git a/src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff b/src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff
index eb2521c8ba0..172fb04a3cc 100644
--- a/src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff
+++ b/src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff
@@ -1,6 +1,6 @@
 - // MIR for `id_try` before SimplifyBranchSame
 + // MIR for `id_try` after SimplifyBranchSame
-  
+
   fn id_try(_1: std::result::Result<u8, i32>) -> std::result::Result<u8, i32> {
       debug r => _1;                       // in scope 0 at $DIR/simplify-arm.rs:23:11: 23:12
       let mut _0: std::result::Result<u8, i32>; // return place in scope 0 at $DIR/simplify-arm.rs:23:34: 23:49
@@ -37,7 +37,7 @@
       scope 6 {
           debug self => _4;                // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
       }
-  
+
       bb0: {
           StorageLive(_2);                 // scope 0 at $DIR/simplify-arm.rs:24:9: 24:10
           StorageLive(_3);                 // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
@@ -49,7 +49,7 @@
 -         switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
 +         goto -> bb1;                     // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
       }
-  
+
       bb1: {
           _0 = move _3;                    // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
           StorageDead(_3);                 // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
@@ -57,20 +57,20 @@
 -         goto -> bb4;                     // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
 +         goto -> bb2;                     // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
       }
-  
+
       bb2: {
 -         unreachable;                     // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
 -     }
-- 
+-
 -     bb3: {
 -         _0 = move _3;                    // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
 -         StorageDead(_3);                 // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
 -         StorageDead(_2);                 // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
 -         goto -> bb4;                     // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
 -     }
-- 
+-
 -     bb4: {
           return;                          // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
       }
   }
-  
+
diff --git a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff
index 2af387a73b7..12a6617cc5a 100644
--- a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff
+++ b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff
@@ -25,7 +25,7 @@
               }
               scope 8 {
                   debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-                  let mut _12: i32;        // in scope 8 at $DIR/simplify_try.rs:8:14: 8:15
+                  let mut _12: i32;        // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15
               }
           }
       }
diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff
index 6fa14f1e0d8..534836eff7b 100644
--- a/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff
+++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff
@@ -29,7 +29,7 @@
               scope 8 {
 -                 debug v => _8;           // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
 +                 debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-                  let mut _12: i32;        // in scope 8 at $DIR/simplify_try.rs:8:14: 8:15
+                  let mut _12: i32;        // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15
               }
           }
       }
diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir b/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir
index ceb5bfb19a1..d2e37bf4e12 100644
--- a/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir
+++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir
@@ -24,7 +24,7 @@ fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i
             }
             scope 8 {
                 debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-                let mut _12: i32;        // in scope 8 at $DIR/simplify_try.rs:8:14: 8:15
+                let mut _12: i32;        // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15
             }
         }
     }
diff --git a/src/test/ui/associated-types/param-env-normalize-cycle.rs b/src/test/ui/associated-types/param-env-normalize-cycle.rs
new file mode 100644
index 00000000000..12db595ed25
--- /dev/null
+++ b/src/test/ui/associated-types/param-env-normalize-cycle.rs
@@ -0,0 +1,39 @@
+// Minimized case from typenum that didn't compile because:
+// - We tried to normalize the ParamEnv of the second impl
+// - This requires trying to normalize `GrEq<Self, Square<Square<U>>>`
+// - This requires proving `Square<Square<U>>: Sized` so that the first impl
+//   applies
+// - This requires Providing `Square<Square<U>>` is well-formed, so that we
+//   can use the `Sized` bound on `Mul::Output`
+// - This requires proving `Square<U>: Mul`
+// - But first we tried normalizing the whole obligation, including the
+//   ParamEnv, which leads to a cycle error.
+
+// check-pass
+
+trait PrivateSquareRoot {}
+
+pub trait Mul<Rhs = Self> {
+    type Output;
+}
+
+pub trait IsGreaterOrEqual<Rhs> {
+    type Output;
+}
+
+pub type Square<A> = <A as Mul>::Output;
+pub type GrEq<A, B> = <A as IsGreaterOrEqual<B>>::Output;
+
+impl<A, B> IsGreaterOrEqual<B> for A {
+    type Output = ();
+}
+
+impl<U> PrivateSquareRoot for U
+where
+    U: Mul,
+    Square<U>: Mul,
+    GrEq<Self, Square<Square<U>>>: Sized,
+{
+}
+
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs
index c5c8c5c1eca..7dac2b26cce 100644
--- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs
+++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs
@@ -1,3 +1,4 @@
+// ignore-tidy-linelength
 // compile-flags: -Zsave-analysis
 // This is also a regression test for #69415 and the above flag is needed.
 
diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr
index db78e287d65..03011bd1e32 100644
--- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr
+++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr
@@ -1,5 +1,5 @@
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:15:22
+  --> $DIR/feature-gate-associated_type_bounds.rs:16:22
    |
 LL |     type A: Iterator<Item: Copy>;
    |                      ^^^^^^^^^^
@@ -8,7 +8,7 @@ LL |     type A: Iterator<Item: Copy>;
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:19:22
+  --> $DIR/feature-gate-associated_type_bounds.rs:20:22
    |
 LL |     type B: Iterator<Item: 'static>;
    |                      ^^^^^^^^^^^^^
@@ -17,7 +17,7 @@ LL |     type B: Iterator<Item: 'static>;
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:23:20
+  --> $DIR/feature-gate-associated_type_bounds.rs:24:20
    |
 LL | struct _St1<T: Tr1<As1: Tr2>> {
    |                    ^^^^^^^^
@@ -26,7 +26,7 @@ LL | struct _St1<T: Tr1<As1: Tr2>> {
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:30:18
+  --> $DIR/feature-gate-associated_type_bounds.rs:31:18
    |
 LL | enum _En1<T: Tr1<As1: Tr2>> {
    |                  ^^^^^^^^
@@ -35,7 +35,7 @@ LL | enum _En1<T: Tr1<As1: Tr2>> {
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:37:19
+  --> $DIR/feature-gate-associated_type_bounds.rs:38:19
    |
 LL | union _Un1<T: Tr1<As1: Tr2>> {
    |                   ^^^^^^^^
@@ -44,7 +44,7 @@ LL | union _Un1<T: Tr1<As1: Tr2>> {
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:44:37
+  --> $DIR/feature-gate-associated_type_bounds.rs:45:37
    |
 LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
    |                                     ^^^^^^^^^^
@@ -53,7 +53,7 @@ LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:47:22
+  --> $DIR/feature-gate-associated_type_bounds.rs:48:22
    |
 LL | fn _apit(_: impl Tr1<As1: Copy>) {}
    |                      ^^^^^^^^^
@@ -62,7 +62,7 @@ LL | fn _apit(_: impl Tr1<As1: Copy>) {}
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:49:26
+  --> $DIR/feature-gate-associated_type_bounds.rs:50:26
    |
 LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
    |                          ^^^^^^^^^
@@ -71,7 +71,7 @@ LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:52:24
+  --> $DIR/feature-gate-associated_type_bounds.rs:53:24
    |
 LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
    |                        ^^^^^^^^^
@@ -80,7 +80,7 @@ LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:55:31
+  --> $DIR/feature-gate-associated_type_bounds.rs:56:31
    |
 LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
    |                               ^^^^^^^^^
@@ -89,7 +89,7 @@ LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:58:23
+  --> $DIR/feature-gate-associated_type_bounds.rs:59:23
    |
 LL | const _cdef: impl Tr1<As1: Copy> = S1;
    |                       ^^^^^^^^^
@@ -98,7 +98,7 @@ LL | const _cdef: impl Tr1<As1: Copy> = S1;
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:64:24
+  --> $DIR/feature-gate-associated_type_bounds.rs:65:24
    |
 LL | static _sdef: impl Tr1<As1: Copy> = S1;
    |                        ^^^^^^^^^
@@ -107,7 +107,7 @@ LL | static _sdef: impl Tr1<As1: Copy> = S1;
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0658]: associated type bounds are unstable
-  --> $DIR/feature-gate-associated_type_bounds.rs:71:21
+  --> $DIR/feature-gate-associated_type_bounds.rs:72:21
    |
 LL |     let _: impl Tr1<As1: Copy> = S1;
    |                     ^^^^^^^^^
@@ -116,7 +116,7 @@ LL |     let _: impl Tr1<As1: Copy> = S1;
    = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
 
 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
-  --> $DIR/feature-gate-associated_type_bounds.rs:58:14
+  --> $DIR/feature-gate-associated_type_bounds.rs:59:14
    |
 LL | const _cdef: impl Tr1<As1: Copy> = S1;
    |              ^^^^^^^^^^^^^^^^^^^
@@ -124,7 +124,7 @@ LL | const _cdef: impl Tr1<As1: Copy> = S1;
    = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
 
 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
-  --> $DIR/feature-gate-associated_type_bounds.rs:64:15
+  --> $DIR/feature-gate-associated_type_bounds.rs:65:15
    |
 LL | static _sdef: impl Tr1<As1: Copy> = S1;
    |               ^^^^^^^^^^^^^^^^^^^
@@ -132,7 +132,7 @@ LL | static _sdef: impl Tr1<As1: Copy> = S1;
    = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
 
 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
-  --> $DIR/feature-gate-associated_type_bounds.rs:71:12
+  --> $DIR/feature-gate-associated_type_bounds.rs:72:12
    |
 LL |     let _: impl Tr1<As1: Copy> = S1;
    |            ^^^^^^^^^^^^^^^^^^^
@@ -140,7 +140,7 @@ LL |     let _: impl Tr1<As1: Copy> = S1;
    = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
 
 error[E0277]: the trait bound `<<Self as _Tr3>::A as std::iter::Iterator>::Item: std::marker::Copy` is not satisfied
-  --> $DIR/feature-gate-associated_type_bounds.rs:15:28
+  --> $DIR/feature-gate-associated_type_bounds.rs:16:28
    |
 LL |     type A: Iterator<Item: Copy>;
    |                            ^^^^ the trait `std::marker::Copy` is not implemented for `<<Self as _Tr3>::A as std::iter::Iterator>::Item`
diff --git a/src/test/ui/for/for-c-in-str.rs b/src/test/ui/for/for-c-in-str.rs
index df66127c604..8aca8c388d4 100644
--- a/src/test/ui/for/for-c-in-str.rs
+++ b/src/test/ui/for/for-c-in-str.rs
@@ -1,14 +1,16 @@
-// E0277 should point exclusively at line 14, not the entire for loop span
+// E0277 should point exclusively at line 6, not the entire for loop span
+
+// ignore-tidy-linelength
 
 fn main() {
     for c in "asdf" {
-    //~^ ERROR `&str` is not an iterator
-    //~| NOTE `&str` is not an iterator
-    //~| HELP the trait `Iterator` is not implemented for `&str`
-    //~| NOTE required by `into_iter`
-    //~| NOTE in this expansion of desugaring of `for` loop
-    //~| NOTE in this expansion of desugaring of `for` loop
-    //~| NOTE in this expansion of desugaring of `for` loop
+        //~^ ERROR `&str` is not an iterator
+        //~| NOTE `&str` is not an iterator
+        //~| HELP the trait `Iterator` is not implemented for `&str`
+        //~| NOTE required by `into_iter`
+        //~| NOTE in this expansion of desugaring of `for` loop
+        //~| NOTE in this expansion of desugaring of `for` loop
+        //~| NOTE in this expansion of desugaring of `for` loop
         println!();
     }
 }
diff --git a/src/test/ui/for/for-c-in-str.stderr b/src/test/ui/for/for-c-in-str.stderr
index b0f959ba027..f991e08e518 100644
--- a/src/test/ui/for/for-c-in-str.stderr
+++ b/src/test/ui/for/for-c-in-str.stderr
@@ -1,5 +1,5 @@
 error[E0277]: `&str` is not an iterator
-  --> $DIR/for-c-in-str.rs:4:14
+  --> $DIR/for-c-in-str.rs:6:14
    |
 LL |     for c in "asdf" {
    |              ^^^^^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()`
diff --git a/src/test/ui/generic-associated-types/auxiliary/foo_defn.rs b/src/test/ui/generic-associated-types/auxiliary/foo_defn.rs
new file mode 100644
index 00000000000..0e8e14852d9
--- /dev/null
+++ b/src/test/ui/generic-associated-types/auxiliary/foo_defn.rs
@@ -0,0 +1,8 @@
+#![feature(generic_associated_types)]
+
+use std::{future::Future, pin::Pin};
+
+pub trait Foo {
+    type Bar: AsRef<()>;
+    fn foo(&self) -> Pin<Box<dyn Future<Output = Self::Bar> + '_>>;
+}
diff --git a/src/test/ui/generic-associated-types/cross-crate-bounds.rs b/src/test/ui/generic-associated-types/cross-crate-bounds.rs
new file mode 100644
index 00000000000..4e2bab38c88
--- /dev/null
+++ b/src/test/ui/generic-associated-types/cross-crate-bounds.rs
@@ -0,0 +1,32 @@
+// regression test for #73816
+// We handled bounds differently when `feature(generic_associated_types)` was enabled
+
+// edition:2018
+// aux-build:foo_defn.rs
+
+extern crate foo_defn;
+
+use foo_defn::Foo;
+use std::{future::Future, pin::Pin};
+
+pub struct FooImpl;
+
+impl Foo for FooImpl {
+    type Bar = ();
+    //~^ ERROR the trait bound `(): std::convert::AsRef<()>` is not satisfied
+    fn foo(&self) -> Pin<Box<dyn Future<Output = Self::Bar> + '_>> {
+        panic!()
+    }
+}
+
+async fn foo() {
+    bar(&FooImpl).await;
+}
+
+async fn bar<F: Foo>(foo: &F) {
+    foo.foo().await.as_ref();
+}
+
+fn main() {
+    // futures::executor::block_on(foo());
+}
diff --git a/src/test/ui/generic-associated-types/cross-crate-bounds.stderr b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr
new file mode 100644
index 00000000000..5fd2750868f
--- /dev/null
+++ b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the trait bound `(): std::convert::AsRef<()>` is not satisfied
+  --> $DIR/cross-crate-bounds.rs:15:5
+   |
+LL |     type Bar = ();
+   |     ^^^^^^^^^^^^^^ the trait `std::convert::AsRef<()>` is not implemented for `()`
+   | 
+  ::: $DIR/auxiliary/foo_defn.rs:6:15
+   |
+LL |     type Bar: AsRef<()>;
+   |               --------- required by this bound in `foo_defn::Foo::Bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/traits/check-trait-object-bounds-3.rs b/src/test/ui/traits/check-trait-object-bounds-3.rs
index d05aa14f2cf..ba04fd93acc 100644
--- a/src/test/ui/traits/check-trait-object-bounds-3.rs
+++ b/src/test/ui/traits/check-trait-object-bounds-3.rs
@@ -18,4 +18,3 @@ pub fn main() {
 
     println!("{}", z)
 }
-
diff --git a/src/test/ui/traits/check-trait-object-bounds-3.stderr b/src/test/ui/traits/check-trait-object-bounds-3.stderr
index e2a4341454a..ade552c4bab 100644
--- a/src/test/ui/traits/check-trait-object-bounds-3.stderr
+++ b/src/test/ui/traits/check-trait-object-bounds-3.stderr
@@ -1,12 +1,15 @@
-error[E0277]: the trait bound `str: std::clone::Clone` is not satisfied
-  --> $DIR/check-trait-object-bounds-3.rs:12:5
+error[E0597]: `s` does not live long enough
+  --> $DIR/check-trait-object-bounds-3.rs:15:34
    |
-LL | fn f<T: X + ?Sized>() {
-   |         - required by this bound in `f`
-...
-LL |     f::<dyn X<Y = str>>();
-   |     ^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `str`
+LL |         z = f::<dyn X<Y = &str>>(&s);
+   |             ---------------------^^-
+   |             |                    |
+   |             |                    borrowed value does not live long enough
+   |             argument requires that `s` is borrowed for `'static`
+LL |
+LL |     }
+   |     - `s` dropped here while still borrowed
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0597`.