about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-13 08:13:01 +0000
committerbors <bors@rust-lang.org>2019-05-13 08:13:01 +0000
commit69ef8fbe7084f40893252df9fa47298b0a5c5057 (patch)
treef7e70f28d334ea5bfd59e19571295c44e7f25abf /src/test
parentfe5f42cdb88d8ce31f746130099321e7c95e1ef0 (diff)
parent9a4f0abd7a385416acf9d93b9d77ea1fdf755f93 (diff)
downloadrust-69ef8fbe7084f40893252df9fa47298b0a5c5057.tar.gz
rust-69ef8fbe7084f40893252df9fa47298b0a5c5057.zip
Auto merge of #60765 - matthewjasper:fix-more-escaping-rescopes, r=oli-obk
Fix more escaping ReScopes

Closes #58840
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/impl-trait/lifetimes.rs6
-rw-r--r--src/test/ui/impl-trait/can-return-unconstrained-closure.rs4
-rw-r--r--src/test/ui/impl-trait/issue-57464-unexpected-regions.rs7
3 files changed, 17 insertions, 0 deletions
diff --git a/src/test/run-pass/impl-trait/lifetimes.rs b/src/test/run-pass/impl-trait/lifetimes.rs
index 5a21e1dd817..9a9843375e4 100644
--- a/src/test/run-pass/impl-trait/lifetimes.rs
+++ b/src/test/run-pass/impl-trait/lifetimes.rs
@@ -1,6 +1,7 @@
 // run-pass
 
 #![allow(warnings)]
+#![feature(generators)]
 
 use std::fmt::Debug;
 
@@ -112,6 +113,11 @@ impl<'unnecessary_lifetime> MyVec {
     fn iter_doesnt_capture_unnecessary_lifetime<'s>(&'s self) -> impl Iterator<Item = &'s u8> {
         self.0.iter().flat_map(|inner_vec| inner_vec.iter())
     }
+
+    fn generator_doesnt_capture_unnecessary_lifetime<'s: 's>() -> impl Sized {
+        || yield
+    }
 }
 
+
 fn main() {}
diff --git a/src/test/ui/impl-trait/can-return-unconstrained-closure.rs b/src/test/ui/impl-trait/can-return-unconstrained-closure.rs
index a982b176ecd..90a7519074b 100644
--- a/src/test/ui/impl-trait/can-return-unconstrained-closure.rs
+++ b/src/test/ui/impl-trait/can-return-unconstrained-closure.rs
@@ -16,4 +16,8 @@ fn make_identity() -> impl Sized {
     |x: &'static i32| x
 }
 
+fn make_identity_static() -> impl Sized + 'static {
+    |x: &'static i32| x
+}
+
 fn main() {}
diff --git a/src/test/ui/impl-trait/issue-57464-unexpected-regions.rs b/src/test/ui/impl-trait/issue-57464-unexpected-regions.rs
index 29e271c68ec..11f1a392239 100644
--- a/src/test/ui/impl-trait/issue-57464-unexpected-regions.rs
+++ b/src/test/ui/impl-trait/issue-57464-unexpected-regions.rs
@@ -17,6 +17,13 @@ fn wrapped_closure() -> impl Sized {
     A(f)
 }
 
+fn wrapped_closure_with_bound() -> impl Sized + 'static {
+    let f = |x| x;
+    f(&0);
+    A(f)
+}
+
 fn main() {
     let x: Box<dyn Send> = Box::new(wrapped_closure());
+    let y: Box<dyn Send> = Box::new(wrapped_closure_with_bound());
 }