File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ //@ compile-flags: -Copt-level=3 -Ccodegen-units=256 -Clink-arg=-ld_classic --target x86_64-apple-darwin
2
+ //@ run-pass
3
+ //@ only-macos
4
+
5
+ // This is a regression test for https://github.com/rust-lang/rust/issues/140686.
6
+ // Although this is a ld64(ld-classic) bug, we still need to support it
7
+ // due to cross-compilation and support for older Xcode.
8
+
9
+ fn main ( ) {
10
+ let dst: Vec < u8 > = Vec :: new ( ) ;
11
+ let len = broken_func ( 2 , dst) ;
12
+ assert_eq ! ( len, 8 ) ;
13
+ }
14
+
15
+ #[ inline( never) ]
16
+ pub fn broken_func ( version : usize , mut dst : Vec < u8 > ) -> usize {
17
+ match version {
18
+ 1 => dst. extend_from_slice ( b"aaaaaaaa" ) ,
19
+ 2 => dst. extend_from_slice ( b"bbbbbbbb" ) ,
20
+ 3 => dst. extend_from_slice ( b"bbbbbbbb" ) ,
21
+ _ => panic ! ( ) ,
22
+ }
23
+ dst. len ( )
24
+ }
You can’t perform that action at this time.
0 commit comments