]> git.lizzy.rs Git - rust.git/blob - src/doc/unstable-book/src/language-features/unsized-tuple-coercion.md
Rollup merge of #61423 - davidtwco:correct-symbol-mangling, r=eddyb
[rust.git] / src / doc / unstable-book / src / language-features / unsized-tuple-coercion.md
1 # `unsized_tuple_coercion`
2
3 The tracking issue for this feature is: [#42877]
4
5 [#42877]: https://github.com/rust-lang/rust/issues/42877
6
7 ------------------------
8
9 This is a part of [RFC0401]. According to the RFC, there should be an implementation like this:
10
11 ```rust,ignore
12 impl<..., T, U: ?Sized> Unsized<(..., U)> for (..., T) where T: Unsized<U> {}
13 ```
14
15 This implementation is currently gated behind `#[feature(unsized_tuple_coercion)]` to avoid insta-stability. Therefore you can use it like this:
16
17 ```rust
18 #![feature(unsized_tuple_coercion)]
19
20 fn main() {
21     let x : ([i32; 3], [i32; 3]) = ([1, 2, 3], [4, 5, 6]);
22     let y : &([i32; 3], [i32]) = &x;
23     assert_eq!(y.1[0], 4);
24 }
25 ```
26
27 [RFC0401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md