Skip to content

Commit 05198ad

Browse files
authored
Unrolled build for rust-lang#120152
Rollup merge of rust-lang#120152 - rowan-sl:help-message-for-range-pattern, r=oli-obk add help message for `exclusive_range_pattern` error Fixes rust-lang#120047 this error ``` error[E0658]: exclusive range pattern syntax is experimental --> src/lib.rs:3:9 | 3 | 0..42 => {}, | ^^^^^ | = note: see issue rust-lang#37854 <rust-lang#37854> for more information = help: use an inclusive range pattern, like N..=M ``` now includes a help message Not sure of proper procedure here but this seemed like a good help message (used the one suggested in the original issue), if you have a idea for one that is better or something I missed please comment!
2 parents 3066253 + 1c77f87 commit 05198ad

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
398398
&self,
399399
exclusive_range_pattern,
400400
pattern.span,
401-
"exclusive range pattern syntax is experimental"
401+
"exclusive range pattern syntax is experimental",
402+
"use an inclusive range pattern, like N..=M"
402403
);
403404
}
404405
_ => {}

tests/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LL | 0 .. 3 => {}
77
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
88
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
= help: use an inclusive range pattern, like N..=M
1011

1112
error: aborting due to 1 previous error
1213

tests/ui/half-open-range-patterns/range_pat_interactions1.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ LL | if let n @ 2..3|4 = x {
2121
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
2222
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
2323
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
24+
= help: use an inclusive range pattern, like N..=M
2425

2526
error[E0658]: exclusive range pattern syntax is experimental
2627
--> $DIR/range_pat_interactions1.rs:14:23
@@ -31,6 +32,7 @@ LL | } else if let 2..3 | 4 = x {
3132
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
3233
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
3334
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
35+
= help: use an inclusive range pattern, like N..=M
3436

3537
error: aborting due to 4 previous errors
3638

tests/ui/half-open-range-patterns/range_pat_interactions3.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LL | 1 | -3..0 => first_or.push(x),
1717
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
1818
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20+
= help: use an inclusive range pattern, like N..=M
2021

2122
error[E0658]: exclusive range pattern syntax is experimental
2223
--> $DIR/range_pat_interactions3.rs:12:18
@@ -27,6 +28,7 @@ LL | y @ (0..5 | 6) => or_two.push(y),
2728
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
2829
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
2930
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
31+
= help: use an inclusive range pattern, like N..=M
3032

3133
error[E0658]: exclusive range pattern syntax is experimental
3234
--> $DIR/range_pat_interactions3.rs:14:17
@@ -37,6 +39,7 @@ LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5),
3739
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
3840
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
3941
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
42+
= help: use an inclusive range pattern, like N..=M
4043

4144
error[E0658]: exclusive range pattern syntax is experimental
4245
--> $DIR/range_pat_interactions3.rs:18:17
@@ -47,6 +50,7 @@ LL | y @ ..-7 => assert_eq!(y, -8),
4750
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
4851
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
4952
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
53+
= help: use an inclusive range pattern, like N..=M
5054

5155
error: aborting due to 5 previous errors
5256

tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs;
1717
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
1818
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20+
= help: use an inclusive range pattern, like N..=M
2021

2122
error[E0658]: exclusive range pattern syntax is experimental
2223
--> $DIR/slice_pattern_syntax_problem1.rs:4:32
@@ -27,6 +28,7 @@ LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs;
2728
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
2829
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
2930
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
31+
= help: use an inclusive range pattern, like N..=M
3032

3133
error: aborting due to 3 previous errors
3234

0 commit comments

Comments
 (0)