File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-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+ //@ needs-llvm-components: x86
5+
6+ // This is a regression test for https://github.com/rust-lang/rust/issues/140686.
7+ // Although this is a ld64(ld-classic) bug, we still need to support it
8+ // due to cross-compilation and support for older Xcode.
9+
10+ fn main ( ) {
11+ let dst: Vec < u8 > = Vec :: new ( ) ;
12+ let len = broken_func ( 2 , dst) ;
13+ assert_eq ! ( len, 8 ) ;
14+ }
15+
16+ #[ inline( never) ]
17+ pub fn broken_func ( version : usize , mut dst : Vec < u8 > ) -> usize {
18+ match version {
19+ 1 => dst. extend_from_slice ( b"aaaaaaaa" ) ,
20+ 2 => dst. extend_from_slice ( b"bbbbbbbb" ) ,
21+ 3 => dst. extend_from_slice ( b"bbbbbbbb" ) ,
22+ _ => panic ! ( ) ,
23+ }
24+ dst. len ( )
25+ }
You can’t perform that action at this time.
0 commit comments