@@ -75,6 +75,9 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
75
75
unsafe { crate :: ptr:: drop_in_place ( to_drop) }
76
76
}
77
77
78
+ #[ cfg( bootstrap) ]
79
+ pub use self :: r#try as catch_unwind;
80
+
78
81
extern "rust-intrinsic" {
79
82
// N.B., these intrinsics take raw pointers because they mutate aliased
80
83
// memory, which is not valid for either `&` or `&mut`.
@@ -2382,6 +2385,21 @@ extern "rust-intrinsic" {
2382
2385
#[ rustc_nounwind]
2383
2386
pub fn variant_count < T > ( ) -> usize ;
2384
2387
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
+
2385
2403
/// Rust's "try catch" construct which invokes the function pointer `try_fn`
2386
2404
/// with the data pointer `data`.
2387
2405
///
@@ -2392,6 +2410,7 @@ extern "rust-intrinsic" {
2392
2410
///
2393
2411
/// `catch_fn` must not unwind.
2394
2412
#[ rustc_nounwind]
2413
+ #[ cfg( bootstrap) ]
2395
2414
pub fn r#try ( try_fn : fn ( * mut u8 ) , data : * mut u8 , catch_fn : fn ( * mut u8 , * mut u8 ) ) -> i32 ;
2396
2415
2397
2416
/// Emits a `!nontemporal` store according to LLVM (see their docs).
0 commit comments