File tree 2 files changed +53
-0
lines changed
src/test/ui/specialization/min_specialization
2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( min_specialization) ]
2
+ use std:: fmt:: { self , Display } ;
3
+
4
+ pub enum Cow < ' a , B : ?Sized + ' a , O = <B as ToOwned >:: Owned >
5
+ where
6
+ B : ToOwned ,
7
+ {
8
+ Borrowed ( & ' a B ) ,
9
+ Owned ( O ) ,
10
+ }
11
+
12
+ impl ToString for Cow < ' _ , str > {
13
+ fn to_string ( & self ) -> String {
14
+ String :: new ( )
15
+ }
16
+ }
17
+
18
+ impl < B : ?Sized > Display for Cow < ' _ , B > { //~ ERROR: the trait bound `B: Clone` is not satisfied [E0277]
19
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result { //~ ERROR: the trait bound `B: Clone` is not satisfied [E0277]
20
+ write ! ( f, "foo" )
21
+ }
22
+ }
23
+
24
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0277]: the trait bound `B: Clone` is not satisfied
2
+ --> $DIR/issue-79224.rs:18:17
3
+ |
4
+ LL | impl<B: ?Sized> Display for Cow<'_, B> {
5
+ | ^^^^^^^ the trait `Clone` is not implemented for `B`
6
+ |
7
+ = note: required because of the requirements on the impl of `ToOwned` for `B`
8
+ help: consider further restricting this bound
9
+ |
10
+ LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
11
+ | +++++++++++++++++++
12
+
13
+ error[E0277]: the trait bound `B: Clone` is not satisfied
14
+ --> $DIR/issue-79224.rs:19:5
15
+ |
16
+ LL | / fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17
+ LL | | write!(f, "foo")
18
+ LL | | }
19
+ | |_____^ the trait `Clone` is not implemented for `B`
20
+ |
21
+ = note: required because of the requirements on the impl of `ToOwned` for `B`
22
+ help: consider further restricting this bound
23
+ |
24
+ LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
25
+ | +++++++++++++++++++
26
+
27
+ error: aborting due to 2 previous errors
28
+
29
+ For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments