-
Notifications
You must be signed in to change notification settings - Fork 226
rust: Fix ICE with infer type used in struct attribute #4504
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #![feature(no_core)] | ||
| #![no_core] | ||
|
|
||
| struct Test10 { | ||
| a: _, // { dg-error "the placeholder ... is not allowed within types on item" } | ||
| } | ||
|
|
||
| struct Test11 { | ||
| a: _, // { dg-error "the placeholder ... is not allowed within types on item" } | ||
| b: i32, | ||
| } | ||
|
|
||
| struct Test12 { | ||
| a: (_, _), // { dg-error "the placeholder ... is not allowed within types on item" } | ||
| } | ||
|
|
||
| struct Test13 { | ||
| a: [_; _], // { dg-error "the placeholder ... is not allowed within types on item" } | ||
| } | ||
|
|
||
| struct Test14 { | ||
| a: [i32; _], // { dg-error "the placeholder ... is not allowed within types on item" } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is
[i32; _]detected?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.
Hi, I checked and it ICE's. Should that be fixed in
contains_infer? It seems like it should but I'm not sure.Right now, it only checks for the underlying type, not for the other pattern.
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.
I think adding the check to
contains_infermakes sense, at least for now :) this case should definitely beThere 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.
Thank you, I will be adding this check as soon as possible!
Uh oh!
There was an error while loading. Please reload this page.
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.
I have added the check, but I ran into some problems with the
ConstInferType's locus not being properly set (which should probably be made into a new issue), so instead of usingget_locus, I used theMappingsdirectly. I also had to add a case forConstInferTypeincontains_inferdespite there being no other usages ofConst...types in the function, because the array capacity is being passed as such. Let me know if there is some other way to do this, or if it's intentional.