Skip to content

Commit d2c188e

Browse files
authored
C unwind is stable (#2591)
* c_unwind stabilised in Rust 1.71 * update changelog * adjust test to indicate it not longer requires nightly * rename tests to indicate new reality * improve changelog entry * add unit test
1 parent 1d2b579 commit d2c188e

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@
175175
## Changed
176176
- The `Clone` implementation for `_BindgenUnionField` has been changed to pass
177177
the `incorrect_clone_impl_on_copy_type` Clippy lint.
178+
- The `c_unwind` ABI can be used without a feature gate for any Rust target version
179+
equal to or greater than 1.71.
180+
This comes as a result of the ABI being stabilised (in Rust 1.71).
178181
## Removed
179182
## Fixed
180183
- Bindgen no longer panics when parsing an objective-C header that includes a

bindgen-tests/tests/expectations/tests/c-unwind-abi-override-nightly.rs bindgen-tests/tests/expectations/tests/c-unwind-abi-override.rs

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/headers/c-unwind-abi-override-nightly.h

-5
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// bindgen-flags: --override-abi="foo|bar=C-unwind"
2+
3+
void foo();
4+
void bar();
5+
void baz();

bindgen/features.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,12 @@ macro_rules! rust_target_base {
137137
/// Rust stable 1.68
138138
/// * `abi_efiapi` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/65815))
139139
=> Stable_1_68 => 1.68;
140+
/// Rust stable 1.71
141+
/// * `c_unwind` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/74990))
142+
=> Stable_1_71 => 1.71;
140143
/// Nightly rust
141144
/// * `thiscall` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/42202))
142145
/// * `vectorcall` calling convention (no tracking issue)
143-
/// * `c_unwind` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/74990))
144146
=> Nightly => nightly;
145147
);
146148
}
@@ -150,7 +152,7 @@ rust_target_base!(rust_target_def);
150152
rust_target_base!(rust_target_values_def);
151153

152154
/// Latest stable release of Rust
153-
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_68;
155+
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_71;
154156

155157
/// Create RustFeatures struct definition, new(), and a getter for each field
156158
macro_rules! rust_feature_def {
@@ -253,10 +255,12 @@ rust_feature_def!(
253255
Stable_1_68 {
254256
=> abi_efiapi;
255257
}
258+
Stable_1_71 {
259+
=> c_unwind_abi;
260+
}
256261
Nightly {
257262
=> thiscall_abi;
258263
=> vectorcall_abi;
259-
=> c_unwind_abi;
260264
}
261265
);
262266

@@ -296,6 +300,12 @@ mod test {
296300
!f_1_21.thiscall_abi &&
297301
!f_1_21.vectorcall_abi
298302
);
303+
let features = RustFeatures::from(RustTarget::Stable_1_71);
304+
assert!(
305+
features.c_unwind_abi &&
306+
features.abi_efiapi &&
307+
!features.thiscall_abi
308+
);
299309
let f_nightly = RustFeatures::from(RustTarget::Nightly);
300310
assert!(
301311
f_nightly.static_lifetime_elision &&
@@ -306,8 +316,7 @@ mod test {
306316
f_nightly.maybe_uninit &&
307317
f_nightly.repr_align &&
308318
f_nightly.thiscall_abi &&
309-
f_nightly.vectorcall_abi &&
310-
f_nightly.c_unwind_abi
319+
f_nightly.vectorcall_abi
311320
);
312321
}
313322

@@ -324,6 +333,7 @@ mod test {
324333
test_target("1.19", RustTarget::Stable_1_19);
325334
test_target("1.21", RustTarget::Stable_1_21);
326335
test_target("1.25", RustTarget::Stable_1_25);
336+
test_target("1.71", RustTarget::Stable_1_71);
327337
test_target("nightly", RustTarget::Nightly);
328338
}
329339
}

0 commit comments

Comments
 (0)