diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-13 14:36:59 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-13 14:36:59 +0100 |
commit | 0f0b6d6e97ede76693f4d48b90ee04ad7126069b (patch) | |
tree | b2bcf8091444187d543a635d576561d51034e32b /libbindgen/src/codegen/mod.rs | |
parent | 883ff74e5f20b68b41f322daa582d9208eece65a (diff) |
codegen: Rename the temporary variable in constructors for __bindgen_tmp, to avoid potential conflicts.
Diffstat (limited to 'libbindgen/src/codegen/mod.rs')
-rw-r--r-- | libbindgen/src/codegen/mod.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs index f3181de7..bf516cd2 100644 --- a/libbindgen/src/codegen/mod.rs +++ b/libbindgen/src/codegen/mod.rs @@ -1359,13 +1359,14 @@ impl MethodCodegen for Method { let mut stmts = vec![]; // If it's a constructor, we need to insert an extra parameter with a - // variable called `tmp` we're going to create. + // variable called `__bindgen_tmp` we're going to create. if self.is_constructor() { let tmp_variable_decl = - quote_stmt!(ctx.ext_cx(), let mut tmp = ::std::mem::uninitialized()) + quote_stmt!(ctx.ext_cx(), + let mut __bindgen_tmp = ::std::mem::uninitialized()) .unwrap(); stmts.push(tmp_variable_decl); - exprs[0] = quote_expr!(ctx.ext_cx(), &mut tmp); + exprs[0] = quote_expr!(ctx.ext_cx(), &mut __bindgen_tmp); } else if !self.is_static() { assert!(!exprs.is_empty()); exprs[0] = if self.is_const() { @@ -1388,7 +1389,7 @@ impl MethodCodegen for Method { }); if self.is_constructor() { - stmts.push(quote_stmt!(ctx.ext_cx(), tmp).unwrap()); + stmts.push(quote_stmt!(ctx.ext_cx(), __bindgen_tmp).unwrap()); } let block = ast::Block { |