fix - don't panic on ATPIT with method-local generics - #23128
Conversation
|
@ChayimFriedman2 thanks for review and i see.. i need a bit more time on this PR and will try to fix it as soon as possible... |
|
this version walks the hidden type and drops any use whose params are not covered by the |
|
Inventing your own way to handle that is not a wise idea. You should look at how rustc handles that and copy it. |
|
i got what you are saying.. would it fix the issue if we copy rustcs remap_generic_params_to_declaration_params / ReverseMapper? im a bit confused here.. it would be great if you could guide me a bit here... (i also tried with those 2 and that worked fine and passed all tests) |
|
we can do it like the way rustc does with a ReverseMapper folder? we check opaque_type_has_defining_use_args, then map generic params back to declaration.. if we see any unmapped method-local generics, we map them to TyKind::Error / Const::Error instead of rejecting |
when an opaque type has no generic parameters but its hidden type
references a method-local generic...
instantiatewould panic becausethe parameter has no corresponding slot in the opaque's args
reject such uses as non-defining before it gets there and guard the
instantiatecall to fall back to an error type instead of crashing.fixes #23125
(this is my 1st PR to this repo... and please correct me if i did something wrong here for lack of experience)