Stop using the '<->' operator

This commit is contained in:
Alex Crichton 2013-05-06 00:42:54 -04:00
parent 7d22437ecd
commit 998fececd6
29 changed files with 214 additions and 296 deletions

View file

@ -1,28 +0,0 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn test1() {
let v: int;
let mut w: int;
v = 1; //~ NOTE prior assignment occurs here
w = 2;
v <-> w; //~ ERROR re-assignment of immutable variable
}
fn test2() {
let v: int;
let mut w: int;
v = 1; //~ NOTE prior assignment occurs here
w = 2;
w <-> v; //~ ERROR re-assignment of immutable variable
}
fn main() {
}

View file

@ -1,16 +0,0 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
let mut x = 3;
let y;
x <-> y; //~ ERROR use of possibly uninitialized variable: `y`
copy x;
}

View file

@ -87,7 +87,7 @@ fn f110() {
fn f120() {
let x = ~[~"hi", ~"ho"];
x[0] <-> x[1];
vec::swap(x, 0, 1);
touch(&x[0]);
touch(&x[1]);
}

View file

@ -1,15 +0,0 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
5 <-> 3;
//~^ ERROR cannot assign
//~^^ ERROR cannot assign
}