about summary refs log tree commit diff
path: root/tests/ui/unsigned-literal-negation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/unsigned-literal-negation.rs')
-rw-r--r--tests/ui/unsigned-literal-negation.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/ui/unsigned-literal-negation.rs b/tests/ui/unsigned-literal-negation.rs
new file mode 100644
index 00000000000..943c7f79742
--- /dev/null
+++ b/tests/ui/unsigned-literal-negation.rs
@@ -0,0 +1,5 @@
+fn main() {
+    let x = -1 as usize; //~ ERROR: cannot apply unary operator `-`
+    let x = (-1) as usize; //~ ERROR: cannot apply unary operator `-`
+    let x: u32 = -1; //~ ERROR: cannot apply unary operator `-`
+}