summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gen.rs2
-rw-r--r--src/lib.rs2
-rw-r--r--src/macro.rs15
-rw-r--r--src/parser.rs2
4 files changed, 15 insertions, 6 deletions
diff --git a/src/gen.rs b/src/gen.rs
index a0eb9842..c050ae23 100644
--- a/src/gen.rs
+++ b/src/gen.rs
@@ -925,7 +925,7 @@ fn mk_fnty(ctx: &mut GenCtx, decl: &ast::FnDecl, abi: abi::Abi) -> ast::Ty {
}));
let mut segs = Vec::new();
- segs.push_all([
+ segs.push_all(&[
ast::PathSegment {
identifier: ctx.ext_cx.ident_of("std"),
parameters: ast::AngleBracketedParameters(ast::AngleBracketedParameterData {
diff --git a/src/lib.rs b/src/lib.rs
index 274f33e6..76a0d060 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,6 @@
#![crate_name = "bindgen"]
#![crate_type = "dylib"]
-#![feature(globs, quote, phase, plugin_registrar)]
+#![feature(globs, quote, phase, plugin_registrar, if_let)]
extern crate syntax;
extern crate rustc;
diff --git a/src/macro.rs b/src/macro.rs
index 3d5345d1..f4a1839c 100644
--- a/src/macro.rs
+++ b/src/macro.rs
@@ -29,8 +29,14 @@ pub fn bindgen_macro(cx: &mut base::ExtCtxt, sp: codemap::Span, tts: &[ast::Toke
// Set the working dir to the directory containing the invoking rs file so
// that clang searches for headers relative to it rather than the crate root
let mod_dir = Path::new(cx.codemap().span_to_filename(sp)).dirname().to_vec();
- let cwd = os::getcwd();
- os::change_dir(&Path::new(mod_dir));
+ let cwd = match os::getcwd() {
+ Ok(d) => d,
+ Err(e) => panic!("Invalid current working directory: {}", e),
+ };
+ let p = Path::new(mod_dir);
+ if let Err(e) = os::change_dir(&p) {
+ panic!("Failed to change to directory {}: {}", p.display(), e);
+ };
// We want the span for errors to just match the bindgen! symbol
// instead of the whole invocation which can span multiple lines
@@ -46,7 +52,10 @@ pub fn bindgen_macro(cx: &mut base::ExtCtxt, sp: codemap::Span, tts: &[ast::Toke
Err(_) => base::DummyResult::any(sp)
};
- os::change_dir(&Path::new(cwd));
+ let p = Path::new(cwd);
+ if let Err(e) = os::change_dir(&p) {
+ panic!("Failed to return to directory {}: {}", p.display(), e);
+ }
ret
}
diff --git a/src/parser.rs b/src/parser.rs
index 83bccb9c..5b06b0e9 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -465,7 +465,7 @@ pub fn parse(options: ClangParserOptions, logger: &Logger) -> Result<Vec<Global>
return Err(())
}
- let unit = TranslationUnit::parse(&ix, "", ctx.options.clang_args.as_slice(), [], 0);
+ let unit = TranslationUnit::parse(&ix, "", ctx.options.clang_args.as_slice(), &[], 0);
if unit.is_null() {
ctx.logger.error("No input files given");
return Err(())