File tree 1 file changed +13
-10
lines changed
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
7
2
8
3
//@ check-pass
9
4
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 ,
12
13
}
13
14
14
15
pub 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 } ;
17
20
}
You can’t perform that action at this time.
0 commit comments