Add regression test
This commit is contained in:
parent
1000fc5120
commit
655a2b4709
32
tests/ui/ice-2636.rs
Normal file
32
tests/ui/ice-2636.rs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
enum Foo {
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
C,
|
||||||
|
}
|
||||||
|
|
||||||
|
macro_rules! test_hash {
|
||||||
|
($foo:expr, $($t:ident => $ord:expr),+ ) => {
|
||||||
|
use self::Foo::*;
|
||||||
|
match $foo {
|
||||||
|
$ ( & $t => $ord,
|
||||||
|
)*
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let a = Foo::A;
|
||||||
|
test_hash!(&a, A => 0, B => 1, C => 2);
|
||||||
|
}
|
||||||
|
|
16
tests/ui/ice-2636.stderr
Normal file
16
tests/ui/ice-2636.stderr
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
error: you don't need to add `&` to both the expression and the patterns
|
||||||
|
--> $DIR/ice-2636.rs:21:9
|
||||||
|
|
|
||||||
|
21 | / match $foo {
|
||||||
|
22 | | $ ( & $t => $ord,
|
||||||
|
23 | | )*
|
||||||
|
24 | | };
|
||||||
|
| |_________^
|
||||||
|
...
|
||||||
|
30 | test_hash!(&a, A => 0, B => 1, C => 2);
|
||||||
|
| --------------------------------------- in this macro invocation
|
||||||
|
|
|
||||||
|
= note: `-D clippy::match-ref-pats` implied by `-D warnings`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user