-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Compiler crash pattern matching unsized tuple in enum variant #37685
Comments
So 322122547 in hex is 0xC0000005 which is the windows error code for access violation :) |
For me this happens only when compiling with debuginfo, backtrace:
|
From a gdb session of a RelWithDbg build of llvm, the argument |
It seems as if the second value of an
|
Unsized tuples are simply not supported, although they have never been properly banned. Trans is likely to crash and burn instead. cc @rust-lang/lang @rust-lang/compiler |
Unsized tuple coercions Part of #18469. Fixes #32702. #37685 and #34451 might also be related. This PR does the following: - Introduce explicit `Sized` constraints on tuple initializers, similar to that of record-struct initializers. Not much relevant to the main contribution but I noticed this when making tests for unsized tuple coercions. - Implement `(.., T): Unsize<(.., U)>` where `T: Unsize<U>`. - Assume `(.., T)` is MaybeUnsizedUnivariant. - Modify `src/librustc/ty/util.rs` and `src/librustc_trans/glue.rs` so that tuples and structs are uniformly traversed when translating.
This issue looks resolved? I can no longer reproduce the ICE in my example in the playground. |
I was trying to get an enum which owns some
String
orVec<u8>
be able to deref into an unsized enum whose variants havestr
or[u8]
but this appears to be unsupported at the moment.But I am persistent so I try to make the variants hold refs to their original owners but one of them is a tuple.
I found plenty of issues where tuples are also not allowed to have their tail unsized (which seems odd as tuple structs are perfectly fine having their last member unsized) but I tried it anyway in the context of an enum variant tuple.
I tried this code: playground
I expected to see this happen: A sane error about tuples not being allowed to have an unsized tail.
Instead, this happened: mysterious exit (
error: Could not compile ...
without any further explanation) with error code 3221225477. On the playground this results inSegmentation fault (core dumped)
.As I wrote this I found out that the above example only breaks in Debug builds, Release builds print
Program ended.
on any Rust version on the playground.Meta
The text was updated successfully, but these errors were encountered: