Skip to content

Commit b21a527

Browse files
committed
---
yaml --- r: 80766 b: refs/heads/try c: 6c4c5f5 h: refs/heads/master v: v3
1 parent 71e17aa commit b21a527

File tree

14 files changed

+271
-325
lines changed

14 files changed

+271
-325
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: ec8f88417c2ced5bed685c6bc94d11a7c0840f96
5+
refs/heads/try: 6c4c5f56313b3b48dc42297ca927f2a43715e19f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rustpkg.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ A valid workspace must contain each of the following subdirectories:
5252
rustpkg will install libraries for bar to `foo/lib/x86_64-apple-darwin/`.
5353
The libraries will have names of the form `foo/lib/x86_64-apple-darwin/libbar-[hash].dylib`,
5454
where [hash] is a hash of the package ID.
55-
* 'bin/': `rustpkg install` installs executable binaries into this directory.
55+
* 'bin/': `rustpkg install` installs executable binaries into a target-specific subdirectory of this directory.
5656

57-
For example, rustpkg will install executables for `bar` to
58-
`foo/bin`.
59-
The executables will have names of the form `foo/bin/bar`.
57+
For example, on a 64-bit machine running Mac OS X,
58+
if `foo` is a workspace, containing the package `bar`,
59+
rustpkg will install executables for `bar` to
60+
`foo/bin/x86_64-apple-darwin/`.
61+
The executables will have names of the form `foo/bin/x86_64-apple-darwin/bar`.
6062
* 'build/': `rustpkg build` stores temporary build artifacts in a target-specific subdirectory of this directory.
6163

6264
For example, on a 64-bit machine running Mac OS X,
@@ -83,12 +85,6 @@ rustpkg also interprets any dependencies on such a package ID literally
8385
Thus, `github.com/mozilla/rust#5c4cd30f80` is also a valid package ID,
8486
since git can deduce that 5c4cd30f80 refers to a revision of the desired repository.
8587

86-
A package identifier can name a subdirectory of another package.
87-
For example, if `foo` is a workspace, and `foo/src/bar/lib.rs` exists,
88-
as well as `foo/src/bar/extras/baz/lib.rs`,
89-
then both `bar` and `bar/extras/baz` are valid package identifiers
90-
in the workspace `foo`.
91-
9288
## Source files
9389

9490
rustpkg searches for four different fixed filenames in order to determine the crates to build:
@@ -144,11 +140,9 @@ but not in their `lib` or `bin` directories.
144140

145141
## install
146142

147-
`rustpkg install foo` builds the libraries and/or executables that are targets for `foo`.
148-
If `RUST_PATH` is declared as an environment variable, then rustpkg installs the
149-
libraries and executables into the `lib` and `bin` subdirectories
150-
of the first entry in `RUST_PATH`.
151-
Otherwise, it installs them into `foo`'s `lib` and `bin` directories.
143+
`rustpkg install foo` builds the libraries and/or executables that are targets for `foo`,
144+
and then installs them either into `foo`'s `lib` and `bin` directories,
145+
or into the `lib` and `bin` subdirectories of the first entry in `RUST_PATH`.
152146

153147
## test
154148

