-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Support repr(simd) on ADTs containing a single array field #63531
Closed
Closed
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
257158f
Support repr(simd) on ADTs containing a single array field
gnzlbg 3773bcf
Document which errors are caught in typeck
gnzlbg 58fe683
Ignore tidy length in simd-array-transmute test
gnzlbg 8963966
Rename simd_type_size to simd_ty_and_len
gnzlbg bf44809
Remove assert
gnzlbg a446967
Revert unnecessary param_env change
gnzlbg 518eff2
Improve non-machine type in error message
gnzlbg fbe64f4
Add more transmute tests
gnzlbg 173aafa
Fix more tests
gnzlbg 9f72fc7
Simplify simd_ty_and_len
gnzlbg 06037a3
Fix typo
gnzlbg 69d0fa9
Skip align attribute in tests
gnzlbg a21939b
Bump min-llvm-version of transmute test
gnzlbg 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 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 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
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.
Are these new post-monomorphization errors... if so, why that?
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.
Not really, typeck errors before any of these can trigger, at least, as long as everything is correct there.
I added these to help during development. If typeck fails to error, an error here is better than an error down the line. That's why these are ICEs instead of something nicer.
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.
Alright; this sounds good. Could you add comments to the places where you added these
.fatal
errors noting that these should be caught in typeck?(Also, why isn't
bug!(...)
being used for ICEs here?)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.
No idea, the code was using fatal error for ICES already so I just also used that - the existing fatal error even has a test..
Sure.
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.
So i've done that.
The already existing error that fails if the element type isn't a machine type is currently not caught in typeck (this was already the case), and can fail if a generic SIMD vector is instantiated with an inappropriate element type. The way this is handled is that
libcore
should have a trait that bounds the accepted types so that this cannot happen (these features are all perma unstable).There is a new monomorphization type error here now that we support generic lengths, and that's if the length passed to the vector is zero. We can only catch this once we know the actual value of the vector length, which right now is only at monomorphization time.
Either libcore would bound the length of the vector, once we have bounds for const generics, or we should start accepting zero-element vectors (I don't see a reason to forbid this), but that is probably better done in a different PR.
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.
@Centril so is this issue resolved?
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 leave that to @eddyb -- the only thing I would note is that we don't want to add new monomorphization errors in stable but such a consideration seems far off since this is just for experimentation.
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.
There is a huge difference between monomorphization time errors that affect Rust users, and adding code to catch logic errors in rustc early.
I regularly get LLVM errors when using Rust. Their output is completely useless, and the first step into debugging those is requiring users to re-compile a Rust toolchain with LLVM assertions enabled, and debugging back to Rust from there.
I'd much rather have a monomorphization time error just saying "This generic intrinsics does not support that type", and wish others would as well.
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 I know what needs to be cleared up: the
fatal
was moved from one place to another, it's not new (AFAIK).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.
@gnzlbg I think you misunderstood me; I was making a general remark about user exposed monmorphization time errors, not internal ones for intrinsics... so we should be good.