Fix fallout from coercion removal
This commit is contained in:
parent
803aacd5ae
commit
ca08540a00
142 changed files with 1269 additions and 1283 deletions
|
|
@ -52,7 +52,7 @@ impl Noise2DContext {
|
|||
for (i, x) in permutations.iter_mut().enumerate() {
|
||||
*x = i as i32;
|
||||
}
|
||||
rng.shuffle(permutations);
|
||||
rng.shuffle(&mut permutations);
|
||||
|
||||
Noise2DContext { rgradients: rgradients, permutations: permutations }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ impl Perm {
|
|||
fn max(&self) -> u32 { self.fact[self.n as uint] }
|
||||
|
||||
fn next(&mut self) -> P {
|
||||
next_permutation(self.perm.p, self.cnt);
|
||||
next_permutation(&mut self.perm.p, &mut self.cnt);
|
||||
self.permcount += 1;
|
||||
|
||||
self.perm
|
||||
|
|
@ -141,7 +141,7 @@ fn work(mut perm: Perm, n: uint, max: uint) -> (i32, i32) {
|
|||
|
||||
while p.p[0] != 1 {
|
||||
let k = p.p[0] as uint;
|
||||
reverse(p.p, k);
|
||||
reverse(&mut p.p, k);
|
||||
flips += 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ impl<'a, W: Writer> RandomFasta<'a, W> {
|
|||
buf[i] = self.nextc();
|
||||
}
|
||||
buf[LINE_LEN] = '\n' as u8;
|
||||
try!(self.out.write(buf));
|
||||
try!(self.out.write(&buf));
|
||||
}
|
||||
for i in range(0u, chars_left) {
|
||||
buf[i] = self.nextc();
|
||||
|
|
@ -225,12 +225,12 @@ fn main() {
|
|||
}
|
||||
|
||||
out.write_line(">TWO IUB ambiguity codes").unwrap();
|
||||
let iub = sum_and_scale(IUB);
|
||||
let iub = sum_and_scale(&IUB);
|
||||
let mut random = RandomFasta::new(&mut out, iub.as_slice());
|
||||
random.make(n * 3).unwrap();
|
||||
|
||||
random.out.write_line(">THREE Homo sapiens frequency").unwrap();
|
||||
let homo_sapiens = sum_and_scale(HOMO_SAPIENS);
|
||||
let homo_sapiens = sum_and_scale(&HOMO_SAPIENS);
|
||||
random.lookup = make_lookup(homo_sapiens.as_slice());
|
||||
random.make(n * 5).unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ fn main() {
|
|||
|
||||
let mut f = File::open(&Path::new("something.txt"));
|
||||
let mut buff = [0u8, ..16];
|
||||
match f.read(buff) {
|
||||
match f.read(&mut buff) {
|
||||
Ok(cnt) => println!("read this many bytes: {}", cnt),
|
||||
Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_string()),
|
||||
//~^ ERROR variable `EndOfFile` should have a snake case name such as `end_of_file`
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ enum Enum {
|
|||
}
|
||||
|
||||
fn vectors_with_nested_enums() {
|
||||
let x: &'static [Enum] = [First, Second(false)];
|
||||
let x: &'static [Enum] = &[First, Second(false)];
|
||||
match x {
|
||||
//~^ ERROR non-exhaustive patterns: `[Second(true), Second(false)]` not covered
|
||||
[] => (),
|
||||
|
|
|
|||
|
|
@ -39,8 +39,9 @@ pub fn bar() {
|
|||
() => {
|
||||
#[inline]
|
||||
#[allow(dead_code)]
|
||||
static __STATIC_FMTSTR: [&'static str, ..(1u as uint)] =
|
||||
([("test" as &'static str)] as [&'static str, ..1]);
|
||||
static __STATIC_FMTSTR: &'static [&'static str] =
|
||||
(&([("test" as &'static str)] as [&'static str, ..1]) as
|
||||
&'static [&'static str, ..1]);
|
||||
let __args_vec =
|
||||
(&([] as [core::fmt::Argument<'_>, ..0]) as
|
||||
&[core::fmt::Argument<'_>, ..0]);
|
||||
|
|
@ -49,7 +50,7 @@ pub fn bar() {
|
|||
((::std::fmt::Arguments::new as
|
||||
unsafe fn(&'static [&'static str], &'a [core::fmt::Argument<'a>]) -> core::fmt::Arguments<'a>)((__STATIC_FMTSTR
|
||||
as
|
||||
[&'static str, ..1]),
|
||||
&'static [&'static str]),
|
||||
(__args_vec
|
||||
as
|
||||
&[core::fmt::Argument<'_>, ..0]))
|
||||
|
|
|
|||
|
|
@ -53,5 +53,5 @@ pub fn main() {
|
|||
// Call a method
|
||||
z.iterate(|y| { assert!(z[*y as uint] == *y); true });
|
||||
// Call a parameterized function
|
||||
assert_eq!(length::<int, &[int]>(z), z.len());
|
||||
assert_eq!(length::<int, &[int]>(&z), z.len());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn get<'a, T>(ms: &'a MutSlice<'a, T>, index: uint) -> &'a T {
|
|||
pub fn main() {
|
||||
let mut data = [1i, 2, 3];
|
||||
{
|
||||
let slice = MutSlice { data: data };
|
||||
let slice = MutSlice { data: &mut data };
|
||||
slice.data[0] += 4;
|
||||
let index0 = get(&slice, 0);
|
||||
let index1 = get(&slice, 1);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ fn each<T>(x: &[T], f: |&T|) {
|
|||
fn main() {
|
||||
let mut sum = 0u;
|
||||
let elems = [ 1u, 2, 3, 4, 5 ];
|
||||
each(elems, |val| sum += *val);
|
||||
each(&elems, |val| sum += *val);
|
||||
assert_eq!(sum, 15);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) {
|
|||
fn main() {
|
||||
let mut sum = 0u;
|
||||
let elems = [ 1u, 2, 3, 4, 5 ];
|
||||
each(elems, |&mut: val: &uint| sum += *val);
|
||||
each(&elems, |&mut: val: &uint| sum += *val);
|
||||
assert_eq!(sum, 15);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ extern crate cci_iter_lib;
|
|||
pub fn main() {
|
||||
//let bt0 = sys::rusti::frame_address(1u32);
|
||||
//println!("%?", bt0);
|
||||
cci_iter_lib::iter([1i, 2, 3], |i| {
|
||||
cci_iter_lib::iter(&[1i, 2, 3], |i| {
|
||||
println!("{}", *i);
|
||||
//assert!(bt0 == sys::rusti::frame_address(2u32));
|
||||
})
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ const C: *const u8 = B as *const u8;
|
|||
pub fn main() {
|
||||
unsafe {
|
||||
let foo = &A as *const u8;
|
||||
assert_eq!(str::raw::from_utf8(A), "hi");
|
||||
assert_eq!(str::raw::from_utf8(&A), "hi");
|
||||
assert_eq!(string::raw::from_buf_len(foo, A.len()), "hi".to_string());
|
||||
assert_eq!(string::raw::from_buf_len(C, B.len()), "hi".to_string());
|
||||
assert!(*C == A[0]);
|
||||
assert!(*(&B[0] as *const u8) == A[0]);
|
||||
|
||||
let bar = str::raw::from_utf8(A).to_c_str();
|
||||
let bar = str::raw::from_utf8(&A).to_c_str();
|
||||
assert_eq!(bar.as_str(), "hi".to_c_str().as_str());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ fn f(_: &[int]) {}
|
|||
|
||||
pub fn main() {
|
||||
let v = [ 1, 2, 3 ];
|
||||
f(v);
|
||||
f(&v);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
static x : [int, ..4] = [1,2,3,4];
|
||||
static y : &'static [int] = &[1,2,3,4];
|
||||
static z : &'static [int, ..4] = &[1,2,3,4];
|
||||
static zz : &'static [int] = [1,2,3,4];
|
||||
static zz : &'static [int] = &[1,2,3,4];
|
||||
|
||||
pub fn main() {
|
||||
println!("{}", x[1]);
|
||||
|
|
|
|||
|
|
@ -72,11 +72,11 @@ fn main() {
|
|||
let r = &1i;
|
||||
let r: [&Foo, ..2] = [r, ..2];
|
||||
let _n = F {
|
||||
t: r
|
||||
t: &r
|
||||
};
|
||||
let x: [&Foo, ..2] = [&1i, &2i];
|
||||
let _n = F {
|
||||
t: x
|
||||
t: &x
|
||||
};
|
||||
|
||||
struct M<'a> {
|
||||
|
|
@ -87,6 +87,6 @@ fn main() {
|
|||
};
|
||||
let x: [Box<Foo>, ..2] = [box 1i, box 2i];
|
||||
let _n = M {
|
||||
t: x
|
||||
t: &x
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ impl<S: Stream, H: StreamHasher<S>> Hash<H> for u8 {
|
|||
|
||||
impl<S: Stream, H: StreamHasher<S>> StreamHash<S, H> for u8 {
|
||||
fn input_stream(&self, stream: &mut S) {
|
||||
stream.input([*self]);
|
||||
stream.input(&[*self]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ fn main() {
|
|||
let args = os::args();
|
||||
if args.len() > 1 {
|
||||
let mut out = stdio::stdout();
|
||||
out.write(['a' as u8, ..128 * 1024]).unwrap();
|
||||
out.write(&['a' as u8, ..128 * 1024]).unwrap();
|
||||
} else {
|
||||
let out = Command::new(args[0].as_slice()).arg("child").output();
|
||||
let out = out.unwrap();
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ fn main() {
|
|||
break
|
||||
}
|
||||
}
|
||||
assert!(result.as_slice() == [2, 4]);
|
||||
assert!(result.as_slice() == &[2, 4]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ fn read_board_grid<rdr:'static + io::Reader>(mut input: rdr)
|
|||
let mut input: &mut io::Reader = &mut input;
|
||||
let mut grid = Vec::new();
|
||||
let mut line = [0, ..10];
|
||||
input.read(line);
|
||||
input.read(&mut line);
|
||||
let mut row = Vec::new();
|
||||
for c in line.iter() {
|
||||
row.push(square_from_char(*c as char))
|
||||
|
|
|
|||
|
|
@ -33,6 +33,6 @@ fn main() {
|
|||
let out = bar("baz", "foo");
|
||||
let [a, xs.., d] = out;
|
||||
assert_eq!(a, "baz");
|
||||
assert!(xs == ["foo", "foo"]);
|
||||
assert!(xs == &["foo", "foo"]);
|
||||
assert_eq!(d, "baz");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
use std::io;
|
||||
|
||||
fn foo(a: &mut io::Writer) {
|
||||
a.write([]).unwrap();
|
||||
a.write(&[]).unwrap();
|
||||
}
|
||||
|
||||
pub fn main(){}
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static DATA:&'static [&'static str] = ["my string"];
|
||||
static DATA:&'static [&'static str] = &["my string"];
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ fn foo(x: &[int]) -> int {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
let p = [1,2,3,4,5];
|
||||
let p = &[1,2,3,4,5];
|
||||
assert_eq!(foo(p), 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ fn rename_directory() {
|
|||
|
||||
let tmpdir = TempDir::new("rename_directory").ok().expect("rename_directory failed");
|
||||
let tmpdir = tmpdir.path();
|
||||
let old_path = tmpdir.join_many(["foo", "bar", "baz"]);
|
||||
let old_path = tmpdir.join_many(&["foo", "bar", "baz"]);
|
||||
fs::mkdir_recursive(&old_path, io::USER_RWX);
|
||||
let test_file = &old_path.join("temp.txt");
|
||||
|
||||
|
|
@ -46,11 +46,11 @@ fn rename_directory() {
|
|||
});
|
||||
assert_eq!(libc::fclose(ostream), (0u as libc::c_int));
|
||||
|
||||
let new_path = tmpdir.join_many(["quux", "blat"]);
|
||||
let new_path = tmpdir.join_many(&["quux", "blat"]);
|
||||
fs::mkdir_recursive(&new_path, io::USER_RWX);
|
||||
fs::rename(&old_path, &new_path.join("newdir"));
|
||||
assert!(new_path.join("newdir").is_dir());
|
||||
assert!(new_path.join_many(["newdir", "temp.txt"]).exists());
|
||||
assert!(new_path.join_many(&["newdir", "temp.txt"]).exists());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn test() {
|
|||
let mut writer = PipeStream::open(writer);
|
||||
drop(reader);
|
||||
|
||||
let _ = writer.write([1]);
|
||||
let _ = writer.write(&[1]);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub fn main() {
|
|||
Ok(f) => {
|
||||
let mut f = f;
|
||||
for _ in range(0u, 1000) {
|
||||
f.write([0]);
|
||||
f.write(&[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,17 +27,17 @@ pub fn main() {
|
|||
|
||||
assert!((str::is_utf8(s.as_bytes())));
|
||||
// invalid prefix
|
||||
assert!((!str::is_utf8([0x80_u8])));
|
||||
assert!((!str::is_utf8(&[0x80_u8])));
|
||||
// invalid 2 byte prefix
|
||||
assert!((!str::is_utf8([0xc0_u8])));
|
||||
assert!((!str::is_utf8([0xc0_u8, 0x10_u8])));
|
||||
assert!((!str::is_utf8(&[0xc0_u8])));
|
||||
assert!((!str::is_utf8(&[0xc0_u8, 0x10_u8])));
|
||||
// invalid 3 byte prefix
|
||||
assert!((!str::is_utf8([0xe0_u8])));
|
||||
assert!((!str::is_utf8([0xe0_u8, 0x10_u8])));
|
||||
assert!((!str::is_utf8([0xe0_u8, 0xff_u8, 0x10_u8])));
|
||||
assert!((!str::is_utf8(&[0xe0_u8])));
|
||||
assert!((!str::is_utf8(&[0xe0_u8, 0x10_u8])));
|
||||
assert!((!str::is_utf8(&[0xe0_u8, 0xff_u8, 0x10_u8])));
|
||||
// invalid 4 byte prefix
|
||||
assert!((!str::is_utf8([0xf0_u8])));
|
||||
assert!((!str::is_utf8([0xf0_u8, 0x10_u8])));
|
||||
assert!((!str::is_utf8([0xf0_u8, 0xff_u8, 0x10_u8])));
|
||||
assert!((!str::is_utf8([0xf0_u8, 0xff_u8, 0xff_u8, 0x10_u8])));
|
||||
assert!((!str::is_utf8(&[0xf0_u8])));
|
||||
assert!((!str::is_utf8(&[0xf0_u8, 0x10_u8])));
|
||||
assert!((!str::is_utf8(&[0xf0_u8, 0xff_u8, 0x10_u8])));
|
||||
assert!((!str::is_utf8(&[0xf0_u8, 0xff_u8, 0xff_u8, 0x10_u8])));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,17 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn sub_expr() {
|
||||
// Test for a &[T] => &&[T] coercion in sub-expression position
|
||||
// (surprisingly, this can cause errors which are not caused by either of:
|
||||
// `let x = vec.slice_mut(0, 2);`
|
||||
// `foo(vec.slice_mut(0, 2));` ).
|
||||
let mut vec: Vec<int> = vec!(1, 2, 3, 4);
|
||||
let b: &mut [int] = [1, 2];
|
||||
assert!(vec.slice_mut(0, 2) == b);
|
||||
}
|
||||
|
||||
fn index() {
|
||||
pub fn main() {
|
||||
// Tests for indexing into box/& [T, ..n]
|
||||
let x: [int, ..3] = [1, 2, 3];
|
||||
let mut x: Box<[int, ..3]> = box x;
|
||||
|
|
@ -40,8 +30,3 @@ fn index() {
|
|||
assert!(x[1] == 45);
|
||||
assert!(x[2] == 3);
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
sub_expr();
|
||||
index();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ fn foldr<T,U:Clone>(values: &[T],
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
let x = [1i, 2, 3, 4, 5];
|
||||
let x = &[1i, 2, 3, 4, 5];
|
||||
|
||||
let product = foldl(x, 1i, |a, b| a * *b);
|
||||
assert_eq!(product, 120);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue