Implement feature(precise_capturing_of_types)#138473
Implement feature(precise_capturing_of_types)#138473compiler-errors wants to merge 3 commits intorust-lang:mainfrom
feature(precise_capturing_of_types)#138473Conversation
lcnr
left a comment
There was a problem hiding this comment.
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.
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 |
|
☔ The latest upstream changes (presumably #138956) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@rustbot author |
|
Anyone is welcome to pick this back up. It would be nice to play around with this even if it's known that it's half broken. |
r? lcnr or reassign if you're not interested in reviewing feature work
tracking: