-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Covariance check with _assert_covariance
is insufficient, unsound
#49
Comments
Sigh, here we go again. Variance the bane of self-referential abstractions. Thanks for finding the issue and reporting and fixing it! |
With the bug fixed on main, here are the next steps I propose:
Please let me know if that aligns with your expectations. |
For 0.10, you could also add a point release containing the fix (for example, just the minimal fix changing the single line in the implementation), I think it would make sense not to unnecessarily break the |
I'd really like to avoid having to maintain multiple versions, the migration from 0.10 to 1.0 is without any breakage. |
The point of a Migration is “without breakage” for the author of a migrating library, but yanking all In my personal view, the only reasonable approaches are to either not yank all I would even believe that publishing a single, minimal |
I’ve written such a |
I find your arguments convincing. I want to publish a
|
Hmm… I don’t think doctests failing is a problem though. This does exactly follow the pattern of the semver trick repo, as far as I can tell. I think the error makes sense since doctests will add the library itself and its dependencies as a dependency, which then means in this case, two dependencies (of the doctest-generated code) with the same name. However, a crate that actually depends on self_cell would only specify one version as a dependency, and it works fine (I tested it locally with a path dependency on the |
It’s interesting though that it does point out the error in the |
Tested it now; renaming seems to incur no problems, too, so I pushed a commit with the rename. |
Thanks, I've published 0.10.3, and have yanked the affected versions. |
changes: freestrings/jsonpath@v0.2.6...v0.3.0 self_cell: bump to 0.10.3 due to RUSTSEC-2023-0070 https://rustsec.org/advisories/RUSTSEC-2023-0070.html Voultapher/self_cell#49 bump h2 to 0.3.22, dropping few dup crate versions https://github.com/hyperium/h2/blob/v0.3.22/CHANGELOG.md
…ulacrum bump few deps to fix unsoundness and drop few dup deps jsondocck: bump jsonpath to 0.3, dropping few dup dependencies changes: freestrings/jsonpath@v0.2.6...v0.3.0 self_cell: bump to 0.10.3 due to RUSTSEC-2023-0070 https://rustsec.org/advisories/RUSTSEC-2023-0070.html Voultapher/self_cell#49 bump h2 to 0.3.22, dropping few dup crate versions https://github.com/hyperium/h2/blob/v0.3.22/CHANGELOG.md
…ulacrum bump few deps to fix unsoundness and drop few dup deps jsondocck: bump jsonpath to 0.3, dropping few dup dependencies changes: freestrings/jsonpath@v0.2.6...v0.3.0 self_cell: bump to 0.10.3 due to RUSTSEC-2023-0070 https://rustsec.org/advisories/RUSTSEC-2023-0070.html Voultapher/self_cell#49 bump h2 to 0.3.22, dropping few dup crate versions https://github.com/hyperium/h2/blob/v0.3.22/CHANGELOG.md
…ulacrum bump few deps to fix unsoundness and drop few dup deps jsondocck: bump jsonpath to 0.3, dropping few dup dependencies changes: freestrings/jsonpath@v0.2.6...v0.3.0 self_cell: bump to 0.10.3 due to RUSTSEC-2023-0070 https://rustsec.org/advisories/RUSTSEC-2023-0070.html Voultapher/self_cell#49 bump h2 to 0.3.22, dropping few dup crate versions https://github.com/hyperium/h2/blob/v0.3.22/CHANGELOG.md
Rollup merge of rust-lang#118034 - klensy:dep-up-18-11-23, r=Mark-Simulacrum bump few deps to fix unsoundness and drop few dup deps jsondocck: bump jsonpath to 0.3, dropping few dup dependencies changes: freestrings/jsonpath@v0.2.6...v0.3.0 self_cell: bump to 0.10.3 due to RUSTSEC-2023-0070 https://rustsec.org/advisories/RUSTSEC-2023-0070.html Voultapher/self_cell#49 bump h2 to 0.3.22, dropping few dup crate versions https://github.com/hyperium/h2/blob/v0.3.22/CHANGELOG.md
Dependent<'a>
is not covariant in'a
, however unsize coercion still allows an OWNED valueto be coerced into
for lifetimes
'x: 'y
, hence_assert_covariance
compiles fine.Unsoundness follows.
(run in Rust Explorer)
A better
_assert_covariance
needs to check whether coercing theDependent
s behind a level of indirection is still possible.Options include coercing
Box<Dependent<'x>>
toBox<Dependent<'y>>
, or (more close to the actual use-case) coercing&'y Dependent<'x>
into&'y Dependent<'y>
.The text was updated successfully, but these errors were encountered: