Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some comments to panic runtime #66694

Merged
merged 3 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/libcore/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<'_>) -> !
Copy link
Member Author

@RalfJung RalfJung Nov 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cc #66689 -- this is a minimal fix, but I am not sure if the comment further down is still accurate. There is still no Box<Any> but there is an &Any that can be passed in.

//! # { loop {} }
//! ```
//!
Expand Down Expand Up @@ -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() }
Expand All @@ -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() }
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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))]
Expand Down