about summary refs log tree commit diff
path: root/tests/ui/methods
diff options
context:
space:
mode:
authorr0cky <mu001999@outlook.com>2024-02-07 10:42:01 +0800
committerr0cky <mu001999@outlook.com>2024-02-07 10:42:01 +0800
commitc7519d42c2664828c98fdb98acab73e9a39b0b97 (patch)
tree87e875c88b08158761df546ea4e88902fbb08d6a /tests/ui/methods
parent40878ca6ea79d6e55e430846a2de3350a76cd08f (diff)
downloadrust-c7519d42c2664828c98fdb98acab73e9a39b0b97.tar.gz
rust-c7519d42c2664828c98fdb98acab73e9a39b0b97.zip
Update tests
Diffstat (limited to 'tests/ui/methods')
-rw-r--r--tests/ui/methods/method-lookup-order.rs1
-rw-r--r--tests/ui/methods/method-recursive-blanket-impl.rs2
-rw-r--r--tests/ui/methods/method-recursive-blanket-impl.stderr10
-rw-r--r--tests/ui/methods/method-two-trait-defer-resolution-2.rs2
-rw-r--r--tests/ui/methods/method-two-trait-defer-resolution-2.stderr12
-rw-r--r--tests/ui/methods/method-two-traits-distinguished-via-where-clause.rs2
-rw-r--r--tests/ui/methods/method-two-traits-distinguished-via-where-clause.stderr10
7 files changed, 36 insertions, 3 deletions
diff --git a/tests/ui/methods/method-lookup-order.rs b/tests/ui/methods/method-lookup-order.rs
index 986fe103cdc..5a46cf35dec 100644
--- a/tests/ui/methods/method-lookup-order.rs
+++ b/tests/ui/methods/method-lookup-order.rs
@@ -1,6 +1,7 @@
 // ignore-tidy-linelength
 
 // run-pass
+#![allow(dead_code)]
 
 // There are five cfg's below. I explored the set of all non-empty combinations
 // of the below five cfg's, which is 2^5 - 1 = 31 combinations.
diff --git a/tests/ui/methods/method-recursive-blanket-impl.rs b/tests/ui/methods/method-recursive-blanket-impl.rs
index a2db75b4e85..e7e83cbec77 100644
--- a/tests/ui/methods/method-recursive-blanket-impl.rs
+++ b/tests/ui/methods/method-recursive-blanket-impl.rs
@@ -11,7 +11,7 @@
 use std::marker::Sized;
 
 // Note: this must be generic for the problem to show up
-trait Foo<A> {
+trait Foo<A> { //~ WARN trait `Foo` is never used
     fn foo(&self, a: A);
 }
 
diff --git a/tests/ui/methods/method-recursive-blanket-impl.stderr b/tests/ui/methods/method-recursive-blanket-impl.stderr
new file mode 100644
index 00000000000..9797a8f6c83
--- /dev/null
+++ b/tests/ui/methods/method-recursive-blanket-impl.stderr
@@ -0,0 +1,10 @@
+warning: trait `Foo` is never used
+  --> $DIR/method-recursive-blanket-impl.rs:14:7
+   |
+LL | trait Foo<A> {
+   |       ^^^
+   |
+   = note: `#[warn(dead_code)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/methods/method-two-trait-defer-resolution-2.rs b/tests/ui/methods/method-two-trait-defer-resolution-2.rs
index fc5766da971..d6076126732 100644
--- a/tests/ui/methods/method-two-trait-defer-resolution-2.rs
+++ b/tests/ui/methods/method-two-trait-defer-resolution-2.rs
@@ -14,7 +14,7 @@ trait Foo {
     fn foo(&self) -> isize;
 }
 
-trait MyCopy { fn foo(&self) { } }
+trait MyCopy { fn foo(&self) { } } //~ WARN method `foo` is never used
 impl MyCopy for i32 { }
 
 impl<T:MyCopy> Foo for Vec<T> {
diff --git a/tests/ui/methods/method-two-trait-defer-resolution-2.stderr b/tests/ui/methods/method-two-trait-defer-resolution-2.stderr
new file mode 100644
index 00000000000..4501ea5d243
--- /dev/null
+++ b/tests/ui/methods/method-two-trait-defer-resolution-2.stderr
@@ -0,0 +1,12 @@
+warning: method `foo` is never used
+  --> $DIR/method-two-trait-defer-resolution-2.rs:17:19
+   |
+LL | trait MyCopy { fn foo(&self) { } }
+   |       ------      ^^^
+   |       |
+   |       method in this trait
+   |
+   = note: `#[warn(dead_code)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/methods/method-two-traits-distinguished-via-where-clause.rs b/tests/ui/methods/method-two-traits-distinguished-via-where-clause.rs
index d820d2ad08a..2fd6c3bfab8 100644
--- a/tests/ui/methods/method-two-traits-distinguished-via-where-clause.rs
+++ b/tests/ui/methods/method-two-traits-distinguished-via-where-clause.rs
@@ -4,7 +4,7 @@
 
 // pretty-expanded FIXME #23616
 
-trait A {
+trait A { //~ WARN trait `A` is never used
     fn foo(self);
 }
 
diff --git a/tests/ui/methods/method-two-traits-distinguished-via-where-clause.stderr b/tests/ui/methods/method-two-traits-distinguished-via-where-clause.stderr
new file mode 100644
index 00000000000..0a60c6242bb
--- /dev/null
+++ b/tests/ui/methods/method-two-traits-distinguished-via-where-clause.stderr
@@ -0,0 +1,10 @@
+warning: trait `A` is never used
+  --> $DIR/method-two-traits-distinguished-via-where-clause.rs:7:7
+   |
+LL | trait A {
+   |       ^
+   |
+   = note: `#[warn(dead_code)]` on by default
+
+warning: 1 warning emitted
+