2022-02-21 16:25:59 -08:00
|
|
|
mod banana {
|
2024-02-13 23:05:23 +00:00
|
|
|
//~^ HELP the following traits which provide `pick` are implemented but not in scope
|
2022-02-21 16:25:59 -08:00
|
|
|
pub struct Chaenomeles;
|
|
|
|
|
|
|
|
pub trait Apple {
|
|
|
|
fn pick(&self) {}
|
|
|
|
}
|
|
|
|
impl Apple for Chaenomeles {}
|
|
|
|
|
|
|
|
pub trait Peach {
|
|
|
|
fn pick(&self, a: &mut ()) {}
|
|
|
|
}
|
|
|
|
impl<Mango: Peach> Peach for Box<Mango> {}
|
|
|
|
impl Peach for Chaenomeles {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
banana::Chaenomeles.pick()
|
|
|
|
//~^ ERROR no method named
|
|
|
|
//~| HELP items from traits can only be used if the trait is in scope
|
|
|
|
}
|