2024-06-12 10:31:27 -05:00
|
|
|
#![deny(dead_code)]
|
|
|
|
|
|
|
|
struct T1; //~ ERROR struct `T1` is never constructed
|
2024-07-30 11:23:41 -05:00
|
|
|
pub struct T2(i32); //~ ERROR field `0` is never read
|
2024-07-30 11:28:59 -05:00
|
|
|
struct T3;
|
2024-06-12 10:31:27 -05:00
|
|
|
|
|
|
|
trait Trait1 { //~ ERROR trait `Trait1` is never used
|
|
|
|
const UNUSED: i32;
|
|
|
|
fn unused(&self) {}
|
|
|
|
fn construct_self() -> Self;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Trait2 {
|
2024-07-30 11:28:59 -05:00
|
|
|
const USED: i32;
|
|
|
|
fn used(&self) {}
|
2024-06-12 10:31:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Trait3 {
|
2024-07-30 11:28:59 -05:00
|
|
|
const USED: i32;
|
|
|
|
fn construct_self() -> Self;
|
2024-06-12 10:31:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait1 for T1 {
|
|
|
|
const UNUSED: i32 = 0;
|
|
|
|
fn construct_self() -> Self {
|
|
|
|
Self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait1 for T2 {
|
|
|
|
const UNUSED: i32 = 0;
|
|
|
|
fn construct_self() -> Self {
|
2024-07-30 11:28:59 -05:00
|
|
|
T2(0)
|
2024-06-12 10:31:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait2 for T1 {
|
2024-07-30 11:28:59 -05:00
|
|
|
const USED: i32 = 0;
|
2024-06-12 10:31:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait2 for T2 {
|
2024-07-30 11:28:59 -05:00
|
|
|
const USED: i32 = 0;
|
2024-07-04 09:05:00 -05:00
|
|
|
}
|
|
|
|
|
2024-07-30 11:28:59 -05:00
|
|
|
impl Trait3 for T3 {
|
|
|
|
const USED: i32 = 0;
|
|
|
|
fn construct_self() -> Self {
|
2024-06-12 10:31:27 -05:00
|
|
|
Self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|