summaryrefslogtreecommitdiff
path: root/libbindgen/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'libbindgen/src/codegen')
-rw-r--r--libbindgen/src/codegen/helpers.rs5
-rw-r--r--libbindgen/src/codegen/mod.rs11
2 files changed, 9 insertions, 7 deletions
diff --git a/libbindgen/src/codegen/helpers.rs b/libbindgen/src/codegen/helpers.rs
index c09f0071..b4cc75f5 100644
--- a/libbindgen/src/codegen/helpers.rs
+++ b/libbindgen/src/codegen/helpers.rs
@@ -153,7 +153,7 @@ pub mod ast_ty {
}
pub fn float_expr(f: f64) -> P<ast::Expr> {
- use aster::str::ToInternedString;
+ use aster::symbol::ToSymbol;
let mut string = f.to_string();
// So it gets properly recognised as a floating point constant.
@@ -161,8 +161,7 @@ pub mod ast_ty {
string.push('.');
}
- let interned_str = string.as_str().to_interned_string();
- let kind = ast::LitKind::FloatUnsuffixed(interned_str);
+ let kind = ast::LitKind::FloatUnsuffixed(string.as_str().to_symbol());
aster::AstBuilder::new().expr().lit().build_lit(kind)
}
diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs
index f8352cc8..b223783e 100644
--- a/libbindgen/src/codegen/mod.rs
+++ b/libbindgen/src/codegen/mod.rs
@@ -1863,16 +1863,19 @@ impl ToRustTy for Type {
if let ast::TyKind::Path(_, ref mut path) = inner_ty.node {
let template_args = template_args.iter()
.map(|arg| arg.to_rust_ty(ctx))
- .collect();
+ .collect::<Vec<_>>();
- path.segments.last_mut().unwrap().parameters =
- ast::PathParameters::AngleBracketed(
+ path.segments.last_mut().unwrap().parameters = if template_args.is_empty() {
+ None
+ } else {
+ Some(P(ast::PathParameters::AngleBracketed(
ast::AngleBracketedParameterData {
lifetimes: vec![],
types: P::from_vec(template_args),
bindings: P::from_vec(vec![]),
}
- );
+ )))
+ }
}
P(inner_ty)