branches/try/src/libextra/glob.rs

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,194 @@ mod test {
516516
use super::*;
517517
use tempfile;
518518
519+
#[test]
520+
fn test_relative_pattern() {
521+
522+
fn change_then_remove(p: &Path, f: &fn()) {
523+
do (|| {
524+
unstable::change_dir_locked(p, || f());
525+
}).finally {
526+
os::remove_dir_recursive(p);
527+
}
528+
}
529+
530+
fn mk_file(path: &str, directory: bool) {
531+
if directory {
532+
os::make_dir(&Path(path), 0xFFFF);
533+
} else {
534+
io::mk_file_writer(&Path(path), [io::Create]);
535+
}
536+
}
537+
538+
fn abs_path(path: &str) -> Path {
539+
os::getcwd().push_many(Path(path).components)
540+
}
541+
542+
fn glob_vec(pattern: &str) -> ~[Path] {
543+
glob(pattern).collect()
544+
}
545+
546+
let root = tempfile::mkdtemp(&os::tmpdir(), "glob-tests");
547+
let root = root.expect("Should have created a temp directory");
548+
549+
do change_then_remove(&root) {
550+
551+
mk_file("aaa", true);
552+
mk_file("aaa/apple", true);
553+
mk_file("aaa/orange", true);
554+
mk_file("aaa/tomato", true);
555+
mk_file("aaa/tomato/tomato.txt", false);
556+
mk_file("aaa/tomato/tomoto.txt", false);
557+
mk_file("bbb", true);
558+
mk_file("bbb/specials", true);
559+
mk_file("bbb/specials/!", false);
560+
561+
// windows does not allow `*` or `?` characters to exist in filenames
562+
if os::consts::FAMILY != os::consts::windows::FAMILY {
563+
mk_file("bbb/specials/*", false);
564+
mk_file("bbb/specials/?", false);
565+
}
566+
567+
mk_file("bbb/specials/[", false);
568+
mk_file("bbb/specials/]", false);
569+
mk_file("ccc", true);
570+
mk_file("xyz", true);
571+
mk_file("xyz/x", false);
572+
mk_file("xyz/y", false);
573+
mk_file("xyz/z", false);
574+
575+
assert_eq!(glob_vec(""), ~[]);
576+
assert_eq!(glob_vec("."), ~[]);
577+
assert_eq!(glob_vec(".."), ~[]);
578+
579+
assert_eq!(glob_vec("aaa"), ~[abs_path("aaa")]);
580+
assert_eq!(glob_vec("aaa/"), ~[abs_path("aaa")]);
581+
assert_eq!(glob_vec("a"), ~[]);
582+
assert_eq!(glob_vec("aa"), ~[]);
583+
assert_eq!(glob_vec("aaaa"), ~[]);
584+
585+
assert_eq!(glob_vec("aaa/apple"), ~[abs_path("aaa/apple")]);
586+
assert_eq!(glob_vec("aaa/apple/nope"), ~[]);
587+
588+
// windows should support both / and \ as directory separators
589+
if os::consts::FAMILY == os::consts::windows::FAMILY {
590+
assert_eq!(glob_vec("aaa\\apple"), ~[abs_path("aaa/apple")]);
591+
}
592+
593+
assert_eq!(glob_vec("???/"), ~[
594+
abs_path("aaa"),
595+
abs_path("bbb"),
596+
abs_path("ccc"),
597+
abs_path("xyz")]);
598+
599+
assert_eq!(glob_vec("aaa/tomato/tom?to.txt"), ~[
600+
abs_path("aaa/tomato/tomato.txt"),
601+
abs_path("aaa/tomato/tomoto.txt")]);
602+
603+
assert_eq!(glob_vec("xyz/?"), ~[
604+
abs_path("xyz/x"),
605+
abs_path("xyz/y"),
606+
abs_path("xyz/z")]);
607+
608+
assert_eq!(glob_vec("a*"), ~[abs_path("aaa")]);
609+
assert_eq!(glob_vec("*a*"), ~[abs_path("aaa")]);
610+
assert_eq!(glob_vec("a*a"), ~[abs_path("aaa")]);
611+
assert_eq!(glob_vec("aaa*"), ~[abs_path("aaa")]);
612+
assert_eq!(glob_vec("*aaa"), ~[abs_path("aaa")]);
613+
assert_eq!(glob_vec("*aaa*"), ~[abs_path("aaa")]);
614+
assert_eq!(glob_vec("*a*a*a*"), ~[abs_path("aaa")]);
615+
assert_eq!(glob_vec("aaa*/"), ~[abs_path("aaa")]);
616+
617+
assert_eq!(glob_vec("aaa/*"), ~[
618+
abs_path("aaa/apple"),
619+
abs_path("aaa/orange"),
620+
abs_path("aaa/tomato")]);
621+
622+
assert_eq!(glob_vec("aaa/*a*"), ~[
623+
abs_path("aaa/apple"),
624+
abs_path("aaa/orange"),
625+
abs_path("aaa/tomato")]);
626+
627+
assert_eq!(glob_vec("*/*/*.txt"), ~[
628+
abs_path("aaa/tomato/tomato.txt"),
629+
abs_path("aaa/tomato/tomoto.txt")]);
630+
631+
assert_eq!(glob_vec("*/*/t[aob]m?to[.]t[!y]t"), ~[
632+
abs_path("aaa/tomato/tomato.txt"),
633+
abs_path("aaa/tomato/tomoto.txt")]);
634+
635+
assert_eq!(glob_vec("aa[a]"), ~[abs_path("aaa")]);
636+
assert_eq!(glob_vec("aa[abc]"), ~[abs_path("aaa")]);
637+
assert_eq!(glob_vec("a[bca]a"), ~[abs_path("aaa")]);
638+
assert_eq!(glob_vec("aa[b]"), ~[]);
639+
assert_eq!(glob_vec("aa[xyz]"), ~[]);
640+
assert_eq!(glob_vec("aa[]]"), ~[]);
641+
642+
assert_eq!(glob_vec("aa[!b]"), ~[abs_path("aaa")]);
643+
assert_eq!(glob_vec("aa[!bcd]"), ~[abs_path("aaa")]);
644+
assert_eq!(glob_vec("a[!bcd]a"), ~[abs_path("aaa")]);
645+
assert_eq!(glob_vec("aa[!a]"), ~[]);
646+
assert_eq!(glob_vec("aa[!abc]"), ~[]);
647+
648+
assert_eq!(glob_vec("bbb/specials/[[]"), ~[abs_path("bbb/specials/[")]);
649+
assert_eq!(glob_vec("bbb/specials/!"), ~[abs_path("bbb/specials/!")]);
650+
assert_eq!(glob_vec("bbb/specials/[]]"), ~[abs_path("bbb/specials/]")]);
651+
652+
if os::consts::FAMILY != os::consts::windows::FAMILY {
653+
assert_eq!(glob_vec("bbb/specials/[*]"), ~[abs_path("bbb/specials/*")]);
654+
assert_eq!(glob_vec("bbb/specials/[?]"), ~[abs_path("bbb/specials/?")]);
655+
}
656+
657+
if os::consts::FAMILY == os::consts::windows::FAMILY {
658+
659+
assert_eq!(glob_vec("bbb/specials/[![]"), ~[
660+
abs_path("bbb/specials/!"),
661+
abs_path("bbb/specials/]")]);
662+
663+
assert_eq!(glob_vec("bbb/specials/[!]]"), ~[
664+
abs_path("bbb/specials/!"),
665+
abs_path("bbb/specials/[")]);
666+
667+
assert_eq!(glob_vec("bbb/specials/[!!]"), ~[
668+
abs_path("bbb/specials/["),
669+
abs_path("bbb/specials/]")]);
670+
671+
} else {
672+
673+
assert_eq!(glob_vec("bbb/specials/[![]"), ~[
674+
abs_path("bbb/specials/!"),
675+
abs_path("bbb/specials/*"),
676+
abs_path("bbb/specials/?"),
677+
abs_path("bbb/specials/]")]);
678+
679+
assert_eq!(glob_vec("bbb/specials/[!]]"), ~[
680+
abs_path("bbb/specials/!"),
681+
abs_path("bbb/specials/*"),
682+
abs_path("bbb/specials/?"),
683+
abs_path("bbb/specials/[")]);
684+
685+
assert_eq!(glob_vec("bbb/specials/[!!]"), ~[
686+
abs_path("bbb/specials/*"),
687+
abs_path("bbb/specials/?"),
688+
abs_path("bbb/specials/["),
689+
abs_path("bbb/specials/]")]);
690+
691+
assert_eq!(glob_vec("bbb/specials/[!*]"), ~[
692+
abs_path("bbb/specials/!"),
693+
abs_path("bbb/specials/?"),
694+
abs_path("bbb/specials/["),
695+
abs_path("bbb/specials/]")]);
696+
697+
assert_eq!(glob_vec("bbb/specials/[!?]"), ~[
698+
abs_path("bbb/specials/!"),
699+
abs_path("bbb/specials/*"),
700+
abs_path("bbb/specials/["),
701+
abs_path("bbb/specials/]")]);
702+
703+
}
704+
};
705+
}
706+
519707
#[test]
520708
fn test_absolute_pattern() {
521709
// assume that the filesystem is not empty!

branches/try/src/librustc/metadata/filesearch.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
7777
if !found {
7878
let rustpath = rust_path();
7979
for path in rustpath.iter() {
80-
let tlib_path = make_rustpkg_target_lib_path(path, self.target_triple);
81-
debug!("is %s in visited_dirs? %?", tlib_path.to_str(),
82-
visited_dirs.contains(&tlib_path.to_str()));
80+
debug!("is %s in visited_dirs? %?",
81+
path.push("lib").to_str(),
82+
visited_dirs.contains(&path.push("lib").to_str()));
8383

84-
if !visited_dirs.contains(&tlib_path.to_str()) {
85-
visited_dirs.insert(tlib_path.to_str());
84+
if !visited_dirs.contains(&path.push("lib").to_str()) {
85+
visited_dirs.insert(path.push("lib").to_str());
8686
// Don't keep searching the RUST_PATH if one match turns up --
8787
// if we did, we'd get a "multiple matching crates" error
88-
match f(&tlib_path) {
88+
match f(&path.push("lib")) {
8989
FileMatches => {
9090
break;
9191
}
@@ -145,11 +145,6 @@ fn make_target_lib_path(sysroot: &Path,
145145
sysroot.push_rel(&relative_target_lib_path(target_triple))
146146
}
147147

148-
fn make_rustpkg_target_lib_path(dir: &Path,
149-
target_triple: &str) -> Path {
150-
dir.push_rel(&Path(libdir()).push(target_triple.to_owned()))
151-
}
152-
153148
fn get_or_default_sysroot() -> Path {
154149
match os::self_exe_path() {
155150
option::Some(ref p) => (*p).pop(),

branches/try/src/librustc/middle/trans/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,9 +655,9 @@ pub fn FastCall(cx: @mut Block, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef {
655655
}
656656

657657
pub fn CallWithConv(cx: @mut Block, Fn: ValueRef, Args: &[ValueRef],
658-
Conv: CallConv, sret: bool) -> ValueRef {
658+
Conv: CallConv) -> ValueRef {
659659
if cx.unreachable { return _UndefReturn(cx, Fn); }
660-
B(cx).call_with_conv(Fn, Args, Conv, sret)
660+
B(cx).call_with_conv(Fn, Args, Conv)
661661
}
662662

663663
pub fn AtomicFence(cx: @mut Block, order: AtomicOrdering) {

branches/try/src/librustc/middle/trans/builder.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use lib::llvm::llvm;
1313
use lib::llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect};
1414
use lib::llvm::{Opcode, IntPredicate, RealPredicate, False};
1515
use lib::llvm::{ValueRef, BasicBlockRef, BuilderRef, ModuleRef};
16-
use lib::llvm::{StructRetAttribute};
1716
use middle::trans::base;
1817
use middle::trans::common::*;
1918
use middle::trans::machine::llalign_of_min;
@@ -779,9 +778,14 @@ impl Builder {
779778

780779
pub fn call(&self, llfn: ValueRef, args: &[ValueRef]) -> ValueRef {
781780
self.count_insn("call");
781+
782+
debug!("Call(llfn=%s, args=%?)",
783+
self.ccx.tn.val_to_str(llfn),
784+
args.map(|arg| self.ccx.tn.val_to_str(*arg)));
785+
782786
do args.as_imm_buf |ptr, len| {
783787
unsafe {
784-
llvm::LLVMBuildCall(self.llbuilder, llfn, ptr, len as c_uint, noname())
788+
llvm::LLVMBuildCall(self.llbuilder, llfn, ptr, len as c_uint, noname())
785789
}
786790
}
787791
}
@@ -797,16 +801,12 @@ impl Builder {
797801
}
798802

799803
pub fn call_with_conv(&self, llfn: ValueRef, args: &[ValueRef],
800-
conv: CallConv, sret: bool) -> ValueRef {
804+
conv: CallConv) -> ValueRef {
801805
self.count_insn("callwithconv");
802806
unsafe {
803807
let v = llvm::LLVMBuildCall(self.llbuilder, llfn, vec::raw::to_ptr(args),
804808
args.len() as c_uint, noname());
805809
lib::llvm::SetInstructionCallConv(v, conv);
806-
if sret {
807-
let return_slot = 1;
808-
llvm::LLVMAddInstrAttribute(v, return_slot, StructRetAttribute as c_uint);
809-
}
810810
v
811811
}
812812
}

branches/try/src/librustc/middle/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ pub fn trans_native_call(bcx: @mut Block,
266266
}
267267
};
268268

269-
let llforeign_retval = CallWithConv(bcx, llfn, llargs_foreign, cc, fn_type.sret);
269+
let llforeign_retval = CallWithConv(bcx, llfn, llargs_foreign, cc);
270270

271271
// If the function we just called does not use an outpointer,
272272
// store the result into the rust outpointer. Cast the outpointer

0 commit comments

Comments
 (0)