Skip to content

Commit a4386f5

Browse files
committed
Auto merge of #118257 - mu001999:dead_code/trait, r=cjgillot
Make traits / trait methods detected by the dead code lint Fixes #118139 and #41883
2 parents 46e1598 + 9f5db99 commit a4386f5

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

tests/fail/dyn-call-trait-mismatch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
trait T1 {
2+
#[allow(dead_code)]
23
fn method1(self: Box<Self>);
34
}
45
trait T2 {

tests/fail/dyn-upcast-trait-mismatch.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,36 @@
22
#![allow(incomplete_features)]
33

44
trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync {
5+
#[allow(dead_code)]
56
fn a(&self) -> i32 {
67
10
78
}
89

10+
#[allow(dead_code)]
911
fn z(&self) -> i32 {
1012
11
1113
}
1214

15+
#[allow(dead_code)]
1316
fn y(&self) -> i32 {
1417
12
1518
}
1619
}
1720

1821
trait Bar: Foo {
22+
#[allow(dead_code)]
1923
fn b(&self) -> i32 {
2024
20
2125
}
2226

27+
#[allow(dead_code)]
2328
fn w(&self) -> i32 {
2429
21
2530
}
2631
}
2732

2833
trait Baz: Bar {
34+
#[allow(dead_code)]
2935
fn c(&self) -> i32 {
3036
30
3137
}

tests/pass/cast-rfc0401-vtable-kinds.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ trait Foo<T> {
99
}
1010
}
1111

12+
#[allow(dead_code)]
1213
trait Bar {
1314
fn bar(&self) {
1415
println!("Bar!");

tests/pass/dyn-upcast.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,17 @@ fn struct_() {
383383

384384
fn replace_vptr() {
385385
trait A {
386+
#[allow(dead_code)]
386387
fn foo_a(&self);
387388
}
388389

389390
trait B {
391+
#[allow(dead_code)]
390392
fn foo_b(&self);
391393
}
392394

393395
trait C: A + B {
396+
#[allow(dead_code)]
394397
fn foo_c(&self);
395398
}
396399

tests/pass/weak_memory/weak.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::sync::atomic::Ordering::*;
1111
use std::sync::atomic::{fence, AtomicUsize};
1212
use std::thread::spawn;
1313

14+
#[allow(dead_code)]
1415
#[derive(Copy, Clone)]
1516
struct EvilSend<T>(pub T);
1617

0 commit comments

Comments
 (0)