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

Lines changed: 3 additions & 2 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 13 additions & 3 deletions
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

Lines changed: 4 additions & 3 deletions
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

Lines changed: 0 additions & 72 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 2 deletions
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
}

0 commit comments

Comments
 (0)