Skip to content

Commit ae6a4cd

Browse files
committed
---
yaml --- r: 51350 b: refs/heads/incoming c: becad9b h: refs/heads/master v: v3
1 parent bf41837 commit ae6a4cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+372
-598
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 900a0c8df15162e750a6f34496dcf239d0848503
9+
refs/heads/incoming: becad9bb07423ed4d0d8b192cce83de99b535e86
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/etc/tidy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from licenseck import *
66

77
err=0
8-
cols=100
8+
cols=78
99

1010
# Be careful to support Python 2.4, 2.6, and 3.x here!
1111
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],

branches/incoming/src/libcore/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod rusti {
1212
#[abi = "rust-intrinsic"]
1313
#[link_name = "rusti"]
1414
pub extern {
15-
fn forget<T>(+x: T);
15+
fn forget<T>(-x: T);
1616
fn reinterpret_cast<T, U>(&&e: T) -> U;
1717
}
1818
}

branches/incoming/src/libcore/container.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ pub trait Map<K, V>: Mutable {
3535
/// Visit all values
3636
pure fn each_value(&self, f: &fn(&V) -> bool);
3737

38+
/// Iterate over the map and mutate the contained values
39+
fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool);
40+
3841
/// Return the value corresponding to the key in the map
3942
pure fn find(&self, key: &K) -> Option<&self/V>;
4043

