Skip to content

Commit

Permalink
Workaround for [rust#89190: Trait upcasting shadows (trait object) de…
Browse files Browse the repository at this point in the history
…ref coercion](rust-lang/rust#89190) hitting stable before its fix
  • Loading branch information
Tamschi committed Nov 16, 2021
1 parent a82c179 commit d117eba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

<!-- markdownlint-disable no-trailing-punctuation -->

## next

TODO: Date

- Revisions:
- Workaround for [rust#89190: Trait upcasting shadows (trait object) deref coercion](https://github.com/rust-lang/rust/issues/89190) hitting stable before its fix.

## 0.0.1

2021-09-29
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ impl<'a> PartialEq for dyn 'a + DyncastEq {
fn eq(&self, other: &Self) -> bool {
unsafe{self.dyncast_::<dyn 'a + PartialEq<dyn 'a + Dyncast>, dyn PartialEq<dyn Dyncast>>()}
.expect("Expected `Self` to be *dynamically* `dyn PartialEq<dyn Dyncast>` via `dyn DyncastOrd: PartialOrd`")
.eq(other)
.eq(other.as_dyncast())
}
}
impl<'a> Eq for dyn 'a + DyncastEq {}
Expand Down Expand Up @@ -792,15 +792,15 @@ impl<'a> Display for dyn 'a + DyncastOrd {
}
impl<'a> PartialEq for dyn 'a + DyncastOrd {
fn eq(&self, other: &Self) -> bool {
self.as_dyncast_eq().eq(other)
self.as_dyncast_eq().eq(other.as_dyncast_eq())
}
}
impl<'a> Eq for dyn 'a + DyncastOrd {}
impl<'a> PartialOrd for dyn 'a + DyncastOrd {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
unsafe{self.dyncast_::<dyn 'a+PartialOrd<dyn 'a+Dyncast>,dyn PartialOrd<dyn Dyncast>>()}
.expect("Expected `Self` to be *dynamically* `dyn PartialOrd<dyn Dyncast>` via `dyn DyncastOrd: PartialOrd`")
.partial_cmp(other)
.partial_cmp(other.as_dyncast())
}
}
impl<'a> Ord for dyn 'a + DyncastOrd {
Expand Down

0 comments on commit d117eba

Please sign in to comment.