about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-28 00:18:59 +0000
committerbors <bors@rust-lang.org>2019-12-28 00:18:59 +0000
commit3a087ad3a924be12343bb035bf9b63ed81f650bf (patch)
tree280371e5569301f96fa6ed0a2498625a90795e28 /src/test
parent74c4e6a981d3150db8444c8d250e50bbe6b93b6b (diff)
parent65bbcf0e13d0ce81f443b2fcfc5548b589c8462e (diff)
downloadrust-3a087ad3a924be12343bb035bf9b63ed81f650bf.tar.gz
rust-3a087ad3a924be12343bb035bf9b63ed81f650bf.zip
Auto merge of #67670 - oli-obk:rollup-2dp08sd, r=oli-obk
Rollup of 15 pull requests

Successful merges:

 - #65244 (add IntoFuture trait and support for await)
 - #67576 (reuse `capacity` variable in slice::repeat)
 - #67588 (Use NonNull in slice::Iter and slice::IterMut.)
 - #67594 (Update libc to 0.2.66)
 - #67602 (Use issue = "none" instead of "0" in intrinsics)
 - #67604 (Add Scalar::to_(u|i)16 methods)
 - #67617 (Remove `compiler_builtins_lib` documentation)
 - #67621 (Use the correct type for static qualifs)
 - #67629 (Remove redundant link texts)
 - #67632 (Convert collapsed to shortcut reference links)
 - #67633 (Update .mailmap)
 - #67635 (Document safety of Path casting)
 - #67654 (Add regression test for old NLL ICE)
 - #67659 (Stabilize the `matches!` macro)
 - #67664 (Fix some mailmap entries)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/async-await/async-fn-size-moved-locals.rs6
-rw-r--r--src/test/ui/async-await/await-into-future.rs28
-rw-r--r--src/test/ui/async-await/issues/issue-62009-1.stderr5
-rw-r--r--src/test/ui/consts/const-eval/promote-static.rs14
-rw-r--r--src/test/ui/issues/issue-51770.rs20
5 files changed, 66 insertions, 7 deletions
diff --git a/src/test/ui/async-await/async-fn-size-moved-locals.rs b/src/test/ui/async-await/async-fn-size-moved-locals.rs
index 4a413381aa3..f2469de7394 100644
--- a/src/test/ui/async-await/async-fn-size-moved-locals.rs
+++ b/src/test/ui/async-await/async-fn-size-moved-locals.rs
@@ -112,7 +112,7 @@ async fn mixed_sizes() {
 fn main() {
     assert_eq!(1028, std::mem::size_of_val(&single()));
     assert_eq!(1032, std::mem::size_of_val(&single_with_noop()));
-    assert_eq!(3084, std::mem::size_of_val(&joined()));
-    assert_eq!(3084, std::mem::size_of_val(&joined_with_noop()));
-    assert_eq!(7188, std::mem::size_of_val(&mixed_sizes()));
+    assert_eq!(3080, std::mem::size_of_val(&joined()));
+    assert_eq!(3080, std::mem::size_of_val(&joined_with_noop()));
+    assert_eq!(6164, std::mem::size_of_val(&mixed_sizes()));
 }
diff --git a/src/test/ui/async-await/await-into-future.rs b/src/test/ui/async-await/await-into-future.rs
new file mode 100644
index 00000000000..d5ff0eb3049
--- /dev/null
+++ b/src/test/ui/async-await/await-into-future.rs
@@ -0,0 +1,28 @@
+// check-pass
+
+// edition:2018
+
+#![feature(into_future)]
+
+use std::{future::{Future, IntoFuture}, pin::Pin};
+
+struct AwaitMe;
+
+impl IntoFuture for AwaitMe {
+    type Output = i32;
+    type Future = Pin<Box<dyn Future<Output = i32>>>;
+
+    fn into_future(self) -> Self::Future {
+        Box::pin(me())
+    }
+}
+
+async fn me() -> i32 {
+    41
+}
+
+async fn run() {
+    assert_eq!(AwaitMe.await, 41);
+}
+
+fn main() {}
diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr
index 3a49a5a97de..e31904b6c1f 100644
--- a/src/test/ui/async-await/issues/issue-62009-1.stderr
+++ b/src/test/ui/async-await/issues/issue-62009-1.stderr
@@ -32,11 +32,8 @@ error[E0277]: the trait bound `[closure@$DIR/issue-62009-1.rs:13:5: 13:15]: std:
    |
 LL |     (|_| 2333).await;
    |     ^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:13:5: 13:15]`
-   | 
-  ::: $SRC_DIR/libstd/future.rs:LL:COL
    |
-LL |     F: Future,
-   |        ------ required by this bound in `std::future::poll_with_tls_context`
+   = note: required by `std::future::IntoFuture::into_future`
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/consts/const-eval/promote-static.rs b/src/test/ui/consts/const-eval/promote-static.rs
new file mode 100644
index 00000000000..d3c663c53e9
--- /dev/null
+++ b/src/test/ui/consts/const-eval/promote-static.rs
@@ -0,0 +1,14 @@
+// regression test for #67609.
+
+// check-pass
+
+static NONE: Option<String> = None;
+
+static NONE_REF_REF: &&Option<String> = {
+    let x = &&NONE;
+    x
+};
+
+fn main() {
+    println!("{:?}", NONE_REF_REF);
+}
diff --git a/src/test/ui/issues/issue-51770.rs b/src/test/ui/issues/issue-51770.rs
new file mode 100644
index 00000000000..bcb37a5f4ff
--- /dev/null
+++ b/src/test/ui/issues/issue-51770.rs
@@ -0,0 +1,20 @@
+// check-pass
+
+#![crate_type = "lib"]
+
+// In an older version, when NLL was still a feature, the following previously did not compile
+// #![feature(nll)]
+
+use std::ops::Index;
+
+pub struct Test<T> {
+    a: T,
+}
+
+impl<T> Index<usize> for Test<T> {
+    type Output = T;
+
+    fn index(&self, _index: usize) -> &Self::Output {
+        &self.a
+    }
+}