Skip to content

Commit 716a534

Browse files
committed
Remove bindgen_marker_UnusedTemplateParam.
To see if this is really necessary.
1 parent c602167 commit 716a534

File tree

3 files changed

+1
-47
lines changed

3 files changed

+1
-47
lines changed

bindgen/codegen/helpers.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,3 @@ pub(crate) fn reference(ty_ptr: syn::TypePtr, is_rvalue: bool, ctx: &BindgenCont
419419
ptr
420420
}
421421
}
422-
423-
pub(crate) fn with_unused_template_args(inner: syn::Type, ctx: &BindgenContext) -> syn::Type {
424-
if ctx.options().use_unused_template_param_newtype_wrapper {
425-
syn::parse_quote! { __bindgen_marker_UnusedTemplateParam< #inner > }
426-
} else {
427-
inner
428-
}
429-
}

bindgen/codegen/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4561,21 +4561,12 @@ impl TryToRustTy for TemplateInstantiation {
45614561
})
45624562
.collect::<error::Result<Vec<_>>>()?;
45634563

4564-
let has_unused_template_args = def_params
4565-
.iter()
4566-
// Only pass type arguments for the type parameters that
4567-
// the def uses.
4568-
.any(|param| !ctx.uses_template_parameter(def.id(), *param));
45694564
let inner = if template_args.is_empty() {
45704565
syn::parse_quote! { #ty }
45714566
} else {
45724567
syn::parse_quote! { #ty<#(#template_args),*> }
45734568
};
4574-
Ok(if has_unused_template_args {
4575-
helpers::with_unused_template_args(inner, ctx)
4576-
} else {
4577-
inner
4578-
})
4569+
Ok(inner)
45794570
}
45804571
}
45814572

bindgen/options/mod.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -225,35 +225,6 @@ options! {
225225
as_args: "--use-reference-newtype-wrapper",
226226
},
227227

228-
/// Use a newtype wrapper to denote types with "missing" C++ template
229-
/// arguments. Sometimes bindgen is unable to see the purpose of
230-
/// a given template argument, because it doesn't translate to
231-
/// a real purpose in the generated Rust code (e.g. for SFINAE type
232-
/// tricks for compile-time evaluation on the C++ side). Bindgen
233-
/// thus omits these template parameters. But this can cause problems
234-
/// for postprocessors which expect to see all template parameters;
235-
/// when this option is enabled we denote these types using a newtype
236-
/// wrapper.
237-
/// The newtype wrapper will be a fake type called
238-
/// `bindgen_marker_MissingTemplateParam`.
239-
/// It's assumed that you will replace this with some
240-
/// real sensible newtype wrapper of your own, either by post-processing
241-
/// the output of bindgen, or by using a `use` statemet injected using
242-
/// `--module-raw-lines` or similar.
243-
use_unused_template_param_newtype_wrapper: bool {
244-
methods: {
245-
/// If this is true, wrap types that don't have a complete set
246-
/// of template parameters in a fake newtype
247-
/// wrapper which post-processors can replace with something
248-
/// more sensible.
249-
pub fn use_unused_template_param_newtype_wrapper(mut self, doit: bool) -> Builder {
250-
self.options.use_unused_template_param_newtype_wrapper = doit;
251-
self
252-
}
253-
},
254-
as_args: "--use-unused-template-param-newtype-wrapper",
255-
},
256-
257228
/// Whether we should distinguish between C++'s 'char16_t' and 'u16'.
258229
/// The C++ type `char16_t` is its own special type; it's not a typedef
259230
/// of some other integer (this differs from C).

0 commit comments

Comments
 (0)