File tree 3 files changed +20
-1
lines changed
3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -757,7 +757,9 @@ impl<A: Allocator> RawVecInner<A> {
757
757
}
758
758
}
759
759
760
- #[ inline( never) ]
760
+ // not marked inline(never) since we want optimizers to be able to observe the specifics of this
761
+ // function, see tests/codegen/vec-reserve-extend.rs.
762
+ #[ cold]
761
763
fn finish_grow < A > (
762
764
new_layout : Layout ,
763
765
current_memory : Option < ( NonNull < u8 > , Layout ) > ,
Original file line number Diff line number Diff line change 362
362
#![ feature( strict_provenance_atomic_ptr) ]
363
363
#![ feature( sync_unsafe_cell) ]
364
364
#![ feature( ub_checks) ]
365
+ #![ feature( used_with_arg) ]
365
366
// tidy-alphabetical-end
366
367
//
367
368
// Library features (alloc):
Original file line number Diff line number Diff line change @@ -27,6 +27,22 @@ use crate::sys::backtrace;
27
27
use crate :: sys:: stdio:: panic_output;
28
28
use crate :: { fmt, intrinsics, process, thread} ;
29
29
30
+ // This forces codegen of the function called by panic!() inside the std crate, rather than in
31
+ // downstream crates. Primarily this is useful for rustc's codegen tests, which rely on noticing
32
+ // complete removal of panic from generated IR. Since begin_panic is inline(never), it's only
33
+ // codegen'd once per crate-graph so this pushes that to std rather than our codegen test crates.
34
+ //
35
+ // (See https://github.com/rust-lang/rust/pull/123244 for more info on why).
36
+ //
37
+ // If this is causing problems we can also modify those codegen tests to use a crate type like
38
+ // cdylib which doesn't export "Rust" symbols to downstream linkage units.
39
+ #[ unstable( feature = "libstd_sys_internals" , reason = "used by the panic! macro" , issue = "none" ) ]
40
+ #[ doc( hidden) ]
41
+ #[ allow( dead_code) ]
42
+ #[ used( compiler) ]
43
+ pub static EMPTY_PANIC : fn ( & ' static str ) -> ! =
44
+ begin_panic :: < & ' static str > as fn ( & ' static str ) -> !;
45
+
30
46
// Binary interface to the panic runtime that the standard library depends on.
31
47
//
32
48
// The standard library is tagged with `#![needs_panic_runtime]` (introduced in
You can’t perform that action at this time.
0 commit comments