about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-05-30 07:56:05 +0000
committerbors <bors@rust-lang.org>2020-05-30 07:56:05 +0000
commit91fb72a8a9f53de2bcc5638c1358fcb552dba8ce (patch)
tree6bd52d61abaa0eab87137167ee3d8e8556670858 /src/test
parent0e9e4083100aa3ebf09b8f1ace0348cb37475eb9 (diff)
parent025058f2aa5bcc890d1db8cc71ff63f690b8df0f (diff)
Auto merge of #72768 - JohnTitor:rollup-6kwokh6, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #72033 (Update RELEASES.md for 1.44.0)
 - #72162 (Add Extend::{extend_one,extend_reserve})
 - #72419 (Miri read_discriminant: return a scalar instead of raw underlying bytes)
 - #72621 (Don't bail out of trait selection when predicate references an error)
 - #72677 (Fix diagnostics for `@ ..` binding pattern in tuples and tuple structs)
 - #72710 (Add test to make sure -Wunused-crate-dependencies works with tests)
 - #72724 (Revert recursive `TokenKind::Interpolated` expansion for now)
 - #72741 (Remove unused mut from long-linker-command-lines test)
 - #72750 (Remove remaining calls to `as_local_node_id`)
 - #72752 (remove mk_bool)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make-fulldeps/long-linker-command-lines/foo.rs2
-rw-r--r--src/test/ui/async-await/issue-72590-type-error-sized.rs22
-rw-r--r--src/test/ui/async-await/issue-72590-type-error-sized.stderr28
-rw-r--r--src/test/ui/issues/issue-72574-1.rs8
-rw-r--r--src/test/ui/issues/issue-72574-1.stderr14
-rw-r--r--src/test/ui/issues/issue-72574-2.rs10
-rw-r--r--src/test/ui/issues/issue-72574-2.stderr14
-rw-r--r--src/test/ui/proc-macro/macro-rules-capture.rs18
-rw-r--r--src/test/ui/proc-macro/macro-rules-capture.stderr12
-rw-r--r--src/test/ui/unused-crate-deps/test-use-ok.rs15
10 files changed, 112 insertions, 31 deletions
diff --git a/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs b/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs
index 96fb16b1fcc..f313798de21 100644
--- a/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs
+++ b/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs
@@ -90,7 +90,7 @@ fn main() {
         }
 
         let linker_args = read_linker_args(&ok);
