Box<dyn FnOnce(T)>
doesn't seem to be really contravariant with T
#100728
Labels
A-trait-objects
Area: trait objects, vtable layout
A-trait-system
Area: Trait system
A-variance
Area: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
I tried this code:
I expected it to compile but I got the following:
playground
I asked this on stackoverflow too hopefully I am not misinterpreting something about variance.
The text was updated successfully, but these errors were encountered: