Skip to content

Commit 8674a39

Browse files
David Tolnayfacebook-github-bot
authored andcommitted
Work around Bindgen incorrect detection of nested name specifier
Summary: Clang recently made major changes to the AST representation of nested name specifiers in [llvm-project#147835](llvm/llvm-project#147835). While waiting for Bindgen to be updated to understand the new representation, this diff changes our Bindgen invocation on `folly::IOBuf` to disregard the nested name `folly::IOBuf::Iterator`, which is unused anyway in the Rust `IOBuf` binding. This unblocks staging builds for the LLVM Server Compiler team. This diff causes the following difference in the Bindgen-generated Rust binding observed through `buck2 build fbcode//mode/opt fbcode//folly/rust/iobuf:iobuf-sys-bindgen`: ```lang=diff @@ -571,8 +571,6 @@ pub const IOBuf_CombinedOption_SEPARATE: root::folly::IOBuf_CombinedOption = 2; pub type IOBuf_CombinedOption = ::std::os::raw::c_int; pub type IOBuf_value_type = root::folly::ByteRange; - pub type IOBuf_iterator = root::folly::IOBuf_Iterator; - pub type IOBuf_const_iterator = root::folly::IOBuf_Iterator; pub type IOBuf_FreeFunction = ::std::option::Option< unsafe extern "C" fn( buf: *mut ::std::os::raw::c_void, @@ -765,31 +763,6 @@ "Offset of field: IOBuf::sharedInfo_", ][::std::mem::offset_of!(IOBuf, sharedInfo_) - 48usize]; }; - #[repr(C)] - #[derive(Debug, Copy, Clone)] - pub struct IOBuf_Iterator { - pub pos_: *const root::folly::IOBuf, - pub end_: *const root::folly::IOBuf, - pub val_: root::folly::ByteRange, - } - #[allow(clippy::unnecessary_operation, clippy::identity_op)] - const _: () = { - [ - "Size of IOBuf_Iterator", - ][::std::mem::size_of::<IOBuf_Iterator>() - 32usize]; - [ - "Alignment of IOBuf_Iterator", - ][::std::mem::align_of::<IOBuf_Iterator>() - 8usize]; - [ - "Offset of field: IOBuf_Iterator::pos_", - ][::std::mem::offset_of!(IOBuf_Iterator, pos_) - 0usize]; - [ - "Offset of field: IOBuf_Iterator::end_", - ][::std::mem::offset_of!(IOBuf_Iterator, end_) - 8usize]; - [ - "Offset of field: IOBuf_Iterator::val_", - ][::std::mem::offset_of!(IOBuf_Iterator, val_) - 16usize]; - }; } pub mod facebook { #[allow(unused_imports)] ``` Bindgen issue: [bindgen#3264](rust-lang/rust-bindgen#3264) Reviewed By: HighW4y2H3ll Differential Revision: D80186965 fbshipit-source-id: 9f0546a2964b5d4e5c67e6bdd91b542e3e5f7b2c
1 parent e41b3e6 commit 8674a39

File tree

1 file changed

+6
-0
lines changed
  • folly/rust/iobuf

1 file changed

+6
-0
lines changed

folly/rust/iobuf/BUCK

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ rust_bindgen_library(
4848
"facebook::rust::.*",
4949
],
5050
blocklist_types = [
51+
# Work around incorrect detection of nested name specifier. T234253370
52+
# Bindgen needs to be fixed to understand the new AST representation.
53+
# https://github.com/llvm/llvm-project/pull/147835
54+
"folly::IOBuf_Iterator",
55+
"folly::IOBuf_iterator",
56+
"folly::IOBuf_const_iterator",
5157
# These seems to come from type_traits / make_signed via fbvector
5258
"folly::fbvector.*",
5359
"__type",

0 commit comments

Comments
 (0)