File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 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> {
757757 }
758758}
759759
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]
761763fn finish_grow < A > (
762764 new_layout : Layout ,
763765 current_memory : Option < ( NonNull < u8 > , Layout ) > ,
Original file line number Diff line number Diff line change 362362#![ feature( strict_provenance_atomic_ptr) ]
363363#![ feature( sync_unsafe_cell) ]
364364#![ feature( ub_checks) ]
365+ #![ feature( used_with_arg) ]
365366// tidy-alphabetical-end
366367//
367368// Library features (alloc):
Original file line number Diff line number Diff line change @@ -27,6 +27,22 @@ use crate::sys::backtrace;
2727use crate :: sys:: stdio:: panic_output;
2828use crate :: { fmt, intrinsics, process, thread} ;
2929
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+
3046// Binary interface to the panic runtime that the standard library depends on.
3147//
3248// The standard library is tagged with `#![needs_panic_runtime]` (introduced in
You can’t perform that action at this time.
0 commit comments