File tree 2 files changed +39
-0
lines changed
tests/ui/type/pattern_types
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( pattern_types) ]
2
+ #![ feature( pattern_type_macro) ]
3
+
4
+ use std:: pat:: pattern_type;
5
+
6
+ type Sign = pattern_type ! ( u32 is -10 ..) ;
7
+ //~^ ERROR: cannot apply unary operator `-`
8
+
9
+ type SignedChar = pattern_type ! ( char is -'A' ..) ;
10
+ //~^ ERROR: cannot apply unary operator `-`
11
+
12
+ fn main ( ) {
13
+ match 42_u8 {
14
+ -10 ..253 => { }
15
+ _ => { }
16
+ }
17
+
18
+ match 'A' {
19
+ -'\0' ..'a' => { }
20
+ _ => { }
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ error[E0600]: cannot apply unary operator `-` to type `u32`
2
+ --> $DIR/signed_ranges.rs:6:34
3
+ |
4
+ LL | type Sign = pattern_type!(u32 is -10..);
5
+ | ^^^ cannot apply unary operator `-`
6
+ |
7
+ = note: unsigned values cannot be negated
8
+
9
+ error[E0600]: cannot apply unary operator `-` to type `char`
10
+ --> $DIR/signed_ranges.rs:9:41
11
+ |
12
+ LL | type SignedChar = pattern_type!(char is -'A'..);
13
+ | ^^^^ cannot apply unary operator `-`
14
+
15
+ error: aborting due to 2 previous errors
16
+
17
+ For more information about this error, try `rustc --explain E0600`.
You can’t perform that action at this time.
0 commit comments