about summary refs log tree commit diff
path: root/tests/ui/diagnostic-width
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/diagnostic-width')
-rw-r--r--tests/ui/diagnostic-width/binop.rs17
-rw-r--r--tests/ui/diagnostic-width/binop.stderr24
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/ui/diagnostic-width/binop.rs b/tests/ui/diagnostic-width/binop.rs
new file mode 100644
index 00000000000..60ba40b8047
--- /dev/null
+++ b/tests/ui/diagnostic-width/binop.rs
@@ -0,0 +1,17 @@
+//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
+// The regex below normalizes the long type file name to make it suitable for compare-modes.
+//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'"
+type A = (i32, i32, i32, i32);
+type B = (A, A, A, A);
+type C = (B, B, B, B);
+type D = (C, C, C, C);
+
+fn foo(x: D) {
+    x + x; //~ ERROR cannot add `(...
+}
+
+fn bar(x: D) {
+    !x; //~ ERROR cannot apply unary operator `!` to type `(...
+}
+
+fn main() {}
diff --git a/tests/ui/diagnostic-width/binop.stderr b/tests/ui/diagnostic-width/binop.stderr
new file mode 100644
index 00000000000..fd69129c33e
--- /dev/null
+++ b/tests/ui/diagnostic-width/binop.stderr
@@ -0,0 +1,24 @@
+error[E0369]: cannot add `(..., ..., ..., ...)` to `(..., ..., ..., ...)`
+  --> $DIR/binop.rs:10:7
+   |
+LL |     x + x;
+   |     - ^ - (..., ..., ..., ...)
+   |     |
+   |     (..., ..., ..., ...)
+   |
+   = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt'
+   = note: consider using `--verbose` to print the full type name to the console
+
+error[E0600]: cannot apply unary operator `!` to type `(..., ..., ..., ...)`
+  --> $DIR/binop.rs:14:5
+   |
+LL |     !x;
+   |     ^^ cannot apply unary operator `!`
+   |
+   = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt'
+   = note: consider using `--verbose` to print the full type name to the console
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0369, E0600.
+For more information about an error, try `rustc --explain E0369`.