aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compile-fail/handler.rs19
-rw-r--r--tests/tests.rs2
2 files changed, 13 insertions, 8 deletions
diff --git a/tests/compile-fail/handler.rs b/tests/compile-fail/handler.rs
index fdc464a..64ab961 100644
--- a/tests/compile-fail/handler.rs
+++ b/tests/compile-fail/handler.rs
@@ -1,8 +1,13 @@
extern crate clint;
+#[macro_use]
+extern crate lazy_static;
+
use clint::Handler;
-static mut HANDLER: Handler = Handler::new();
+lazy_static! {
+ static ref HANDLER: Handler<'static> = Handler::new();
+}
fn main() {
need_move();
@@ -12,11 +17,11 @@ fn main() {
fn need_move() {
let x = vec![1, 2, 3];
- let c = || {
+ let mut c = || {
println!("x(h-c): {:?}", x); //~ ERROR does not live long enough
};
unsafe {
- HANDLER.replace(&c);
+ HANDLER.replace(&mut c);
HANDLER.call();
HANDLER.call();
}
@@ -25,11 +30,11 @@ fn need_move() {
fn borrow_error() {
let x = vec![1, 2, 3];
- let c = move || {
+ let mut c = move || {
println!("x(h-c): {:?}", x);
};
unsafe {
- HANDLER.replace(&c);
+ HANDLER.replace(&mut c);
HANDLER.call();
HANDLER.call();
}
@@ -38,11 +43,11 @@ fn borrow_error() {
fn no_borrow_needed() {
let x = vec![1, 2, 3];
- let c = || {
+ let mut c = || {
println!("x(h-c): hi!");
};
unsafe {
- HANDLER.replace(&c);
+ HANDLER.replace(&mut c);
HANDLER.call();
HANDLER.call();
}
diff --git a/tests/tests.rs b/tests/tests.rs
index c295c5a..eedb4b0 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -5,7 +5,7 @@ fn run_mode(mode: &'static str) {
config.mode = mode.parse().expect("invalid mode");
config.src_base = PathBuf::from(format!("tests/{}", mode));
- config.target_rustcflags = Some("-L target/debug".to_string());
+ config.target_rustcflags = Some("-L target/debug/deps".to_string());
config.clean_rmeta();
compiletest_rs::run_tests(&config);