-
Notifications
You must be signed in to change notification settings - Fork 13.7k
-Znext-solver
allow ExprKind::Call
for not-yet defined opaques
#145993
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
|
-Znext-solver
allow ExprKind::Call
on not-yet defined opaques-Znext-solver
allow ExprKind::Call
for not-yet defined opaques
The job Click to see the possible cause of the failure (guessed by this bot)
|
// bounds list, which can lead to inference weirdness but doesn't | ||
// matter today. | ||
for clause in | ||
self.tcx.item_self_bounds(alias_ty.def_id).iter_instantiated(self.tcx, alias_ty.args) | ||
{ |
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.
The desired behavior is quite 🤷 here...
if we've got impl FnMut(u32) + FnMut(u32)
we should prefer the Fn
bound. We should do for call_trait { for item bound { check }}
.
If we've got impl Fn(&'a str) + Fn(&'b str)
or sth that should be handled fine, even for non-defining uses. Needs tests
Even if we've got impl Fn(T)
as the opaque type, rn we don't use this at all, but instead lookup_method_for_operator
just emits all the bounds necessary to use that method, so we then rely on incomplete item bounds jank to actually constrain the args of the call.
This is necessary to support stuff like
fn recur() -> impl Fn(fn(&str) -> usize) {
if false {
let x = recur();
x(|s| s.len());
}
|_func| ()
}
the other issue is handling
fn recur() -> impl Sized {
if false {
let x = recur();
x();
}
|| ()
}
this should result in a "type must be known at this point error, not a "type doesn't implement fn"
I guess I am gonna block this PR on getting item bounds working as otherwise we're missing some important tests here
Stacked on top of #140375 and #145990. Revival of #140496.
Fixes rust-lang/trait-system-refactor-initiative#181
r? @BoxyUwU