Skip to content

Commit 0677d6a

Browse files
committed
---
yaml --- r: 23999 b: refs/heads/master c: e653d49 h: refs/heads/master i: 23997: 16f7396 23995: e30c999 23991: 5caed02 23983: 8cd1771 23967: f64b096 23935: 079d98f v: v3
1 parent 3f42d70 commit 0677d6a

File tree

78 files changed

+180
-41
lines changed

Some content is hidden

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

78 files changed

+180
-41
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: d53cfd225a4e2b671b2b40b71725394c24fb1761
2+
refs/heads/master: e653d493fb8df74bd0583c4f32c882a590135ef1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/fuzzer/fuzzer.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#[no_core];
66

7+
#[legacy_modes];
8+
79
#[allow(vecs_implicitly_copyable)];
810
#[allow(non_camel_case_types)];
911

trunk/src/libcore/core.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
// Don't link to core. We are core.
3232
#[no_core];
3333

34+
#[legacy_modes];
35+
3436
#[warn(vecs_implicitly_copyable)];
3537
#[deny(non_camel_case_types)];
3638

trunk/src/libstd/std.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#[no_core];
1212

13+
#[legacy_modes];
14+
1315
#[allow(vecs_implicitly_copyable)];
1416
#[deny(non_camel_case_types)];
1517

trunk/src/libsyntax/syntax.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#[no_core];
1010

11+
#[legacy_modes];
12+
1113
#[allow(vecs_implicitly_copyable)];
1214
#[allow(non_camel_case_types)];
1315

trunk/src/rustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
206206
middle::region::determine_rp_in_crate(sess, ast_map, def_map, crate));
207207

208208
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
209-
region_map, rp_set, move lang_items);
209+
region_map, rp_set, move lang_items, crate);
210210

211211
let (method_map, vtable_map) = time(time_passes, ~"typechecking", ||
212212
typeck::check_crate(ty_cx,

trunk/src/rustc/driver/rustc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#[no_core];
22
#[allow(vecs_implicitly_copyable)];
33
#[allow(non_camel_case_types)];
4+
#[legacy_modes];
45

56
extern mod core(vers = "0.4");
67
extern mod std(vers = "0.4");

trunk/src/rustc/middle/lint.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use syntax::ast_util::{path_to_ident};
1313
use syntax::print::pprust::{expr_to_str, mode_to_str, pat_to_str};
1414
export lint, ctypes, unused_imports, while_true, path_statement, old_vecs;
1515
export unrecognized_lint, non_implicitly_copyable_typarams;
16-
export vecs_implicitly_copyable, implicit_copies;
16+
export vecs_implicitly_copyable, implicit_copies, legacy_modes;
1717
export level, allow, warn, deny, forbid;
1818
export lint_dict, get_lint_dict, level_to_str;
1919
export get_lint_level, get_lint_settings_level;
@@ -59,6 +59,8 @@ enum lint {
5959
owned_heap_memory,
6060
heap_memory,
6161

62+
legacy_modes,
63+
6264
// FIXME(#3266)--make liveness warnings lintable
6365
// unused_variable,
6466
// dead_assignment
@@ -179,6 +181,11 @@ fn get_lint_dict() -> lint_dict {
179181
desc: ~"use of any structural records",
180182
default: allow}),
181183

184+
(~"legacy modes",
185+
@{lint: legacy_modes,
186+
desc: ~"allow legacy modes",
187+
default: forbid}),
188+
182189
/* FIXME(#3266)--make liveness warnings lintable
183190
(~"unused_variable",
184191
@{lint: unused_variable,

trunk/src/rustc/middle/ty.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ type ctxt =
319319
interner: HashMap<intern_key, t_box>,
320320
mut next_id: uint,
321321
vecs_implicitly_copyable: bool,
322+
legacy_modes: bool,
322323
cstore: metadata::cstore::cstore,
323324
sess: session::session,
324325
def_map: resolve::DefMap,
@@ -827,7 +828,19 @@ fn mk_ctxt(s: session::session,
827828
freevars: freevars::freevar_map,
828829
region_map: middle::region::region_map,
829830
region_paramd_items: middle::region::region_paramd_items,
830-
+lang_items: middle::lang_items::LanguageItems) -> ctxt {
831+
+lang_items: middle::lang_items::LanguageItems,
832+
crate: @ast::crate) -> ctxt {
833+
let mut legacy_modes = false;
834+
for crate.node.attrs.each |attribute| {
835+
match attribute.node.value.node {
836+
ast::meta_word(w) if w == ~"legacy_modes" => {
837+
legacy_modes = true;
838+
break;
839+
}
840+
_ => {}
841+
}
842+
}
843+
831844
let interner = map::HashMap();
832845
let vecs_implicitly_copyable =
833846
get_lint_level(s.lint_settings.default_settings,
@@ -836,6 +849,7 @@ fn mk_ctxt(s: session::session,
836849
interner: interner,
837850
mut next_id: 0u,
838851
vecs_implicitly_copyable: vecs_implicitly_copyable,
852+
legacy_modes: legacy_modes,
839853
cstore: s.cstore,
840854
sess: s,
841855
def_map: dm,
@@ -1075,9 +1089,14 @@ pure fn mach_sty(cfg: @session::config, t: t) -> sty {
10751089
}
10761090
}
10771091

1078-
fn default_arg_mode_for_ty(ty: ty::t) -> ast::rmode {
1079-
if ty::type_is_immediate(ty) { ast::by_val }
1080-
else { ast::by_ref }
1092+
fn default_arg_mode_for_ty(tcx: ctxt, ty: ty::t) -> ast::rmode {
1093+
if ty::type_is_immediate(ty) {
1094+
ast::by_val
1095+
} else if tcx.legacy_modes {
1096+
ast::by_ref
1097+
} else {
1098+
ast::by_copy
1099+
}
10811100
}
10821101

10831102
// Returns the narrowest lifetime enclosing the evaluation of the expression

trunk/src/rustc/middle/typeck/astconv.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ fn ty_of_arg<AC: ast_conv, RS: region_scope Copy Owned>(
432432
// tables in tcx but should never fail, because nothing else
433433
// will have been unified with m yet:
434434
_ => {
435-
let m1 = ast::expl(ty::default_arg_mode_for_ty(ty));
435+
let m1 = ast::expl(ty::default_arg_mode_for_ty(self.tcx(),
436+
ty));
436437
result::get(ty::unify_mode(
437438
self.tcx(),
438439
ty::expected_found {expected: m1,

trunk/src/rustc/middle/typeck/check/writeback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn visit_expr(e: @ast::expr, wbcx: wb_ctxt, v: wb_vt) {
145145
match (r_ty, input.mode) {
146146
(Some(t), ast::infer(_)) => {
147147
let tcx = wbcx.fcx.ccx.tcx;
148-
let m_def = ty::default_arg_mode_for_ty(t);
148+
let m_def = ty::default_arg_mode_for_ty(tcx, t);
149149
ty::set_default_mode(tcx, input.mode, m_def);
150150
}
151151
_ => ()

trunk/src/rustc/rustc.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#[no_core];
1313

14+
#[legacy_modes];
15+
1416
#[allow(vecs_implicitly_copyable)];
1517
#[allow(non_camel_case_types)];
1618
// #[warn(deprecated_pattern)];

trunk/src/rustc/util/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str {
258258
ast::infer(_) => ~"",
259259
ast::expl(m) => {
260260
if !ty::type_needs_infer(ty) &&
261-
m == ty::default_arg_mode_for_ty(ty) {
261+
m == ty::default_arg_mode_for_ty(cx, ty) {
262262
~""
263263
} else {
264264
mode_to_str(ast::expl(m))

trunk/src/rustdoc/rustdoc.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#[no_core];
1313

14+
#[legacy_modes];
15+
1416
#[allow(vecs_implicitly_copyable,
1517
non_implicitly_copyable_typarams)];
1618
#[allow(non_camel_case_types)];

trunk/src/test/auxiliary/cci_iter_lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[link(name="cci_iter_lib", vers="0.0")];
2+
#[legacy_modes];
23

34
#[inline]
45
fn iter<T>(v: ~[T], f: fn(T)) {

trunk/src/test/auxiliary/cci_nested_lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
use dvec::DVec;
24

35
type entry<A,B> = {key: A, value: B};
@@ -26,4 +28,4 @@ fn new_int_alist_2<B: Copy>() -> alist<int, B> {
2628
#[inline]
2729
fn eq_int(&&a: int, &&b: int) -> bool { a == b }
2830
return {eq_fn: eq_int, data: DVec()};
29-
}
31+
}

trunk/src/test/bench/graph500-bfs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ An implementation of the Graph500 Breadth First Search problem in Rust.
44
55
*/
66

7+
#[legacy_modes];
8+
79
extern mod std;
810
use std::arc;
911
use std::time;

trunk/src/test/bench/msgsend-pipes-shared.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// xfail-pretty
1212

13+
#[legacy_modes];
14+
1315
extern mod std;
1416
use io::Writer;
1517
use io::WriterUtil;

trunk/src/test/bench/msgsend-pipes.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
// xfail-pretty
88

9+
#[legacy_modes];
10+
911
extern mod std;
1012
use io::Writer;
1113
use io::WriterUtil;

trunk/src/test/bench/shootout-k-nucleotide-pipes.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
// multi tasking k-nucleotide
44

5+
#[legacy_modes];
6+
57
extern mod std;
68
use std::map;
79
use std::map::HashMap;

trunk/src/test/bench/shootout-mandelbrot.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
// writes pbm image to output path
1414

15+
#[legacy_modes];
16+
1517
extern mod std;
1618
use io::WriterUtil;
1719
use std::map::HashMap;

trunk/src/test/bench/shootout-pfib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
1111
*/
1212

13+
#[legacy_modes];
14+
1315
extern mod std;
1416

1517
use std::{time, getopts};

trunk/src/test/bench/task-perf-word-count-generic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// xfail-pretty
1212

13+
#[legacy_modes];
14+
1315
extern mod std;
1416

1517
use option = option;

trunk/src/test/compile-fail/borrowck-unchecked-with-borrow.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// xfail-test
2+
// xfail-fast
3+
#[legacy_modes];
4+
15
fn impure(_i: int) {}
26

37
// check that unchecked alone does not override borrowck:

trunk/src/test/compile-fail/fn-variance-1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
fn takes_mut(&&x: @mut int) { }
24
fn takes_const(&&x: @const int) { }
35
fn takes_imm(&&x: @int) { }

trunk/src/test/compile-fail/issue-2587-2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
fn foo<T: Copy>(+_t: T) { fail; }
24

35
fn bar<T>(+_t: T) { fail; }

trunk/src/test/compile-fail/mode-inference-fail.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
// In this test, the mode gets inferred to ++ due to the apply_int(),
24
// but then we get a failure in the generic apply().
35

trunk/src/test/compile-fail/pure-higher-order.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
// Test rules governing higher-order pure fns.
24

35
pure fn range(from: uint, to: uint, f: fn(uint)) {
@@ -45,4 +47,4 @@ fn print(i: uint) { error!("i=%u", i); }
4547
pure fn noop(_i: uint) {}
4648

4749
fn main() {
48-
}
50+
}

trunk/src/test/compile-fail/regions-creating-enums.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
enum ast {
24
num(uint),
35
add(&ast, &ast)
@@ -30,4 +32,4 @@ fn map_nums(x: &ast, f: fn(uint) -> uint) -> &ast {
3032
}
3133
}
3234

33-
fn main() {}
35+
fn main() {}

trunk/src/test/run-pass-fulldeps/qquote.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// xfail-pretty
22

3+
#[legacy_modes];
4+
35
extern mod std;
46
extern mod syntax;
57

trunk/src/test/run-pass/argument-passing.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
fn f1(a: {mut x: int}, &b: int, -c: int) -> int {
24
let r = a.x + b + c;
35
a.x = 0;

trunk/src/test/run-pass/assignability-trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// making method calls, but only if there aren't any matches without
33
// it.
44

5+
#[legacy_modes];
6+
57
trait iterable<A> {
68
fn iterate(blk: fn(A) -> bool);
79
}

trunk/src/test/run-pass/auto_serialize.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
extern mod std;
24

35
// These tests used to be separate files, but I wanted to refactor all

trunk/src/test/run-pass/block-iter-1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
fn iter_vec<T>(v: ~[T], f: fn(T)) { for v.each |x| { f(x); } }
24

35
fn main() {

trunk/src/test/run-pass/block-iter-2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
fn iter_vec<T>(v: ~[T], f: fn(T)) { for v.each |x| { f(x); } }
24

35
fn main() {

trunk/src/test/run-pass/cci_iter_exe.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// xfail-fast - check-fast doesn't understand aux-build
22
// aux-build:cci_iter_lib.rs
33

4+
#[legacy_modes];
5+
46
extern mod cci_iter_lib;
57

68
fn main() {

trunk/src/test/run-pass/cci_nested_exe.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// xfail-fast - check-fast doesn't understand aux-build
22
// aux-build:cci_nested_lib.rs
33

4+
#[legacy_modes];
5+
46
extern mod cci_nested_lib;
57
use cci_nested_lib::*;
68

trunk/src/test/run-pass/class-impl-very-parameterized-trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_modes];
2+
13
extern mod std;
24
use std::map::*;
35

0 commit comments

Comments
 (0)