rust/tests/ui/methods/supertrait-shadowing/common-ancestor.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
551 B
Rust
Raw Normal View History

2024-09-19 00:45:20 +00:00
//@ run-pass
//@ check-run-results
#![feature(supertrait_item_shadowing)]
#![warn(supertrait_item_shadowing_usage)]
#![warn(supertrait_item_shadowing_definition)]
2024-09-19 00:45:20 +00:00
#![allow(dead_code)]
trait A {
fn hello(&self) {
println!("A");
}
}
impl<T> A for T {}
trait B: A {
fn hello(&self) {
//~^ WARN trait item `hello` from `B` shadows identically named item
2024-09-19 00:45:20 +00:00
println!("B");
}
}
impl<T> B for T {}
fn main() {
().hello();
//~^ WARN trait item `hello` from `B` shadows identically named item from supertrait
}