Expand free alias types during variance computation#141030
Expand free alias types during variance computation#141030fmease wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
[WIP] Expand free alias types during variance computation Instead of computing variances for them since they can never be rigid anyway. Fixes rust-lang#140230.
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (1b77fcd): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 3.2%, secondary 5.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary -0.8%, secondary -10.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 773.561s -> 773.719s (0.02%) |
|
@bors2 try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
[WIP] Expand free alias types during variance computation Instead of computing variances for them since they can never be rigid anyway. Fixes #140230.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (f04a108): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -1.5%, secondary 1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 463.013s -> 463.287s (0.06%) |
This comment has been minimized.
This comment has been minimized.
|
Ready :) A lot of the diff is test additions to increase coverage. |
|
☔ The latest upstream changes (presumably #155083) made this pull request unmergeable. Please resolve the merge conflicts. |
|
|
||
| ty::Alias(ty::AliasTy { kind: ty::Free { def_id }, args, .. }) => { | ||
| self.add_constraints_from_args(current, def_id, args, variance); | ||
| ty::Alias(ref alias_ty) => { |
There was a problem hiding this comment.
i kind of prefer keeping this "exhaustive" and matching on the rest of the kind here
| // This is a regression test for issue #114221. | ||
| // Check that we compute variances for lazy type aliases. | ||
|
|
||
| // Ensure that we eagerly *expand* free alias types during variance computation. |
There was a problem hiding this comment.
can you add a test that we expand multiple layers of type alias, e.g.
type Foo<'a> = &'a u8;
type Bar<'a> = Foo<'a>;
type Qux<'a> = Bar<'a>;
type Co<'a> = Qux<'a>;
struct Co2<'a>(Co<'a>);| // This is a regression test for issue #114221. | ||
| // Check that we compute variances for lazy type aliases. | ||
|
|
||
| // Ensure that we eagerly *expand* free alias types during variance computation. |
There was a problem hiding this comment.
can you also add a test for unused params of an adt due to unused params of an LTA:
type Unused<T> = ();
struct Foo<T>(Unused<T>);There was a problem hiding this comment.
I expect this probably errors? because T winds up unconstrained. Unsure whether that is desirable or not. We should note this as a thing to figure out pre-stabilization (though it's forwards compatible with making T invariant)
Instead of computing variances for them since they can never be rigid anyway.
Fixes #140230.