2121//! necessary lang items for the compiler. All panics are funneled through this
2222//! one function. The actual symbol is declared through the `#[panic_handler]` attribute.
2323
24- #![ allow( dead_code, missing_docs ) ]
24+ #![ allow( dead_code) ]
2525#![ unstable(
2626 feature = "panic_internals" ,
2727 reason = "internal details of the implementation of the `panic!` and related macros" ,
@@ -182,6 +182,7 @@ macro_rules! panic_const {
182182// slightly different forms. It's not clear if there's a good way to deduplicate without adding
183183// special cases to the compiler (e.g., a const generic function wouldn't have a single definition
184184// shared across crates, which is exactly what we want here).
185+ #[ allow( missing_docs) ]
185186pub mod panic_const {
186187 use super :: * ;
187188 panic_const ! {
@@ -233,9 +234,10 @@ pub fn panic_nounwind_nobacktrace(expr: &'static str) -> ! {
233234 panic_nounwind_fmt ( fmt:: Arguments :: from_str ( expr) , /* force_no_backtrace */ true ) ;
234235}
235236
237+ /// Needed by `non-fmt-panics` lint.
236238#[ inline]
237239#[ track_caller]
238- #[ rustc_diagnostic_item = "unreachable_display" ] // needed for `non-fmt-panics` lint
240+ #[ rustc_diagnostic_item = "unreachable_display" ]
239241pub fn unreachable_display < T : fmt:: Display > ( x : & T ) -> ! {
240242 panic_fmt ( format_args ! ( "internal error: entered unreachable code: {}" , * x) ) ;
241243}
@@ -250,9 +252,10 @@ pub const fn panic_str_2015(expr: &str) -> ! {
250252 panic_display ( & expr) ;
251253}
252254
255+ /// Needed for const-evaluated panics.
253256#[ inline]
254257#[ track_caller]
255- #[ lang = "panic_display" ] // needed for const-evaluated panics
258+ #[ lang = "panic_display" ]
256259#[ rustc_do_not_const_check] // hooked by const-eval
257260#[ rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
258261pub const fn panic_display < T : fmt:: Display > ( x : & T ) -> ! {
@@ -457,31 +460,31 @@ fn assert_failed_inner(
457460 }
458461}
459462
460- // panic!() without args expands to this, to generate slightly less code
463+ /// ` panic!()` without args expands to this, to generate slightly less code.
461464#[ cfg_attr( not( panic = "immediate-abort" ) , inline( never) , cold) ]
462465#[ cfg_attr( panic = "immediate-abort" , inline) ]
463466#[ track_caller]
464467pub const fn panic_default_msg ( ) -> ! {
465468 panic ( "explicit panic" )
466469}
467470
468- // unreachable!() without args expands to this, to generate slightly less code
471+ /// ` unreachable!()` without args expands to this, to generate slightly less code.
469472#[ cfg_attr( not( panic = "immediate-abort" ) , inline( never) , cold) ]
470473#[ cfg_attr( panic = "immediate-abort" , inline) ]
471474#[ track_caller]
472475pub const fn unreachable_default_msg ( ) -> ! {
473476 panic ( "internal error: entered unreachable code" )
474477}
475478
476- // unimplemented!() without args expands to this, to generate slightly less code
479+ /// ` unimplemented!()` without args expands to this, to generate slightly less code.
477480#[ cfg_attr( not( panic = "immediate-abort" ) , inline( never) , cold) ]
478481#[ cfg_attr( panic = "immediate-abort" , inline) ]
479482#[ track_caller]
480483pub const fn unimplemented_default_msg ( ) -> ! {
481484 panic ( "not implemented" )
482485}
483486
484- // todo!() without args expands to this, to generate slightly less code
487+ /// ` todo!()` without args expands to this, to generate slightly less code.
485488#[ cfg_attr( not( panic = "immediate-abort" ) , inline( never) , cold) ]
486489#[ cfg_attr( panic = "immediate-abort" , inline) ]
487490#[ track_caller]
0 commit comments