about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-09-16 20:49:48 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-09-16 20:49:48 +0200
commit370fbcc0225a226096773fc8641c59eb5e635f7a (patch)
tree7c66bcb478a63f1f54cac35e07573138dce175a1
parent05cc3c0a83fc7faab20a10f2e0eca61dc34a6394 (diff)
downloadrust-370fbcc0225a226096773fc8641c59eb5e635f7a.tar.gz
rust-370fbcc0225a226096773fc8641c59eb5e635f7a.zip
or-patterns: #47390: we rely on names to exercise `IndexMap`.
-rw-r--r--src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs3
-rw-r--r--src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr20
2 files changed, 13 insertions, 10 deletions
diff --git a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs
index 4cb35e907c8..7870d394c8b 100644
--- a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs
+++ b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs
@@ -33,6 +33,9 @@ fn main() {
     let mut mut_unused_var = 1;
 
     let (mut var, unused_var) = (1, 2);
+    // NOTE: `var` comes after `unused_var` lexicographically yet the warning
+    // for `var` will be emitted before the one for `unused_var`. We use an
+    // `IndexMap` to ensure this is the case instead of a `BTreeMap`.
 
     if let SoulHistory { corridors_of_light,
                          mut hours_are_suns,
diff --git a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr
index a0b34d220c8..74bbef8adad 100644
--- a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr
+++ b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr
@@ -30,13 +30,13 @@ LL |     let (mut var, unused_var) = (1, 2);
    |                   ^^^^^^^^^^ help: consider prefixing with an underscore: `_unused_var`
 
 warning: unused variable: `corridors_of_light`
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:26
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:40:26
    |
 LL |     if let SoulHistory { corridors_of_light,
    |                          ^^^^^^^^^^^^^^^^^^ help: try ignoring the field: `corridors_of_light: _`
 
 warning: variable `hours_are_suns` is assigned to, but never used
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:38:30
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:41:30
    |
 LL |                          mut hours_are_suns,
    |                              ^^^^^^^^^^^^^^
@@ -44,7 +44,7 @@ LL |                          mut hours_are_suns,
    = note: consider using `_hours_are_suns` instead
 
 warning: value assigned to `hours_are_suns` is never read
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:40:9
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:43:9
    |
 LL |         hours_are_suns = false;
    |         ^^^^^^^^^^^^^^
@@ -58,43 +58,43 @@ LL | #![warn(unused)] // UI tests pass `-A unused` (#43896)
    = help: maybe it is overwritten before being read?
 
 warning: unused variable: `fire`
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:44:32
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:47:32
    |
 LL |     let LovelyAmbition { lips, fire } = the_spirit;
    |                                ^^^^ help: try ignoring the field: `fire: _`
 
 warning: unused variable: `case`
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:53:23
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:56:23
    |
 LL |         Large::Suit { case } => {}
    |                       ^^^^ help: try ignoring the field: `case: _`
 
 warning: unused variable: `case`
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:58:24
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:61:24
    |
 LL |         &Large::Suit { case } => {}
    |                        ^^^^ help: try ignoring the field: `case: _`
 
 warning: unused variable: `case`
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:63:27
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:66:27
    |
 LL |         box Large::Suit { case } => {}
    |                           ^^^^ help: try ignoring the field: `case: _`
 
 warning: unused variable: `case`
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:68:24
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:71:24
    |
 LL |         (Large::Suit { case },) => {}
    |                        ^^^^ help: try ignoring the field: `case: _`
 
 warning: unused variable: `case`
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:73:24
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:76:24
    |
 LL |         [Large::Suit { case }] => {}
    |                        ^^^^ help: try ignoring the field: `case: _`
 
 warning: unused variable: `case`
-  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:78:29
+  --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:81:29
    |
 LL |         Tuple(Large::Suit { case }, ()) => {}
    |                             ^^^^ help: try ignoring the field: `case: _`