-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
infer variance for region parameters #2282
Comments
Can you clarify this with an example? |
A bug might look like this:
The call to This is a result of the typing rules for nominal types. Basically we have to know whether the region is used covariantly within the nominal type definition. |
punting to 0.4 |
It turns out that we are always treating region parameters as invariant. This is good, because it is sound, but less flexible than we might like. I've decided it's probably best to infer the variance on regions. |
Here is a test from @bblum that doesn't work because we are always invariant:
|
Support no-std targets and test it in CI cc `@jamesmunns` This is a bit annoying as you need to have `MIRI_NO_STD=1` set at all times, but it works ™️ Once libstd's `restricted_std` feature becomes more usable, we can probably do away with that env var. I also added a test to CI to make sure it keeps working. This test only builds libcore and runs a single test, so it's pretty fast.
Document `fetch.prunetags = true` gotcha during rustc-pull
It occurs to me that we are always treating regions covariantly. This is clearly wrong. We should either (1) not allow regions to appear in in- or contravariant positions within nominal types or (2) allow variance to be declared. I am leaning towards (1) at the moment.
The text was updated successfully, but these errors were encountered: