Skip to content

Commit e6addeb

Browse files
committed
---
yaml --- r: 114299 b: refs/heads/master c: 42be687 h: refs/heads/master i: 114297: edc8a7d 114295: ec5728e v: v3
1 parent 144014f commit e6addeb

File tree

59 files changed

+674
-208
lines changed

Some content is hidden

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

59 files changed

+674
-208
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: 3a1b7d47f33ca8004820548a99e562d3f7d60921
2+
refs/heads/master: 42be687fa1a1070195c25a8e607d1209a9f8c88b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ec0258a381b88b5574e3f8ce72ae553ac3a574b7
55
refs/heads/try: 7c6c492fb2af9a85f21ff952942df3523b22fd17

trunk/mk/main.mk

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,18 +349,45 @@ CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
349349
endef
350350

351351
# Same macro/variables as above, but defined in a separate loop so it can use
352-
# all the varibles above for all archs. The RPATH_VAR setup sometimes needs to
352+
# all the variables above for all archs. The RPATH_VAR setup sometimes needs to
353353
# reach across triples to get things in order.
354+
#
355+
# Defines (with the standard $(1)_T_$(2)_H_$(3) suffix):
356+
# * `LD_LIBRARY_PATH_ENV_NAME`: the name for the key to use in the OS
357+
# environment to access or extend the lookup path for dynamic
358+
# libraries. Note on Windows, that key is `$PATH`, and thus not
359+
# only conflates programs with dynamic libraries, but also often
360+
# contains spaces which confuse make.
361+
# * `LD_LIBRARY_PATH_ENV_HOSTDIR`: the entry to add to lookup path for the host
362+
# * `LD_LIBRARY_PATH_ENV_TARGETDIR`: the entry to add to lookup path for target
363+
#
364+
# Below that, HOST_RPATH_VAR and TARGET_RPATH_VAR are defined in terms of the
365+
# above settings.
366+
#
354367
define SREQ_CMDS
355368

356369
ifeq ($$(OSTYPE_$(3)),apple-darwin)
357-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
358-
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
370+
LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := DYLD_LIBRARY_PATH
371+
else
372+
ifeq ($$(CFG_WINDOWSY_$(2)),1)
373+
LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := PATH
359374
else
360-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
361-
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
375+
LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LD_LIBRARY_PATH
376+
endif
362377
endif
363378

379+
LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
380+
$$(CURDIR)/$$(HLIB$(1)_H_$(3))
381+
LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
382+
$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))
383+
384+
HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
385+
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)):$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))
386+
TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
387+
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)):$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))
388+
389+
RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3))
390+
364391
# Pass --cfg stage0 only for the build->host part of stage0;
365392
# if you're building a cross config, the host->* parts are
366393
# effectively stage1, since it uses the just-built stage0.
@@ -376,13 +403,7 @@ ifeq ($(1),0)
376403
ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
377404
CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
378405

379-
ifeq ($$(OSTYPE_$(3)),apple-darwin)
380-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
381-
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))"
382-
else
383-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
384-
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))"
385-
endif
406+
RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3))
386407
endif
387408
endif
388409

trunk/mk/tests.mk

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,27 @@ else
793793
CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
794794
endif
795795

796+
# (Issues #13732, #13983, #14000) The doc for the regex crate includes
797+
# uses of the `regex!` macro from the regex_macros crate. There is
798+
# normally a dependence injected that makes the target's regex depend
799+
# upon the host's regex_macros (see #13845), but that dependency
800+
# injection is currently skipped for stage1 as a special case.
801+
#
802+
# Therefore, as a further special case, this conditional skips
803+
# attempting to run the doc tests for the regex crate atop stage1,
804+
# (since there is no regex_macros crate for the stage1 rustc to load).
805+
#
806+
# (Another approach for solving this would be to inject the desired
807+
# dependence for stage1 as well, by setting things up to generate a
808+
# regex_macros crate that was compatible with the stage1 rustc and
809+
# thus re-enable our ability to run this test.)
810+
ifeq (stage$(1)-crate-$(4),stage1-crate-regex)
811+
check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec:
812+
@$$(call E, skipping doc-crate-$(4) as it uses macros and cannot run at stage$(1))
813+
else
796814
check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
797815
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
816+
endif
798817

799818
ifeq ($(2),$$(CFG_BUILD))
800819
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
@@ -951,7 +970,10 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
951970
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
952971
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
953972
"$$(TESTNAME)" \
954-
"$$(RPATH_VAR$(1)_T_$(2)_H_$(3))"
973+
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) \
974+
"$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))" \
975+
"$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))" \
976+
$(1)
955977
@touch $$@
956978
else
957979
# FIXME #11094 - The above rule doesn't work right for multiple targets

trunk/src/compiletest/procsrv.rs

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,54 +11,31 @@
1111
use std::os;
1212
use std::str;
1313
use std::io::process::{ProcessExit, Command, Process, ProcessOutput};
14+
use std::unstable::dynamic_lib::DynamicLibrary;
1415

15-
#[cfg(target_os = "win32")]
1616
fn target_env(lib_path: &str, prog: &str) -> Vec<(StrBuf, StrBuf)> {
17-
let env = os::env();
17+
let prog = if cfg!(windows) {prog.slice_to(prog.len() - 4)} else {prog};
18+
let aux_path = prog + ".libaux";
1819

19-
// Make sure we include the aux directory in the path
20-
assert!(prog.ends_with(".exe"));
21-
let aux_path = prog.slice(0u, prog.len() - 4u).to_owned() + ".libaux";
20+
// Need to be sure to put both the lib_path and the aux path in the dylib
21+
// search path for the child.
22+
let mut path = DynamicLibrary::search_path();
23+
path.insert(0, Path::new(aux_path));
24+
path.insert(0, Path::new(lib_path));
2225

23-
let mut new_env: Vec<_> = env.move_iter().map(|(k, v)| {
24-
let new_v = if "PATH" == k {
25-
format_strbuf!("{};{};{}", v, lib_path, aux_path)
26-
} else {
27-
v.to_strbuf()
28-
};
29-
(k.to_strbuf(), new_v)
30-
}).collect();
31-
if prog.ends_with("rustc.exe") {
32-
new_env.push(("RUST_THREADS".to_strbuf(), "1".to_strbuf()));
26+
// Remove the previous dylib search path var
27+
let var = DynamicLibrary::envvar();
28+
let mut env: Vec<(StrBuf,StrBuf)> =
29+
os::env().move_iter().map(|(a,b)|(a.to_strbuf(), b.to_strbuf())).collect();
30+
match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
31+
Some(i) => { env.remove(i); }
32+
None => {}
3333
}
34-
return new_env;
35-
}
3634

37-
#[cfg(target_os = "linux")]
38-
#[cfg(target_os = "macos")]
39-
#[cfg(target_os = "freebsd")]
40-
fn target_env(lib_path: &str, prog: &str) -> Vec<(StrBuf,StrBuf)> {
41-
// Make sure we include the aux directory in the path
42-
let aux_path = prog + ".libaux";
43-
44-
let mut env: Vec<(StrBuf,StrBuf)> =
45-
os::env().move_iter()
46-
.map(|(ref k, ref v)| (k.to_strbuf(), v.to_strbuf()))
47-
.collect();
48-
let var = if cfg!(target_os = "macos") {
49-
"DYLD_LIBRARY_PATH"
50-
} else {
51-
"LD_LIBRARY_PATH"
52-
};
53-
let prev = match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
54-
Some(i) => env.remove(i).unwrap().val1(),
55-
None => "".to_strbuf(),
56-
};
57-
env.push((var.to_strbuf(), if prev.is_empty() {
58-
format_strbuf!("{}:{}", lib_path, aux_path)
59-
} else {
60-
format_strbuf!("{}:{}:{}", lib_path, aux_path, prev)
61-
}));
35+
// Add the new dylib search path var
36+
let newpath = DynamicLibrary::create_path(path.as_slice());
37+
env.push((var.to_strbuf(),
38+
str::from_utf8(newpath.as_slice()).unwrap().to_strbuf()));
6239
return env;
6340
}
6441

trunk/src/etc/maketest.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,21 @@ def putenv(name, value):
3030
value = normalize_path(value)
3131
os.putenv(name, value)
3232

