about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-22 10:04:41 +0000
committerbors <bors@rust-lang.org>2018-11-22 10:04:41 +0000
commit93fa2d76bd9a8ffbbb46df2da6d27c13ee7fa73e (patch)
tree35b359452ea12e799c831d01c01262ec7fc1d4ec /src/test/ui
parentf3adec65dd0b05a0a30cd2c134f252e8bece0b76 (diff)
parent61d7b3e9b028ba1a682448e8bdc6212552ce1ff3 (diff)
downloadrust-93fa2d76bd9a8ffbbb46df2da6d27c13ee7fa73e.tar.gz
rust-93fa2d76bd9a8ffbbb46df2da6d27c13ee7fa73e.zip
Auto merge of #56155 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 11 pull requests

Successful merges:

 - #55367 (lint if a private item has doctests)
 - #55485 (Return &T / &mut T in ManuallyDrop Deref(Mut) impl)
 - #55784 (Clarifying documentation for collections::hash_map::Entry::or_insert)
 - #55961 (Fix VecDeque pretty-printer)
 - #55980 (Suggest on closure args count mismatching with pipe span)
 - #56002 (fix #55972: Erroneous self arguments on bare functions emit subpar compilation error)
 - #56063 (Update any.rs documentation using keyword dyn)
 - #56067 (Add SGX target to rustc)
 - #56078 (Fix error message for `-C panic=xxx`.)
 - #56106 (Remove some incorrect doc comments)
 - #56126 (core/benches/num: Add `from_str/from_str_radix()` benchmarks)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/invalid-self-argument/bare-fn-start.rs5
