File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change 1- //! Regression test that a vector can be coerced to a slice
2- //!
3- //! Note that the purpose of this test has diverged from the original issue, which was testing a ICE
4- //! for legacy syntax.
5- //! Issue: https://github.com/rust-lang/rust/issues/9382
6- //! Commit: https://github.com/rust-lang/rust/commit/920ca61871b681a278e8a3519952a4769c071034
1+ //! Regression test that ensures struct field literals can be coerced into slice and `Box` types
72
83//@ check-pass
94
10- struct Foo < ' a > {
11- bar : & ' a [ isize ] ,
5+ struct Thing1 < ' a > {
6+ baz : & ' a [ Box < isize > ] ,
7+ bar : Box < u64 > ,
8+ }
9+
10+ struct Thing2 < ' a > {
11+ baz : & ' a [ Box < isize > ] ,
12+ bar : u64 ,
1213}
1314
1415pub fn main ( ) {
15- let _a = Foo { bar : & [ ] } ;
16- let _b = Foo { bar : & Vec :: new ( ) } ;
16+ let _a = Thing1 { baz : & [ ] , bar : Box :: new ( 32 ) } ;
17+ let _b = Thing1 { baz : & Vec :: new ( ) , bar : Box :: new ( 32 ) } ;
18+ let _c = Thing2 { baz : & [ ] , bar : 32 } ;
19+ let _d = Thing2 { baz : & Vec :: new ( ) , bar : 32 } ;
1720}
You can’t perform that action at this time.
0 commit comments