@@ -220,12 +220,19 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
220
220
//
221
221
// This is pretty close to Rust's exception handling approach, except that Rust
222
222
// does have a single "catch-all" handler at the bottom of each task's stack.
223
- // So we have two versions:
223
+ // So we have two versions of the personality routine :
224
224
// - rust_eh_personality, used by all cleanup landing pads, which never catches,
225
225
// so the behavior of __gcc_personality_v0 is perfectly adequate there, and
226
226
// - rust_eh_personality_catch, used only by rust_try(), which always catches.
227
- // This is achieved by overriding the return value in search phase to always
228
- // say "catch!".
227
+ //
228
+ // Note, however, that for implementation simplicity, rust_eh_personality_catch
229
+ // lacks code to install a landing pad, so in order to obtain exception object
230
+ // pointer (which it needs to return upstream), rust_try() employs another trick:
231
+ // it calls into the nested rust_try_inner(), whose landing pad does not resume
232
+ // unwinds. Instead, it extracts the exception pointer and performs a "normal"
233
+ // return.
234
+ //
235
+ // See also: rt/rust_try.ll
229
236
230
237
#[ cfg( not( target_arch = "arm" ) , not( windows, target_arch = "x86_64" ) , not( test) ) ]
231
238
#[ doc( hidden) ]
@@ -334,7 +341,8 @@ pub mod eabi {
334
341
335
342
// ARM EHABI uses a slightly different personality routine signature,
336
343
// but otherwise works the same.
337
- #[ cfg( target_arch = "arm" , not( target_os = "ios" , not( test) ) ) ]
344
+ #[ cfg( target_arch = "arm" , not( target_os = "ios" ) , not( test) ) ]
345
+ #[ doc( hidden) ]
338
346
#[ allow( visible_private_types) ]
339
347
pub mod eabi {
340
348
use uw = libunwind;
@@ -384,10 +392,9 @@ pub mod eabi {
384
392
// with an "API translator" layer (_GCC_specific_handler).
385
393
386
394
#[ cfg( windows, target_arch = "x86_64" , not( test) ) ]
395
+ #[ doc( hidden) ]
387
396
#[ allow( visible_private_types) ]
388
397
#[ allow( non_camel_case_types) ]
389
- #[ allow( unused_variable) ]
390
- #[ allow( uppercase_variables) ]
391
398
pub mod eabi {
392
399
use uw = libunwind;
393
400
use libc:: { c_void, c_int} ;
0 commit comments