Skip to content

Commit ffcc680

Browse files
committed
Fix test fallout from removing vecs_implicitly_copyable
1 parent 5614e83 commit ffcc680

File tree

14 files changed

+52
-62
lines changed

14 files changed

+52
-62
lines changed

src/etc/extract-tests.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,16 @@
6060
if not re.search(r"\bextern mod std\b", block):
6161
block = "extern mod std;\n" + block
6262
block = """#[ forbid(ctypes) ];
63-
#[ forbid(deprecated_mode) ];
6463
#[ forbid(deprecated_pattern) ];
6564
#[ forbid(implicit_copies) ];
6665
#[ forbid(non_implicitly_copyable_typarams) ];
6766
#[ forbid(path_statement) ];
6867
#[ forbid(type_limits) ];
6968
#[ forbid(unrecognized_lint) ];
7069
#[ forbid(unused_imports) ];
71-
#[ forbid(vecs_implicitly_copyable) ];
7270
#[ forbid(while_true) ];
7371
74-
#[ warn(deprecated_self) ];
75-
#[ warn(non_camel_case_types) ];
76-
#[ warn(structural_records) ];\n
72+
#[ warn(non_camel_case_types) ];\n
7773
""" + block
7874
if xfail:
7975
block = "// xfail-test\n" + block

src/libfuzzer/fuzzer.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub fn stash_expr_if(c: @fn(@ast::expr, test_mode)->bool,
134134
e: @ast::expr,
135135
tm: test_mode) {
136136
if c(e, tm) {
137-
*es += ~[e];
137+
*es = *es + ~[e];
138138
} else {
139139
/* now my indices are wrong :( */
140140
}

src/librustc/util/enum_set.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ impl<E:CLike> BitAnd<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
102102

103103
#[cfg(test)]
104104
mod test {
105-
use core;
106105
use core::iter;
107106
use util::enum_set::*;
108107

src/librustdoc/attr_pass.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn parse_item_attrs<T:Owned>(
103103
id: doc::AstId,
104104
parse_attrs: ~fn(a: ~[ast::attribute]) -> T) -> T {
105105
do astsrv::exec(srv) |ctxt| {
106-
let attrs = match *ctxt.ast_map.get(&id) {
106+
let attrs = match ctxt.ast_map.get_copy(&id) {
107107
ast_map::node_item(item, _) => copy item.attrs,
108108
ast_map::node_foreign_item(item, _, _, _) => copy item.attrs,
109109
_ => fail!("parse_item_attrs: not an item")
@@ -127,7 +127,7 @@ fn fold_enum(
127127
let desc = {
128128
let variant = copy variant;
129129
do astsrv::exec(srv.clone()) |ctxt| {
130-
match *ctxt.ast_map.get(&doc_id) {
130+
match ctxt.ast_map.get_copy(&doc_id) {
131131
ast_map::node_item(@ast::item {
132132
node: ast::item_enum(ref enum_definition, _), _
133133
}, _) => {
@@ -177,7 +177,7 @@ fn merge_method_attrs(
177177

178178
// Create an assoc list from method name to attributes
179179
let attrs: ~[(~str, Option<~str>)] = do astsrv::exec(srv) |ctxt| {
180-
match *ctxt.ast_map.get(&item_id) {
180+
match ctxt.ast_map.get_copy(&item_id) {
181181
ast_map::node_item(@ast::item {
182182
node: ast::item_trait(_, _, ref methods), _
183183
}, _) => {

src/librustdoc/prune_hidden_pass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn is_hidden(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
5353

5454
let id = doc.id;
5555
do astsrv::exec(srv) |ctxt| {
56-
let attrs = match *ctxt.ast_map.get(&id) {
56+
let attrs = match ctxt.ast_map.get_copy(&id) {
5757
ast_map::node_item(item, _) => copy item.attrs,
5858
_ => ~[]
5959
};

src/librustdoc/prune_private_pass.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn fold_impl(
5555
let doc = fold::default_seq_fold_impl(fold, doc);
5656

5757
do astsrv::exec(fold.ctxt.clone()) |ctxt| {
58-
match *ctxt.ast_map.get(&doc.item.id) {
58+
match ctxt.ast_map.get_copy(&doc.item.id) {
5959
ast_map::node_item(item, _) => {
6060
match item.node {
6161
ast::item_impl(_, None, _, ref methods) => {
@@ -134,7 +134,7 @@ fn is_visible(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
134134
let id = doc.id;
135135

136136
do astsrv::exec(srv) |ctxt| {
137-
match *ctxt.ast_map.get(&id) {
137+
match ctxt.ast_map.get_copy(&id) {
138138
ast_map::node_item(item, _) => {
139139
match &item.node {
140140
&ast::item_impl(*) => {

src/librustdoc/tystr_pass.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn fold_fn(
6363

6464
fn get_fn_sig(srv: astsrv::Srv, fn_id: doc::AstId) -> Option<~str> {
6565
do astsrv::exec(srv) |ctxt| {
66-
match *ctxt.ast_map.get(&fn_id) {
66+
match ctxt.ast_map.get_copy(&fn_id) {
6767
ast_map::node_item(@ast::item {
6868
ident: ident,
6969
node: ast::item_fn(ref decl, purity, _, ref tys, _), _
@@ -90,7 +90,7 @@ fn fold_const(
9090
sig: Some({
9191
let doc = copy doc;
9292
do astsrv::exec(srv) |ctxt| {
93-
match *ctxt.ast_map.get(&doc.id()) {
93+
match ctxt.ast_map.get_copy(&doc.id()) {
9494
ast_map::node_item(@ast::item {
9595
node: ast::item_const(ty, _), _
9696
}, _) => {
@@ -115,7 +115,7 @@ fn fold_enum(
115115
let sig = {
116116
let variant = copy *variant;
117117
do astsrv::exec(srv.clone()) |ctxt| {
118-
match *ctxt.ast_map.get(&doc_id) {
118+
match ctxt.ast_map.get_copy(&doc_id) {
119119
ast_map::node_item(@ast::item {
120120
node: ast::item_enum(ref enum_definition, _), _
121121
}, _) => {
@@ -170,7 +170,7 @@ fn get_method_sig(
170170
method_name: ~str
171171
) -> Option<~str> {
172172
do astsrv::exec(srv) |ctxt| {
173-
match *ctxt.ast_map.get(&item_id) {
173+
match ctxt.ast_map.get_copy(&item_id) {
174174
ast_map::node_item(@ast::item {
175175
node: ast::item_trait(_, _, ref methods), _
176176
}, _) => {
@@ -241,7 +241,7 @@ fn fold_impl(
241241
let (bounds, trait_types, self_ty) = {
242242
let doc = copy doc;
243243
do astsrv::exec(srv) |ctxt| {
244-
match *ctxt.ast_map.get(&doc.id()) {
244+
match ctxt.ast_map.get_copy(&doc.id()) {
245245
ast_map::node_item(@ast::item {
246246
node: ast::item_impl(ref generics, opt_trait_type, self_ty, _), _
247247
}, _) => {
@@ -280,7 +280,7 @@ fn fold_type(
280280
sig: {
281281
let doc = copy doc;
282282
do astsrv::exec(srv) |ctxt| {
283-
match *ctxt.ast_map.get(&doc.id()) {
283+
match ctxt.ast_map.get_copy(&doc.id()) {
284284
ast_map::node_item(@ast::item {
285285
ident: ident,
286286
node: ast::item_ty(ty, ref params), _
@@ -312,7 +312,7 @@ fn fold_struct(
312312
sig: {
313313
let doc = copy doc;
314314
do astsrv::exec(srv) |ctxt| {
315-
match *ctxt.ast_map.get(&doc.id()) {
315+
match ctxt.ast_map.get_copy(&doc.id()) {
316316
ast_map::node_item(item, _) => {
317317
let item = strip_struct_extra_stuff(item);
318318
Some(pprust::item_to_str(item,

src/librustpkg/rustpkg.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ use context::Ctx;
4141
mod conditions;
4242
mod context;
4343
mod path_util;
44+
#[cfg(test)]
4445
mod tests;
4546
mod util;
4647
mod workspace;

src/librustpkg/tests.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ fn is_rwx(p: &Path) -> bool {
7777
}
7878
}
7979

80-
#[cfg(test)]
8180
fn test_sysroot() -> Path {
8281
// Totally gross hack but it's just for test cases.
8382
// Infer the sysroot from the exe name and tack "stage2"
@@ -107,19 +106,19 @@ fn test_install_valid() {
107106
let temp_pkg_id = fake_pkg();
108107
let temp_workspace = mk_temp_workspace(&temp_pkg_id.path);
109108
// should have test, bench, lib, and main
110-
ctxt.install(&temp_workspace, temp_pkg_id);
109+
ctxt.install(&temp_workspace, &temp_pkg_id);
111110
// Check that all files exist
112-
let exec = target_executable_in_workspace(temp_pkg_id, &temp_workspace);
111+
let exec = target_executable_in_workspace(&temp_pkg_id, &temp_workspace);
113112
debug!("exec = %s", exec.to_str());
114113
assert!(os::path_exists(&exec));
115114
assert!(is_rwx(&exec));
116-
let lib = target_library_in_workspace(temp_pkg_id, &temp_workspace);
115+
let lib = target_library_in_workspace(&temp_pkg_id, &temp_workspace);
117116
debug!("lib = %s", lib.to_str());
118117
assert!(os::path_exists(&lib));
119118
assert!(is_rwx(&lib));
120119
// And that the test and bench executables aren't installed
121-
assert!(!os::path_exists(&target_test_in_workspace(temp_pkg_id, &temp_workspace)));
122-
let bench = target_bench_in_workspace(temp_pkg_id, &temp_workspace);
120+
assert!(!os::path_exists(&target_test_in_workspace(&temp_pkg_id, &temp_workspace)));
121+
let bench = target_bench_in_workspace(&temp_pkg_id, &temp_workspace);
123122
debug!("bench = %s", bench.to_str());
124123
assert!(!os::path_exists(&bench));
125124
}
@@ -140,7 +139,7 @@ fn test_install_invalid() {
140139
do cond.trap(|_| {
141140
error_occurred = true;
142141
}).in {
143-
ctxt.install(&temp_workspace, pkgid);
142+
ctxt.install(&temp_workspace, &pkgid);
144143
}
145144
}
146145
assert!(error_occurred && error1_occurred);
@@ -155,19 +154,19 @@ fn test_install_url() {
155154
let temp_pkg_id = remote_pkg();
156155
let temp_workspace = mk_temp_workspace(&temp_pkg_id.path);
157156
// should have test, bench, lib, and main
158-
ctxt.install(&temp_workspace, temp_pkg_id);
157+
ctxt.install(&temp_workspace, &temp_pkg_id);
159158
// Check that all files exist
160-
let exec = target_executable_in_workspace(temp_pkg_id, &temp_workspace);
159+
let exec = target_executable_in_workspace(&temp_pkg_id, &temp_workspace);
161160
debug!("exec = %s", exec.to_str());
162161
assert!(os::path_exists(&exec));
163162
assert!(is_rwx(&exec));
164-
let lib = target_library_in_workspace(temp_pkg_id, &temp_workspace);
163+
let lib = target_library_in_workspace(&temp_pkg_id, &temp_workspace);
165164
debug!("lib = %s", lib.to_str());
166165
assert!(os::path_exists(&lib));
167166
assert!(is_rwx(&lib));
168167
// And that the test and bench executables aren't installed
169-
assert!(!os::path_exists(&target_test_in_workspace(temp_pkg_id, &temp_workspace)));
170-
let bench = target_bench_in_workspace(temp_pkg_id, &temp_workspace);
168+
assert!(!os::path_exists(&target_test_in_workspace(&temp_pkg_id, &temp_workspace)));
169+
let bench = target_bench_in_workspace(&temp_pkg_id, &temp_workspace);
171170
debug!("bench = %s", bench.to_str());
172171
assert!(!os::path_exists(&bench));
173-
}
172+
}

src/librustpkg/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use syntax::codemap::{dummy_sp, spanned, dummy_spanned};
2323
use syntax::ext::base::{mk_ctxt, ext_ctxt};
2424
use syntax::ext::build;
2525
use syntax::{ast, attr, codemap, diagnostic, fold};
26-
use syntax::ast::{meta_name_value, meta_list, attribute, crate_};
26+
use syntax::ast::{meta_name_value, meta_list, attribute};
2727
use syntax::attr::{mk_attr};
2828
use rustc::back::link::output_type_exe;
2929
use rustc::driver::session::{lib_crate, unknown_crate, crate_type};

src/libsyntax/ast_util.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -679,19 +679,19 @@ mod test {
679679
#[test] fn xorpush_test () {
680680
let mut s = ~[];
681681
xorPush(&mut s,14);
682-
assert_eq!(s,~[14]);
682+
assert_eq!(copy s,~[14]);
683683
xorPush(&mut s,14);
684-
assert_eq!(s,~[]);
684+
assert_eq!(copy s,~[]);
685685
xorPush(&mut s,14);
686-
assert_eq!(s,~[14]);
686+
assert_eq!(copy s,~[14]);
687687
xorPush(&mut s,15);
688-
assert_eq!(s,~[14,15]);
688+
assert_eq!(copy s,~[14,15]);
689689
xorPush (&mut s,16);
690-
assert_eq! (s,~[14,15,16]);
690+
assert_eq!(copy s,~[14,15,16]);
691691
xorPush (&mut s,16);
692-
assert_eq! (s,~[14,15]);
692+
assert_eq!(copy s,~[14,15]);
693693
xorPush (&mut s,15);
694-
assert_eq! (s,~[14]);
694+
assert_eq!(copy s,~[14]);
695695
}
696696

697697
// convert a list of uints to an @~[ident]
@@ -746,7 +746,7 @@ mod test {
746746
let mut t = mk_sctable();
747747

748748
let test_sc = ~[M(3),R(id(101,0),14),M(9)];
749-
assert_eq!(unfold_test_sc(test_sc,empty_ctxt,&mut t),3);
749+
assert_eq!(unfold_test_sc(copy test_sc,empty_ctxt,&mut t),3);
750750
assert_eq!(t[1],Mark(9,0));
751751
assert_eq!(t[2],Rename(id(101,0),14,1));
752752
assert_eq!(t[3],Mark(3,2));

src/libsyntax/ext/expand.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -662,12 +662,11 @@ mod test {
662662
#[test] fn fail_exists_test () {
663663
let src = ~"fn main() { fail!(\"something appropriately gloomy\");}";
664664
let sess = parse::new_parse_sess(None);
665-
let cfg = ~[];
666665
let crate_ast = parse::parse_crate_from_source_str(
667666
~"<test>",
668667
@src,
669-
cfg,sess);
670-
expand_crate(sess,cfg,crate_ast);
668+
~[],sess);
669+
expand_crate(sess,~[],crate_ast);
671670
}
672671
673672
// these following tests are quite fragile, in that they don't test what
@@ -679,13 +678,12 @@ mod test {
679678
let src = ~"fn bogus() {macro_rules! z (() => (3+4))}\
680679
fn inty() -> int { z!() }";
681680
let sess = parse::new_parse_sess(None);
682-
let cfg = ~[];
683681
let crate_ast = parse::parse_crate_from_source_str(
684682
~"<test>",
685683
@src,
686-
cfg,sess);
684+
~[],sess);
687685
// should fail:
688-
expand_crate(sess,cfg,crate_ast);
686+
expand_crate(sess,~[],crate_ast);
689687
}
690688
691689
// make sure that macros can leave scope for modules
@@ -694,27 +692,25 @@ mod test {
694692
let src = ~"mod foo {macro_rules! z (() => (3+4))}\
695693
fn inty() -> int { z!() }";
696694
let sess = parse::new_parse_sess(None);
697-
let cfg = ~[];
698695
let crate_ast = parse::parse_crate_from_source_str(
699696
~"<test>",
700697
@src,
701-
cfg,sess);
698+
~[],sess);
702699
// should fail:
703-
expand_crate(sess,cfg,crate_ast);
700+
expand_crate(sess,~[],crate_ast);
704701
}
705702
706703
// macro_escape modules shouldn't cause macros to leave scope
707704
#[test] fn macros_can_escape_flattened_mods_test () {
708705
let src = ~"#[macro_escape] mod foo {macro_rules! z (() => (3+4))}\
709706
fn inty() -> int { z!() }";
710707
let sess = parse::new_parse_sess(None);
711-
let cfg = ~[];
712708
let crate_ast = parse::parse_crate_from_source_str(
713709
~"<test>",
714710
@src,
715-
cfg,sess);
711+
~[], sess);
716712
// should fail:
717-
expand_crate(sess,cfg,crate_ast);
713+
expand_crate(sess,~[],crate_ast);
718714
}
719715
720716
#[test] fn core_macros_must_parse () {

src/libsyntax/parse/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,14 @@ mod test {
351351
use core::option::None;
352352
use core::int;
353353
use core::num::NumCast;
354-
use core::path::Path;
355-
use codemap::{dummy_sp, CodeMap, span, BytePos, spanned};
354+
use codemap::{CodeMap, span, BytePos, spanned};
356355
use opt_vec;
357356
use ast;
358357
use abi;
359358
use ast_util::mk_ident;
360359
use parse::parser::Parser;
361-
use parse::token::{ident_interner, mk_ident_interner, mk_fresh_ident_interner};
362-
use diagnostic::{span_handler, mk_span_handler, mk_handler, Emitter};
360+
use parse::token::{ident_interner, mk_fresh_ident_interner};
361+
use diagnostic::{mk_span_handler, mk_handler};
363362

364363
// add known names to interner for testing
365364
fn mk_testing_interner() -> @ident_interner {
@@ -408,7 +407,7 @@ mod test {
408407
409408
// map a string to tts, return the tt without its parsesess
410409
fn string_to_tts_only(source_str : @~str) -> ~[ast::token_tree] {
411-
let (tts,ps) = string_to_tts_t(source_str);
410+
let (tts,_ps) = string_to_tts_t(source_str);
412411
tts
413412
}
414413
@@ -483,7 +482,7 @@ mod test {
483482
}*/
484483
485484
#[test] fn string_to_tts_1 () {
486-
let (tts,ps) = string_to_tts_t(@~"fn a (b : int) { b; }");
485+
let (tts,_ps) = string_to_tts_t(@~"fn a (b : int) { b; }");
487486
assert_eq!(to_json_str(@tts),
488487
~"[\
489488
[\"tt_tok\",null,[\"IDENT\",\"fn\",false]],\
@@ -548,7 +547,7 @@ mod test {
548547
}
549548
550549
fn parser_done(p: Parser){
551-
assert_eq!(*p.token,token::EOF);
550+
assert_eq!(copy *p.token,token::EOF);
552551
}
553552
554553
#[test] fn parse_ident_pat () {

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2388,7 +2388,7 @@ pub impl Parser {
23882388
// preceded by unary-minus) or identifiers.
23892389
let val = self.parse_literal_maybe_minus();
23902390
if self.eat(&token::DOTDOT) {
2391-
let end = if is_ident_or_path(&tok) {
2391+
let end = if is_ident_or_path(tok) {
23922392
let path = self.parse_path_with_tps(true);
23932393
let hi = self.span.hi;
23942394
self.mk_expr(lo, hi, expr_path(path))

0 commit comments

Comments
 (0)