branches/incoming/src/libcore/hashmap.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,19 @@ pub mod linear {
324324
self.each(|&(_, v)| blk(v))
325325
}
326326
327+
/// Iterate over the map and mutate the contained values
328+
fn mutate_values(&mut self, blk: &fn(&'self K,
329+
&'self mut V) -> bool) {
330+
for uint::range(0, self.buckets.len()) |i| {
331+
match self.buckets[i] {
332+
Some(Bucket{key: ref key, value: ref mut value, _}) => {
333+
if !blk(key, value) { return }
334+
}
335+
None => ()
336+
}
337+
}
338+
}
339+
327340
/// Return the value corresponding to the key in the map
328341
pure fn find(&self, k: &K) -> Option<&self/V> {
329342
match self.bucket_for_key(k) {

branches/incoming/src/libcore/rt/thread.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct Thread {
2222
impl Thread {
2323
static fn start(main: ~fn()) -> Thread {
2424
fn substart(main: &fn()) -> *raw_thread {
25-
unsafe { rust_raw_thread_start(&main) }
25+
unsafe { rust_raw_thread_start(main) }
2626
}
2727
let raw = substart(main);
2828
Thread {
@@ -39,6 +39,6 @@ impl Drop for Thread {
3939
}
4040

4141
extern {
42-
pub unsafe fn rust_raw_thread_start(f: &(&fn())) -> *raw_thread;
42+
pub unsafe fn rust_raw_thread_start(f: &fn()) -> *raw_thread;
4343
pub unsafe fn rust_raw_thread_join_delete(thread: *raw_thread);
4444
}

branches/incoming/src/libcore/trie.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,16 @@ impl<T> Map<uint, T> for TrieMap<T> {
8181

8282
/// Visit all values in order
8383
#[inline(always)]
84-
pure fn each_value(&self,
85-
f: &fn(&T) -> bool) {
84+
pure fn each_value(&self, f: &fn(&T) -> bool) {
8685
self.each(|&(_, v)| f(v))
8786
}
8887

88+
/// Iterate over the map and mutate the contained values
89+
#[inline(always)]
90+
fn mutate_values(&mut self, f: &fn(&uint, &mut T) -> bool) {
91+
self.root.mutate_values(f);
92+
}
93+
8994
/// Return the value corresponding to the key in the map
9095
#[inline(hint)]
9196
pure fn find(&self, key: &uint) -> Option<&self/T> {
@@ -150,11 +155,6 @@ impl<T> TrieMap<T> {
150155
pure fn each_value_reverse(&self, f: &fn(&T) -> bool) {
151156
self.each_reverse(|&(_, v)| f(v))
152157
}
153-
154-
/// Iterate over the map and mutate the contained values
155-
fn mutate_values(&mut self, f: &fn(uint, &mut T) -> bool) {
156-
self.root.mutate_values(f);
157-
}
158158
}
159159

160160
pub struct TrieSet {
@@ -248,13 +248,13 @@ impl<T> TrieNode<T> {
248248
true
249249
}
250250

251-
fn mutate_values(&mut self, f: &fn(uint, &mut T) -> bool) -> bool {
251+
fn mutate_values(&mut self, f: &fn(&uint, &mut T) -> bool) -> bool {
252252
for vec::each_mut(self.children) |child| {
253253
match *child {
254254
Internal(ref mut x) => if !x.mutate_values(f) {
255255
return false
256256
},
257-
External(k, ref mut v) => if !f(k, v) { return false },
257+
External(k, ref mut v) => if !f(&k, v) { return false },
258258
Nothing => ()
259259
}
260260
}
@@ -269,8 +269,8 @@ pure fn chunk(n: uint, idx: uint) -> uint {
269269
(n >> (SHIFT * real_idx)) & MASK
270270
}
271271

272-
fn insert<T>(count: &mut uint, child: &mut Child<T>, key: uint,
273-
value: T, idx: uint) -> bool {
272+
fn insert<T>(count: &mut uint, child: &mut Child<T>, key: uint, value: T,
273+
idx: uint) -> bool {
274274
let mut tmp = Nothing;
275275
tmp <-> *child;
276276
let mut added = false;

branches/incoming/src/libcore/unstable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ mod rustrt {
4747
pub unsafe fn rust_lock_little_lock(lock: rust_little_lock);
4848
pub unsafe fn rust_unlock_little_lock(lock: rust_little_lock);
4949

50-
pub unsafe fn rust_raw_thread_start(f: &(&fn())) -> *raw_thread;
50+
pub unsafe fn rust_raw_thread_start(f: &fn()) -> *raw_thread;
5151
pub unsafe fn rust_raw_thread_join_delete(thread: *raw_thread);
5252
}
5353
}
@@ -72,7 +72,7 @@ pub fn run_in_bare_thread(f: ~fn()) {
7272
let closure: &fn() = || {
7373
f()
7474
};
75-
let thread = rustrt::rust_raw_thread_start(&closure);
75+
let thread = rustrt::rust_raw_thread_start(closure);
7676
rustrt::rust_raw_thread_join_delete(thread);
7777
chan.send(());
7878
}

branches/incoming/src/libcore/unstable/intrinsics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ pub extern {
3434

3535
pub fn size_of<T>() -> uint;
3636

37-
pub fn move_val<T>(dst: &mut T, +src: T);
38-
pub fn move_val_init<T>(dst: &mut T, +src: T);
37+
pub fn move_val<T>(dst: &mut T, -src: T);
38+
pub fn move_val_init<T>(dst: &mut T, -src: T);
3939

4040
pub fn min_align_of<T>() -> uint;
4141
pub fn pref_align_of<T>() -> uint;

branches/incoming/src/librust/rust.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
// rust - central access to other rust tools
12-
// FIXME #2238 Make commands run and test emit proper file endings on winds
13-
// FIXME #2238 Make run only accept source that emits an executable
12+
// XXX: Make commands run and test emit proper file endings on winds
13+
// XXX: Make run only accept source that emits an executable
1414

1515
#[deny(deprecated_self)];
1616

branches/incoming/src/librustc/back/link.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
486486

487487
// This calculates CMH as defined above
488488
fn crate_meta_extras_hash(symbol_hasher: &hash::State,
489-
+cmh_items: ~[@ast::meta_item],
489+
-cmh_items: ~[@ast::meta_item],
490490
dep_hashes: ~[~str]) -> @str {
491491
fn len_and_str(s: &str) -> ~str {
492492
fmt!("%u_%s", s.len(), s)
@@ -535,7 +535,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
535535
name, default));
536536
}
537537

538-
fn crate_meta_name(sess: Session, output: &Path, +opt_name: Option<@str>)
538+
fn crate_meta_name(sess: Session, output: &Path, -opt_name: Option<@str>)
539539
-> @str {
540540
return match opt_name {
541541
Some(v) => v,

branches/incoming/src/librustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ pub fn pretty_print_input(sess: Session, +cfg: ast::crate_cfg, input: input,
440440
}
441441
}
442442
443-
pub fn get_os(triple: &str) -> Option<session::os> {
443+
pub fn get_os(triple: ~str) -> Option<session::os> {
444444
if str::contains(triple, ~"win32") ||
445445
str::contains(triple, ~"mingw32") {
446446
Some(session::os_win32)
@@ -455,7 +455,7 @@ pub fn get_os(triple: &str) -> Option<session::os> {
455455
} else { None }
456456
}
457457

458-
pub fn get_arch(triple: &str) -> Option<session::arch> {
458+
pub fn get_arch(triple: ~str) -> Option<session::arch> {
459459
if str::contains(triple, ~"i386") ||
460460
str::contains(triple, ~"i486") ||
461461
str::contains(triple, ~"i586") ||

branches/incoming/src/librustc/lib/llvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ pub mod llvm {
14431443
/** Prepares inline assembly. */
14441444
pub unsafe fn LLVMInlineAsm(Ty: TypeRef, AsmString: *c_char,
14451445
Constraints: *c_char, SideEffects: Bool,
1446-
AlignStack: Bool, Dialect: c_uint)
1446+
AlignStack: Bool, Dialect: AsmDialect)
14471447
-> ValueRef;
14481448
}
14491449
}

branches/incoming/src/librustc/metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ fn metas_with_ident(ident: @~str, +metas: ~[@ast::meta_item])
222222
metas_with(ident, @~"name", metas)
223223
}
224224

225-
fn existing_match(e: @mut Env, metas: &[@ast::meta_item], hash: @~str)
225+
fn existing_match(e: @mut Env, metas: ~[@ast::meta_item], hash: @~str)
226226
-> Option<int> {
227227
for e.crate_cache.each |c| {
228228
if loader::metadata_matches(*c.metas, metas)

branches/incoming/src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ pub fn maybe_get_item_ast(intr: @ident_interner, cdata: cmd, tcx: ty::ctxt,
560560
let item_path = item_path(intr, item_doc);
561561
vec::from_slice(item_path.init())
562562
};
563-
match decode_inlined_item(cdata, tcx, copy path, item_doc) {
563+
match decode_inlined_item(cdata, tcx, path, item_doc) {
564564
Some(ref ii) => csearch::found((/*bad*/copy *ii)),
565565
None => {
566566
match item_parent_item(item_doc) {

branches/incoming/src/librustc/metadata/loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn crate_matches(crate_data: @~[u8],
176176
metadata_matches(linkage_metas, metas)
177177
}
178178
179-
pub fn metadata_matches(extern_metas: &[@ast::meta_item],
179+
pub fn metadata_matches(extern_metas: ~[@ast::meta_item],
180180
local_metas: &[@ast::meta_item]) -> bool {
181181
182182
debug!("matching %u metadata requirements against %u items",

branches/incoming/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ fn parse_mode(st: @mut PState) -> ast::mode {
427427
let m = ast::expl(match next(st) {
428428
'+' => ast::by_copy,
429429
'=' => ast::by_ref,
430+
'#' => ast::by_val,
430431
_ => fail!(~"bad mode")
431432
});
432433
return m;

branches/incoming/src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ pub fn enc_mode(w: io::Writer, cx: @ctxt, m: mode) {
342342
match ty::resolved_mode(cx.tcx, m) {
343343
by_copy => w.write_char('+'),
344344
by_ref => w.write_char('='),
345+
by_val => w.write_char('#')
345346
}
346347
}
347348

branches/incoming/src/librustc/middle/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub fn encode_inlined_item(ecx: @e::EncodeContext,
105105
pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
106106
tcx: ty::ctxt,
107107
maps: Maps,
108-
+path: ast_map::path,
108+
path: ast_map::path,
109109
par_doc: ebml::Doc)
110110
-> Option<ast::inlined_item> {
111111
let dcx = @DecodeContext {

branches/incoming/src/librustc/middle/borrowck/gather_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ fn req_loans_in_expr(ex: @ast::expr,
156156
let arg_cmt = self.bccx.cat_expr(*arg);
157157
self.guarantee_valid(arg_cmt, m_imm, scope_r);
158158
}
159-
ast::by_copy => {}
159+
ast::by_val | ast::by_copy => {}
160160
}
161161
}
162162
visit::visit_expr(ex, self, vt);
@@ -172,7 +172,7 @@ fn req_loans_in_expr(ex: @ast::expr,
172172
let arg_cmt = self.bccx.cat_expr(*arg);
173173
self.guarantee_valid(arg_cmt, m_imm, scope_r);
174174
}
175-
ast::by_copy => {}
175+
ast::by_val | ast::by_copy => {}
176176
}
177177
}
178178

branches/incoming/src/librustc/middle/lint.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub enum lint {
7878
deprecated_self,
7979
deprecated_mutable_fields,
8080
deprecated_drop,
81-
foreign_mode,
8281

8382
managed_heap_memory,
8483
owned_heap_memory,
@@ -183,13 +182,6 @@ pub fn get_lint_dict() -> LintDict {
183182
default: warn
184183
}),
185184

186-
(@~"foreign_mode",
187-
@LintSpec {
188-
lint: foreign_mode,
189-
desc: "warn about deprecated uses of modes in foreign fns",
190-
default: warn
191-
}),
192-
193185
(@~"deprecated_pattern",
194186
@LintSpec {
195187
lint: deprecated_pattern,
@@ -761,20 +753,6 @@ fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) {
761753

762754
fn check_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id,
763755
decl: &ast::fn_decl) {
764-
// warn about `&&` mode on foreign functions, both because it is
765-
// deprecated and because its semantics have changed recently:
766-
for decl.inputs.eachi |i, arg| {
767-
match ty::resolved_mode(cx, arg.mode) {
768-
ast::by_copy => {}
769-
ast::by_ref => {
770-
cx.sess.span_lint(
771-
foreign_mode, fn_id, fn_id, arg.ty.span,
772-
fmt!("foreign function uses `&&` mode \
773-
on argument %u", i));
774-
}
775-
}
776-
}
777-
778756
let tys = vec::map(decl.inputs, |a| a.ty );
779757
for vec::each(vec::append_one(tys, decl.output)) |ty| {
780758
match ty.node {
@@ -807,7 +785,7 @@ fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) {
807785
if attr::foreign_abi(it.attrs) !=
808786
either::Right(ast::foreign_abi_rust_intrinsic) => {
809787
for nmod.items.each |ni| {
810-
match ni.node {
788+
match /*bad*/copy ni.node {
811789
ast::foreign_item_fn(ref decl, _, _) => {
812790
check_foreign_fn(cx, it.id, decl);
813791
}

branches/incoming/src/librustc/middle/liveness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ pub impl IrMaps {
427427
v.push(id);
428428
}
429429
Arg(_, _, by_ref) |
430-
ImplicitRet => {
430+
Arg(_, _, by_val) | ImplicitRet => {
431431
debug!("--but it is not owned");
432432
}
433433
}
@@ -1006,7 +1006,7 @@ pub impl Liveness {
10061006
// inputs passed by & mode should be considered live on exit:
10071007
for decl.inputs.each |arg| {
10081008
match ty::resolved_mode(self.tcx, arg.mode) {
1009-
by_ref => {
1009+
by_val | by_ref => {
10101010
// By val and by ref do not own, so register a
10111011
// read at the end. This will prevent us from
10121012
// moving out of such variables but also prevent

branches/incoming/src/librustc/middle/mem_categorization.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,14 @@ pub impl mem_categorization_ctxt {
486486
let lp = match ty::resolved_mode(self.tcx, mode) {
487487
ast::by_copy => Some(@lp_arg(vid)),
488488
ast::by_ref => None,
489+
ast::by_val => {
490+
// by-value is this hybrid mode where we have a
491+
// pointer but we do not own it. This is not
492+
// considered loanable because, for example, a by-ref
493+
// and and by-val argument might both actually contain
494+
// the same unique ptr.
495+
None
496+
}
489497
};
490498
@cmt_ {
491499
id:id,

branches/incoming/src/librustc/middle/moves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ pub impl VisitContext {
782782
*/
783783

784784
match arg_mode {
785-
by_ref => self.use_expr(arg_expr, Read, visitor),
785+
by_val | by_ref => self.use_expr(arg_expr, Read, visitor),
786786
by_copy => self.consume_expr(arg_expr, visitor)
787787
}
788788
}

0 commit comments

Comments
 (0)