-
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
Implement feature(precise_capturing_of_types)
#138473
base: master
Are you sure you want to change the base?
Implement feature(precise_capturing_of_types)
#138473
Conversation
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.
how does this avoid unconstrained type variables when doing something like
fn foo<T>() -> impl Sized + use<> {}
fn main() {
let x = foo<u32>(); // opaque<u32>;
let y = x; // opaque<?unconstrained>
}
it doesn't afaict :> this feature is still pretty broken, that's why it's incomplete |
☔ The latest upstream changes (presumably #138464) made this pull request unmergeable. Please resolve the merge conflicts. |
d8a6a1d
to
233dcff
Compare
let guar = if self.uncaptured_args.contains(&ct.into()) { | ||
// FIXME(precise_capturing_of_types): Mention `use<>` list | ||
// and add an structured suggestion. | ||
self.tcx.dcx().struct_span_err( | ||
self.span, | ||
format!("hidden type mentions uncaptured const parameter `{ct}`"), | ||
) | ||
} else { | ||
self.tcx.dcx().struct_span_err( | ||
self.span, | ||
format!( | ||
"const parameter `{ct}` is mentioned in hidden type of \ | ||
type alias impl trait, but is not declared in its generic \ | ||
args" | ||
), | ||
) | ||
} | ||
.emit_unless(self.ignore_errors); |
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.
also extract this into a subfn?
do you have a plan for how to fix this? I feel like the feature as is doesn't have much value and worry that we likely can't stabilize it without large changes however, I don't think the cost of supporting this is meaningfully large, so r=me after nits |
r? lcnr or reassign if you're not interested in reviewing feature work
tracking: