- writeln!(w, "impl {} for {} {{", s, trait_name).unwrap();
+
+ // Blindly assume that the same imports where `supertrait` is defined are also
+ // imported here. This will almost certainly break at some point, but it should be
+ // a compilation failure when it does so.
+ write!(w, "impl").unwrap();
+ maybe_write_lifetime_generics(w, &supertrait.generics, types);
+ write!(w, " {}", s).unwrap();
+ maybe_write_generics(w, &supertrait.generics, types, false);
+ writeln!(w, " for {} {{", trait_name).unwrap();
+