-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Eagerly instantiate closure/coroutine-like bounds with placeholders to deal with binders correctly #122267
Conversation
☔ The latest upstream changes (presumably #122338) made this pull request unmergeable. Please resolve the merge conflicts. |
d8d44a6
to
0d9269f
Compare
@bors try |
…r=<try> Eagerly instantiate closure/coroutine-like bounds with placeholders to deal with binders correctly A follow-up to rust-lang#119849, however it aims to fix a different set of issues. Currently, we have trouble confirming goals where built-in closure/fnptr/coroutine signatures are compared against higher-ranked goals. Currently, we don't support goals like `for<'a> fn(&'a ()): Fn(&'a ())` because we don't expect the self type of goal to reference any bound regions from the goal, because we don't really know how to deal with the double binder of predicate + self type. However, this definitely can be reached (rust-lang#121653) -- and in fact, it results in post-mono errors in the case of rust-lang#112347 where the builtin type (e.g. a coroutine) is hidden behind a TAIT. The proper fix here is to instantiate the goal before trying to extract the signature from the self type. See final two commits. r? lcnr
☀️ Try build successful - checks-actions |
this prevents an codegen ICE. Please add it as a test trait Trait {
type Assoc<'a>: FnOnce(&'a ());
}
impl Trait for () {
type Assoc<'a> = fn(&'a ());
}
trait Indir {
fn break_me() {}
}
impl<F: Trait> Indir for F
where
for<'a> F::Assoc<'a>: FnOnce(&'a ()),
{
fn break_me() {}
}
fn foo<F: Trait>() {
F::break_me()
}
fn main() {
foo::<()>();
} @rust-lang/types we previously failed to handle builtin This PR allows more code to pass and can in likely very artificial cases be breaking (by fixing coherence/changing candidate selection). I am confident enough that this won't break anything that I am going to start the FCP right away, even before we've finished the crater run. We can always reconsider if any breakage is found @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. |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
Crater run is clean. One failure is |
2496bf9
to
b8526f0
Compare
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after adding comment
//@[next] compile-flags: -Znext-solver | ||
//@ build-pass | ||
|
||
trait Trait { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trait Trait { | |
// Regression test for incomplete handling of Fn-trait goals, | |
// fixed in #122267. | |
trait Trait { |
b8526f0
to
09ea3f9
Compare
@bors r=lcnr |
☀️ Test successful - checks-actions |
Finished benchmarking commit (e2cf2cb): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 668.516s -> 667.053s (-0.22%) |
No need to instantiate binder in `confirm_async_closure_candidate` Removes a FIXME that is redundant. No longer needed since rust-lang#122267.
No need to instantiate binder in `confirm_async_closure_candidate` Removes a FIXME that is redundant. No longer needed since rust-lang#122267.
Rollup merge of rust-lang#132486 - compiler-errors:no-binder, r=lcnr No need to instantiate binder in `confirm_async_closure_candidate` Removes a FIXME that is redundant. No longer needed since rust-lang#122267.
A follow-up to #119849, however it aims to fix a different set of issues. Currently, we have trouble confirming goals where built-in closure/fnptr/coroutine signatures are compared against higher-ranked goals.
Currently, we don't support goals like
for<'a> fn(&'a ()): Fn(&'a ())
because we don't expect the self type of goal to reference any bound regions from the goal, because we don't really know how to deal with the double binder of predicate + self type. However, this definitely can be reached (#121653) -- and in fact, it results in post-mono errors in the case of #112347 where the builtin type (e.g. a coroutine) is hidden behind a TAIT.The proper fix here is to instantiate the goal before trying to extract the signature from the self type. See final two commits.
r? lcnr