]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/async-await/async-borrowck-escaping-block-error.rs
Auto merge of #83152 - guswynn:jemallocator_part2, r=Mark-Simulacrum
[rust.git] / src / test / ui / async-await / async-borrowck-escaping-block-error.rs
index 4f35fd52ca39beed26bfb01c5becd7ef41c7e593..ec752c15fa28456aac4bace049dcf18bcee9d1f5 100644 (file)
@@ -1,12 +1,18 @@
 // edition:2018
 // run-rustfix
 
-fn foo() -> Box<impl std::future::Future<Output = u32>> {
+fn test_boxed() -> Box<impl std::future::Future<Output = u32>> {
     let x = 0u32;
     Box::new(async { x } )
     //~^ ERROR E0373
 }
 
+fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ {
+    async { *x }
+    //~^ ERROR E0373
+}
+
 fn main() {
-    let _foo = foo();
+    let _ = test_boxed();
+    let _ = test_ref(&0u32);
 }