Skip to content

Commit

Permalink
Unrolled build for rust-lang#120152
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
rust-timer authored Jan 22, 2024
2 parents 3066253 + 1c77f87 commit 05198ad
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
&self,
exclusive_range_pattern,
pattern.span,
"exclusive range pattern syntax is experimental"
"exclusive range pattern syntax is experimental",
"use an inclusive range pattern, like N..=M"
);
}
_ => {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ LL | 0 .. 3 => {}
= note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= help: use an inclusive range pattern, like N..=M

error: aborting due to 1 previous error

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

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

error: aborting due to 4 previous errors

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

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

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

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

error: aborting due to 5 previous errors

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

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

error: aborting due to 3 previous errors

Expand Down

0 comments on commit 05198ad

Please sign in to comment.