about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorZack M. Davis <code@zackmdavis.net>2018-07-21 17:55:34 -0700
committerZack M. Davis <code@zackmdavis.net>2018-07-21 18:30:33 -0700
commit6c50ee5abc1f41aaf587f74cc317819ff8eca7d8 (patch)
tree15e2270a8d94f6fa51c40ec1ae382b7743598014 /src/test
parent874dec25ed4c08d36f17d396b6872ca50313fc8e (diff)
downloadrust-6c50ee5abc1f41aaf587f74cc317819ff8eca7d8.tar.gz
rust-6c50ee5abc1f41aaf587f74cc317819ff8eca7d8.zip
dead-code lint: say "constructed" for structs
This is a sequel to November 2017's #46103 / 1a9dc2e9. It had been
reported (more than once—at least #19140, #44083, and #44565) that the
"never used" language was confusing for enum variants that were "used"
as match patterns, so the wording was changed to say never
"constructed" specifically for enum variants. More recently, the same
issue was raised for structs (#52325). It seems consistent to say
"constructed" here, too, for the same reasons.

We considered using more specific word "called" for unused functions
and methods (while we declined to do this in #46103, the rationale
given in the commit message doesn't actually make sense), but it turns
out that Cargo's test suite expects the "never used" message, and
maybe we don't care enough even to make a Cargo PR over such a petty
and subjective wording change.

This resolves #52325.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/lint-dead-code-1.rs4
-rw-r--r--src/test/compile-fail/lint-dead-code-3.rs2
-rw-r--r--src/test/ui/span/macro-span-replacement.rs2
-rw-r--r--src/test/ui/span/macro-span-replacement.stderr4
-rw-r--r--src/test/ui/span/unused-warning-point-at-signature.rs2
-rw-r--r--src/test/ui/span/unused-warning-point-at-signature.stderr4
6 files changed, 9 insertions, 9 deletions
diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs
index d6ca5e6b1d9..2fe72365bab 100644
--- a/src/test/compile-fail/lint-dead-code-1.rs
+++ b/src/test/compile-fail/lint-dead-code-1.rs
@@ -19,7 +19,7 @@
 pub use foo2::Bar2;
 
 mod foo {
-    pub struct Bar; //~ ERROR: struct is never used
+    pub struct Bar; //~ ERROR: struct is never constructed
 }
 
 mod foo2 {
@@ -42,7 +42,7 @@ const CONST_USED_IN_ENUM_DISCRIMINANT: isize = 11;
 
 pub type typ = *const UsedStruct4;
 pub struct PubStruct;
-struct PrivStruct; //~ ERROR: struct is never used
+struct PrivStruct; //~ ERROR: struct is never constructed
 struct UsedStruct1 {
     #[allow(dead_code)]
     x: isize
diff --git a/src/test/compile-fail/lint-dead-code-3.rs b/src/test/compile-fail/lint-dead-code-3.rs
index f680e395449..112d3630952 100644
--- a/src/test/compile-fail/lint-dead-code-3.rs
+++ b/src/test/compile-fail/lint-dead-code-3.rs
@@ -20,7 +20,7 @@ extern {
     pub fn extern_foo();
 }
 
-struct Foo; //~ ERROR: struct is never used
+struct Foo; //~ ERROR: struct is never constructed
 impl Foo {
     fn foo(&self) { //~ ERROR: method is never used
         bar()
diff --git a/src/test/ui/span/macro-span-replacement.rs b/src/test/ui/span/macro-span-replacement.rs
index 4fe35042300..7374f157468 100644
--- a/src/test/ui/span/macro-span-replacement.rs
+++ b/src/test/ui/span/macro-span-replacement.rs
@@ -14,7 +14,7 @@
 
 macro_rules! m {
     ($a:tt $b:tt) => {
-        $b $a; //~ WARN struct is never used
+        $b $a; //~ WARN struct is never constructed
     }
 }
 
diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr
index bb59fa206df..b12ca86d3c9 100644
--- a/src/test/ui/span/macro-span-replacement.stderr
+++ b/src/test/ui/span/macro-span-replacement.stderr
@@ -1,7 +1,7 @@
-warning: struct is never used: `S`
+warning: struct is never constructed: `S`
   --> $DIR/macro-span-replacement.rs:17:14
    |
-LL |         $b $a; //~ WARN struct is never used
+LL |         $b $a; //~ WARN struct is never constructed
    |              ^
 ...
 LL |     m!(S struct);
diff --git a/src/test/ui/span/unused-warning-point-at-signature.rs b/src/test/ui/span/unused-warning-point-at-signature.rs
index 6a7071d49ae..c074f03db46 100644
--- a/src/test/ui/span/unused-warning-point-at-signature.rs
+++ b/src/test/ui/span/unused-warning-point-at-signature.rs
@@ -19,7 +19,7 @@ enum Enum { //~ WARN enum is never used
     D,
 }
 
-struct Struct { //~ WARN struct is never used
+struct Struct { //~ WARN struct is never constructed
     a: usize,
     b: usize,
     c: usize,
diff --git a/src/test/ui/span/unused-warning-point-at-signature.stderr b/src/test/ui/span/unused-warning-point-at-signature.stderr
index de234344d84..8344853d6de 100644
--- a/src/test/ui/span/unused-warning-point-at-signature.stderr
+++ b/src/test/ui/span/unused-warning-point-at-signature.stderr
@@ -11,10 +11,10 @@ LL | #![warn(unused)]
    |         ^^^^^^
    = note: #[warn(dead_code)] implied by #[warn(unused)]
 
-warning: struct is never used: `Struct`
+warning: struct is never constructed: `Struct`
   --> $DIR/unused-warning-point-at-signature.rs:22:1
    |
-LL | struct Struct { //~ WARN struct is never used
+LL | struct Struct { //~ WARN struct is never constructed
    | ^^^^^^^^^^^^^
 
 warning: function is never used: `func`