You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see this happen: Prior to Rust 1.56, this compiled.
Instead, this happened: The following error appears:
error[E0284]:type annotations needed:cannot satisfy `<Option<[u8;32]>asArchive>::Archived == _`
--> src\main.rs:3:25
|
3 | #[derive(rkyv::Archive, rkyv::Deserialize)]
| ^^^^^^^^^^^^^^^^^ cannot satisfy `<Option<[u8;32]>asArchive>::Archived == _`
|
= note: this error originates in the derive macro `rkyv::Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)For more information about this error, try `rustc --explain E0284`.
error: could not compile `rkyv-test` due to previous error
Also, if you remove one of the Option<[u8; ARRAY_SIZE]>: Archive, lines, the code still compiles on 1.55 but the error on 1.56 changes to:
error[E0275]: overflow evaluating the requirement `(): Deserialize<__D>`
--> <source>:13:11
|
13 | impl<__D> Deserialize<__D> for ()
| ^^^^^^^^^^^^^^^^
|
note: required by a bound in `Deserialize`
--> <source>:10:1
|
10 | pub trait Deserialize<D> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Deserialize`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0275`.
Apparently when looking for Archive implementation for Option<[u8; ARRAY_SIZE]> compiler considers candidates: one for top-level impl and two ParamCandidates.
Before #87280candidate_should_be_dropped_in_favor_of was using TypeFoldable::is_global() that was enough to discard the two ParamCandidates. But #87280 changed it to use TypeFoldable::is_know_global() instead, which is pessimistic, so now the compiler drops the global impl instead (because is_known_global is not sure) and then can't decide between the two ParamCandidates.
Funny thing is it seems like it's fixed already in the master branch... Trying to bisect what fixed it to better understand if my change is needed after all.
Activity
xobs commentedon Oct 23, 2021
Further information: This is using the
rkyvcrate. We use an older0.4.0, however this still occurs with the latest0.7version.add maintenance notes around the fix for rust-lang/rust#90195
hkratz commentedon Oct 23, 2021
Bisected to #87280.
@rustbot label +E-needs-mcve
hkratz commentedon Oct 23, 2021
Reproducer without macros, but still dependent on rkyv:
SNCPlay42 commentedon Oct 23, 2021
Reduced:
Also, if you remove one of the
Option<[u8; ARRAY_SIZE]>: Archive,lines, the code still compiles on 1.55 but the error on 1.56 changes to:@rustbot label regression-from-stable-to-stable
(not sure what happened with rustbot and the labels above)
SNCPlay42 commentedon Oct 23, 2021
@rustbot label -E-needs-mcve
yanok commentedon Oct 28, 2021
@rustbot claim
apiraino commentedon Oct 28, 2021
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.
@rustbot label -I-prioritize +P-high +T-compiler
Use `is_global` in `candidate_should_be_dropped_in_favor_of`
yanok commentedon Oct 28, 2021
Ok, I know what is the problem and have a fix.
Apparently when looking for
Archiveimplementation forOption<[u8; ARRAY_SIZE]>compiler considers candidates: one for top-level impl and twoParamCandidates.Before #87280
candidate_should_be_dropped_in_favor_ofwas usingTypeFoldable::is_global()that was enough to discard the twoParamCandidates. But #87280 changed it to useTypeFoldable::is_know_global()instead, which is pessimistic, so now the compiler drops the global impl instead (becauseis_known_globalis not sure) and then can't decide between the twoParamCandidates.yanok commentedon Oct 28, 2021
Funny thing is it seems like it's fixed already in the master branch... Trying to bisect what fixed it to better understand if my change is needed after all.
yanok commentedon Oct 28, 2021
c6b6901 also fixes it.
Rollup merge of rust-lang#90375 - yanok:master, r=lcnr