panicking comments

This commit is contained in:
Ralf Jung 2019-11-24 11:26:07 +01:00
parent e41ced3f8d
commit 35ee6bd59b
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@
//!
//! ```
//! # use std::fmt;
//! fn panic_impl(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> !
//! fn panic_impl(pi: &PanicInfo<'_>) -> !
//! # { loop {} }
//! ```
//!
@ -35,7 +35,7 @@ use crate::panic::{Location, PanicInfo};
// never inline unless panic_immediate_abort to avoid code
// bloat at the call sites as much as possible
#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
#[lang = "panic"]
#[lang = "panic"] // needed by codegen for panic on overflow and other `Assert` MIR terminators
pub fn panic(expr: &str, location: &Location<'_>) -> ! {
if cfg!(feature = "panic_immediate_abort") {
unsafe { super::intrinsics::abort() }
@ -52,7 +52,7 @@ pub fn panic(expr: &str, location: &Location<'_>) -> ! {
#[cold]
#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
#[lang = "panic_bounds_check"]
#[lang = "panic_bounds_check"] // needed by codegen for panic on OOB array/slice access
fn panic_bounds_check(location: &Location<'_>, index: usize, len: usize) -> ! {
if cfg!(feature = "panic_immediate_abort") {
unsafe { super::intrinsics::abort() }

View file

@ -294,7 +294,7 @@ pub fn panicking() -> bool {
update_panic_count(0) != 0
}
/// Entry point of panic from the libcore crate.
/// Entry point of panic from the libcore crate (`panic_impl` lang item).
#[cfg(not(test))]
#[panic_handler]
#[unwind(allowed)]
@ -380,7 +380,7 @@ fn continue_panic_fmt(info: &PanicInfo<'_>) -> ! {
#[unstable(feature = "libstd_sys_internals",
reason = "used by the panic! macro",
issue = "0")]
#[cfg_attr(not(test), lang = "begin_panic")]
#[cfg_attr(not(test), lang = "begin_panic")] // lang item for CTFE panic support
// never inline unless panic_immediate_abort to avoid code
// bloat at the call sites as much as possible
#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]