-
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
Unsized tuples shouldn't compile #34451
Comments
cc @eddyb |
Unsized tuples are not implemented yet, did we choose to allow them prematurely? cc @arielb1 |
Small testcase compiles without errors. E-needstest. trait A {
fn b(&self);
}
impl<'c> A for (usize,[&'c [u8]]) {
fn b(&self) {
0;
}
}
fn main() {} |
No, it shouldn't compile, I just don't think we ever bothered banning it. |
Removing E-needstest. @eddyb That seems.. bad. Is that just because in this case the type isn't really used anywhere? |
impl<'a> A for (usize,[&'a [u8]])
The ICE here is a mismatch between LLVM's view of the type and ours but the LLVM type is computed in such a way that I don't think that mismatch is ever possible. Some operations might still ICE. |
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.
Triage: still compiles without error. |
I think unsized tuples are implemented now. cc @nikomatsakis |
This has compiled for a while now. Unsized tuples are being exercised, incl by tests related to #42877. Closing. |
Small testcase here.
The text was updated successfully, but these errors were encountered: