Skip to content

Make it build with latest rustc #5

@paulolieuthier

Description

@paulolieuthier

Can't build it using rustc nightly. I've fixed the erros in build.rs, but there are errors in source code as well.

EDIT: I've fixed ffi.rs as well, but couldn't fix lib.rs as it makes use of std::intrinsics::TyDesc, which was removed from Rust as you can see here: rust-lang/rust#23376.

diff --git a/build.rs b/build.rs
index 9deb49d..b8c6358 100644
--- a/build.rs
+++ b/build.rs
@@ -1,27 +1,25 @@
-extern crate "pkg-config" as pkg_config;
+#![feature(convert)]

-use std::old_io::Command;
-use std::os;
+extern crate pkg_config;

-#[allow(unused_must_use)]
-fn main() {
-    let mut build = os::getcwd().unwrap();
-    build.push_many(&["ext", "libqmlrswrapper", "build"]);
+use std::process::Command;
+use std::fs;
+use std::env;
+use std::path::PathBuf;

-    /* Ignore error, the return value is not reliable and we'll catch it when chdir'ing anyway. */
-    std::old_io::fs::mkdir(&build, std::old_io::USER_RWX);
+fn main() {
+    let wcd = env::current_dir().unwrap();
+    let build = PathBuf::from(&wcd.join("ext/libqmlrswrapper/build"));

-    os::change_dir(&build).ok().expect("Failed to change into build directory");
+    let _ = fs::create_dir_all(&build);
...skipping...

     println!("cargo:rustc-flags=-L {} -l qmlrswrapper:static -l stdc++", build.display());
     pkg_config::find_library("Qt5Core Qt5Gui Qt5Qml Qt5Quick").unwrap();
diff --git a/src/ffi.rs b/src/ffi.rs
index 207d5c2..aaee52d 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -9,7 +9,7 @@ pub enum QVariant {}
 pub enum QVariantList {}

 #[repr(C)]
-#[derive(Eq, PartialEq, Show, Copy)]
+#[derive(Eq, PartialEq, Debug, Copy)]
 pub enum QrsVariantType {
     Invalid = 0,
     Int64,
diff --git a/src/lib.rs b/src/lib.rs
index 7d658ec..664dfe5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,6 +5,7 @@ extern crate libc;

 use libc::{c_char, c_int, c_uint, c_void};
 use std::sync::Arc;
+use std::old_path::Path;
 use ffi::{QVariant, QrsEngine, QObject};

 /* Re-exports */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions