Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oeb25/rkyv-partial-eq-error-reproduction


https://github.com/oeb25/rkyv-partial-eq-error-reproduction

Last synced: about 9 hours ago
JSON representation

Awesome Lists containing this project

README

        

# Reproduction for [scylladb/scylla-rust-driver#838](https://github.com/scylladb/scylla-rust-driver/pull/838)

Rust automatically dereferences `&&str` when comparing against `&str` as exemplified by the following example.

```rs
fn compiles() {
Some("") == Some(&"");
}
```

However, adding any use of `rkyv` as in the following code:

```rs
use rkyv::AlignedVec;
fn does_not_compile() {
Some("") == Some(&"");
}
```

Results in this error:

```rs
error[E0277]: can't compare `Option<&str>` with `Option<&&str>`
--> src/lib.rs:3:14
|
3 | Some("") == Some(&"");
| ^^ no implementation for `Option<&str> == Option<&&str>`
|
= help: the trait `PartialEq>` is not implemented for `Option<&str>`
= help: the following other types implement trait `PartialEq`:
> as PartialEq>>
as PartialEq>
as PartialEq>>
```

---

This repository contains two crates, `okay` and `errors`, which reproduce the above successful and failing compile respectively.