Commit 6df9df7
authored
Rollup merge of rust-lang#87236 - sunfishcode:avoid-locking-args, r=joshtriplett
Simplify command-line argument initialization on unix
Simplify Rust's command-line argument initialization code on unix:
- The cleanup code isn't needed, because it was just zeroing out non-owning variables at runtime cleanup time. After 91c3eee, Rust's command-line initialization code on unix no longer allocates `CString`s and a `Vec` at startup time.
- The `Mutex` isn't needed; if there's somehow a call to `args()` before argument initialization has happened, the code returns return an empty list, which we can do with a null check.
With these changes, a simple cdylib that doesn't use threads avoids getting `pthread_mutex_lock`/`pthread_mutex_unlock` in its symbol table.2 files changed
+3
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 17 | | |
23 | 18 | | |
24 | 19 | | |
| |||
82 | 77 | | |
83 | 78 | | |
84 | 79 | | |
85 | | - | |
86 | | - | |
87 | 80 | | |
88 | 81 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 82 | | |
93 | 83 | | |
94 | | - | |
95 | 84 | | |
96 | 85 | | |
97 | 86 | | |
| |||
127 | 116 | | |
128 | 117 | | |
129 | 118 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | 119 | | |
137 | 120 | | |
138 | 121 | | |
139 | 122 | | |
140 | 123 | | |
141 | 124 | | |
142 | | - | |
143 | | - | |
| 125 | + | |
| 126 | + | |
144 | 127 | | |
| 128 | + | |
145 | 129 | | |
146 | 130 | | |
147 | 131 | | |
| |||
159 | 143 | | |
160 | 144 | | |
161 | 145 | | |
162 | | - | |
163 | | - | |
164 | 146 | | |
165 | 147 | | |
166 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | 126 | | |
128 | 127 | | |
129 | 128 | | |
| |||
0 commit comments