]> git.lizzy.rs Git - rust.git/blob - src/test/ui/feature-gates/feature-gate-negate-unsigned.rs
parser will not give wrong help message for 'public'
[rust.git] / src / test / ui / feature-gates / feature-gate-negate-unsigned.rs
1 // Test that negating unsigned integers doesn't compile
2
3 struct S;
4 impl std::ops::Neg for S {
5     type Output = u32;
6     fn neg(self) -> u32 { 0 }
7 }
8
9 fn main() {
10     let _max: usize = -1;
11     //~^ ERROR cannot apply unary operator `-` to type `usize`
12
13     let x = 5u8;
14     let _y = -x;
15     //~^ ERROR cannot apply unary operator `-` to type `u8`
16
17     -S; // should not trigger the gate; issue 26840
18 }