11error[E0080]: evaluation of constant value failed
2- --> $DIR/literals.rs:93 :62
2+ --> $DIR/literals.rs:86 :62
33 |
44LL | fn empty_range_at_base_type_min() -> pattern_type!(u32 is 0..0) {
55 | ^ attempt to compute `0_u32 - 1_u32`, which would overflow
66
77error[E0080]: evaluation of constant value failed
8- --> $DIR/literals.rs:98 :63
8+ --> $DIR/literals.rs:91 :63
99 |
1010LL | fn empty_range_at_base_type_min2() -> pattern_type!(u32 is 0..0) {
1111 | ^ attempt to compute `0_u32 - 1_u32`, which would overflow
1212
1313error[E0080]: evaluation of constant value failed
14- --> $DIR/literals.rs:113 :65
14+ --> $DIR/literals.rs:106 :65
1515 |
1616LL | fn wraparound_range_at_base_ty_end() -> pattern_type!(u32 is 1..0) {
1717 | ^ attempt to compute `0_u32 - 1_u32`, which would overflow
1818
1919error[E0080]: evaluation of constant value failed
20- --> $DIR/literals.rs:118 :66
20+ --> $DIR/literals.rs:111 :66
2121 |
2222LL | fn wraparound_range_at_base_ty_end2() -> pattern_type!(u32 is 1..0) {
2323 | ^ attempt to compute `0_u32 - 1_u32`, which would overflow
2424
2525error[E0080]: evaluation of constant value failed
26- --> $DIR/literals.rs:123 :66
26+ --> $DIR/literals.rs:116 :66
2727 |
2828LL | fn wraparound_range_at_base_ty_end3() -> pattern_type!(u32 is 1..0) {
2929 | ^ attempt to compute `0_u32 - 1_u32`, which would overflow
@@ -39,63 +39,20 @@ LL | 0
3939 = note: expected pattern type `(u32) is 1..`
4040 found type `{integer}`
4141
42- error[E0308]: mismatched types
43- --> $DIR/literals.rs:14:5
44- |
45- LL | fn at_range_start() -> pattern_type!(u32 is 1..) {
46- | ------------------------- expected `(u32) is 1..` because of return type
47- LL | 1
48- | ^ expected `(u32) is 1..`, found integer
49- |
50- = note: expected pattern type `(u32) is 1..`
51- found type `{integer}`
52-
53- error[E0308]: mismatched types
54- --> $DIR/literals.rs:19:5
55- |
56- LL | fn in_range() -> pattern_type!(u32 is 1..) {
57- | ------------------------- expected `(u32) is 1..` because of return type
58- LL | 2
59- | ^ expected `(u32) is 1..`, found integer
60- |
61- = note: expected pattern type `(u32) is 1..`
62- found type `{integer}`
63-
64- error[E0308]: mismatched types
65- --> $DIR/literals.rs:24:5
42+ error[E0600]: cannot apply unary operator `-` to type `(u32) is 1..`
43+ --> $DIR/literals.rs:22:5
6644 |
67- LL | fn negative_lit_on_unsigned_ty() -> pattern_type!(u32 is 1..) {
68- | ------------------------- expected `(u32) is 1..` because of return type
6945LL | -3
70- | ^^ expected `(u32) is 1..`, found integer
71- |
72- = note: expected pattern type `(u32) is 1..`
73- found type `{integer}`
46+ | ^^ cannot apply unary operator `-`
7447
75- error[E0308 ]: mismatched types
76- --> $DIR/literals.rs:29 :5
48+ error[E0600 ]: cannot apply unary operator `-` to type `(i8) is -5..=4`
49+ --> $DIR/literals.rs:27 :5
7750 |
78- LL | fn negative_lit_in_range() -> pattern_type!(i8 is -5..5) {
79- | -------------------------- expected `(i8) is -5..=4` because of return type
8051LL | -2
81- | ^^ expected `(i8) is -5..=4`, found integer
82- |
83- = note: expected pattern type `(i8) is -5..=4`
84- found type `{integer}`
52+ | ^^ cannot apply unary operator `-`
8553
8654error[E0308]: mismatched types
87- --> $DIR/literals.rs:34:5
88- |
89- LL | fn positive_lit_in_range_of_signed() -> pattern_type!(i8 is -5..5) {
90- | -------------------------- expected `(i8) is -5..=4` because of return type
91- LL | 2
92- | ^ expected `(i8) is -5..=4`, found integer
93- |
94- = note: expected pattern type `(i8) is -5..=4`
95- found type `{integer}`
96-
97- error[E0308]: mismatched types
98- --> $DIR/literals.rs:39:5
55+ --> $DIR/literals.rs:36:5
9956 |
10057LL | fn negative_lit_at_range_start() -> pattern_type!(i8 is -5..5) {
10158 | -------------------------- expected `(i8) is -5..=4` because of return type
@@ -106,18 +63,7 @@ LL | -5
10663 found type `{integer}`
10764
10865error[E0308]: mismatched types
109- --> $DIR/literals.rs:44:5
110- |
111- LL | fn positive_lit_at_range_end() -> pattern_type!(i8 is -5..5) {
112- | -------------------------- expected `(i8) is -5..=4` because of return type
113- LL | 4
114- | ^ expected `(i8) is -5..=4`, found integer
115- |
116- = note: expected pattern type `(i8) is -5..=4`
117- found type `{integer}`
118-
119- error[E0308]: mismatched types
120- --> $DIR/literals.rs:49:5
66+ --> $DIR/literals.rs:45:5
12167 |
12268LL | fn lit_one_beyond_range_end() -> pattern_type!(i8 is -5..5) {
12369 | -------------------------- expected `(i8) is -5..=4` because of return type
@@ -128,7 +74,7 @@ LL | 5
12874 found type `{integer}`
12975
13076error[E0308]: mismatched types
131- --> $DIR/literals.rs:54 :5
77+ --> $DIR/literals.rs:50 :5
13278 |
13379LL | fn wrong_lit_kind() -> pattern_type!(u32 is 1..) {
13480 | ------------------------- expected `(u32) is 1..` because of return type
@@ -139,7 +85,7 @@ LL | '3'
13985 found type `char`
14086
14187error[E0308]: mismatched types
142- --> $DIR/literals.rs:59 :5
88+ --> $DIR/literals.rs:55 :5
14389 |
14490LL | fn char_lit_in_range() -> pattern_type!(char is 'a'..'z') {
14591 | ------------------------------- expected `(char) is 'a'..='y'` because of return type
@@ -150,7 +96,7 @@ LL | 'b'
15096 found type `char`
15197
15298error[E0308]: mismatched types
153- --> $DIR/literals.rs:64 :5
99+ --> $DIR/literals.rs:60 :5
154100 |
155101LL | fn char_lit_out_of_range() -> pattern_type!(char is 'a'..'z') {
156102 | ------------------------------- expected `(char) is 'a'..='y'` because of return type
@@ -161,29 +107,7 @@ LL | 'A'
161107 found type `char`
162108
163109error[E0308]: mismatched types
164- --> $DIR/literals.rs:69:5
165- |
166- LL | fn lit_at_unsigned_range_inclusive_end() -> pattern_type!(u32 is 0..=1) {
167- | --------------------------- expected `(u32) is 0..=1` because of return type
168- LL | 1
169- | ^ expected `(u32) is 0..=1`, found integer
170- |
171- = note: expected pattern type `(u32) is 0..=1`
172- found type `{integer}`
173-
174- error[E0308]: mismatched types
175- --> $DIR/literals.rs:74:5
176- |
177- LL | fn single_element_range() -> pattern_type!(u32 is 0..=0) {
178- | --------------------------- expected `(u32) is 0..=0` because of return type
179- LL | 0
180- | ^ expected `(u32) is 0..=0`, found integer
181- |
182- = note: expected pattern type `(u32) is 0..=0`
183- found type `{integer}`
184-
185- error[E0308]: mismatched types
186- --> $DIR/literals.rs:79:5
110+ --> $DIR/literals.rs:73:5
187111 |
188112LL | fn lit_oob_single_element_range() -> pattern_type!(u32 is 0..=0) {
189113 | --------------------------- expected `(u32) is 0..=0` because of return type
@@ -194,7 +118,7 @@ LL | 1
194118 found type `{integer}`
195119
196120error[E0308]: mismatched types
197- --> $DIR/literals.rs:84 :5
121+ --> $DIR/literals.rs:78 :5
198122 |
199123LL | fn lit_oob_single_element_range_exclusive() -> pattern_type!(u32 is 0..1) {
200124 | -------------------------- expected `(u32) is 0..=0` because of return type
@@ -204,19 +128,10 @@ LL | 1
204128 = note: expected pattern type `(u32) is 0..=0`
205129 found type `{integer}`
206130
207- error[E0308]: mismatched types
208- --> $DIR/literals.rs:89:5
209- |
210- LL | fn single_element_range_exclusive() -> pattern_type!(u32 is 0..1) {
211- | -------------------------- expected `(u32) is 0..=0` because of return type
212- LL | 0
213- | ^ expected `(u32) is 0..=0`, found integer
214- |
215- = note: expected pattern type `(u32) is 0..=0`
216- found type `{integer}`
131+ error: pattern type ranges cannot wrap: 1..=0
217132
218133error[E0308]: mismatched types
219- --> $DIR/literals.rs:104 :5
134+ --> $DIR/literals.rs:97 :5
220135 |
221136LL | fn empty_range() -> pattern_type!(u32 is 1..1) {
222137 | -------------------------- expected `(u32) is 1..=0` because of return type
@@ -227,7 +142,7 @@ LL | 0
227142 found type `{integer}`
228143
229144error[E0308]: mismatched types
230- --> $DIR/literals.rs:109 :5
145+ --> $DIR/literals.rs:102 :5
231146 |
232147LL | fn empty_range2() -> pattern_type!(u32 is 1..1) {
233148 | -------------------------- expected `(u32) is 1..=0` because of return type
@@ -237,8 +152,10 @@ LL | 1
237152 = note: expected pattern type `(u32) is 1..=0`
238153 found type `{integer}`
239154
155+ error: pattern type ranges cannot wrap: 2..=0
156+
240157error[E0308]: mismatched types
241- --> $DIR/literals.rs:129 :5
158+ --> $DIR/literals.rs:122 :5
242159 |
243160LL | fn wraparound_range() -> pattern_type!(u32 is 2..1) {
244161 | -------------------------- expected `(u32) is 2..=0` because of return type
@@ -249,7 +166,7 @@ LL | 1
249166 found type `{integer}`
250167
251168error[E0308]: mismatched types
252- --> $DIR/literals.rs:134 :5
169+ --> $DIR/literals.rs:127 :5
253170 |
254171LL | fn lit_in_wraparound_range() -> pattern_type!(u32 is 2..1) {
255172 | -------------------------- expected `(u32) is 2..=0` because of return type
@@ -260,7 +177,7 @@ LL | 0
260177 found type `{integer}`
261178
262179error[E0308]: mismatched types
263- --> $DIR/literals.rs:139 :5
180+ --> $DIR/literals.rs:132 :5
264181 |
265182LL | fn lit_at_wraparound_range_start() -> pattern_type!(u32 is 2..1) {
266183 | -------------------------- expected `(u32) is 2..=0` because of return type
@@ -270,7 +187,7 @@ LL | 2
270187 = note: expected pattern type `(u32) is 2..=0`
271188 found type `{integer}`
272189
273- error: aborting due to 27 previous errors
190+ error: aborting due to 22 previous errors
274191
275- Some errors have detailed explanations: E0080, E0308.
192+ Some errors have detailed explanations: E0080, E0308, E0600 .
276193For more information about an error, try `rustc --explain E0080`.
0 commit comments