-rw-r--r--src/test/ui/invalid-self-argument/bare-fn-start.stderr8
-rw-r--r--src/test/ui/invalid-self-argument/bare-fn.rs5
-rw-r--r--src/test/ui/invalid-self-argument/bare-fn.stderr8
-rw-r--r--src/test/ui/invalid-self-argument/trait-fn.rs11
-rw-r--r--src/test/ui/invalid-self-argument/trait-fn.stderr8
-rw-r--r--src/test/ui/mismatched_types/closure-arg-count.rs2
-rw-r--r--src/test/ui/mismatched_types/closure-arg-count.stderr38
-rw-r--r--src/test/ui/panic-runtime/bad-panic-flag1.rs2
-rw-r--r--src/test/ui/panic-runtime/bad-panic-flag1.stderr2
-rw-r--r--src/test/ui/panic-runtime/bad-panic-flag2.rs2
-rw-r--r--src/test/ui/panic-runtime/bad-panic-flag2.stderr2
12 files changed, 79 insertions, 14 deletions
diff --git a/src/test/ui/invalid-self-argument/bare-fn-start.rs b/src/test/ui/invalid-self-argument/bare-fn-start.rs
new file mode 100644
index 00000000000..741ba5f41ce
--- /dev/null
+++ b/src/test/ui/invalid-self-argument/bare-fn-start.rs
@@ -0,0 +1,5 @@
+fn a(&self) { }
+//~^ ERROR unexpected `self` argument in function
+//~| NOTE `self` is only valid as the first argument of an associated function
+
+fn main() { }
diff --git a/src/test/ui/invalid-self-argument/bare-fn-start.stderr b/src/test/ui/invalid-self-argument/bare-fn-start.stderr
new file mode 100644
index 00000000000..6a878b619d8
--- /dev/null
+++ b/src/test/ui/invalid-self-argument/bare-fn-start.stderr
@@ -0,0 +1,8 @@
+error: unexpected `self` argument in function
+  --> $DIR/bare-fn-start.rs:1:7
+   |
+LL | fn a(&self) { }
+   |       ^^^^ `self` is only valid as the first argument of an associated function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/invalid-self-argument/bare-fn.rs b/src/test/ui/invalid-self-argument/bare-fn.rs
new file mode 100644
index 00000000000..704fa996ca6
--- /dev/null
+++ b/src/test/ui/invalid-self-argument/bare-fn.rs
@@ -0,0 +1,5 @@
+fn b(foo: u32, &mut self) { }
+//~^ ERROR unexpected `self` argument in function
+//~| NOTE `self` is only valid as the first argument of an associated function
+
+fn main() { }
diff --git a/src/test/ui/invalid-self-argument/bare-fn.stderr b/src/test/ui/invalid-self-argument/bare-fn.stderr
new file mode 100644
index 00000000000..b13f746a4ec
--- /dev/null
+++ b/src/test/ui/invalid-self-argument/bare-fn.stderr
@@ -0,0 +1,8 @@
+error: unexpected `self` argument in function
+  --> $DIR/bare-fn.rs:1:21
+   |
+LL | fn b(foo: u32, &mut self) { }
+   |                     ^^^^ `self` is only valid as the first argument of an associated function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/invalid-self-argument/trait-fn.rs b/src/test/ui/invalid-self-argument/trait-fn.rs
new file mode 100644
index 00000000000..31e867bc764
--- /dev/null
+++ b/src/test/ui/invalid-self-argument/trait-fn.rs
@@ -0,0 +1,11 @@
+struct Foo {}
+
+impl Foo {
+    fn c(foo: u32, self) {}
+    //~^ ERROR unexpected `self` argument in function
+    //~| NOTE `self` is only valid as the first argument of an associated function
+
+    fn good(&mut self, foo: u32) {}
+}
+
+fn main() { }
diff --git a/src/test/ui/invalid-self-argument/trait-fn.stderr b/src/test/ui/invalid-self-argument/trait-fn.stderr
new file mode 100644
index 00000000000..b3c2cc5b5eb
--- /dev/null
+++ b/src/test/ui/invalid-self-argument/trait-fn.stderr
@@ -0,0 +1,8 @@
+error: unexpected `self` argument in function
+  --> $DIR/trait-fn.rs:4:20
+   |
+LL |     fn c(foo: u32, self) {}
+   |                    ^^^^ `self` is only valid as the first argument of an associated function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs
index 9eb11148a8b..2dcc7a25c84 100644
--- a/src/test/ui/mismatched_types/closure-arg-count.rs
+++ b/src/test/ui/mismatched_types/closure-arg-count.rs
@@ -22,6 +22,8 @@ fn main() {
     //~^ ERROR closure is expected to take
     f(|| panic!());
     //~^ ERROR closure is expected to take
+    f(  move    || panic!());
+    //~^ ERROR closure is expected to take
 
     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
     //~^ ERROR closure is expected to take
diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr
index 057cf6efa1d..eeadf07262c 100644
--- a/src/test/ui/mismatched_types/closure-arg-count.stderr
+++ b/src/test/ui/mismatched_types/closure-arg-count.stderr
@@ -60,8 +60,26 @@ help: consider changing the closure to take and ignore the expected argument
 LL |     f(|_| panic!());
    |       ^^^
 
+error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
+  --> $DIR/closure-arg-count.rs:25:5
+   |
+LL |     f(  move    || panic!());
+   |     ^   ---------- takes 0 arguments
+   |     |
+   |     expected closure that takes 1 argument
+   |
+note: required by `f`
+  --> $DIR/closure-arg-count.rs:13:1
+   |
+LL | fn f<F: Fn<usize>>(_: F) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+help: consider changing the closure to take and ignore the expected argument
+   |
+LL |     f(  move    |_| panic!());
+   |                 ^^^
+
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
-  --> $DIR/closure-arg-count.rs:26:53
+  --> $DIR/closure-arg-count.rs:28:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
    |                                                     ^^^ ------ takes 2 distinct arguments
@@ -73,7 +91,7 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
    |                                                         ^^^^^^^^
 
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
-  --> $DIR/closure-arg-count.rs:28:53
+  --> $DIR/closure-arg-count.rs:30:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
    |                                                     ^^^ ------------- takes 2 distinct arguments
@@ -85,7 +103,7 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
    |                                                         ^^^^^^^^
 
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
-  --> $DIR/closure-arg-count.rs:30:53
+  --> $DIR/closure-arg-count.rs:32:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
    |                                                     ^^^ --------- takes 3 distinct arguments
@@ -93,7 +111,7 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
    |                                                     expected closure that takes a single 2-tuple as argument
 
 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments
-  --> $DIR/closure-arg-count.rs:32:53
+  --> $DIR/closure-arg-count.rs:34:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
    |                                                     ^^^ expected function that takes a single 2-tuple as argument
@@ -102,7 +120,7 @@ LL | fn foo() {}
    | -------- takes 0 arguments
 
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
-  --> $DIR/closure-arg-count.rs:35:53
+  --> $DIR/closure-arg-count.rs:37:53
    |
 LL |     let bar = |i, x, y| i;
    |               --------- takes 3 distinct arguments
@@ -110,7 +128,7 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
    |                                                     ^^^ expected closure that takes a single 2-tuple as argument
 
 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
-  --> $DIR/closure-arg-count.rs:37:53
+  --> $DIR/closure-arg-count.rs:39:53
    |
 LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
    |                                                     ^^^ expected function that takes a single 2-tuple as argument
@@ -119,13 +137,13 @@ LL | fn qux(x: usize, y: usize) {}
    | -------------------------- takes 2 distinct arguments
 
 error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
-  --> $DIR/closure-arg-count.rs:40:41
+  --> $DIR/closure-arg-count.rs:42:41
    |
 LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
    |                                         ^^^ expected function that takes 1 argument
 
 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
-  --> $DIR/closure-arg-count.rs:43:5
+  --> $DIR/closure-arg-count.rs:45:5
    |
 LL |     call(Foo);
    |     ^^^^ expected function that takes 0 arguments
@@ -134,11 +152,11 @@ LL | struct Foo(u8);
    | --------------- takes 1 argument
    |
 note: required by `call`
-  --> $DIR/closure-arg-count.rs:50:1
+  --> $DIR/closure-arg-count.rs:52:1
    |
 LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 13 previous errors
+error: aborting due to 14 previous errors
 
 For more information about this error, try `rustc --explain E0593`.
diff --git a/src/test/ui/panic-runtime/bad-panic-flag1.rs b/src/test/ui/panic-runtime/bad-panic-flag1.rs
index f067b6b8349..4e553c4df2f 100644
--- a/src/test/ui/panic-runtime/bad-panic-flag1.rs
+++ b/src/test/ui/panic-runtime/bad-panic-flag1.rs
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 // compile-flags:-C panic=foo
-// error-pattern:either `panic` or `abort` was expected
+// error-pattern:either `unwind` or `abort` was expected
 
 fn main() {}
diff --git a/src/test/ui/panic-runtime/bad-panic-flag1.stderr b/src/test/ui/panic-runtime/bad-panic-flag1.stderr
index 3a65419c98f..013373c6f93 100644
--- a/src/test/ui/panic-runtime/bad-panic-flag1.stderr
+++ b/src/test/ui/panic-runtime/bad-panic-flag1.stderr
@@ -1,2 +1,2 @@
-error: incorrect value `foo` for codegen option `panic` - either `panic` or `abort` was expected
+error: incorrect value `foo` for codegen option `panic` - either `unwind` or `abort` was expected
 
diff --git a/src/test/ui/panic-runtime/bad-panic-flag2.rs b/src/test/ui/panic-runtime/bad-panic-flag2.rs
index 0ecf65f080f..f560e7f4eb2 100644
--- a/src/test/ui/panic-runtime/bad-panic-flag2.rs
+++ b/src/test/ui/panic-runtime/bad-panic-flag2.rs
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 // compile-flags:-C panic
-// error-pattern:requires either `panic` or `abort`
+// error-pattern:requires either `unwind` or `abort`
 
 fn main() {}
diff --git a/src/test/ui/panic-runtime/bad-panic-flag2.stderr b/src/test/ui/panic-runtime/bad-panic-flag2.stderr
index 8d919e55c90..6ab94ea704d 100644
--- a/src/test/ui/panic-runtime/bad-panic-flag2.stderr
+++ b/src/test/ui/panic-runtime/bad-panic-flag2.stderr
@@ -1,2 +1,2 @@
-error: codegen option `panic` requires either `panic` or `abort` (C panic=<value>)
+error: codegen option `panic` requires either `unwind` or `abort` (C panic=<value>)