Skip to content

Commit 0920eee

Browse files
committed
fix: msvr issue
1 parent 17dbb68 commit 0920eee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bindgen/codegen/postprocessing/merge_cfg_attributes.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ impl Visitor {
208208

209209
fn visit_foreign_mod(&mut self, foreign_mod: &mut ItemForeignMod) {
210210
for mut foreign_item in std::mem::take(&mut foreign_mod.items) {
211+
// When MSRV >= 1.79.0 we can return &Vec::new() in the generic case as this wll get lifetime extended,
212+
// see also https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html#extending-automatic-temporary-lifetime-extension.
213+
let mut _attrs = vec![];
211214
let (inner_attrs, inner_unsafety, inner_abi) =
212215
match &mut foreign_item {
213216
ForeignItem::Fn(f) => {
@@ -216,7 +219,7 @@ impl Visitor {
216219
ForeignItem::Static(s) => (&mut s.attrs, None, None),
217220
ForeignItem::Type(t) => (&mut t.attrs, None, None),
218221
ForeignItem::Macro(m) => (&mut m.attrs, None, None),
219-
_ => (&mut Vec::new(), None, None),
222+
_ => (&mut _attrs, None, None),
220223
};
221224

222225
let mut attr_set = AttributeSet::new(

0 commit comments

Comments
 (0)