Skip to content

Commit 56e4c82

Browse files
committed
Test fixes and merge conflicts
1 parent c1e287a commit 56e4c82

File tree

18 files changed

+44
-97
lines changed

18 files changed

+44
-97
lines changed

mk/tests.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,10 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
924924
@rm -rf $(3)/test/run-make/$$*
925925
@mkdir -p $(3)/test/run-make/$$*
926926
@echo maketest: $$*
927-
@python $(S)src/etc/maketest.py $$(dir $$<) \
927+
$$(Q)python $(S)src/etc/maketest.py $$(dir $$<) \
928928
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
929-
$(3)/test/run-make/$$*
929+
$(3)/test/run-make/$$* \
930+
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))"
930931
@touch $$@
931932

932933
endef

src/etc/maketest.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
os.putenv('RUSTC', os.path.abspath(sys.argv[2]))
88
os.putenv('TMPDIR', os.path.abspath(sys.argv[3]))
9+
os.putenv('CC', sys.argv[4])
910

1011
proc = subprocess.Popen(['make', '-C', sys.argv[1]],
1112
stdout = subprocess.PIPE,

src/libextra/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Rust extras are part of the standard Rust distribution.
4040

4141
#[deny(non_camel_case_types)];
4242
#[deny(missing_doc)];
43+
#[allow(attribute_usage)]; // NOTE: remove after the next snapshot
4344

4445
use std::str::{StrSlice, OwnedStr};
4546

src/librustc/back/archive.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct Archive {
2727

2828
fn run_ar(sess: Session, args: &str, cwd: Option<&Path>,
2929
paths: &[&Path]) -> ProcessOutput {
30-
let ar = sess.opts.ar.clone().unwrap_or(~"ar");
30+
let ar = sess.opts.ar.clone().unwrap_or_else(|| ~"ar");
3131
let mut args = ~[args.to_owned()];
3232
let mut paths = paths.iter().map(|p| p.as_str().unwrap().to_owned());
3333
args.extend(&mut paths);
@@ -64,7 +64,17 @@ impl Archive {
6464

6565
/// Read a file in the archive
6666
pub fn read(&self, file: &str) -> ~[u8] {
67-
run_ar(self.sess, "p", None, [&self.dst, &Path::new(file)]).output
67+
// Apparently if "ar p" is used on windows, it generates a corrupt file
68+
// which has bad headers and LLVM will immediately choke on it
69+
if cfg!(windows) && cfg!(windows) { // FIXME(#10734) double-and
70+
let loc = TempDir::new("rsar").unwrap();
71+
let archive = os::make_absolute(&self.dst);
72+
run_ar(self.sess, "x", Some(loc.path()), [&archive,
73+
&Path::init(file)]);
74+
fs::File::open(&loc.path().join(file)).read_to_end()
75+
} else {
76+
run_ar(self.sess, "p", None, [&self.dst, &Path::init(file)]).output
77+
}
6878
}
6979

7080
/// Adds all of the contents of a native library to this archive. This will
@@ -77,7 +87,7 @@ impl Archive {
7787
/// Adds all of the contents of the rlib at the specified path to this
7888
/// archive.
7989
pub fn add_rlib(&mut self, rlib: &Path) {
80-
let name = rlib.filename_str().unwrap().split_iter('-').next().unwrap();
90+
let name = rlib.filename_str().unwrap().split('-').next().unwrap();
8191
self.add_archive(rlib, name);
8292
}
8393

src/librustc/back/link.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ fn link_args(sess: Session,
11121112
// follow this flag. Thus, use it before specifing libraries to link to.
11131113
args.push(~"-Wl,--as-needed");
11141114

1115-
// GNU-style linkers supports optimization with -O. --gc-sections
1115+
// GNU-style linkers support optimization with -O. --gc-sections
11161116
// removes metadata and potentially other useful things, so don't
11171117
// include it. GNU ld doesn't need a numeric argument, but other linkers
11181118
// do.
@@ -1212,7 +1212,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
12121212
}
12131213
}
12141214

1215-
// This is a fallback of three differnet cases of linking:
1215+
// This is a fallback of three different cases of linking:
12161216
//
12171217
// * When creating a dynamic library, all inputs are required to be dynamic
12181218
// as well
@@ -1223,7 +1223,8 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
12231223
let crates = cstore::get_used_crates(cstore, cstore::RequireDynamic);
12241224
for &(cnum, ref path) in crates.iter() {
12251225
let cratepath = match *path {
1226-
Some(ref p) => p.clone(), None => {
1226+
Some(ref p) => p.clone(),
1227+
None => {
12271228
sess.err(format!("could not find dynamic library for: `{}`",
12281229
cstore::get_crate_data(sess.cstore, cnum).name));
12291230
return

src/librustc/driver/session.rs

-72
Original file line numberDiff line numberDiff line change
@@ -420,75 +420,3 @@ pub fn sess_os_to_meta_os(os: abi::Os) -> metadata::loader::Os {
420420
abi::OsFreebsd => loader::OsFreebsd
421421
}
422422
}
423-
424-
#[cfg(test)]
425-
mod test {
426-
use driver::session::{bin_crate, building_library, lib_crate};
427-
use driver::session::{unknown_crate};
428-
429-
use syntax::ast;
430-
use syntax::attr;
431-
use syntax::codemap;
432-
433-
fn make_crate_type_attr(t: @str) -> ast::Attribute {
434-
attr::mk_attr(attr::mk_name_value_item_str(@"crate_type", t))
435-
}
436-
437-
fn make_crate(with_bin: bool, with_lib: bool) -> @ast::Crate {
438-
let mut attrs = ~[];
439-
if with_bin {
440-
attrs.push(make_crate_type_attr(@"bin"));
441-
}
442-
if with_lib {
443-
attrs.push(make_crate_type_attr(@"lib"));
444-
}
445-
@ast::Crate {
446-
module: ast::_mod { view_items: ~[], items: ~[] },
447-
attrs: attrs,
448-
config: ~[],
449-
span: codemap::dummy_sp(),
450-
}
451-
}
452-
453-
#[test]
454-
fn bin_crate_type_attr_results_in_bin_output() {
455-
let crate = make_crate(true, false);
456-
assert!(!building_library(unknown_crate, crate, false));
457-
}
458-
459-
#[test]
460-
fn lib_crate_type_attr_results_in_lib_output() {
461-
let crate = make_crate(false, true);
462-
assert!(building_library(unknown_crate, crate, false));
463-
}
464-
465-
#[test]
466-
fn bin_option_overrides_lib_crate_type() {
467-
let crate = make_crate(false, true);
468-
assert!(!building_library(bin_crate, crate, false));
469-
}
470-
471-
#[test]
472-
fn lib_option_overrides_bin_crate_type() {
473-
let crate = make_crate(true, false);
474-
assert!(building_library(lib_crate, crate, false));
475-
}
476-
477-
#[test]
478-
fn bin_crate_type_is_default() {
479-
let crate = make_crate(false, false);
480-
assert!(!building_library(unknown_crate, crate, false));
481-
}
482-
483-
#[test]
484-
fn test_option_overrides_lib_crate_type() {
485-
let crate = make_crate(false, true);
486-
assert!(!building_library(unknown_crate, crate, true));
487-
}
488-
489-
#[test]
490-
fn test_option_does_not_override_requested_lib_type() {
491-
let crate = make_crate(false, false);
492-
assert!(building_library(lib_crate, crate, true));
493-
}
494-
}

src/librustc/front/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl Visitor<()> for Context {
135135
}
136136
}
137137

138-
ast::item_foreign_mod(*) => {
138+
ast::item_foreign_mod(..) => {
139139
if attr::contains_name(i.attrs, "link_args") &&
140140
cfg!(stage0, remove_this_on_next_snapshot) { // NOTE: snap
141141
self.gate_feature("link_args", i.span,

src/librustc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#[crate_type = "dylib"];
2121

2222
#[feature(macro_rules, globs, struct_variant, managed_boxes)];
23+
#[allow(attribute_usage)]; // NOTE: remove after the next snapshot
2324

2425
extern mod extra;
2526
extern mod syntax;

src/librustc/metadata/creader.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ fn visit_item(e: &Env, i: @ast::item) {
187187
for m in link_args.iter() {
188188
match m.meta_item_list() {
189189
Some(items) => {
190-
let kind = do items.iter().find |k| {
190+
let kind = items.iter().find(|k| {
191191
"kind" == k.name()
192-
}.and_then(|a| a.value_str());
192+
}).and_then(|a| a.value_str());
193193
let kind = match kind {
194194
Some(k) if "static" == k => cstore::NativeStatic,
195195
Some(k) => {
@@ -198,9 +198,9 @@ fn visit_item(e: &Env, i: @ast::item) {
198198
}
199199
None => cstore::NativeUnknown
200200
};
201-
let n = do items.iter().find |n| {
201+
let n = items.iter().find(|n| {
202202
"name" == n.name()
203-
}.and_then(|a| a.value_str());
203+
}).and_then(|a| a.value_str());
204204
let n = match n {
205205
Some(n) => n,
206206
None => {

src/librustc/metadata/decoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1533,9 +1533,9 @@ pub fn get_trait_of_method(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt)
15331533
pub fn get_native_libraries(cdata: Cmd) -> ~[~str] {
15341534
let libraries = reader::get_doc(reader::Doc(cdata.data), tag_native_libraries);
15351535
let mut result = ~[];
1536-
do reader::tagged_docs(libraries, tag_native_libraries_lib) |lib_doc| {
1536+
reader::tagged_docs(libraries, tag_native_libraries_lib, |lib_doc| {
15371537
result.push(lib_doc.as_str());
15381538
true
1539-
};
1539+
});
15401540
return result;
15411541
}

src/librustc/metadata/loader.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl Context {
8383
let rlib_prefix = format!("lib{}-", crate_name);
8484

8585
let mut matches = ~[];
86-
do filesearch::search(filesearch) |path| {
86+
filesearch::search(filesearch, |path| {
8787
match path.filename_str() {
8888
None => FileDoesntMatch,
8989
Some(file) => {
@@ -135,7 +135,7 @@ impl Context {
135135
}
136136
}
137137
}
138-
}
138+
});
139139

140140
match matches.len() {
141141
0 => None,
@@ -180,7 +180,7 @@ impl Context {
180180
lib.rlib = Some(path.clone());
181181
return true;
182182
}
183-
Some(*) | None => {}
183+
Some(..) | None => {}
184184
}
185185
}
186186
return false;
@@ -200,7 +200,7 @@ impl Context {
200200
lib.dylib = Some(path.clone());
201201
return true;
202202
}
203-
Some(*) | None => {}
203+
Some(..) | None => {}
204204
}
205205
}
206206
return false;
@@ -360,7 +360,7 @@ pub fn list_file_metadata(sess: Session,
360360
let crate_name = path.filename_str().unwrap();
361361
let crate_name = if crate_name.starts_with("lib") {
362362
crate_name.slice_from(3) } else { crate_name };
363-
let crate_name = crate_name.split_iter('-').next().unwrap();
363+
let crate_name = crate_name.split('-').next().unwrap();
364364
match get_metadata_section(sess, os, path, crate_name) {
365365
option::Some(bytes) => decoder::list_crate_metadata(intr, bytes, out),
366366
option::None => {

src/librustc/middle/lint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ fn check_heap_item(cx: &Context, it: &ast::item) {
808808
}
809809

810810
static crate_attrs: &'static [&'static str] = &[
811-
"crate_type", "link", "feature", "no_uv", "no_main", "no_std",
811+
"crate_type", "feature", "no_uv", "no_main", "no_std",
812812
"desc", "comment", "license", "copyright", // not used in rustc now
813813
];
814814

@@ -830,7 +830,7 @@ static other_attrs: &'static [&'static str] = &[
830830
"deprecated", "experimental", "unstable", "stable", "locked", "frozen", //item stability
831831
"crate_map", "cfg", "doc", "export_name", "link_section", "no_freeze",
832832
"no_mangle", "no_send", "static_assert", "unsafe_no_drop_flag",
833-
"packed", "simd", "repr", "deriving", "unsafe_destructor",
833+
"packed", "simd", "repr", "deriving", "unsafe_destructor", "link",
834834

835835
//mod-level
836836
"path", "link_name", "link_args", "nolink", "macro_escape", "no_implicit_prelude",

src/librustuv/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ via `close` and `delete` methods.
4646
#[crate_type = "dylib"];
4747

4848
#[feature(macro_rules, globs)];
49+
#[allow(attribute_usage)]; // NOTE: remove after the next snapshot
4950

5051
use std::cast::transmute;
5152
use std::cast;

src/librustuv/uvll.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ extern {
723723
}
724724

725725
// various platform libraries required by libuv
726-
#[cfg(not(stage0))]
726+
#[cfg(not(stage0), not(target_os = "android"))]
727727
#[link(name = "pthread")]
728728
extern {}
729729
#[cfg(stage0)]

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666

6767
#[deny(non_camel_case_types)];
6868
#[deny(missing_doc)];
69+
#[allow(attribute_usage)]; // NOTE: remove after the next snapshot
6970

7071
// When testing libstd, bring in libuv as the I/O backend so tests can print
7172
// things and all of the std::io tests have an I/O interface to run on top

src/test/run-make/tools.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ endif
1919
%.a: %.o
2020
ar crus $@ $<
2121
%.dylib: %.o
22-
ld -o $@ $< -dylib
22+
$(CC) -dynamiclib -Wl,-dylib -o $@ $<
2323
%.so: %.o
24-
ld -o $@ $< -shared
24+
$(CC) -o $@ $< -shared
2525
$(TMPDIR)/lib%.o: %.c
2626
$(CC) -c -o $@ $<
2727

src/test/run-pass/anon-extern-mod-cross-crate-2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// xfail-fast
12+
// xfail-pretty
1213
// aux-build:anon-extern-mod-cross-crate-1.rs
1314
extern mod anonexternmod;
1415

src/test/run-pass/invoke-external-foreign.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// xfail-fast
12+
// xfail-pretty
1213
// aux-build:foreign_lib.rs
1314

1415
// The purpose of this test is to check that we can

0 commit comments

Comments
 (0)