about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/codegen/force-unwind-tables.rs7
-rw-r--r--src/test/compile-fail/unwind-tables-panic-required.rs10
-rw-r--r--src/test/compile-fail/unwind-tables-target-required.rs11
-rw-r--r--src/test/ui/issues/issue-43162.stderr3
-rw-r--r--src/test/ui/typeck/issue-67971.rs9
-rw-r--r--src/test/ui/typeck/issue-67971.stderr18
6 files changed, 55 insertions, 3 deletions
diff --git a/src/test/codegen/force-unwind-tables.rs b/src/test/codegen/force-unwind-tables.rs
new file mode 100644
index 00000000000..fbaf38d69df
--- /dev/null
+++ b/src/test/codegen/force-unwind-tables.rs
@@ -0,0 +1,7 @@
+// min-llvm-version 8.0
+// compile-flags: -C no-prepopulate-passes -C force-unwind-tables=y
+
+#![crate_type="lib"]
+
+// CHECK: attributes #{{.*}} uwtable
+pub fn foo() {}
diff --git a/src/test/compile-fail/unwind-tables-panic-required.rs b/src/test/compile-fail/unwind-tables-panic-required.rs
new file mode 100644
index 00000000000..314d9e778d5
--- /dev/null
+++ b/src/test/compile-fail/unwind-tables-panic-required.rs
@@ -0,0 +1,10 @@
+// Tests that the compiler errors if the user tries to turn off unwind tables
+// when they are required.
+//
+// compile-flags: -C panic=unwind -C force-unwind-tables=no
+// ignore-tidy-linelength
+//
+// error-pattern: panic=unwind requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`.
+
+pub fn main() {
+}
diff --git a/src/test/compile-fail/unwind-tables-target-required.rs b/src/test/compile-fail/unwind-tables-target-required.rs
new file mode 100644
index 00000000000..14c17893764
--- /dev/null
+++ b/src/test/compile-fail/unwind-tables-target-required.rs
@@ -0,0 +1,11 @@
+// Tests that the compiler errors if the user tries to turn off unwind tables
+// when they are required.
+//
+// only-x86_64-windows-msvc
+// compile-flags: -C force-unwind-tables=no
+// ignore-tidy-linelength
+//
+// error-pattern: target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`.
+
+pub fn main() {
+}
diff --git a/src/test/ui/issues/issue-43162.stderr b/src/test/ui/issues/issue-43162.stderr
index 0ed3d27c65b..a443db40732 100644
--- a/src/test/ui/issues/issue-43162.stderr
+++ b/src/test/ui/issues/issue-43162.stderr
@@ -17,9 +17,6 @@ LL | fn foo() -> bool {
    |    ---      ^^^^ expected `bool`, found `()`
    |    |
    |    implicitly returns `()` as its body has no tail or `return` expression
-LL |
-LL |     break true;
-   |               - help: consider removing this semicolon
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/typeck/issue-67971.rs b/src/test/ui/typeck/issue-67971.rs
new file mode 100644
index 00000000000..8bf725cb5ee
--- /dev/null
+++ b/src/test/ui/typeck/issue-67971.rs
@@ -0,0 +1,9 @@
+struct S {}
+
+fn foo(ctx: &mut S) -> String { //~ ERROR mismatched types
+    // Don't suggest to remove semicolon as it won't fix anything
+    ctx.sleep = 0;
+    //~^ ERROR no field `sleep` on type `&mut S`
+}
+
+fn main() {}
diff --git a/src/test/ui/typeck/issue-67971.stderr b/src/test/ui/typeck/issue-67971.stderr
new file mode 100644
index 00000000000..36ad3fcb342
--- /dev/null
+++ b/src/test/ui/typeck/issue-67971.stderr
@@ -0,0 +1,18 @@
+error[E0609]: no field `sleep` on type `&mut S`
+  --> $DIR/issue-67971.rs:5:9
+   |
+LL |     ctx.sleep = 0;
+   |         ^^^^^ unknown field
+
+error[E0308]: mismatched types
+  --> $DIR/issue-67971.rs:3:24
+   |
+LL | fn foo(ctx: &mut S) -> String {
+   |    ---                 ^^^^^^ expected struct `std::string::String`, found `()`
+   |    |
+   |    implicitly returns `()` as its body has no tail or `return` expression
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0308, E0609.
+For more information about an error, try `rustc --explain E0308`.