Skip to content

Commit a9c4392

Browse files
authored
Merge pull request #714 from rust-ndarray/s-compile-error
Add error message for invalid syntax in s![]
2 parents f607ff6 + 3829f52 commit a9c4392

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/slice.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ macro_rules! s(
612612
(@convert $r:expr, $s:expr) => {
613613
<$crate::SliceOrIndex as ::std::convert::From<_>>::from($r).step_by($s as isize)
614614
};
615+
// Catch-all clause for syntax errors
616+
(@parse $($t:tt)*) => { compile_error!("Invalid syntax in s![], expected at least one index or range") };
615617
($($t:tt)*) => {
616618
// The extra `*&` is a workaround for this compiler bug:
617619
// https://github.com/rust-lang/rust/issues/23014

0 commit comments

Comments
 (0)