about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2017-06-28 01:15:29 +0200
committerest31 <MTest31@outlook.com>2017-07-02 13:53:29 +0200
commiteb5fb21bd5871a0dd3bb7bc135bc1a083ad32292 (patch)
tree53d595f50db5a07a4deeb7f080e5f056c6d9f176 /src/libstd
parentda887074fc70a9f8d2afec8dbe6e2eeea6fc1406 (diff)
downloadrust-eb5fb21bd5871a0dd3bb7bc135bc1a083ad32292.tar.gz
rust-eb5fb21bd5871a0dd3bb7bc135bc1a083ad32292.zip
Fix the test failure, add comment, and refactor a little bit
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/panicking.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs
index 1a8d3b09009..494376b831e 100644
--- a/src/libstd/panicking.rs
+++ b/src/libstd/panicking.rs
@@ -315,6 +315,7 @@ impl<'a> Location<'a> {
     /// # Examples
     ///
     /// ```should_panic
+    /// #![feature(panic_col)]
     /// use std::panic;
     ///
     /// panic::set_hook(Box::new(|panic_info| {
@@ -327,7 +328,7 @@ impl<'a> Location<'a> {
     ///
     /// panic!("Normal panic");
     /// ```
-    #[unstable(feature = "panic_col", issue = "42939")]
+    #[unstable(feature = "panic_col", reason = "recently added", issue = "42939")]
     pub fn column(&self) -> u32 {
         self.col
     }
@@ -520,7 +521,21 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments,
     begin_panic_new(s, file_line_col)
 }
 
-// FIXME: remove begin_panic and rename begin_panic_new to begin_panic when SNAP
+// FIXME: In PR #42938, we have added the column as info passed to the panic
+// handling code. For this, we want to break the ABI of begin_panic.
+// This is not possible to do directly, as the stage0 compiler is hardcoded
+// to emit a call to begin_panic in src/libsyntax/ext/build.rs, only
+// with the file and line number being passed, but not the colum number.
+// By changing the compiler source, we can only affect behaviour of higher
+// stages. We need to perform the switch over two stage0 replacements, using
+// a temporary function begin_panic_new while performing the switch:
+// 0. Right now, we tell stage1 onward to emit a call to begin_panic_new.
+// 1. In the first SNAP, stage0 calls begin_panic_new with the new ABI,
+//    begin_panic stops being used. Now we can change begin_panic to
+//    the new ABI, and start emitting calls to begin_panic in higher
+//    stages again, this time with the new ABI.
+// 2. After the second SNAP, stage0 calls begin_panic with the new ABI,
+//    and we can remove the temporary begin_panic_new function.
 
 /// This is the entry point of panicking for panic!() and assert!().
 #[unstable(feature = "libstd_sys_internals",