Skip to content

Commit 3a6864c

Browse files
authored
Merge pull request #1530 from emilio/rustup
Update default rust target to 1.33.
2 parents 1cd8301 + a43cc2a commit 3a6864c

File tree

74 files changed

+680
-155
lines changed

Some content is hidden

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

74 files changed

+680
-155
lines changed

CHANGELOG.md

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,56 @@
99
- [Removed](#removed)
1010
- [Fixed](#fixed)
1111
- [Security](#security)
12-
- [0.47.3](#0473)
12+
- [0.48.0](#0480)
1313
- [Changed](#changed-1)
14-
- [0.47.2](#0472)
1514
- [Fixed](#fixed-1)
16-
- [0.47.1](#0471)
15+
- [0.47.3](#0473)
1716
- [Changed](#changed-2)
17+
- [0.47.2](#0472)
1818
- [Fixed](#fixed-2)
19-
- [0.47.0](#0470)
19+
- [0.47.1](#0471)
2020
- [Changed](#changed-3)
2121
- [Fixed](#fixed-3)
22+
- [0.47.0](#0470)
23+
- [Changed](#changed-4)
24+
- [Fixed](#fixed-4)
2225
- [0.33.1 .. 0.46.0](#0331--0460)
2326
- [Added](#added-1)
2427
- [Removed](#removed-1)
25-
- [Changed](#changed-4)
26-
- [Fixed](#fixed-4)
27-
- [0.33.1](#0331)
28+
- [Changed](#changed-5)
2829
- [Fixed](#fixed-5)
30+
- [0.33.1](#0331)
31+
- [Fixed](#fixed-6)
2932
- [0.33.0](#0330)
3033
- [Added](#added-2)
31-
- [Changed](#changed-5)
34+
- [Changed](#changed-6)
3235
- [Deprecated](#deprecated-1)
3336
- [Removed](#removed-2)
34-
- [Fixed](#fixed-6)
37+
- [Fixed](#fixed-7)
3538
- [Security](#security-1)
3639
- [0.32.2](#0322)
37-
- [Fixed](#fixed-7)
38-
- [0.32.1](#0321)
3940
- [Fixed](#fixed-8)
41+
- [0.32.1](#0321)
42+
- [Fixed](#fixed-9)
4043
- [0.32.0](#0320)
4144
- [Added](#added-3)
42-
- [Changed](#changed-6)
43-
- [Fixed](#fixed-9)
45+
- [Changed](#changed-7)
46+
- [Fixed](#fixed-10)
4447
- [0.31.0](#0310)
4548
- [Added](#added-4)
46-
- [Changed](#changed-7)
49+
- [Changed](#changed-8)
4750
- [Deprecated](#deprecated-2)
4851
- [Removed](#removed-3)
49-
- [Fixed](#fixed-10)
52+
- [Fixed](#fixed-11)
5053
- [0.30.0](#0300)
5154
- [Added](#added-5)
52-
- [Changed](#changed-8)
55+
- [Changed](#changed-9)
5356
- [Deprecated](#deprecated-3)
54-
- [Fixed](#fixed-11)
57+
- [Fixed](#fixed-12)
5558
- [0.29.0](#0290)
5659
- [Added](#added-6)
57-
- [Changed](#changed-9)
58-
- [Fixed](#fixed-12)
60+
- [Changed](#changed-10)
61+
- [Fixed](#fixed-13)
5962

6063
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
6164

@@ -89,6 +92,25 @@ Released YYYY/MM/DD
8992

9093
* TODO (or remove section if none)
9194

95+
96+
--------------------------------------------------------------------------------
97+
98+
# 0.48.0
99+
100+
Released 2019/03/04
101+
102+
## Changed
103+
104+
* Default rust target was changed to 1.33, which means that bindgen can get much
105+
more often the layout of structs right. [#1529][]
106+
107+
## Fixed
108+
109+
* Bindgen will output repr(align) just when needed for unions. [#1498][]
110+
111+
[#1529]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1529
112+
[#1498]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1498
113+
92114
--------------------------------------------------------------------------------
93115

94116
# 0.47.3

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ readme = "README.md"
1414
repository = "https://github.com/rust-lang/rust-bindgen"
1515
documentation = "https://docs.rs/bindgen"
1616
homepage = "https://rust-lang.github.io/rust-bindgen/"
17-
version = "0.47.3"
17+
version = "0.48.0"
1818
build = "build.rs"
1919

2020
include = [

bindgen-integration/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ fn test_bitfield_constructors() {
179179

180180
let mut second = bindings::bitfields::Second {
181181
_bitfield_1: bindings::bitfields::Second::new_bitfield_1(1337, true),
182-
__bindgen_align: [],
183182
};
184183
assert!(unsafe { second.assert(1337, true) });
185184

@@ -189,7 +188,6 @@ fn test_bitfield_constructors() {
189188
false,
190189
bindings::bitfields::ItemKind::ITEM_KIND_TRES,
191190
),
192-
__bindgen_align: [],
193191
};
194192
assert!(unsafe {
195193
third.assert(42, false, bindings::bitfields::ItemKind::ITEM_KIND_TRES)

src/codegen/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,6 +1589,7 @@ impl CodeGenerator for CompInfo {
15891589
// TODO(emilio): It'd be nice to unify this with the struct path
15901590
// above somehow.
15911591
let layout = layout.expect("Unable to get layout information?");
1592+
struct_layout.saw_union(layout);
15921593

15931594
if struct_layout.requires_explicit_align(layout) {
15941595
explicit_align = Some(layout.align);
@@ -1600,8 +1601,6 @@ impl CodeGenerator for CompInfo {
16001601
_bindgen_union_align: #ty ,
16011602
}
16021603
} else {
1603-
struct_layout.saw_union(layout);
1604-
16051604
quote! {
16061605
pub bindgen_union_field: #ty ,
16071606
}

src/codegen/struct_layout.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ impl<'a> StructLayoutTracker<'a> {
8585
name: &'a str,
8686
) -> Self {
8787
StructLayoutTracker {
88-
name: name,
89-
ctx: ctx,
90-
comp: comp,
88+
name,
89+
ctx,
90+
comp,
9191
is_packed: comp.is_packed(ctx, &ty.layout(ctx)),
9292
latest_offset: 0,
9393
padding_count: 0,

src/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ rust_target_base!(rust_target_def);
114114
rust_target_base!(rust_target_values_def);
115115

116116
/// Latest stable release of Rust
117-
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_21;
117+
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_33;
118118

119119
/// Create RustFeatures struct definition, new(), and a getter for each field
120120
macro_rules! rust_feature_def {

tests/expectations/tests/16-byte-alignment.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/* automatically generated by rust-bindgen */
22

3-
4-
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
5-
3+
#![allow(
4+
dead_code,
5+
non_snake_case,
6+
non_camel_case_types,
7+
non_upper_case_globals
8+
)]
69

710
#[repr(C)]
811
#[derive(Copy, Clone)]
@@ -271,11 +274,12 @@ impl Default for rte_ipv6_tuple {
271274
}
272275
}
273276
#[repr(C)]
277+
#[repr(align(16))]
274278
#[derive(Copy, Clone)]
275279
pub union rte_thash_tuple {
276280
pub v4: rte_ipv4_tuple,
277281
pub v6: rte_ipv6_tuple,
278-
_bindgen_union_align: [u8; 48usize],
282+
_bindgen_union_align: [u128; 3usize],
279283
}
280284
#[test]
281285
fn bindgen_test_layout_rte_thash_tuple() {
@@ -284,6 +288,11 @@ fn bindgen_test_layout_rte_thash_tuple() {
284288
48usize,
285289
concat!("Size of: ", stringify!(rte_thash_tuple))
286290
);
291+
assert_eq!(
292+
::std::mem::align_of::<rte_thash_tuple>(),
293+
16usize,
294+
concat!("Alignment of ", stringify!(rte_thash_tuple))
295+
);
287296
assert_eq!(
288297
unsafe { &(*(::std::ptr::null::<rte_thash_tuple>())).v4 as *const _ as usize },
289298
0usize,

tests/expectations/tests/annotation_hide.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/// <div rustbindgen opaque></div>
1111
#[repr(C)]
12+
#[repr(align(4))]
1213
#[derive(Debug, Default, Copy, Clone)]
1314
pub struct D {
1415
pub _bindgen_opaque_blob: u32,

tests/expectations/tests/anon_struct_in_union.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/* automatically generated by rust-bindgen */
22

3-
4-
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
5-
3+
#![allow(
4+
dead_code,
5+
non_snake_case,
6+
non_camel_case_types,
7+
non_upper_case_globals
8+
)]
69

710
#[repr(C)]
811
#[derive(Copy, Clone)]

0 commit comments

Comments
 (0)