Das Ermitteln eines Merkmals führt zu einem unerwarteten Compilerfehler, aber die manuelle Implementierung funktioniert

Dieser Code Spielplat):

#[derive(Clone)]
struct Foo<'a, T: 'a> {
    t: &'a T,
}

fn bar<'a, T>(foo: Foo<'a, T>) {
    foo.clone();
}

... kompiliert nicht:

error: no method named `clone` found for type `Foo<'a, T>` in the current scope
  --> <anon>:7:9
   |>
16 |>     foo.clone();
   |>         ^^^^^
note: the method `clone` exists but the following trait bounds were not satisfied: `T : std::clone::Clone`
help: items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `clone`, perhaps you need to implement it:
help: candidate #1: `std::clone::Clone`

Addinguse std::clone::Clone; ändert nichts, da es sowieso schon im Auftakt ist.

Wenn ich das @ entfer#[derive(Clone)] und manuell implementierenClone zumFoo, escompiles as expected!

impl<'a, T> Clone for Foo<'a, T> {
    fn clone(&self) -> Self {
        Foo {
            t: self.t,
        }
    }
}

Was geht hier vor sich

Gibt es einen Unterschied zwischen#[derive()] -Impls und manuelle?Ist das ein Compiler-Fehler?Etwas anderes, woran ich nicht gedacht habe?

Antworten auf die Frage(4)

Ihre Antwort auf die Frage