Skip to content

Commit

Permalink
Use path to refer to constants in cross-crate pattern tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Apr 28, 2020
1 parent e68a5c6 commit 532ba46
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/test/ui/consts/const_in_pattern/cross-crate-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]`

Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/consts/const_in_pattern/cross-crate-fail.stderr
Original file line number Diff line number Diff line change
@@ -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

4 changes: 2 additions & 2 deletions src/test/ui/consts/const_in_pattern/cross-crate-pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
_ => {}
}
}

0 comments on commit 532ba46

Please sign in to comment.