diff -up firefox-113.0.1/Cargo.lock.D178251 firefox-113.0.1/Cargo.lock --- firefox-113.0.1/Cargo.lock.D178251 2023-05-12 00:09:22.000000000 +0200 +++ firefox-113.0.1/Cargo.lock 2023-05-24 10:55:51.177278597 +0200 @@ -417,8 +417,6 @@ dependencies = [ [[package]] name = "bindgen" version = "0.64.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ "bitflags 1.3.2", "cexpr", diff -up firefox-113.0.1/Cargo.toml.D178251 firefox-113.0.1/Cargo.toml --- firefox-113.0.1/Cargo.toml.D178251 2023-05-12 00:09:22.000000000 +0200 +++ firefox-113.0.1/Cargo.toml 2023-05-24 10:56:39.836959570 +0200 @@ -119,7 +119,7 @@ tinyvec = { path = "build/rust/tinyvec" wasi = { path = "build/rust/wasi" } # Patch bindgen 0.63 to 0.64 -bindgen = { path = "build/rust/bindgen" } +bindgen_0_63 = { package = "bindgen", path = "build/rust/bindgen" } # Patch memoffset 0.6 to 0.8 memoffset = { path = "build/rust/memoffset" } @@ -145,6 +145,9 @@ web-sys = { path = "build/rust/dummy-web # Overrides to allow easier use of common internal crates. moz_asserts = { path = "mozglue/static/rust/moz_asserts" } +# Patch bindgen to work around issues with some unsound transmutes when compiling with LLVM 16+. +bindgen = { path = "third_party/rust/bindgen" } + # Patch `rure` to disable building the cdylib and staticlib targets # Cargo has no way to disable building targets your dependencies provide which # you don't depend on, and linking the cdylib breaks during instrumentation diff -up firefox-113.0.1/supply-chain/config.toml.D178251 firefox-113.0.1/supply-chain/config.toml --- firefox-113.0.1/supply-chain/config.toml.D178251 2023-05-12 00:09:23.000000000 +0200 +++ firefox-113.0.1/supply-chain/config.toml 2023-05-24 10:55:51.178278632 +0200 @@ -23,6 +23,10 @@ url = "https://raw.githubusercontent.com audit-as-crates-io = true notes = "This is the upstream code plus a few local fixes, see bug 1685697." +[policy."bindgen:0.64.0"] +audit-as-crates-io = true +notes = "This is a local override of the bindgen crate from crates.io, with a small local patch." + [policy.chardetng] audit-as-crates-io = true notes = "This is a crate Henri wrote which is also published. We should probably update Firefox to tip and certify that." diff -up firefox-113.0.1/third_party/rust/bindgen/codegen/mod.rs.D178251 firefox-113.0.1/third_party/rust/bindgen/codegen/mod.rs --- firefox-113.0.1/third_party/rust/bindgen/codegen/mod.rs.D178251 2023-05-11 23:42:49.000000000 +0200 +++ firefox-113.0.1/third_party/rust/bindgen/codegen/mod.rs 2023-05-24 10:55:51.178278632 +0200 @@ -141,12 +141,13 @@ fn derives_of_item( item: &Item, ctx: &BindgenContext, packed: bool, + forward_decl: bool, ) -> DerivableTraits { let mut derivable_traits = DerivableTraits::empty(); let all_template_params = item.all_template_params(ctx); - if item.can_derive_copy(ctx) && !item.annotations().disallow_copy() { + if item.can_derive_copy(ctx) && !item.annotations().disallow_copy() && !forward_decl { derivable_traits |= DerivableTraits::COPY; if ctx.options().rust_features().builtin_clone_impls || @@ -991,7 +992,7 @@ impl CodeGenerator for Type { vec![attributes::repr("transparent")]; let packed = false; // Types can't be packed in Rust. let derivable_traits = - derives_of_item(item, ctx, packed); + derives_of_item(item, ctx, packed, false); if !derivable_traits.is_empty() { let derives: Vec<_> = derivable_traits.into(); attributes.push(attributes::derives(&derives)) @@ -2032,8 +2033,9 @@ impl CodeGenerator for CompInfo { } if forward_decl { + let prefix = ctx.trait_prefix(); fields.push(quote! { - _unused: [u8; 0], + _unused: ::#prefix::cell::UnsafeCell<[u8; 0]>, }); } @@ -2095,7 +2097,7 @@ impl CodeGenerator for CompInfo { } } - let derivable_traits = derives_of_item(item, ctx, packed); + let derivable_traits = derives_of_item(item, ctx, packed, self.is_forward_declaration()); if !derivable_traits.contains(DerivableTraits::DEBUG) { needs_debug_impl = ctx.options().derive_debug && ctx.options().impl_debug && @@ -3127,7 +3129,7 @@ impl CodeGenerator for Enum { if !variation.is_const() { let packed = false; // Enums can't be packed in Rust. - let mut derives = derives_of_item(item, ctx, packed); + let mut derives = derives_of_item(item, ctx, packed, false); // For backwards compat, enums always derive // Clone/Eq/PartialEq/Hash, even if we don't generate those by // default.