@@ -75,6 +75,9 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
7575 unsafe { crate :: ptr:: drop_in_place ( to_drop) }
7676}
7777
78+ #[ cfg( bootstrap) ]
79+ pub use self :: r#try as catch_unwind;
80+
7881extern "rust-intrinsic" {
7982 // N.B., these intrinsics take raw pointers because they mutate aliased
8083 // memory, which is not valid for either `&` or `&mut`.
@@ -2382,6 +2385,21 @@ extern "rust-intrinsic" {
23822385 #[ rustc_nounwind]
23832386 pub fn variant_count < T > ( ) -> usize ;
23842387
2388+ /// Rust's "try catch" construct for unwinding. Invokes the function pointer `try_fn` with the
2389+ /// data pointer `data`, and calls `catch_fn` if unwinding occurs while `try_fn` runs.
2390+ ///
2391+ /// `catch_fn` must not unwind.
2392+ ///
2393+ /// The third argument is a function called if an unwind occurs (both Rust unwinds for foreign
2394+ /// unwinds). This function takes the data pointer and a pointer to the target-specific
2395+ /// exception object that was caught. For more information, see the compiler's source as well as
2396+ /// std's `catch_unwind` implementation.
2397+ ///
2398+ /// The stable version of this intrinsic is `std::panic::catch_unwind`.
2399+ #[ rustc_nounwind]
2400+ #[ cfg( not( bootstrap) ) ]
2401+ pub fn catch_unwind ( try_fn : fn ( * mut u8 ) , data : * mut u8 , catch_fn : fn ( * mut u8 , * mut u8 ) ) -> i32 ;
2402+
23852403 /// Rust's "try catch" construct which invokes the function pointer `try_fn`
23862404 /// with the data pointer `data`.
23872405 ///
@@ -2392,6 +2410,7 @@ extern "rust-intrinsic" {
23922410 ///
23932411 /// `catch_fn` must not unwind.
23942412 #[ rustc_nounwind]
2413+ #[ cfg( bootstrap) ]
23952414 pub fn r#try ( try_fn : fn ( * mut u8 ) , data : * mut u8 , catch_fn : fn ( * mut u8 , * mut u8 ) ) -> i32 ;
23962415
23972416 /// Emits a `!nontemporal` store according to LLVM (see their docs).
0 commit comments