Hi,
In multiple editors (Kakoune and Helix) I've tried the following code:
#[cfg(test)]
mod tests {
const distance_tests : Vec<(((i32, i32), (i32, i32)), i32)> = vec![
(((0, 0), (0, 0)), 0);
(((0, 0), (1, 0)), 1);
(((0, 0), (0, 1)), 1);
(((0, 0), (-1, 0)), 1);
(((0, 0), (0, -1)), 1);
(((14, 13), (14, 13)), 0);
(((10, -3), (-16, 2)), 31);
(((-16, 2), (10, -3)), 31);
(((1, 10), (1, -10)), 20);
(((1, 10), (-1, 10)), 2);
(((1, 10), (-1, -10)), 22)
];
#[test]
fn test_distance() {
}
}
fn main() {
println!("Hello, world!");
}
rust-analyzer gives me the following diagnostics:
src/main.rs:3:11: warning: Constant `distance_tests` should have UPPER_SNAKE_CASE name, e.g. `DISTANCE_TESTS`
src/main.rs:5:30: error: no rules expected the token `;`
no rules expected this token in macro call
/home/alice/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/macros.rs:46:18: while trying to match meta-variable `$n:expr`
/home/alice/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/macros.rs:46:18: hint: while trying to match meta-variable `$n:expr`
src/main.rs:5:30: original diagnostic
But the code compiles fine, and nothing looks wrong (specifically re: the token :
). Is there a known reason it's doing this?