Files
rust/tests/ui/dyn-compatibility/spurious-dyn-compat-errors-58734.rs

26 lines
564 B
Rust
Raw Normal View History

2025-08-20 14:02:50 -04:00
// https://github.com/rust-lang/rust/issues/58734
trait Trait {
fn exists(self) -> ();
fn dyn_incompatible() -> Self;
}
impl Trait for () {
fn exists(self) -> () {
}
fn dyn_incompatible() -> Self {
()
}
}
fn main() {
// dyn-compatible or not, this call is OK
Trait::exists(());
// no dyn-compatibility error
Trait::nonexistent(());
//~^ WARN trait objects without an explicit `dyn` are deprecated
2021-07-10 10:00:54 +02:00
//~| WARN this is accepted in the current edition
2025-02-12 15:52:15 +01:00
//~| ERROR the trait `Trait` is not dyn compatible
}