33+
def convert_path_spec(name, value):
34+
if os.name == 'nt' and name != 'PATH':
35+
value = ":".join(normalize_path(v) for v in value.split(";"))
36+
return value
3337

3438
make = sys.argv[2]
3539
putenv('RUSTC', os.path.abspath(sys.argv[3]))
3640
putenv('TMPDIR', os.path.abspath(sys.argv[4]))
3741
putenv('CC', sys.argv[5])
3842
putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
3943
filt = sys.argv[7]
40-
ldpath = sys.argv[8]
41-
if ldpath != '':
42-
name = ldpath.split('=')[0]
43-
value = ldpath.split('=')[1]
44-
if os.name == 'nt' and name != 'PATH':
45-
value = ":".join(normalize_path(v) for v in value.split(";"))
46-
os.putenv(name, value)
44+
putenv('LD_LIB_PATH_ENVVAR', sys.argv[8]);
45+
putenv('HOST_RPATH_DIR', os.path.abspath(sys.argv[9]));
46+
putenv('TARGET_RPATH_DIR', os.path.abspath(sys.argv[10]));
47+
putenv('RUST_BUILD_STAGE', sys.argv[11])
4748

4849
if not filt in sys.argv[1]:
4950
sys.exit(0)

trunk/src/libcollections/treemap.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//! trees. The only requirement for the types is that the key implements
1313
//! `TotalOrd`.
1414
15+
use std::iter;
1516
use std::iter::{Peekable};
1617
use std::cmp::Ordering;
1718
use std::mem::{replace, swap};
@@ -618,6 +619,12 @@ impl<T: TotalOrd> TreeSet<T> {
618619
RevSetItems{iter: self.map.rev_iter()}
619620
}
620621

622+
/// Get a lazy iterator that consumes the set.
623+
#[inline]
624+
pub fn move_iter(self) -> MoveSetItems<T> {
625+
self.map.move_iter().map(|(value, _)| value)
626+
}
627+
621628
/// Get a lazy iterator pointing to the first value not less than `v` (greater or equal).
622629
/// If all elements in the set are less than `v` empty iterator is returned.
623630
#[inline]
@@ -665,6 +672,9 @@ pub struct RevSetItems<'a, T> {
665672
iter: RevEntries<'a, T, ()>
666673
}
667674

675+
/// Lazy forward iterator over a set that consumes the set while iterating
676+
pub type MoveSetItems<T> = iter::Map<'static, (T, ()), T, MoveEntries<T, ()>>;
677+
668678
/// Lazy iterator producing elements in the set difference (in-order)
669679
pub struct DifferenceItems<'a, T> {
670680
a: Peekable<&'a T, SetItems<'a, T>>,
@@ -1542,6 +1552,33 @@ mod test_set {
15421552
}
15431553
}
15441554

1555+
#[test]
1556+
fn test_move_iter() {
1557+
let s: TreeSet<int> = range(0, 5).collect();
1558+
1559+
let mut n = 0;
1560+
for x in s.move_iter() {
1561+
assert_eq!(x, n);
1562+
n += 1;
1563+
}
1564+
}
1565+
1566+
#[test]
1567+
fn test_move_iter_size_hint() {
1568+
let s: TreeSet<int> = vec!(0, 1).move_iter().collect();
1569+
1570+
let mut it = s.move_iter();
1571+
1572+
assert_eq!(it.size_hint(), (2, Some(2)));
1573+
assert!(it.next() != None);
1574+
1575+
assert_eq!(it.size_hint(), (1, Some(1)));
1576+
assert!(it.next() != None);
1577+
1578+
assert_eq!(it.size_hint(), (0, Some(0)));
1579+
assert_eq!(it.next(), None);
1580+
}
1581+
15451582
#[test]
15461583
fn test_clone_eq() {
15471584
let mut m = TreeSet::new();

trunk/src/libcore/fmt/mod.rs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,44 @@ pub mod rt;
4343

4444
pub type Result = result::Result<(), FormatError>;
4545

46-
/// dox
46+
/// The error type which is returned from formatting a message into a stream.
47+
///
48+
/// This type does not support transmission of an error other than that an error
49+
/// occurred. Any extra information must be arranged to be transmitted through
50+
/// some other means.
4751
pub enum FormatError {
48-
/// dox
52+
/// A generic write error occurred during formatting, no other information
53+
/// is transmitted via this variant.
4954
WriteError,
5055
}
5156

52-
/// dox
57+
/// A collection of methods that are required to format a message into a stream.
58+
///
59+
/// This trait is the type which this modules requires when formatting
60+
/// information. This is similar to the standard library's `io::Writer` trait,
61+
/// but it is only intended for use in libcore.
62+
///
63+
/// This trait should generally not be implemented by consumers of the standard
64+
/// library. The `write!` macro accepts an instance of `io::Writer`, and the
65+
/// `io::Writer` trait is favored over implementing this trait.
5366
pub trait FormatWriter {
54-
/// dox
67+
/// Writes a slice of bytes into this writer, returning whether the write
68+
/// succeeded.
69+
///
70+
/// This method can only succeed if the entire byte slice was successfully
71+
/// written, and this method will not return until all data has been
72+
/// written or an error occurs.
73+
///
74+
/// # Errors
75+
///
76+
/// This function will return an instance of `FormatError` on error.
5577
fn write(&mut self, bytes: &[u8]) -> Result;
78+
79+
/// Glue for usage of the `write!` macro with implementors of this trait.
80+
///
81+
/// This method should generally not be invoked manually, but rather through
82+
/// the `write!` macro itself.
83+
fn write_fmt(&mut self, args: &Arguments) -> Result { write(self, args) }
5684
}
5785

5886
/// A struct to represent both where to emit formatting strings to and how they

trunk/src/libcore/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ impl<T> RawPtr<T> for *T {
359359
if self.is_null() {
360360
None
361361
} else {
362-
Some(mem::transmute(*self))
362+
Some(&**self)
363363
}
364364
}
365365
}
@@ -384,7 +384,7 @@ impl<T> RawPtr<T> for *mut T {
384384
if self.is_null() {
385385
None
386386
} else {
387-
Some(mem::transmute(*self))
387+
Some(&**self)
388388
}
389389
}
390390
}
File renamed without changes.
File renamed without changes.

trunk/src/librustc/metadata/creader.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use back::svh::Svh;
1717
use driver::session::Session;
1818
use driver::{driver, config};
1919
use metadata::cstore;
20-
use metadata::cstore::CStore;
20+
use metadata::cstore::{CStore, CrateSource};
2121
use metadata::decoder;
2222
use metadata::loader;
2323
use metadata::loader::CratePaths;
@@ -68,10 +68,15 @@ impl<'a> visit::Visitor<()> for Env<'a> {
6868

6969
fn dump_crates(cstore: &CStore) {
7070
debug!("resolved crates:");
71-
cstore.iter_crate_data(|_, data| {
71+
cstore.iter_crate_data_origins(|_, data, opt_source| {
7272
debug!("crate_id: {}", data.crate_id());
7373
debug!(" cnum: {}", data.cnum);
7474
debug!(" hash: {}", data.hash());
75+
opt_source.map(|cs| {
76+
let CrateSource { dylib, rlib, cnum: _ } = cs;
77+
dylib.map(|dl| debug!(" dylib: {}", dl.display()));
78+
rlib.map(|rl| debug!(" rlib: {}", rl.display()));
79+
});
7580
})
7681
}
7782

trunk/src/librustc/metadata/cstore.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@ impl CStore {
114114
}
115115
}
116116

117+
/// Like `iter_crate_data`, but passes source paths (if available) as well.
118+
pub fn iter_crate_data_origins(&self, i: |ast::CrateNum,
119+
&crate_metadata,
120+
Option<CrateSource>|) {
121+
for (&k, v) in self.metas.borrow().iter() {
122+
let origin = self.get_used_crate_source(k);
123+
origin.as_ref().map(|cs| { assert!(k == cs.cnum); });
124+
i(k, &**v, origin);
125+
}
126+
}
127+
117128
pub fn add_used_crate_source(&self, src: CrateSource) {
118129
let mut used_crate_sources = self.used_crate_sources.borrow_mut();
119130
if !used_crate_sources.contains(&src) {

0 commit comments

Comments
 (0)