summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsigned-literal-negation.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/unsigned-literal-negation.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/ui/unsigned-literal-negation.rs b/src/test/ui/unsigned-literal-negation.rs
new file mode 100644
index 000000000..943c7f797
--- /dev/null
+++ b/src/test/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 `-`
+}