about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2019-11-25 15:05:26 +0100
committerGitHub <noreply@github.com>2019-11-25 15:05:26 +0100
commit30599d765b1474eb93598f57a6fcd790a98be2db (patch)
tree69c7372aebea99d9ed44eef75a1241022319d2e1 /src/libcore
parent11b8e166e852a0a326a0aca97d4a296f533466e0 (diff)
parent6440b9425384d2f8f11c4fe281fe99f79b92afb6 (diff)
downloadrust-30599d765b1474eb93598f57a6fcd790a98be2db.tar.gz
rust-30599d765b1474eb93598f57a6fcd790a98be2db.zip
Rollup merge of #66694 - RalfJung:panic-comments, r=Dylan-DPC
Add some comments to panic runtime
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/panicking.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs
index 8a6ab99c65a..4833194be37 100644
--- a/src/libcore/panicking.rs
+++ b/src/libcore/panicking.rs
@@ -6,8 +6,7 @@
 //! interface for panicking is:
 //!
 //! ```
-//! # use std::fmt;
-//! fn panic_impl(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> !
+//! fn panic_impl(pi: &core::panic::PanicInfo<'_>) -> !
 //! # { loop {} }
 //! ```
 //!
@@ -35,7 +34,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 +51,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() }