Add : Box<_> or ::Box<_> type annotations to various places.

This is the kind of change that one is expected to need to make to
accommodate overloaded-`box`.

----

Note that this is not *all* of the changes necessary to accommodate
Issue 22181.  It is merely the subset of those cases where there was
already a let-binding in place that made it easy to add the necesasry
type ascription.

(For unnamed intermediate `Box` values, one must go down a different
route; `Box::new` is the option that maximizes portability, but has
potential inefficiency depending on whether the call is inlined.)

----

There is one place worth note, `run-pass/coerce-match.rs`, where I
used an ugly form of `Box<_>` type ascription where I would have
preferred to use `Box::new` to accommodate overloaded-`box`.  I
deliberately did not use `Box::new` here, because that is already done
in coerce-match-calls.rs.

----

Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
This commit is contained in:
Felix S. Klock II 2015-02-17 21:41:32 +01:00
parent 14f0942a49
commit 270f0eef73
164 changed files with 281 additions and 264 deletions

View file

@ -69,6 +69,8 @@
//! }
//! ```
use boxed::Box;
use core::prelude::*;
use core::atomic;
@ -170,7 +172,7 @@ impl<T> Arc<T> {
pub fn new(data: T) -> Arc<T> {
// Start the weak pointer count as 1 which is the weak pointer that's
// held by all the strong pointers (kinda), see std/rc.rs for more info
let x = box ArcInner {
let x: Box<_> = box ArcInner {
strong: atomic::AtomicUsize::new(1),
weak: atomic::AtomicUsize::new(1),
data: data,

View file

@ -387,6 +387,7 @@ mod test {
extern crate test;
use self::test::Bencher;
use core::ptr::PtrExt;
use boxed::Box;
use heap;
#[test]
@ -404,7 +405,7 @@ fn basic_reallocate_inplace_noop() {
#[bench]
fn alloc_owned_small(b: &mut Bencher) {
b.iter(|| {
box 10
let _: Box<_> = box 10;
})
}
}

View file

@ -96,9 +96,15 @@
// Primitive types using the heaps above
// Need to conditionally define the mod from `boxed.rs` to avoid
// duplicating the lang-items when building in test cfg; but also need
// to allow code to have `use boxed::HEAP;`
// and `use boxed::Box;` declarations.
#[cfg(not(test))]
pub mod boxed;
#[cfg(test)]
mod boxed { pub use std::boxed::{Box, HEAP}; }
#[cfg(test)]
mod boxed_test;
pub mod arc;
pub mod rc;

View file

@ -795,6 +795,7 @@ fn inner(&self) -> &RcBox<T> {
#[cfg(test)]
mod tests {
use super::{Rc, Weak, weak_count, strong_count};
use std::boxed::Box;
use std::cell::RefCell;
use std::option::Option;
use std::option::Option::{Some, None};
@ -826,7 +827,7 @@ fn test_simple_clone() {
#[test]
fn test_destructor() {
let x = Rc::new(box 5);
let x: Rc<Box<_>> = Rc::new(box 5);
assert_eq!(**x, 5);
}

View file

@ -581,11 +581,11 @@ pub fn bench_copy(b: &mut Bencher) {
#[bench]
pub fn bench_copy_nonarena(b: &mut Bencher) {
b.iter(|| {
box Point {
let _: Box<_> = box Point {
x: 1,
y: 2,
z: 3,
}
};
})
}
@ -634,10 +634,10 @@ pub fn bench_noncopy(b: &mut Bencher) {
#[bench]
pub fn bench_noncopy_nonarena(b: &mut Bencher) {
b.iter(|| {
box Noncopy {
let _: Box<_> = box Noncopy {
string: "hello world".to_string(),
array: vec!( 1, 2, 3, 4, 5 ),
}
};
})
}

View file

@ -790,7 +790,7 @@ fn test_push() {
#[test]
fn test_push_unique() {
let mut heap = BinaryHeap::from_vec(vec![box 2, box 4, box 9]);
let mut heap = BinaryHeap::<Box<_>>::from_vec(vec![box 2, box 4, box 9]);
assert_eq!(heap.len(), 3);
assert!(*heap.peek().unwrap() == box 9);
heap.push(box 11);

View file

@ -984,7 +984,7 @@ pub fn check_links<T>(list: &LinkedList<T>) {
#[test]
fn test_basic() {
let mut m = LinkedList::new();
let mut m = LinkedList::<Box<_>>::new();
assert_eq!(m.pop_front(), None);
assert_eq!(m.pop_back(), None);
assert_eq!(m.pop_front(), None);

View file

@ -1509,6 +1509,7 @@ unsafe fn step<T>(ptr: &mut *mut T) -> *mut T {
#[cfg(test)]
mod tests {
use alloc::boxed::Box;
use core::cmp::Ordering::{Greater, Less, Equal};
use core::prelude::{Some, None, Clone};
use core::prelude::{Iterator, IteratorExt};
@ -1799,7 +1800,7 @@ fn test_swap_remove_fail() {
#[test]
fn test_swap_remove_noncopyable() {
// Tests that we don't accidentally run destructors twice.
let mut v = Vec::new();
let mut v: Vec<Box<_>> = Vec::new();
v.push(box 0u8);
v.push(box 0u8);
v.push(box 0u8);
@ -1828,7 +1829,7 @@ fn test_push() {
#[test]
fn test_truncate() {
let mut v = vec![box 6,box 5,box 4];
let mut v: Vec<Box<_>> = vec![box 6,box 5,box 4];
v.truncate(1);
let v = v;
assert_eq!(v.len(), 1);
@ -1838,7 +1839,7 @@ fn test_truncate() {
#[test]
fn test_clear() {
let mut v = vec![box 6,box 5,box 4];
let mut v: Vec<Box<_>> = vec![box 6,box 5,box 4];
v.clear();
assert_eq!(v.len(), 0);
// If the unsafe block didn't drop things properly, we blow up here.
@ -1863,11 +1864,11 @@ fn case(a: Vec<i32>, b: Vec<i32>) {
#[test]
fn test_dedup_unique() {
let mut v0 = vec![box 1, box 1, box 2, box 3];
let mut v0: Vec<Box<_>> = vec![box 1, box 1, box 2, box 3];
v0.dedup();
let mut v1 = vec![box 1, box 2, box 2, box 3];
let mut v1: Vec<Box<_>> = vec![box 1, box 2, box 2, box 3];
v1.dedup();
let mut v2 = vec![box 1, box 2, box 3, box 3];
let mut v2: Vec<Box<_>> = vec![box 1, box 2, box 3, box 3];
v2.dedup();
/*
* If the boxed pointers were leaked or otherwise misused, valgrind
@ -1877,11 +1878,11 @@ fn test_dedup_unique() {
#[test]
fn test_dedup_shared() {
let mut v0 = vec![box 1, box 1, box 2, box 3];
let mut v0: Vec<Box<_>> = vec![box 1, box 1, box 2, box 3];
v0.dedup();
let mut v1 = vec![box 1, box 2, box 2, box 3];
let mut v1: Vec<Box<_>> = vec![box 1, box 2, box 2, box 3];
v1.dedup();
let mut v2 = vec![box 1, box 2, box 3, box 3];
let mut v2: Vec<Box<_>> = vec![box 1, box 2, box 3, box 3];
v2.dedup();
/*
* If the pointers were leaked or otherwise misused, valgrind and/or
@ -2254,8 +2255,9 @@ fn test_slice_2() {
#[test]
#[should_fail]
fn test_permute_fail() {
let v = [(box 0, Rc::new(0)), (box 0, Rc::new(0)),
(box 0, Rc::new(0)), (box 0, Rc::new(0))];
let v: [(Box<_>, Rc<_>); 4] =
[(box 0, Rc::new(0)), (box 0, Rc::new(0)),
(box 0, Rc::new(0)), (box 0, Rc::new(0))];
let mut i = 0;
for _ in v.permutations() {
if i == 2 {
@ -2849,7 +2851,7 @@ fn test_mut_last() {
#[test]
fn test_to_vec() {
let xs = box [1, 2, 3];
let xs: Box<_> = box [1, 2, 3];
let ys = xs.to_vec();
assert_eq!(ys, [1, 2, 3]);
}

View file

@ -2130,8 +2130,8 @@ fn test_clone() {
#[test]
fn test_clone_from() {
let mut v = vec!();
let three = vec!(box 1, box 2, box 3);
let two = vec!(box 4, box 5);
let three: Vec<Box<_>> = vec!(box 1, box 2, box 3);
let two: Vec<Box<_>> = vec!(box 4, box 5);
// zero, long
v.clone_from(&three);
assert_eq!(v, three);

View file

@ -1205,7 +1205,7 @@ fn test_mut_rev_iterator() {
#[test]
fn test_move_iter() {
let mut m = VecMap::new();
let mut m: VecMap<Box<_>> = VecMap::new();
m.insert(1, box 2);
let mut called = false;
for (k, v) in m {

View file

@ -68,7 +68,7 @@ fn any_downcast_ref() {
#[test]
fn any_downcast_mut() {
let mut a = 5_usize;
let mut b = box 7_usize;
let mut b: Box<_> = box 7_usize;
let a_r = &mut a as &mut Any;
let tmp: &mut uint = &mut *b;

View file

@ -16,7 +16,7 @@
#[test]
fn test_get_ptr() {
unsafe {
let x = box 0;
let x: Box<_> = box 0;
let addr_x: *const int = mem::transmute(&*x);
let opt = Some(x);
let y = opt.unwrap();

View file

@ -606,7 +606,7 @@ fn test_sha256() {
let tests = wikipedia_tests;
let mut sh = box Sha256::new();
let mut sh: Box<_> = box Sha256::new();
test_hash(&mut *sh, &tests);
}

View file

@ -323,22 +323,22 @@ fn read_ipv6_addr(&mut self) -> Option<IpAddr> {
}
fn read_ip_addr(&mut self) -> Option<IpAddr> {
let ipv4_addr = |p: &mut Parser| p.read_ipv4_addr();
let ipv6_addr = |p: &mut Parser| p.read_ipv6_addr();
self.read_or(&mut [box ipv4_addr, box ipv6_addr])
let ipv4_addr: Box<_> = box |p: &mut Parser| p.read_ipv4_addr();
let ipv6_addr: Box<_> = box |p: &mut Parser| p.read_ipv6_addr();
self.read_or(&mut [ipv4_addr, ipv6_addr])
}
fn read_socket_addr(&mut self) -> Option<SocketAddr> {
let ip_addr = |p: &mut Parser| {
let ipv4_p = |p: &mut Parser| p.read_ip_addr();
let ipv6_p = |p: &mut Parser| {
let ipv4_p: Box<_> = box |p: &mut Parser| p.read_ip_addr();
let ipv6_p: Box<_> = box |p: &mut Parser| {
let open_br = |p: &mut Parser| p.read_given_char('[');
let ip_addr = |p: &mut Parser| p.read_ipv6_addr();
let clos_br = |p: &mut Parser| p.read_given_char(']');
p.read_seq_3::<char, IpAddr, char, _, _, _>(open_br, ip_addr, clos_br)
.map(|t| match t { (_, ip, _) => ip })
};
p.read_or(&mut [box ipv4_p, box ipv6_p])
p.read_or(&mut [ipv4_p, ipv6_p])
};
let colon = |p: &mut Parser| p.read_given_char(':');
let port = |p: &mut Parser| p.read_number(10, 5, 0x10000).map(|n| n as u16);

View file

@ -1044,13 +1044,13 @@ fn smoke() {
#[test]
fn drop_full() {
let (tx, _rx) = channel();
let (tx, _rx) = channel::<Box<int>>();
tx.send(box 1).unwrap();
}
#[test]
fn drop_full_shared() {
let (tx, _rx) = channel();
let (tx, _rx) = channel::<Box<int>>();
drop(tx.clone());
drop(tx.clone());
tx.send(box 1).unwrap();
@ -1389,7 +1389,7 @@ fn oneshot_multi_thread_recv_close_stress() {
#[test]
fn oneshot_multi_thread_send_recv_stress() {
for _ in 0..stress_factor() {
let (tx, rx) = channel();
let (tx, rx) = channel::<Box<int>>();
let _t = thread::spawn(move|| {
tx.send(box 10).unwrap();
});
@ -1566,7 +1566,7 @@ fn smoke() {
#[test]
fn drop_full() {
let (tx, _rx) = sync_channel(1);
let (tx, _rx) = sync_channel::<Box<int>>(1);
tx.send(box 1).unwrap();
}

View file

@ -164,7 +164,7 @@ mod tests {
#[test]
fn test_full() {
let q = Queue::new();
let q: Queue<Box<_>> = Queue::new();
q.push(box 1);
q.push(box 2);
}

View file

@ -289,7 +289,7 @@ fn peek() {
#[test]
fn drop_full() {
unsafe {
let q = Queue::new(0);
let q: Queue<Box<_>> = Queue::new(0);
q.push(box 1);
q.push(box 2);
}

View file

@ -804,7 +804,7 @@ fn test_spawn_sched_childs_on_default_sched() {
fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Thunk<'static>) {
let (tx, rx) = channel();
let x = box 1;
let x: Box<_> = box 1;
let x_in_parent = (&*x) as *const i32 as usize;
spawnfn(Thunk::new(move|| {

View file

@ -146,7 +146,7 @@ fn new() -> Table {
fn search_remainder<C:TableCallback>(item: &mut Entry, key: Code, c: C) {
match item.next {
None => {
let mut entry = box Entry {
let mut entry: Box<_> = box Entry {
code: key,
count: 0,
next: None,
@ -170,7 +170,7 @@ fn lookup<C:TableCallback>(&mut self, key: Code, c: C) {
{
if self.items[index as usize].is_none() {
let mut entry = box Entry {
let mut entry: Box<_> = box Entry {
code: key,
count: 0,
next: None,

View file

@ -124,7 +124,7 @@ pub fn solve(&mut self) {
fn next_color(&mut self, row: u8, col: u8, start_color: u8) -> bool {
if start_color < 10u8 {
// colors not yet used
let mut avail = box Colors::new(start_color);
let mut avail: Box<_> = box Colors::new(start_color);
// drop colors already in use in neighbourhood
self.drop_colors(&mut *avail, row, col);

View file

@ -16,7 +16,7 @@
struct Bar(isize, isize);
fn main() {
let x = (box 1, 2);
let x: (Box<_>, _) = (box 1, 2);
let r = &x.0;
let y = x; //~ ERROR cannot move out of `x` because it is borrowed

View file

@ -23,7 +23,7 @@ fn add(v: &usize, w: usize) -> usize {
}
fn implicit() {
let mut a = box 1;
let mut a: Box<_> = box 1;
// Note the danger here:
//
@ -36,7 +36,7 @@ fn implicit() {
}
fn explicit() {
let mut a = box 1;
let mut a: Box<_> = box 1;
add(
&*a,
rewrite(&mut a)); //~ ERROR cannot borrow

View file

@ -23,7 +23,7 @@ fn add(v: &usize, w: Box<usize>) -> usize {
}
fn implicit() {
let mut a = box 1;
let mut a: Box<_> = box 1;
// Note the danger here:
//
@ -36,7 +36,7 @@ fn implicit() {
}
fn explicit() {
let mut a = box 1;
let mut a: Box<_> = box 1;
add(
&*a,
a); //~ ERROR cannot move

View file

@ -18,7 +18,7 @@ fn foo(&mut self) {
}
pub fn main() {
let a = box A;
let a: Box<_> = box A;
a.foo();
//~^ ERROR cannot borrow immutable `Box` content `*a` as mutable
}

View file

@ -31,100 +31,100 @@ struct D {
}
fn copy_after_move() {
let a = box A { x: box 0, y: 1 };
let a: Box<_> = box A { x: box 0, y: 1 };
let _x = a.x;
let _y = a.y; //~ ERROR use of moved
//~^^ NOTE `a` moved here (through moving `a.x`)
}
fn move_after_move() {
let a = box B { x: box 0, y: box 1 };
let a: Box<_> = box B { x: box 0, y: box 1 };
let _x = a.x;
let _y = a.y; //~ ERROR use of moved
//~^^ NOTE `a` moved here (through moving `a.x`)
}
fn borrow_after_move() {
let a = box A { x: box 0, y: 1 };
let a: Box<_> = box A { x: box 0, y: 1 };
let _x = a.x;
let _y = &a.y; //~ ERROR use of moved
//~^^ NOTE `a` moved here (through moving `a.x`)
}
fn move_after_borrow() {
let a = box B { x: box 0, y: box 1 };
let a: Box<_> = box B { x: box 0, y: box 1 };
let _x = &a.x;
let _y = a.y; //~ ERROR cannot move
}
fn copy_after_mut_borrow() {
let mut a = box A { x: box 0, y: 1 };
let mut a: Box<_> = box A { x: box 0, y: 1 };
let _x = &mut a.x;
let _y = a.y; //~ ERROR cannot use
}
fn move_after_mut_borrow() {
let mut a = box B { x: box 0, y: box 1 };
let mut a: Box<_> = box B { x: box 0, y: box 1 };
let _x = &mut a.x;
let _y = a.y; //~ ERROR cannot move
}
fn borrow_after_mut_borrow() {
let mut a = box A { x: box 0, y: 1 };
let mut a: Box<_> = box A { x: box 0, y: 1 };
let _x = &mut a.x;
let _y = &a.y; //~ ERROR cannot borrow
}
fn mut_borrow_after_borrow() {
let mut a = box A { x: box 0, y: 1 };
let mut a: Box<_> = box A { x: box 0, y: 1 };
let _x = &a.x;
let _y = &mut a.y; //~ ERROR cannot borrow
}
fn copy_after_move_nested() {
let a = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = a.x.x;
let _y = a.y; //~ ERROR use of collaterally moved
}
fn move_after_move_nested() {
let a = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let _x = a.x.x;
let _y = a.y; //~ ERROR use of collaterally moved
}
fn borrow_after_move_nested() {
let a = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = a.x.x;
let _y = &a.y; //~ ERROR use of collaterally moved
}
fn move_after_borrow_nested() {
let a = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let _x = &a.x.x;
let _y = a.y; //~ ERROR cannot move
}
fn copy_after_mut_borrow_nested() {
let mut a = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = &mut a.x.x;
let _y = a.y; //~ ERROR cannot use
}
fn move_after_mut_borrow_nested() {
let mut a = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let _x = &mut a.x.x;
let _y = a.y; //~ ERROR cannot move
}
fn borrow_after_mut_borrow_nested() {
let mut a = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = &mut a.x.x;
let _y = &a.y; //~ ERROR cannot borrow
}
fn mut_borrow_after_borrow_nested() {
let mut a = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = &a.x.x;
let _y = &mut a.y; //~ ERROR cannot borrow
}

View file

@ -52,7 +52,7 @@ fn e() {
}
fn f() {
let mut x = box 3;
let mut x: Box<_> = box 3;
let c1 = || get(&*x);
*x = 5; //~ ERROR cannot assign
}
@ -62,7 +62,7 @@ struct Foo {
f: Box<isize>
}
let mut x = box Foo { f: box 3 };
let mut x: Box<_> = box Foo { f: box 3 };
let c1 = || get(&*x.f);
*x.f = 5; //~ ERROR cannot assign to `*x.f`
}
@ -72,7 +72,7 @@ struct Foo {
f: Box<isize>
}
let mut x = box Foo { f: box 3 };
let mut x: Box<_> = box Foo { f: box 3 };
let c1 = || get(&*x.f);
let c2 = || *x.f = 5; //~ ERROR cannot borrow `x` as mutable
}

View file

@ -50,7 +50,7 @@ struct Foo {
f: Box<isize>
}
let mut x = box Foo { f: box 3 };
let mut x: Box<_> = box Foo { f: box 3 };
let c1 = to_fn_mut(|| set(&mut *x.f));
let c2 = to_fn_mut(|| set(&mut *x.f));
//~^ ERROR cannot borrow `x` as mutable more than once

View file

@ -25,7 +25,7 @@ fn drop(&mut self) {
}
fn main() {
let mut ptr = box Foo { x: 0 };
let mut ptr: Box<_> = box Foo { x: 0 };
let mut test = |foo: &Foo| {
ptr = box Foo { x: ptr.x + 1 };
};

View file

@ -28,7 +28,7 @@ fn main() {
for &a in &f.a { //~ ERROR cannot move out
}
let x = Some(box 1);
let x: Option<Box<_>> = Some(box 1);
for &a in x.iter() { //~ ERROR cannot move out
}
}

View file

@ -18,7 +18,7 @@ struct B<'a> { a: Box<&'a mut isize> }
fn borrow_in_var_from_var() {
let mut x: isize = 1;
let y = box &mut x;
let y: Box<_> = box &mut x;
let p = &y;
let q = &***p;
**y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
@ -28,7 +28,7 @@ fn borrow_in_var_from_var() {
fn borrow_in_var_from_field() {
let mut x = A { a: 1 };
let y = box &mut x.a;
let y: Box<_> = box &mut x.a;
let p = &y;
let q = &***p;
**y = 2; //~ ERROR cannot assign to `**y` because it is borrowed

View file

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = Some(box 1);
let x: Option<Box<_>> = Some(box 1);
match x {
Some(ref _y) => {
let _a = x; //~ ERROR cannot move

View file

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = Some(box 1);
let x: Option<Box<_>> = Some(box 1);
match x {
Some(ref y) => {
let _b = *y; //~ ERROR cannot move out

View file

@ -30,7 +30,7 @@ fn pre_freeze_cond() {
// In this instance, the freeze is conditional and starts before
// the mut borrow.
let mut v = box 3;
let mut v: Box<_> = box 3;
let _w;
if cond() {
_w = &v;
@ -42,7 +42,7 @@ fn pre_freeze_else() {
// In this instance, the freeze and mut borrow are on separate sides
// of the if.
let mut v = box 3;
let mut v: Box<_> = box 3;
let _w;
if cond() {
_w = &v;

View file

@ -28,7 +28,7 @@ fn inc(v: &mut Box<isize>) {
fn loop_overarching_alias_mut() {
// In this instance, the borrow encompasses the entire loop.
let mut v = box 3;
let mut v: Box<_> = box 3;
let mut x = &mut v;
**x += 1;
loop {
@ -39,7 +39,7 @@ fn loop_overarching_alias_mut() {
fn block_overarching_alias_mut() {
// In this instance, the borrow encompasses the entire closure call.
let mut v = box 3;
let mut v: Box<_> = box 3;
let mut x = &mut v;
for _ in 0..3 {
borrow(&*v); //~ ERROR cannot borrow
@ -50,8 +50,8 @@ fn block_overarching_alias_mut() {
fn loop_aliased_mut() {
// In this instance, the borrow is carried through the loop.
let mut v = box 3;
let mut w = box 4;
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
let mut _x = &w;
loop {
borrow_mut(&mut *v); //~ ERROR cannot borrow
@ -62,8 +62,8 @@ fn loop_aliased_mut() {
fn while_aliased_mut() {
// In this instance, the borrow is carried through the loop.
let mut v = box 3;
let mut w = box 4;
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
let mut _x = &w;
while cond() {
borrow_mut(&mut *v); //~ ERROR cannot borrow
@ -75,8 +75,8 @@ fn while_aliased_mut() {
fn loop_aliased_mut_break() {
// In this instance, the borrow is carried through the loop.
let mut v = box 3;
let mut w = box 4;
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
let mut _x = &w;
loop {
borrow_mut(&mut *v);
@ -89,8 +89,8 @@ fn loop_aliased_mut_break() {
fn while_aliased_mut_break() {
// In this instance, the borrow is carried through the loop.
let mut v = box 3;
let mut w = box 4;
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
let mut _x = &w;
while cond() {
borrow_mut(&mut *v);
@ -101,8 +101,8 @@ fn while_aliased_mut_break() {
}
fn while_aliased_mut_cond(cond: bool, cond2: bool) {
let mut v = box 3;
let mut w = box 4;
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
let mut x = &mut w;
while cond {
**x += 1;

View file

@ -29,7 +29,7 @@ fn inc(v: &mut Box<isize>) {
fn pre_freeze() {
// In this instance, the freeze starts before the mut borrow.
let mut v = box 3;
let mut v: Box<_> = box 3;
let _w = &v;
borrow_mut(&mut *v); //~ ERROR cannot borrow
}
@ -37,7 +37,7 @@ fn pre_freeze() {
fn post_freeze() {
// In this instance, the const alias starts after the borrow.
let mut v = box 3;
let mut v: Box<_> = box 3;
borrow_mut(&mut *v);
let _w = &v;
}

View file

@ -17,7 +17,7 @@ fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
}
fn box_imm() {
let v = box 3;
let v: Box<_> = box 3;
let _w = &v;
thread::spawn(move|| {
println!("v={}", *v);
@ -26,7 +26,7 @@ fn box_imm() {
}
fn box_imm_explicit() {
let v = box 3;
let v: Box<_> = box 3;
let _w = &v;
thread::spawn(move|| {
println!("v={}", *v);

View file

@ -15,7 +15,7 @@ fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
}
fn box_imm() {
let mut v = box 3;
let mut v: Box<_> = box 3;
borrow(&*v,
|w| { //~ ERROR cannot borrow `v` as mutable
v = box 4;

View file

@ -14,7 +14,7 @@ fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
pub fn main() {
let bar = box 3;
let bar: Box<_> = box 3;
let _g = to_fn_mut(|| {
let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of
});

View file

@ -14,7 +14,7 @@
#![feature(box_syntax)]
fn main() {
let a = box box 2;
let a: Box<Box<_>> = box box 2;
let b = &a;
let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed

View file

@ -15,7 +15,7 @@ fn call_f<F:FnOnce() -> isize>(f: F) -> isize {
}
fn main() {
let t = box 3;
let t: Box<_> = box 3;
call_f(move|| { *t + 1 });
call_f(move|| { *t + 1 }); //~ ERROR capture of moved value

View file

@ -15,9 +15,9 @@
fn borrow<T>(_: &T) { }
fn different_vars_after_borrows() {
let x1 = box 1;
let x1: Box<_> = box 1;
let p1 = &x1;
let x2 = box 2;
let x2: Box<_> = box 2;
let p2 = &x2;
thread::spawn(move|| {
drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
@ -28,9 +28,9 @@ fn different_vars_after_borrows() {
}
fn different_vars_after_moves() {
let x1 = box 1;
let x1: Box<_> = box 1;
drop(x1);
let x2 = box 2;
let x2: Box<_> = box 2;
drop(x2);
thread::spawn(move|| {
drop(x1); //~ ERROR capture of moved value: `x1`
@ -39,7 +39,7 @@ fn different_vars_after_moves() {
}
fn same_var_after_borrow() {
let x = box 1;
let x: Box<_> = box 1;
let p = &x;
thread::spawn(move|| {
drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
@ -49,7 +49,7 @@ fn same_var_after_borrow() {
}
fn same_var_after_move() {
let x = box 1;
let x: Box<_> = box 1;
drop(x);
thread::spawn(move|| {
drop(x); //~ ERROR capture of moved value: `x`

View file

@ -19,7 +19,7 @@ enum cycle {
empty
}
fn main() {
let mut x = box cycle::node(node_ {a: box cycle::empty});
let mut x: Box<_> = box cycle::node(node_ {a: box cycle::empty});
// Create a cycle!
match *x {
cycle::node(ref mut y) => {

View file

@ -25,7 +25,7 @@ fn index(&self, &i: &usize) -> &T {
}
fn main() {
let v = MyVec { data: vec!(box 1, box 2, box 3) };
let v = MyVec::<Box<_>> { data: vec!(box 1, box 2, box 3) };
let good = &v[0]; // Shouldn't fail here
let bad = v[0];
//~^ ERROR cannot move out of indexed content

View file

@ -13,7 +13,7 @@
fn borrow(_v: &isize) {}
fn local() {
let mut v = box 3;
let mut v: Box<_> = box 3;
borrow(&*v);
}
@ -32,27 +32,27 @@ struct H { h: Box<isize> }
}
fn aliased_imm() {
let mut v = box 3;
let mut v: Box<_> = box 3;
let _w = &v;
borrow(&*v);
}
fn aliased_mut() {
let mut v = box 3;
let mut v: Box<_> = box 3;
let _w = &mut v;
borrow(&*v); //~ ERROR cannot borrow `*v`
}
fn aliased_other() {
let mut v = box 3;
let mut w = box 4;
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
let _x = &mut w;
borrow(&*v);
}
fn aliased_other_reassign() {
let mut v = box 3;
let mut w = box 4;
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
let mut _x = &mut w;
_x = &mut v;
borrow(&*v); //~ ERROR cannot borrow `*v`

View file

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = box 1;
let x: Box<_> = box 1;
let f = move|| {
let _a = x;
drop(x);

View file

@ -21,7 +21,7 @@ fn drop(&mut self) {
}
fn main() {
let mut ptr = box Foo { x: 0 };
let mut ptr: Box<_> = box Foo { x: 0 };
let mut test = |foo: &Foo| {
println!("access {}", foo.x);
ptr = box Foo { x: ptr.x + 1 };

View file

@ -14,7 +14,7 @@ fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
fn main() {
let r = {
let x = box 42;
let x: Box<_> = box 42;
let f = to_fn_once(move|| &x); //~ ERROR: `x` does not live long enough
f()
};

View file

@ -14,7 +14,7 @@ fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
fn do_it(x: &isize) { }
fn main() {
let x = box 22;
let x: Box<_> = box 22;
let f = to_fn_once(move|| do_it(&*x));
to_fn_once(move|| {
f();

View file

@ -13,12 +13,12 @@
struct Foo { a: isize, b: isize }
fn main() {
let mut x = box Foo { a: 1, b: 2 };
let mut x: Box<_> = box Foo { a: 1, b: 2 };
let (a, b) = (&mut x.a, &mut x.b);
//~^ ERROR cannot borrow `x` (here through borrowing `x.b`) as mutable more than once at a time
//~^^ NOTE previous borrow of `x` occurs here (through borrowing `x.a`)
let mut foo = box Foo { a: 1, b: 2 };
let mut foo: Box<_> = box Foo { a: 1, b: 2 };
let (c, d) = (&mut foo.a, &foo.b);
//~^ ERROR cannot borrow `foo` (here through borrowing `foo.b`) as immutable
//~^^ NOTE previous borrow of `foo` occurs here (through borrowing `foo.a`)

View file

@ -16,13 +16,13 @@
#[cfg(target_pointer_width = "64")]
fn main() {
let n = 0_usize;
let a = box [&n; 0xF000000000000000_usize];
let a: Box<_> = box [&n; 0xF000000000000000_usize];
println!("{}", a[0xFFFFFF_usize]);
}
#[cfg(target_pointer_width = "32")]
fn main() {
let n = 0_usize;
let a = box [&n; 0xFFFFFFFF_usize];
let a: Box<_> = box [&n; 0xFFFFFFFF_usize];
println!("{}", a[0xFFFFFF_usize]);
}

View file

@ -21,7 +21,7 @@ impl<T:Copy> Foo for T {
fn take_param<T:Foo>(foo: &T) { }
fn main() {
let x = box 3;
let x: Box<_> = box 3;
take_param(&x);
//~^ ERROR the trait `core::marker::Copy` is not implemented
}

View file

@ -24,12 +24,12 @@ impl<T:Copy> Foo for T {
fn take_param<T:Foo>(foo: &T) { }
fn a() {
let x = box 3;
let x: Box<_> = box 3;
take_param(&x); //~ ERROR `core::marker::Copy` is not implemented
}
fn b() {
let x = box 3;
let x: Box<_> = box 3;
let y = &x;
let z = &x as &Foo; //~ ERROR `core::marker::Copy` is not implemented
}

View file

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = box 5;
let x: Box<_> = box 5;
let y = x;
println!("{}", *x); //~ ERROR use of moved value: `*x`
y.clone();

View file

@ -11,7 +11,7 @@
#![feature(box_syntax)]
pub fn main() {
let x = box 1;
let x: Box<_> = box 1;
let v = (1, 2);

View file

@ -11,7 +11,7 @@
#![feature(box_syntax)]
pub fn main() {
let x = box 1;
let x: Box<_> = box 1;
let v = (1, 2);

View file

@ -13,7 +13,7 @@
struct Foo(Box<isize>);
fn main() {
let x = (box 1,);
let x: (Box<_>,) = (box 1,);
let y = x.0;
let z = x.0; //~ ERROR use of moved value: `x.0`

View file

@ -13,7 +13,7 @@
fn f(_: &mut isize) {}
fn main() {
let mut x = box 3;
let mut x: Box<_> = box 3;
f(x) //~ ERROR mismatched types
}

View file

@ -13,7 +13,7 @@
fn f<T:'static>(_: T) {}
fn main() {
let x = box 3;
let x: Box<_> = box 3;
f(x);
let x = &3; //~ ERROR borrowed value does not live long enough
f(x);

View file

@ -34,8 +34,8 @@ fn push(&mut self, n: Box<ToString+'static>) {
}
fn main() {
let n = box Number { n: 42 };
let mut l = box List { list: Vec::new() };
let n: Box<_> = box Number { n: 42 };
let mut l: Box<_> = box List { list: Vec::new() };
l.push(n);
let x = n.to_string();
//~^ ERROR: use of moved value: `n`

View file

@ -78,7 +78,7 @@ fn main() {
let stack_val_interior_ref_2: &f64 = &stack_val.y;
let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
let unique_val = box SomeStruct { x: 13, y: 26.5 };
let unique_val: Box<_> = box SomeStruct { x: 13, y: 26.5 };
let unique_val_ref: &SomeStruct = &*unique_val;
let unique_val_interior_ref_1: &int = &unique_val.x;
let unique_val_interior_ref_2: &f64 = &unique_val.y;

View file

@ -57,9 +57,9 @@ fn drop(&mut self) {}
fn main() {
let unique = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 };
let unique: Box<_> = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 };
let unique_dtor = box StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 };
let unique_dtor: Box<_> = box StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 };
zzz(); // #break
}

View file

@ -142,7 +142,7 @@ fn main() {
let _ = stack.self_by_ref(-1, 2_u16);
let _ = stack.self_by_val(-3, -4_i16);
let owned = box Struct { x: 1234.5f64 };
let owned: Box<_> = box Struct { x: 1234.5f64 };
let _ = owned.self_by_ref(-5, -6_i32);
let _ = owned.self_by_val(-7, -8_i64);
let _ = owned.self_owned(-9, -10.5_f32);

View file

@ -144,7 +144,7 @@ fn main() {
let _ = stack.self_by_ref(-1, -2);
let _ = stack.self_by_val(-3, -4);
let owned = box Enum::Variant1{ x: 1799, y: 1799 };
let owned: Box<_> = box Enum::Variant1{ x: 1799, y: 1799 };
let _ = owned.self_by_ref(-5, -6);
let _ = owned.self_by_val(-7, -8);
let _ = owned.self_owned(-9, -10);

View file

@ -143,7 +143,7 @@ fn main() {
let _ = stack.self_by_ref(-1, -2);
let _ = stack.self_by_val(-3, -4);
let owned = box Struct { x: 1234.5f64 };
let owned: Box<_> = box Struct { x: 1234.5f64 };
let _ = owned.self_by_ref(-5, -6);
let _ = owned.self_by_val(-7, -8);
let _ = owned.self_owned(-9, -10);

View file

@ -143,7 +143,7 @@ fn main() {
let _ = stack.self_by_ref(-1, -2);
let _ = stack.self_by_val(-3, -4);
let owned = box Struct { x: 200 };
let owned: Box<_> = box Struct { x: 200 };
let _ = owned.self_by_ref(-5, -6);
let _ = owned.self_by_val(-7, -8);
let _ = owned.self_owned(-9, -10);

View file

@ -149,7 +149,7 @@ fn main() {
let _ = stack.self_by_ref(-1, -2);
let _ = stack.self_by_val(-3, -4);
let owned = box Struct { x: 200 };
let owned: Box<_> = box Struct { x: 200 };
let _ = owned.self_by_ref(-5, -6);
let _ = owned.self_by_val(-7, -8);
let _ = owned.self_owned(-9, -10);

View file

@ -141,7 +141,7 @@ fn main() {
let _ = stack.self_by_ref(-1, -2);
let _ = stack.self_by_val(-3, -4);
let owned = box TupleStruct(200, -200.5);
let owned: Box<_> = box TupleStruct(200, -200.5);
let _ = owned.self_by_ref(-5, -6);
let _ = owned.self_by_val(-7, -8);
let _ = owned.self_owned(-9, -10);

View file

@ -143,7 +143,7 @@ fn main() {
let _ = stack.self_by_ref(-1, -2);
let _ = stack.self_by_val(-3, -4);
let owned = box Struct { x: 200 };
let owned: Box<_> = box Struct { x: 200 };
let _ = owned.self_by_ref(-5, -6);
let _ = owned.self_by_val(-7, -8);
let _ = owned.self_owned(-9, -10);

View file

@ -144,7 +144,7 @@ fn main() {
let _ = stack.self_by_ref(-1, 2_u16);
let _ = stack.self_by_val(-3, -4_i16);
let owned = box Struct { x: 879 };
let owned: Box<_> = box Struct { x: 879 };
let _ = owned.self_by_ref(-5, -6_i32);
let _ = owned.self_by_val(-7, -8_i64);
let _ = owned.self_owned(-9, -10.5_f32);

View file

@ -67,15 +67,15 @@ fn main() {
// 0b01111100011111000111110001111100 = 2088533116
// 0b0111110001111100 = 31868
// 0b01111100 = 124
let the_a = box ABC::TheA { x: 0, y: 8970181431921507452 };
let the_a: Box<_> = box ABC::TheA { x: 0, y: 8970181431921507452 };
// 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
// 0b00010001000100010001000100010001 = 286331153
// 0b0001000100010001 = 4369
// 0b00010001 = 17
let the_b = box ABC::TheB (0, 286331153, 286331153);
let the_b: Box<_> = box ABC::TheB (0, 286331153, 286331153);
let univariant = box Univariant::TheOnlyCase(123234);
let univariant: Box<_> = box Univariant::TheOnlyCase(123234);
zzz(); // #break
}

View file

@ -98,7 +98,7 @@ fn main() {
};
let struct_ref = &a_struct;
let owned = box 6;
let owned: Box<_> = box 6;
let mut closure = || {
let closure_local = 8;

View file

@ -58,7 +58,7 @@ fn main() {
c: 4
};
let owned = box 5;
let owned: Box<_> = box 5;
let closure = move || {
zzz(); // #break

View file

@ -90,7 +90,7 @@ fn main() {
};
let struct_ref = &a_struct;
let owned = box 6;
let owned: Box<_> = box 6;
{
let mut first_closure = || {

View file

@ -20,6 +20,6 @@ fn double(self: Box<uint>) -> uint { *self * 2_usize }
}
pub fn main() {
let x = box() (box 3_usize as Box<double>);
let x: Box<_> = box() (box 3_usize as Box<double>);
assert_eq!(x.double(), 6_usize);
}

View file

@ -24,6 +24,6 @@ fn double(self) -> uint { *self * 2_usize }
}
pub fn main() {
let x = box 3_usize;
let x: Box<_> = box 3_usize;
assert_eq!(x.double(), 6_usize);
}

View file

@ -20,6 +20,6 @@ fn double(self: Box<Box<uint>>) -> uint { **self * 2_usize }
}
pub fn main() {
let x = box box box box box 3_usize;
let x: Box<Box<Box<Box<Box<_>>>>> = box box box box box 3_usize;
assert_eq!(x.double(), 6_usize);
}

View file

@ -20,6 +20,6 @@ fn double(self: Box<uint>) -> uint { *self * 2_usize }
}
pub fn main() {
let x = box box 3_usize;
let x: Box<Box<_>> = box box 3_usize;
assert_eq!(x.double(), 6_usize);
}

View file

@ -20,6 +20,6 @@ fn double(self: Box<uint>) -> uint { *self * 2_usize }
}
pub fn main() {
let x = box 3_usize;
let x: Box<_> = box 3_usize;
assert_eq!(x.double(), 6_usize);
}

View file

@ -29,6 +29,6 @@ fn foo(&self) -> String {
}
pub fn main() {
let x = box 3_usize;
let x: Box<_> = box 3_usize;
assert_eq!(x.foo(), "box 3".to_string());
}

View file

@ -16,8 +16,8 @@
use std::collections::BitVec;
fn bitv_test() {
let mut v1 = box BitVec::from_elem(31, false);
let v2 = box BitVec::from_elem(31, true);
let mut v1: Box<_> = box BitVec::from_elem(31, false);
let v2: Box<_> = box BitVec::from_elem(31, true);
v1.union(&*v2);
}

View file

@ -13,7 +13,7 @@
#![feature(unboxed_closures)]
pub fn main() {
let bar = box 3;
let bar: Box<_> = box 3;
let h = || -> int *bar;
assert_eq!(h(), 3);
}

View file

@ -30,7 +30,7 @@ fn iter_ints<F>(x: &Ints, mut f: F) -> bool where F: FnMut(&int) -> bool {
}
pub fn main() {
let mut ints = box Ints {sum: box 0, values: Vec::new()};
let mut ints: Box<_> = box Ints {sum: box 0, values: Vec::new()};
add_int(&mut *ints, 22);
add_int(&mut *ints, 44);

View file

@ -17,7 +17,7 @@
use cci_borrow_lib::foo;
pub fn main() {
let p = box 22_usize;
let p: Box<_> = box 22_usize;
let r = foo(&*p);
println!("r={}", r);
assert_eq!(r, 22_usize);

View file

@ -43,7 +43,7 @@ fn get_bar(x: uint) -> Vec<uint> { vec!(x * 2) }
pub fn fails() {
let x = 2;
let mut y = Vec::new();
let mut y: Vec<Box<_>> = Vec::new();
y.push(box Conzabble::Bickwick(do_it(&get_bar(x))));
}

View file

@ -19,7 +19,7 @@ struct Pair {
}
pub fn main() {
let z = box Pair { a : 10, b : 12};
let z: Box<_> = box Pair { a : 10, b : 12};
let _t = Thread::spawn(move|| {
assert_eq!(z.a, 10);

View file

@ -14,9 +14,13 @@
#![feature(box_syntax)]
pub fn main() {
let _: Box<[int]> = if true { box [1, 2, 3] } else { box [1] };
let _: Box<[int]> =
if true { let b: Box<_> = box [1, 2, 3]; b } else { let b: Box<_> = box [1]; b };
let _: Box<[int]> = match true { true => box [1, 2, 3], false => box [1] };
let _: Box<[int]> = match true {
true => { let b: Box<_> = box [1, 2, 3]; b }
false => { let b: Box<_> = box [1]; b }
};
// Check we don't get over-keen at propagating coercions in the case of casts.
let x = if true { 42 } else { 42u8 } as u16;

View file

@ -22,7 +22,7 @@
pub fn main() {
use crate_method_reexport_grrrrrrr2::rust::add;
use crate_method_reexport_grrrrrrr2::rust::cx;
let x = box() ();
let x: Box<_> = box () ();
x.cx();
let y = ();
y.add("hi".to_string());

View file

@ -14,7 +14,7 @@
use std::cell::Cell;
pub fn main() {
let x = box Cell::new(5);
let x: Box<_> = box Cell::new(5);
x.set(1000);
println!("{}", x.get());
}

View file

@ -33,6 +33,6 @@ pub fn len(&mut self) -> uint {
}
pub fn main() {
let mut m = box linear_map::<(),()>();
let mut m: Box<_> = box linear_map::<(),()>();
assert_eq!(m.len(), 0);
}

View file

@ -70,7 +70,7 @@ pub fn spam(self) -> int { self.x.a }
impl Nus for thing { fn f(&self) {} }
pub fn main() {
let y = box thing(A {a: 10});
let y: Box<_> = box thing(A {a: 10});
assert_eq!(y.clone().bar(), 10);
assert_eq!(y.quux(), 10);

View file

@ -12,4 +12,4 @@
#![allow(unknown_features)]
#![feature(box_syntax)]
pub fn main() { let x = { box 100 }; assert!((*x == 100)); }
pub fn main() { let x: Box<_> = { box 100 }; assert!((*x == 100)); }

View file

@ -15,7 +15,7 @@
// Tests for if as expressions returning boxed types
fn test_box() {
let rs = if true { box 100 } else { box 101 };
let rs: Box<_> = if true { box 100 } else { box 101 };
assert_eq!(*rs, 100);
}

View file

@ -13,7 +13,7 @@
// Tests for match as expressions resulting in boxed types
fn test_box() {
let res = match true { true => { box 100 }, _ => panic!() };
let res: Box<_> = match true { true => { box 100 }, _ => panic!() };
assert_eq!(*res, 100);
}

View file

@ -25,7 +25,7 @@ fn foo(Foo {x, ..}: Foo) -> *const uint {
}
pub fn main() {
let obj = box 1;
let obj: Box<_> = box 1;
let objptr: *const uint = &*obj;
let f = Foo {x: obj, y: box 2};
let xptr = foo(f);

View file

@ -28,7 +28,7 @@ fn checkval(box ref x: Box<uint>) -> uint {
}
pub fn main() {
let obj = box 1;
let obj: Box<_> = box 1;
let objptr: *const uint = &*obj;
let xptr = getaddr(obj);
assert_eq!(objptr, xptr);

View file

@ -14,7 +14,7 @@
fn id<T:Send>(t: T) -> T { return t; }
pub fn main() {
let expected = box 100;
let expected: Box<_> = box 100;
let actual = id::<Box<int>>(expected.clone());
println!("{}", *actual);
assert_eq!(*expected, *actual);

View file

@ -154,7 +154,7 @@ pub fn main() {
test_order();
// make sure that format! doesn't move out of local variables
let a = box 3;
let a: Box<_> = box 3;
format!("{}", a);
format!("{}", a);

View file

@ -67,7 +67,7 @@ fn test_tup() {
fn test_unique() {
let i = &Cell::new(0);
{
let _a = box r(i);
let _a: Box<_> = box r(i);
}
assert_eq!(i.get(), 1);
}
@ -75,7 +75,7 @@ fn test_unique() {
fn test_unique_rec() {
let i = &Cell::new(0);
{
let _a = box BoxR {
let _a: Box<_> = box BoxR {
x: r(i)
};
}

View file

@ -40,7 +40,7 @@ mod rusti {
pub fn main() {
unsafe {
let mut x = box 1;
let mut x: Box<_> = box 1;
assert_eq!(rusti::atomic_load(&*x), 1);
*x = 5;

View file

@ -23,7 +23,7 @@ mod rusti {
pub fn main() {
unsafe {
let x = box 1;
let x: Box<_> = box 1;
let mut y = rusti::init();
let mut z: *const uint = transmute(&x);
rusti::move_val_init(&mut y, x);

Some files were not shown because too many files have changed in this diff Show more