Repository navigation
avoid accessing uninferred closure upvars in diagnostics - #162595
Conversation
|
|
||
| let captures: Vec<_> = | ||
| typeck_results.closure_min_captures_flattened(closure_def_id).collect(); | ||
| let upvar_tys = upvar_args.upvar_tys(); |
There was a problem hiding this comment.
instead of fetching them twice, only use tupled_upvars_ty and match on it?
There was a problem hiding this comment.
you haven't actually done that change, have you?
There was a problem hiding this comment.
Thanks
fixed this now
8670aa1 to
005ce6d
Compare
This comment has been minimized.
This comment has been minimized.
8ef966d to
f535520
Compare
| ty::Infer(_) => return false, | ||
| _ => return false, |
There was a problem hiding this comment.
There was a problem hiding this comment.
the ? was about why you had both a ty::Infer(_) => return false and a catch all _ => return false branch. Either only have the catch all, or the correct thing here,
return false for ty::Infer and make the catch all unreachable!
There was a problem hiding this comment.
I am confused at what is going on here 🤔 does my last comment make sense to you and did you implement the change I mentioned here?
There was a problem hiding this comment.
Sorry
I saw your comment but somehow missed the actual change you were asking for 😅
6bdbafb to
d5972e6
Compare
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
f2bb7cc to
c263e3d
Compare
|
@bors r+ rollup |
…uwer Rollup of 7 pull requests Successful merges: - #163218 (stdarch subtree update) - #159287 (Build a new incr comp session dir from scratch every time) - #163222 (Enable EII tests for cg_gcc) - #163251 (cg_gcc subtree sync 2026-09-24) - #162595 (avoid accessing uninferred closure upvars in diagnostics) - #162937 (do generic_const_args Const::Ty hack only on projection consts) - #163238 (Fix incorrect use of await in parser suggestion)
Rollup merge of #162595 - amirHdev:uninferred-upvars, r=lcnr avoid accessing uninferred closure upvars in diagnostics fixes #162440 `note_closure_capture` can run before closure capture analysis has finished and the upvar tuple may still be an inference variable at that point and calling `upvar_tys()` causes an ICE we can just fall back to the existing closure-level note and wait until the upvar types are available before trying to emit the more specific capture note
…uwer Rollup of 7 pull requests Successful merges: - rust-lang/rust#163218 (stdarch subtree update) - rust-lang/rust#159287 (Build a new incr comp session dir from scratch every time) - rust-lang/rust#163222 (Enable EII tests for cg_gcc) - rust-lang/rust#163251 (cg_gcc subtree sync 2026-09-24) - rust-lang/rust#162595 (avoid accessing uninferred closure upvars in diagnostics) - rust-lang/rust#162937 (do generic_const_args Const::Ty hack only on projection consts) - rust-lang/rust#163238 (Fix incorrect use of await in parser suggestion)
…uwer Rollup of 7 pull requests Successful merges: - rust-lang/rust#163218 (stdarch subtree update) - rust-lang/rust#159287 (Build a new incr comp session dir from scratch every time) - rust-lang/rust#163222 (Enable EII tests for cg_gcc) - rust-lang/rust#163251 (cg_gcc subtree sync 2026-09-24) - rust-lang/rust#162595 (avoid accessing uninferred closure upvars in diagnostics) - rust-lang/rust#162937 (do generic_const_args Const::Ty hack only on projection consts) - rust-lang/rust#163238 (Fix incorrect use of await in parser suggestion)
…uwer Rollup of 7 pull requests Successful merges: - rust-lang/rust#163218 (stdarch subtree update) - rust-lang/rust#159287 (Build a new incr comp session dir from scratch every time) - rust-lang/rust#163222 (Enable EII tests for cg_gcc) - rust-lang/rust#163251 (cg_gcc subtree sync 2026-09-24) - rust-lang/rust#162595 (avoid accessing uninferred closure upvars in diagnostics) - rust-lang/rust#162937 (do generic_const_args Const::Ty hack only on projection consts) - rust-lang/rust#163238 (Fix incorrect use of await in parser suggestion)
…nathanBrouwer Rollup of 7 pull requests Successful merges: - rust-lang#163218 (stdarch subtree update) - rust-lang#159287 (Build a new incr comp session dir from scratch every time) - rust-lang#163222 (Enable EII tests for cg_gcc) - rust-lang#163251 (cg_gcc subtree sync 2026-09-24) - rust-lang#162595 (avoid accessing uninferred closure upvars in diagnostics) - rust-lang#162937 (do generic_const_args Const::Ty hack only on projection consts) - rust-lang#163238 (Fix incorrect use of await in parser suggestion)
fixes #162440
note_closure_capturecan run before closure capture analysis has finished and the upvar tuple may still be an inference variable at that point and callingupvar_tys()causes an ICEwe can just fall back to the existing closure-level note and wait until the upvar types are available before trying to emit the more specific capture note