Use path to refer to constants in cross-crate pattern tests

This commit is contained in:
Dylan MacKenzie 2020-04-28 14:30:44 -07:00
parent e68a5c6800
commit 532ba46402
3 changed files with 9 additions and 10 deletions

View File

@ -3,11 +3,10 @@
#![warn(indirect_structural_match)]
extern crate consts;
use consts::*;
fn main() {
match None {
SOME => panic!(),
consts::SOME => panic!(),
//~^ must be annotated with `#[derive(PartialEq, Eq)]`
//~| must be annotated with `#[derive(PartialEq, Eq)]`

View File

@ -1,14 +1,14 @@
error: to use a constant of type `consts::CustomEq` in a pattern, `consts::CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/cross-crate-fail.rs:10:9
--> $DIR/cross-crate-fail.rs:9:9
|
LL | SOME => panic!(),
| ^^^^
LL | consts::SOME => panic!(),
| ^^^^^^^^^^^^
error: to use a constant of type `consts::CustomEq` in a pattern, `consts::CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/cross-crate-fail.rs:10:9
--> $DIR/cross-crate-fail.rs:9:9
|
LL | SOME => panic!(),
| ^^^^
LL | consts::SOME => panic!(),
| ^^^^^^^^^^^^
error: aborting due to 2 previous errors

View File

@ -4,11 +4,11 @@
#![warn(indirect_structural_match)]
extern crate consts;
use consts::*;
use consts::CustomEq;
fn main() {
match Some(CustomEq) {
NONE => panic!(),
consts::NONE => panic!(),
_ => {}
}
}