about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-01-24 21:23:11 +0000
committerbors <bors@rust-lang.org>2019-01-24 21:23:11 +0000
commit278067d34d1535a840cf9c99bcb8b538bf5b109a (patch)
tree7d3bd558b1a01bef4485dba03117107a7e132635 /src/test
parent01f8e25b15f4ab157c8e7c9c56054df7595ec0e1 (diff)
parent5fa1016f93d77e43c3ed69b1155308616095cfcb (diff)
downloadrust-278067d34d1535a840cf9c99bcb8b538bf5b109a.tar.gz
rust-278067d34d1535a840cf9c99bcb8b538bf5b109a.zip
Auto merge of #57879 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57380 (Fix Instant/Duration math precision & associativity on Windows)
 - #57606 (Get rid of the fake stack frame for reading from constants)
 - #57803 (Several changes to libunwind for SGX target)
 - #57846 (rustdoc: fix ICE from loading proc-macro stubs)
 - #57860 (Add os::fortanix_sgx::ffi module)
 - #57861 (Don't export table by default in wasm)
 - #57863 (Add suggestion for incorrect field syntax.)
 - #57867 (Fix std::future::from_generator documentation)
 - #57873 (Stabilize no_panic_pow)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc/proc-macro.rs5
-rw-r--r--src/test/ui/consts/match_ice.rs10
-rw-r--r--src/test/ui/consts/match_ice.stderr9
-rw-r--r--src/test/ui/issues/issue-57684.fixed37
-rw-r--r--src/test/ui/issues/issue-57684.rs37
-rw-r--r--src/test/ui/issues/issue-57684.stderr18
6 files changed, 116 insertions, 0 deletions
diff --git a/src/test/rustdoc/proc-macro.rs b/src/test/rustdoc/proc-macro.rs
index d4d70d04f5b..1e396f1be0e 100644
--- a/src/test/rustdoc/proc-macro.rs
+++ b/src/test/rustdoc/proc-macro.rs
@@ -4,6 +4,11 @@
 #![crate_type="proc-macro"]
 #![crate_name="some_macros"]
 
+// @has some_macros/index.html
+// @has - '//a/[@href="attr.some_proc_attr.html"]' 'some_proc_attr'
+
+//! include a link to [some_proc_attr] to make sure it works.
+
 extern crate proc_macro;
 
 use proc_macro::TokenStream;
diff --git a/src/test/ui/consts/match_ice.rs b/src/test/ui/consts/match_ice.rs
new file mode 100644
index 00000000000..53c5782a4c7
--- /dev/null
+++ b/src/test/ui/consts/match_ice.rs
@@ -0,0 +1,10 @@
+// https://github.com/rust-lang/rust/issues/53708
+
+struct S;
+
+fn main() {
+    const C: &S = &S;
+    match C { //~ ERROR non-exhaustive
+        C => {} // this is a common bug around constants and references in patterns
+    }
+}
diff --git a/src/test/ui/consts/match_ice.stderr b/src/test/ui/consts/match_ice.stderr
new file mode 100644
index 00000000000..e6e04e2c462
--- /dev/null
+++ b/src/test/ui/consts/match_ice.stderr
@@ -0,0 +1,9 @@
+error[E0004]: non-exhaustive patterns: `&S` not covered
+  --> $DIR/match_ice.rs:7:11
+   |
+LL |     match C { //~ ERROR non-exhaustive
+   |           ^ pattern `&S` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/ui/issues/issue-57684.fixed b/src/test/ui/issues/issue-57684.fixed
new file mode 100644
index 00000000000..4a432206d51
--- /dev/null
+++ b/src/test/ui/issues/issue-57684.fixed
@@ -0,0 +1,37 @@
+// run-rustfix
+
+#![allow(warnings)]
+
+// This test checks that the following error is emitted when a `=` character is used to initialize
+// a struct field when a `:` is expected.
+//
+// ```
+// error: struct fields are initialized with a colon
+//   --> $DIR/issue-57684.rs:12:20
+//    |
+// LL |     let _ = X { f1 = 5 };
+//    |                    ^ help: replace equals symbol with a colon: `:`
+// ```
+
+struct X {
+    f1: i32,
+}
+
+struct Y {
+    f1: i32,
+    f2: i32,
+    f3: i32,
+}
+
+fn main() {
+    let _ = X { f1: 5 };
+    //~^ ERROR expected `:`, found `=`
+
+    let f3 = 3;
+    let _ = Y {
+        f1: 5,
+        //~^ ERROR expected `:`, found `=`
+        f2: 4,
+        f3,
+    };
+}
diff --git a/src/test/ui/issues/issue-57684.rs b/src/test/ui/issues/issue-57684.rs
new file mode 100644
index 00000000000..7a62785e32f
--- /dev/null
+++ b/src/test/ui/issues/issue-57684.rs
@@ -0,0 +1,37 @@
+// run-rustfix
+
+#![allow(warnings)]
+
+// This test checks that the following error is emitted when a `=` character is used to initialize
+// a struct field when a `:` is expected.
+//
+// ```
+// error: struct fields are initialized with a colon
+//   --> $DIR/issue-57684.rs:12:20
+//    |
+// LL |     let _ = X { f1 = 5 };
+//    |                    ^ help: replace equals symbol with a colon: `:`
+// ```
+
+struct X {
+    f1: i32,
+}
+
+struct Y {
+    f1: i32,
+    f2: i32,
+    f3: i32,
+}
+
+fn main() {
+    let _ = X { f1 = 5 };
+    //~^ ERROR expected `:`, found `=`
+
+    let f3 = 3;
+    let _ = Y {
+        f1 = 5,
+        //~^ ERROR expected `:`, found `=`
+        f2: 4,
+        f3,
+    };
+}
diff --git a/src/test/ui/issues/issue-57684.stderr b/src/test/ui/issues/issue-57684.stderr
new file mode 100644
index 00000000000..514bbffde6b
--- /dev/null
+++ b/src/test/ui/issues/issue-57684.stderr
@@ -0,0 +1,18 @@
+error: expected `:`, found `=`
+  --> $DIR/issue-57684.rs:27:20
+   |
+LL |     let _ = X { f1 = 5 };
+   |                   -^
+   |                   |
+   |                   help: replace equals symbol with a colon: `:`
+
+error: expected `:`, found `=`
+  --> $DIR/issue-57684.rs:32:12
+   |
+LL |         f1 = 5,
+   |           -^
+   |           |
+   |           help: replace equals symbol with a colon: `:`
+
+error: aborting due to 2 previous errors
+