-        for mut arg in linker_args.split('S') {
+        for arg in linker_args.split('S') {
             expected_libs.remove(arg);
         }
 
diff --git a/src/test/ui/async-await/issue-72590-type-error-sized.rs b/src/test/ui/async-await/issue-72590-type-error-sized.rs
new file mode 100644
index 00000000000..00e098d43e0
--- /dev/null
+++ b/src/test/ui/async-await/issue-72590-type-error-sized.rs
@@ -0,0 +1,22 @@
+// Regression test for issue #72590
+// Tests that we don't emit a spurious "size cannot be statically determined" error
+// edition:2018
+
+struct Foo {
+    foo: Nonexistent, //~ ERROR cannot find
+    other: str
+}
+
+struct Bar {
+    test: Missing //~ ERROR cannot find
+}
+
+impl Foo {
+    async fn frob(self) {} //~ ERROR the size
+}
+
+impl Bar {
+    async fn myfn(self) {}
+}
+
+fn main() {}
diff --git a/src/test/ui/async-await/issue-72590-type-error-sized.stderr b/src/test/ui/async-await/issue-72590-type-error-sized.stderr
new file mode 100644
index 00000000000..603895b598c
--- /dev/null
+++ b/src/test/ui/async-await/issue-72590-type-error-sized.stderr
@@ -0,0 +1,28 @@
+error[E0412]: cannot find type `Nonexistent` in this scope
+  --> $DIR/issue-72590-type-error-sized.rs:6:10
+   |
+LL |     foo: Nonexistent,
+   |          ^^^^^^^^^^^ not found in this scope
+
+error[E0412]: cannot find type `Missing` in this scope
+  --> $DIR/issue-72590-type-error-sized.rs:11:11
+   |
+LL |     test: Missing
+   |           ^^^^^^^ not found in this scope
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+  --> $DIR/issue-72590-type-error-sized.rs:15:19
+   |
+LL |     async fn frob(self) {}
+   |                   ^^^^ doesn't have a size known at compile-time
+   |
+   = help: within `Foo`, the trait `std::marker::Sized` is not implemented for `str`
+   = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+   = note: required because it appears within the type `Foo`
+   = note: all local variables must have a statically known size
+   = help: unsized locals are gated as an unstable feature
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0277, E0412.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issues/issue-72574-1.rs b/src/test/ui/issues/issue-72574-1.rs
new file mode 100644
index 00000000000..efbb0bfb150
--- /dev/null
+++ b/src/test/ui/issues/issue-72574-1.rs
@@ -0,0 +1,8 @@
+fn main() {
+    let x = (1, 2, 3);
+    match x {
+        (_a, _x @ ..) => {}
+        _ => {}
+    }
+}
+//~^^^^ ERROR `_x @` is not allowed in a tuple
diff --git a/src/test/ui/issues/issue-72574-1.stderr b/src/test/ui/issues/issue-72574-1.stderr
new file mode 100644
index 00000000000..329f7d008d4
--- /dev/null
+++ b/src/test/ui/issues/issue-72574-1.stderr
@@ -0,0 +1,14 @@
+error: `_x @` is not allowed in a tuple
+  --> $DIR/issue-72574-1.rs:4:14
+   |
+LL |         (_a, _x @ ..) => {}
+   |              ^^^^^^^ this is only allowed in slice patterns
+   |
+   = help: remove this and bind each tuple field independently
+help: if you don't need to use the contents of _x, discard the tuple's remaining fields
+   |
+LL |         (_a, ..) => {}
+   |              ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-72574-2.rs b/src/test/ui/issues/issue-72574-2.rs
new file mode 100644
index 00000000000..0c8f6fcc508
--- /dev/null
+++ b/src/test/ui/issues/issue-72574-2.rs
@@ -0,0 +1,10 @@
+struct Binder(i32, i32, i32);
+
+fn main() {
+    let x = Binder(1, 2, 3);
+    match x {
+        Binder(_a, _x @ ..) => {}
+        _ => {}
+    }
+}
+//~^^^^ ERROR `_x @` is not allowed in a tuple struct
diff --git a/src/test/ui/issues/issue-72574-2.stderr b/src/test/ui/issues/issue-72574-2.stderr
new file mode 100644
index 00000000000..6faa57bcca6
--- /dev/null
+++ b/src/test/ui/issues/issue-72574-2.stderr
@@ -0,0 +1,14 @@
+error: `_x @` is not allowed in a tuple struct
+  --> $DIR/issue-72574-2.rs:6:20
+   |
+LL |         Binder(_a, _x @ ..) => {}
+   |                    ^^^^^^^ this is only allowed in slice patterns
+   |
+   = help: remove this and bind each tuple field independently
+help: if you don't need to use the contents of _x, discard the tuple's remaining fields
+   |
+LL |         Binder(_a, ..) => {}
+   |                    ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/proc-macro/macro-rules-capture.rs b/src/test/ui/proc-macro/macro-rules-capture.rs
deleted file mode 100644
index 37436567d70..00000000000
--- a/src/test/ui/proc-macro/macro-rules-capture.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// aux-build: test-macros.rs
-
-extern crate test_macros;
-use test_macros::recollect_attr;
-
-macro_rules! reemit {
-    ($name:ident => $($token:expr)*) => {
-
-        #[recollect_attr]
-        pub fn $name() {
-            $($token)*;
-        }
-    }
-}
-
-reemit! { foo => 45u32.into() } //~ ERROR type annotations
-
-fn main() {}
diff --git a/src/test/ui/proc-macro/macro-rules-capture.stderr b/src/test/ui/proc-macro/macro-rules-capture.stderr
deleted file mode 100644
index 6d512846ff7..00000000000
--- a/src/test/ui/proc-macro/macro-rules-capture.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0282]: type annotations needed
-  --> $DIR/macro-rules-capture.rs:16:24
-   |
-LL | reemit! { foo => 45u32.into() }
-   |                  ------^^^^--
-   |                  |     |
-   |                  |     cannot infer type for type parameter `T` declared on the trait `Into`
-   |                  this method call resolves to `T`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/ui/unused-crate-deps/test-use-ok.rs b/src/test/ui/unused-crate-deps/test-use-ok.rs
new file mode 100644
index 00000000000..66d6440c9cb
--- /dev/null
+++ b/src/test/ui/unused-crate-deps/test-use-ok.rs
@@ -0,0 +1,15 @@
+// Test-only use OK
+
+// edition:2018
+// check-pass
+// aux-crate:bar=bar.rs
+// compile-flags:--test
+
+#![deny(unused_crate_dependencies)]
+
+fn main() {}
+
+#[test]
+fn test_bar() {
+    assert_eq!(bar::BAR, "bar");
+}