librustc: Disallow "mut" from distributing over bindings.

This is the backwards-incompatible part of per-binding-site "mut".
This commit is contained in:
Patrick Walton 2013-06-06 18:54:14 -07:00 committed by Corey Richardson
parent 1c0aa78481
commit f9b54541ee
32 changed files with 190 additions and 50 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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`
}

View file

@ -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);
}
}

View file

@ -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) {}

View file

@ -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) {}

View file

@ -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);

View file

@ -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));