File tree 6 files changed +13
-2
lines changed
6 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,14 @@ pub extern "C" fn __rust_abort() {
96
96
}
97
97
98
98
// SAFETY: must be called only once during runtime initialization.
99
+ // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
99
100
pub unsafe fn init ( argc : isize , argv : * const * const u8 ) {
100
101
let _ = net:: init ( ) ;
101
102
args:: init ( argc, argv) ;
102
103
}
103
104
104
105
// SAFETY: must be called only once during runtime cleanup.
106
+ // NOTE: this is not guaranteed to run, for example when the program aborts.
105
107
pub unsafe fn cleanup ( ) {
106
108
args:: cleanup ( ) ;
107
109
}
Original file line number Diff line number Diff line change @@ -40,13 +40,15 @@ pub mod time;
40
40
pub use crate :: sys_common:: os_str_bytes as os_str;
41
41
42
42
// SAFETY: must be called only once during runtime initialization.
43
+ // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
43
44
pub unsafe fn init ( argc : isize , argv : * const * const u8 ) {
44
45
unsafe {
45
46
args:: init ( argc, argv) ;
46
47
}
47
48
}
48
49
49
50
// SAFETY: must be called only once during runtime cleanup.
51
+ // NOTE: this is not guaranteed to run, for example when the program aborts.
50
52
pub unsafe fn cleanup ( ) { }
51
53
52
54
/// This function is used to implement functionality that simply doesn't exist.
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ pub mod time;
45
45
pub use crate :: sys_common:: os_str_bytes as os_str;
46
46
47
47
// SAFETY: must be called only once during runtime initialization.
48
+ // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
48
49
pub unsafe fn init ( argc : isize , argv : * const * const u8 ) {
49
50
// The standard streams might be closed on application startup. To prevent
50
51
// std::io::{stdin, stdout,stderr} objects from using other unrelated file
@@ -120,6 +121,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8) {
120
121
}
121
122
122
123
// SAFETY: must be called only once during runtime cleanup.
124
+ // NOTE: this is not guaranteed to run, for example when the program aborts.
123
125
pub unsafe fn cleanup ( ) {
124
126
args:: cleanup ( ) ;
125
127
stack_overflow:: cleanup ( ) ;
Original file line number Diff line number Diff line change @@ -11,9 +11,11 @@ pub use crate::sys_common::os_str_bytes as os_str;
11
11
use crate :: os:: raw:: c_char;
12
12
13
13
// SAFETY: must be called only once during runtime initialization.
14
+ // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
14
15
pub unsafe fn init ( _argc : isize , _argv : * const * const u8 ) { }
15
16
16
17
// SAFETY: must be called only once during runtime cleanup.
18
+ // NOTE: this is not guaranteed to run, for example when the program aborts.
17
19
pub unsafe fn cleanup ( ) { }
18
20
19
21
pub fn unsupported < T > ( ) -> std_io:: Result < T > {
Original file line number Diff line number Diff line change @@ -50,11 +50,13 @@ cfg_if::cfg_if! {
50
50
}
51
51
52
52
// SAFETY: must be called only once during runtime initialization.
53
+ // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
53
54
pub unsafe fn init ( _argc : isize , _argv : * const * const u8 ) {
54
55
stack_overflow:: init ( ) ;
55
56
}
56
57
57
58
// SAFETY: must be called only once during runtime cleanup.
59
+ // NOTE: this is not guaranteed to run, for example when the program aborts.
58
60
pub unsafe fn cleanup ( ) {
59
61
net:: cleanup ( ) ;
60
62
}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use crate::thread::Thread;
5
5
6
6
// One-time runtime initialization.
7
7
// Runs before `main`.
8
+ // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
8
9
#[ cfg_attr( test, allow( dead_code) ) ]
9
10
pub fn init ( argc : isize , argv : * const * const u8 ) {
10
11
static INIT : Once = Once :: new ( ) ;
@@ -23,8 +24,8 @@ pub fn init(argc: isize, argv: *const *const u8) {
23
24
}
24
25
25
26
// One-time runtime cleanup.
26
- // Runs after `main` or at program exit. Note however that this is not guaranteed to run,
27
- // for example when the program aborts.
27
+ // Runs after `main` or at program exit.
28
+ // NOTE: this is not guaranteed to run, for example when the program aborts.
28
29
#[ cfg_attr( test, allow( dead_code) ) ]
29
30
pub fn cleanup ( ) {
30
31
static CLEANUP : Once = Once :: new ( ) ;
You can’t perform that action at this time.
0 commit comments