Skip to content

Don't ICE on traits' Self generic parameters #1135

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

Closed

Conversation

CohenArthur
Copy link
Member

@CohenArthur CohenArthur commented Apr 19, 2022

The Self type of a Trait is part of its generic parameter list. This
fails lookup since it's not a properly defined type. We need to be able
to identify Self parameters and skip them in the reachability pass.

Closes #1128


// FIXME: This fails lookup on the `Self` generic parameter of the
// trait definition. We can skip it for now, but that's not a real fix
if (!ok)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is interesting you should put a debug line in to see what the ID is here and compare with what it is over in rust-hir-trait-resolve.h line 138 and ou should be able to call self->debug() we might be missing an insert call

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact yes these are likely not getting inserted at all

The `Self` type of a Trait is part of its generic parameter list. This
fails lookup since it's not a properly defined type. We need to be able
to identify `Self` parameters and skip them in the reachability pass.

Co-authored-by: philberty <[email protected]>
@CohenArthur CohenArthur force-pushed the 1128-ice-reachability-pass branch from 4f3c252 to ebf3032 Compare April 20, 2022 11:59
@philberty
Copy link
Member

I've found the real issue here the fix is simple but it causes a regression in using qualified paths within traits since there is no associated impl block its working by accident right now the relevant test case is gcc/testsuite/rust/execute/torture/trait3.rs.

Do you mind if I take this over?

@CohenArthur
Copy link
Member Author

I've found the real issue here the fix is simple but it causes a regression in using qualified paths within traits since there is no associated impl block its working by accident right now the relevant test case is gcc/testsuite/rust/execute/torture/trait3.rs.

Great! Nice find. I had completely forgotten about this and was neck-deep in simple path resolving haha

Do you mind if I take this over?

Please do! The only interesting thing in this PR is the test case, so you can close it whenever you want

@philberty
Copy link
Member

This will be fixed as part of #1190

@philberty philberty closed this Apr 28, 2022
@CohenArthur CohenArthur deleted the 1128-ice-reachability-pass branch April 28, 2022 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rust1: internal compiler error: in visit_generic_predicates, at rust/privacy/rust-reachability.cc:56
2 participants