-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yuki Okushi <[email protected]>
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/test/ui/specialization/min_specialization/issue-79224.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#![feature(min_specialization)] | ||
use std::fmt::{self, Display}; | ||
|
||
pub enum Cow<'a, B: ?Sized + 'a, O = <B as ToOwned>::Owned> | ||
where | ||
B: ToOwned, | ||
{ | ||
Borrowed(&'a B), | ||
Owned(O), | ||
} | ||
|
||
impl ToString for Cow<'_, str> { | ||
fn to_string(&self) -> String { | ||
String::new() | ||
} | ||
} | ||
|
||
impl<B: ?Sized> Display for Cow<'_, B> { //~ ERROR: the trait bound `B: Clone` is not satisfied [E0277] | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { //~ ERROR: the trait bound `B: Clone` is not satisfied [E0277] | ||
write!(f, "foo") | ||
} | ||
} | ||
|
||
fn main() {} |
29 changes: 29 additions & 0 deletions
29
src/test/ui/specialization/min_specialization/issue-79224.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
error[E0277]: the trait bound `B: Clone` is not satisfied | ||
--> $DIR/issue-79224.rs:18:17 | ||
| | ||
LL | impl<B: ?Sized> Display for Cow<'_, B> { | ||
| ^^^^^^^ the trait `Clone` is not implemented for `B` | ||
| | ||
= note: required because of the requirements on the impl of `ToOwned` for `B` | ||
help: consider further restricting this bound | ||
| | ||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { | ||
| +++++++++++++++++++ | ||
|
||
error[E0277]: the trait bound `B: Clone` is not satisfied | ||
--> $DIR/issue-79224.rs:19:5 | ||
| | ||
LL | / fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
LL | | write!(f, "foo") | ||
LL | | } | ||
| |_____^ the trait `Clone` is not implemented for `B` | ||
| | ||
= note: required because of the requirements on the impl of `ToOwned` for `B` | ||
help: consider further restricting this bound | ||
| | ||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { | ||
| +++++++++++++++++++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |