-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make well-formedness predicates no longer coinductive #140208
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
base: master
Are you sure you want to change the base?
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
[crater] WF is not coinductive r? lcnr
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
Finished benchmarking commit (099e089): comparison URL. Overall result: no relevant changes - no action neededBenchmarking 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. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -0.3%)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.1%)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: 775.475s -> 776.132s (0.08%) |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
3f4d6c9
to
8b2295f
Compare
@bors try |
[crater] WF is not coinductive r? lcnr
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
@craterbot check |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
8b2295f
to
38c05a6
Compare
This PR changes a file inside |
I would like to stop treating well-formed goals as coinductive, even if the reasoning for why it will be problematic is a bit far fetched. We may want to elaborate We currently only elaborate where-bounds by eagerly extending the trait Trait: Sup {}
fn is_sup<T: Sup>() {}
fn foo<T: Trait>() {
is_sup::<T>();
} This currently elaborates the env to Alternatively, we could not elaborate the env and instead have the following proof tree:
When doing this, we need to be careful that this doesn't allow for cyclic reasoning: trait Trait: Sup {}
impl<T> Trait for T {}
fn is_trait<T: Trait>() {}
fn foo<T>() {
is_trait::<T>();
} If we simply check
We therefore need to prove
With this, let's look at the following example: struct WfImpliesOutlives<'a, T> {
field: &'a T,
}
where
T: 'a,
Wf<'a, T>:; Now, one could imagine that elaborating
This means these cycles would have to be non-productive. With the current setup this is only achievable by making nested goals of While I don't know whether we'll ever lazily elaborate This PR causes the following snippet to no longer compile struct Foo
where
Foo:;
struct Bar
where
Vec<Bar>:; We do not break crates which have It's generally difficult to support This is why I believe that keeping There is no crater breakage. @rfcbot fcp merge |
Team member @lcnr has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
I'm okay with walking this back if we avoid actual breakage, even if the reasoning is "this is a bit weird and may block us in the future". I don't like the special-casing for GCE, but we're not walking through a door that we can't step back through if its actually always going to be required there, and its unstable. |
I expect this special casing will not be necessary with mgca (or a potential full gca which would subsume gce), so with my const generics hat on I'm not too worried about this special case 🤔 It kind of sucks that we seem to be accumulating lists of hacks just to avoid breaking too much (unstable) gce code, but it is a relatively pragmatic choice and hopefully won't be necessary for too much longer... |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
This PR makes well-formedness no longer coinductive. It was made coinductive in #98542, but AFAICT this was only to fix UI tests since we stopped lowering
where Ty:
to an empty-region outlives predicate but to a WF predicate instead.Arguably it should lower to something completely different, something like a "type mentioned no-op predicate", but well-formedness serves this purpose fine today, and since no code (according to crater) relies on this coinductive behavior, we'd like to avoid having to emulate it in the new solver.
Fixes #123456 (I didn't want to add a test since it seems low-value to have a ICE test for a fuzzer minimization that is basically garbage code.)
Fixes #109764 (not sure if this behavior is emulatable w/o coinductive WF?)
Fixes rust-lang/trait-system-refactor-initiative#169
r? lcnr