Skip to content

Commit

Permalink
C unwind is stable (#2591)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tshepang authored Jul 27, 2023
1 parent 1d2b579 commit d2c188e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@
## Changed
- The `Clone` implementation for `_BindgenUnionField` has been changed to pass
the `incorrect_clone_impl_on_copy_type` Clippy lint.
- The `c_unwind` ABI can be used without a feature gate for any Rust target version
equal to or greater than 1.71.
This comes as a result of the ABI being stabilised (in Rust 1.71).
## Removed
## Fixed
- Bindgen no longer panics when parsing an objective-C header that includes a
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions bindgen-tests/tests/headers/c-unwind-abi-override-nightly.h

This file was deleted.

5 changes: 5 additions & 0 deletions bindgen-tests/tests/headers/c-unwind-abi-override.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// bindgen-flags: --override-abi="foo|bar=C-unwind"

void foo();
void bar();
void baz();
20 changes: 15 additions & 5 deletions bindgen/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ macro_rules! rust_target_base {
/// Rust stable 1.68
/// * `abi_efiapi` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/65815))
=> Stable_1_68 => 1.68;
/// Rust stable 1.71
/// * `c_unwind` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/74990))
=> Stable_1_71 => 1.71;
/// Nightly rust
/// * `thiscall` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/42202))
/// * `vectorcall` calling convention (no tracking issue)
/// * `c_unwind` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/74990))
=> Nightly => nightly;
);
}
Expand All @@ -150,7 +152,7 @@ rust_target_base!(rust_target_def);
rust_target_base!(rust_target_values_def);

/// Latest stable release of Rust
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_68;
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_71;

/// Create RustFeatures struct definition, new(), and a getter for each field
macro_rules! rust_feature_def {
Expand Down Expand Up @@ -253,10 +255,12 @@ rust_feature_def!(
Stable_1_68 {
=> abi_efiapi;
}
Stable_1_71 {
=> c_unwind_abi;
}
Nightly {
=> thiscall_abi;
=> vectorcall_abi;
=> c_unwind_abi;
}
);

Expand Down Expand Up @@ -296,6 +300,12 @@ mod test {
!f_1_21.thiscall_abi &&
!f_1_21.vectorcall_abi
);
let features = RustFeatures::from(RustTarget::Stable_1_71);
assert!(
features.c_unwind_abi &&
features.abi_efiapi &&
!features.thiscall_abi
);
let f_nightly = RustFeatures::from(RustTarget::Nightly);
assert!(
f_nightly.static_lifetime_elision &&
Expand All @@ -306,8 +316,7 @@ mod test {
f_nightly.maybe_uninit &&
f_nightly.repr_align &&
f_nightly.thiscall_abi &&
f_nightly.vectorcall_abi &&
f_nightly.c_unwind_abi
f_nightly.vectorcall_abi
);
}

Expand All @@ -324,6 +333,7 @@ mod test {
test_target("1.19", RustTarget::Stable_1_19);
test_target("1.21", RustTarget::Stable_1_21);
test_target("1.25", RustTarget::Stable_1_25);
test_target("1.71", RustTarget::Stable_1_71);
test_target("nightly", RustTarget::Nightly);
}
}

0 comments on commit d2c188e

Please sign in to comment.