librustc: Disallow "mut" from distributing over bindings.
This is the backwards-incompatible part of per-binding-site "mut".
This commit is contained in:
parent
1c0aa78481
commit
f9b54541ee
32 changed files with 190 additions and 50 deletions
|
|
@ -23,7 +23,10 @@ fn main() {
|
|||
for range(0, h) |y| {
|
||||
let y = y as f64;
|
||||
for range(0, w) |x| {
|
||||
let mut (Zr, Zi, Tr, Ti) = (0f64, 0f64, 0f64, 0f64);
|
||||
let mut Zr = 0f64;
|
||||
let mut Zi = 0f64;
|
||||
let mut Tr = 0f64;
|
||||
let mut Ti = 0f64;
|
||||
let Cr = 2.0 * (x as f64) / (w as f64) - 1.5;
|
||||
let Ci = 2.0 * (y as f64) / (h as f64) - 1.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ struct Foo {
|
|||
f: @mut int,
|
||||
}
|
||||
|
||||
impl Drop for Foo { //~ ERROR cannot implement a destructor on a struct that is not Send
|
||||
impl Drop for Foo { //~ ERROR cannot implement a destructor on a structure that does not satisfy Send
|
||||
fn drop(&self) {
|
||||
*self.f = 10;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ fn foo(_x: @uint) {}
|
|||
|
||||
fn main() {
|
||||
let x = @3u;
|
||||
let _: ~fn() = || foo(x); //~ ERROR does not fulfill `Owned`
|
||||
let _: ~fn() = || foo(x); //~ ERROR does not fulfill `Owned`
|
||||
let _: ~fn() = || foo(x); //~ ERROR does not fulfill `Owned`
|
||||
let _: ~fn() = || foo(x); //~ ERROR does not fulfill `Send`
|
||||
let _: ~fn() = || foo(x); //~ ERROR does not fulfill `Send`
|
||||
let _: ~fn() = || foo(x); //~ ERROR does not fulfill `Send`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ fn main() {
|
|||
let x = Cell::new(foo(Port(@())));
|
||||
|
||||
do task::spawn {
|
||||
let y = x.take(); //~ ERROR does not fulfill `Owned`
|
||||
let y = x.take(); //~ ERROR does not fulfill `Send`
|
||||
error!(y);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[non_owned]
|
||||
#[non_sendable]
|
||||
enum Foo { A }
|
||||
|
||||
fn bar<T: Send>(_: T) {}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[non_owned]
|
||||
#[non_sendable]
|
||||
struct Foo { a: int }
|
||||
|
||||
fn bar<T: Send>(_: T) {}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ struct A { a: int }
|
|||
|
||||
pub fn main() {
|
||||
let u = X {x: 10, y: @A {a: 20}};
|
||||
let mut X {x: x, y: @A {a: a}} = u;
|
||||
let X {x: x, y: @A {a: a}} = u;
|
||||
let mut x = x;
|
||||
let mut a = a;
|
||||
x = 100;
|
||||
a = 100;
|
||||
assert_eq!(x, 100);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ proto! oneshot (
|
|||
)
|
||||
|
||||
pub fn main() {
|
||||
let mut (p, c) = oneshot::init();
|
||||
let (p, c) = oneshot::init();
|
||||
let mut p = p;
|
||||
let mut c = c;
|
||||
|
||||
assert!(!pipes::peek(&mut p));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue