Skip to content

Commit 65a68cd

Browse files
committed
Revert "Add --rust-target to replace --unstable-rust"
This reverts commit 0bb7b9f. It turns out our CI stopped running test expectations in an earlier regression (from d73507e; fix incoming) and so this pull request actually introduced a bunch of failures when compiling the test expectations and running their unit tests :(
1 parent de180c4 commit 65a68cd

File tree

89 files changed

+891
-7897
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+891
-7897
lines changed

src/codegen/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl CodeGenerator for Module {
350350
}
351351

352352
if item.id() == ctx.root_module() {
353-
if result.saw_union && !ctx.options().rust_features().untagged_union() {
353+
if result.saw_union && !ctx.options().unstable_rust {
354354
utils::prepend_union_types(ctx, &mut *result);
355355
}
356356
if result.saw_incomplete_array {
@@ -911,8 +911,8 @@ impl<'a> FieldCodegen<'a> for FieldData {
911911
let field_ty = ctx.resolve_type(self.ty());
912912
let ty = self.ty().to_rust_ty_or_opaque(ctx, &());
913913

914-
// NB: If supported, we use proper `union` types.
915-
let ty = if parent.is_union() && !ctx.options().rust_features().untagged_union() {
914+
// NB: In unstable rust we use proper `union` types.
915+
let ty = if parent.is_union() && !ctx.options().unstable_rust {
916916
if ctx.options().enable_cxx_namespaces {
917917
quote_ty!(ctx.ext_cx(), root::__BindgenUnionField<$ty>)
918918
} else {
@@ -1052,8 +1052,8 @@ impl BitfieldUnit {
10521052
-> P<ast::Item> {
10531053
let ctor_name = self.ctor_name(ctx);
10541054

1055-
// If supported, add the const.
1056-
let fn_prefix = if ctx.options().rust_features().const_fn() {
1055+
// If we're generating unstable Rust, add the const.
1056+
let fn_prefix = if ctx.options().unstable_rust {
10571057
quote_tokens!(ctx.ext_cx(), pub const fn)
10581058
} else {
10591059
quote_tokens!(ctx.ext_cx(), pub fn)
@@ -1115,8 +1115,8 @@ impl Bitfield {
11151115
let offset = self.offset_into_unit();
11161116
let mask = self.mask();
11171117

1118-
// If supported, add the const.
1119-
let fn_prefix = if ctx.options().rust_features().const_fn() {
1118+
// If we're generating unstable Rust, add the const.
1119+
let fn_prefix = if ctx.options().unstable_rust {
11201120
quote_tokens!(ctx.ext_cx(), pub const fn)
11211121
} else {
11221122
quote_tokens!(ctx.ext_cx(), pub fn)
@@ -1445,7 +1445,7 @@ impl CodeGenerator for CompInfo {
14451445
}
14461446

14471447
let canonical_name = item.canonical_name(ctx);
1448-
let builder = if is_union && ctx.options().rust_features().untagged_union() {
1448+
let builder = if is_union && ctx.options().unstable_rust {
14491449
aster::AstBuilder::new()
14501450
.item()
14511451
.pub_()
@@ -1552,7 +1552,7 @@ impl CodeGenerator for CompInfo {
15521552
());
15531553
}
15541554

1555-
if is_union && !ctx.options().rust_features().untagged_union() {
1555+
if is_union && !ctx.options().unstable_rust {
15561556
let layout = layout.expect("Unable to get layout information?");
15571557
let ty = BlobTyBuilder::new(layout).build();
15581558
let field = StructFieldBuilder::named("bindgen_union_field")

src/features.rs

Lines changed: 0 additions & 187 deletions
This file was deleted.

src/ir/analysis/derive_copy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveCopy<'ctx, 'gen> {
207207
}
208208

209209
if info.kind() == CompKind::Union {
210-
if !self.ctx.options().rust_features().untagged_union() {
210+
if !self.ctx.options().unstable_rust {
211211
// NOTE: If there's no template parameters we can derive copy
212212
// unconditionally, since arrays are magical for rustc, and
213213
// __BindgenUnionField always implements copy.

src/ir/analysis/derive_debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveDebug<'ctx, 'gen> {
208208
);
209209

210210
if info.kind() == CompKind::Union {
211-
if self.ctx.options().rust_features().untagged_union() {
211+
if self.ctx.options().unstable_rust {
212212
trace!(" cannot derive Debug for Rust unions");
213213
return self.insert(id);
214214
}

src/ir/analysis/derive_default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveDefault<'ctx, 'gen> {
242242
);
243243

244244
if info.kind() == CompKind::Union {
245-
if self.ctx.options().rust_features().untagged_union() {
245+
if self.ctx.options().unstable_rust {
246246
trace!(" cannot derive Default for Rust unions");
247247
return self.insert(id);
248248
}

0 commit comments

Comments
 (0)