]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/associated-types/defaults-unsound-62211-1.rs
Rollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-Simulacrum
[rust.git] / src / test / ui / associated-types / defaults-unsound-62211-1.rs
index f283d22b3c7eb9eecb0dbb5d64f3af45234fa52d..fa6a208b4f1baf287ab7e58c27d49b698e70d7a5 100644 (file)
 
 use std::{
     fmt::Display,
-    ops::{AddAssign, Deref}
+    ops::{AddAssign, Deref},
 };
 
-
 trait UncheckedCopy: Sized {
     // This Output is said to be Copy. Yet we default to Self
     // and it's accepted, not knowing if Self ineed is Copy
-    type Output: Copy
+    type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
     //~^ ERROR the trait bound `Self: Copy` is not satisfied
-    + Deref<Target = str>
-    //~^ ERROR the trait bound `Self: Deref` is not satisfied
-    + AddAssign<&'static str>
-    //~^ ERROR cannot add-assign `&'static str` to `Self`
-    + From<Self>
-    + Display = Self;
-    //~^ ERROR `Self` doesn't implement `std::fmt::Display`
+    //~| ERROR the trait bound `Self: Deref` is not satisfied
+    //~| ERROR cannot add-assign `&'static str` to `Self`
+    //~| ERROR `Self` doesn't implement `std::fmt::Display`
 
     // We said the Output type was Copy, so we can Copy it freely!
     fn unchecked_copy(other: &Self::Output) -> Self::Output {
@@ -39,10 +34,6 @@ fn make_origin(s: Self) -> Self::Output {
 }
 
 impl<T> UncheckedCopy for T {}
-//~^ ERROR `T` doesn't implement `std::fmt::Display`
-//~| ERROR the trait bound `T: Deref` is not satisfied
-//~| ERROR cannot add-assign `&'static str` to `T`
-//~| ERROR the trait bound `T: Copy` is not satisfied
 
 fn bug<T: UncheckedCopy>(origin: T) {
     let origin = T::make_origin(origin);