Skip to content

Commit ec485f3

Browse files
committed
Cfg remove lang items in doctest
1 parent 6572dc1 commit ec485f3

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

library/std/src/panicking.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ pub fn panicking() -> bool {
518518
}
519519

520520
/// Entry point of panics from the libcore crate (`panic_impl` lang item).
521-
#[cfg(not(test))]
521+
#[cfg(not(any(test, doctest)))]
522522
#[panic_handler]
523523
pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
524524
struct PanicPayload<'a> {
@@ -590,7 +590,7 @@ pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
590590
/// panic!() and assert!(). In particular, this is the only entry point that supports
591591
/// arbitrary payloads, not just format strings.
592592
#[unstable(feature = "libstd_sys_internals", reason = "used by the panic! macro", issue = "none")]
593-
#[cfg_attr(not(test), lang = "begin_panic")]
593+
#[cfg_attr(not(any(test, doctest)), lang = "begin_panic")]
594594
// lang item for CTFE panic support
595595
// never inline unless panic_immediate_abort to avoid code
596596
// bloat at the call sites as much as possible

library/std/src/personality.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
mod dwarf;
1414

15-
#[cfg(not(test))]
15+
#[cfg(not(any(test, doctest)))]
1616
cfg_if::cfg_if! {
1717
if #[cfg(target_os = "emscripten")] {
1818
mod emcc;

library/std/src/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2151,7 +2151,7 @@ pub fn id() -> u32 {
21512151
/// of the `main` function, this trait is likely to be available only on
21522152
/// standard library's runtime for convenience. Other runtimes are not required
21532153
/// to provide similar functionality.
2154-
#[cfg_attr(not(test), lang = "termination")]
2154+
#[cfg_attr(not(any(test, doctest)), lang = "termination")]
21552155
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
21562156
#[rustc_on_unimplemented(
21572157
on(

library/std/src/rt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn lang_start_internal(
154154
ret_code
155155
}
156156

157-
#[cfg(not(test))]
157+
#[cfg(not(any(test, doctest)))]
158158
#[lang = "start"]
159159
fn lang_start<T: crate::process::Termination + 'static>(
160160
main: fn() -> T,

0 commit comments

Comments
 (0)