Minor test fmt
This commit is contained in:
parent
5eb573a343
commit
ccae456863
@ -9,4 +9,5 @@ const MOVE: fn(&String) -> String = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
println!("{}", MOVE(&String::new()));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// check that borrowck looks inside consts/statics
|
// check that borrowck looks inside consts/statics
|
||||||
|
|
||||||
static FN : &'static (dyn Fn() -> (Box<dyn Fn()->Box<i32>>) + Sync) = &|| {
|
static FN : &'static (dyn Fn() -> Box<dyn Fn()->Box<i32>> + Sync) = &|| {
|
||||||
let x = Box::new(0);
|
let x = Box::new(0);
|
||||||
Box::new(|| x) //~ ERROR cannot move out of `x`, a captured variable in an `Fn` closure
|
Box::new(|| x) //~ ERROR cannot move out of `x`, a captured variable in an `Fn` closure
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,8 @@ static BAR: Foo = Foo { foo: 5 };
|
|||||||
|
|
||||||
|
|
||||||
fn test(f: Foo) {
|
fn test(f: Foo) {
|
||||||
let _f = Foo{foo: 4, ..f};
|
let f = Foo { foo: 4, ..f };
|
||||||
|
println!("{}", f.foo);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0507]: cannot move out of static item `BAR`
|
error[E0507]: cannot move out of static item `BAR`
|
||||||
--> $DIR/borrowck-move-out-of-static-item.rs:15:10
|
--> $DIR/borrowck-move-out-of-static-item.rs:16:10
|
||||||
|
|
|
|
||||||
LL | test(BAR);
|
LL | test(BAR);
|
||||||
| ^^^ move occurs because `BAR` has type `Foo`, which does not implement the `Copy` trait
|
| ^^^ move occurs because `BAR` has type `Foo`, which does not implement the `Copy` trait
|
||||||
|
Loading…
x
Reference in New Issue
Block a user