about summary refs log tree commit diff
path: root/src/test/ui/impl-trait/auto-trait-leak-rpass.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-07-27 02:07:23 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-07-27 18:56:17 +0300
commit5486cc69bdcc1c0027d7d06cd7630a2c48e3b063 (patch)
treecc51bb82d6b0e4456f49f008f551c87573eeec53 /src/test/ui/impl-trait/auto-trait-leak-rpass.rs
parent9be35f82c1abf2ecbab489bca9eca138ea648312 (diff)
downloadrust-5486cc69bdcc1c0027d7d06cd7630a2c48e3b063.tar.gz
rust-5486cc69bdcc1c0027d7d06cd7630a2c48e3b063.zip
tests: Move run-pass tests with naming conflicts to ui
Diffstat (limited to 'src/test/ui/impl-trait/auto-trait-leak-rpass.rs')
-rw-r--r--src/test/ui/impl-trait/auto-trait-leak-rpass.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/auto-trait-leak-rpass.rs b/src/test/ui/impl-trait/auto-trait-leak-rpass.rs
new file mode 100644
index 00000000000..9976a018b46
--- /dev/null
+++ b/src/test/ui/impl-trait/auto-trait-leak-rpass.rs
@@ -0,0 +1,21 @@
+// run-pass
+
+// Fast path, main can see the concrete type returned.
+fn before() -> impl FnMut(i32) {
+    let mut p = Box::new(0);
+    move |x| *p = x
+}
+
+fn send<T: Send>(_: T) {}
+
+fn main() {
+    send(before());
+    send(after());
+}
+
+// Deferred path, main has to wait until typeck finishes,
+// to check if the return type of after is Send.
+fn after() -> impl FnMut(i32) {
+    let mut p = Box::new(0);
+    move |x| *p = x
+}