about summary refs log tree commit diff
path: root/tests/ui/typeck/minus-string.rs
blob: 1c0f73a37132c096a917fe20b42ca84038213254 (plain)
1
2
3
4
5
6
7
// Regression test for issue #813.
// This ensures that the unary negation operator `-` cannot be applied to an owned `String`.
// Previously, due to a type-checking bug, this was mistakenly accepted by the compiler.

fn main() {
    -"foo".to_string(); //~ ERROR cannot apply unary operator `-` to type `String`
}