7d8d06f86b
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
54 lines
1.3 KiB
Rust
54 lines
1.3 KiB
Rust
// Copyright 2012-2014 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.
|
|
|
|
use std::thread::Thread;
|
|
|
|
fn user(_i: int) {}
|
|
|
|
fn foo() {
|
|
// Here, i is *copied* into the proc (heap closure).
|
|
// Requires allocation. The proc's copy is not mutable.
|
|
let mut i = 0;
|
|
let _t = Thread::spawn(move|| {
|
|
user(i);
|
|
println!("spawned {}", i)
|
|
});
|
|
i += 1;
|
|
println!("original {}", i)
|
|
}
|
|
|
|
fn bar() {
|
|
// Here, the original i has not been moved, only copied, so is still
|
|
// mutable outside of the proc.
|
|
let mut i = 0;
|
|
while i < 10 {
|
|
let _t = Thread::spawn(move|| {
|
|
user(i);
|
|
});
|
|
i += 1;
|
|
}
|
|
}
|
|
|
|
fn car() {
|
|
// Here, i must be shadowed in the proc to be mutable.
|
|
let mut i = 0;
|
|
while i < 10 {
|
|
let _t = Thread::spawn(move|| {
|
|
let mut i = i;
|
|
i += 1;
|
|
user(i);
|
|
});
|
|
i += 1;
|
|
}
|
|
}
|
|
|
|
pub fn main() {}
|
|
|