Skip to content

Commit 8c0e3bd

Browse files
committed
---
yaml --- r: 130966 b: refs/heads/auto c: 4727381 h: refs/heads/master v: v3
1 parent b4a9e88 commit 8c0e3bd

File tree

10 files changed

+150
-63
lines changed

10 files changed

+150
-63
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: c456cca90ac3e2b2a853f3a9354d1e0c9fe6c427
16+
refs/heads/auto: 47273816857c5684c1cc0059860cdf7e844e50a7
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/mk/dist.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ PKG_EXE = dist/$(PKG_NAME)-$(CFG_BUILD).exe
123123
$(PKG_EXE): rust.iss modpath.iss upgrade.iss LICENSE.txt rust-logo.ico \
124124
$(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
125125
dist-prepare-win
126-
$(CFG_PYTHON) $(S)src/etc/copy-runtime-deps.py tmp/dist/win/bin $(CFG_BUILD)
126+
$(CFG_PYTHON) $(S)src/etc/make-win-dist.py tmp/dist/win $(CFG_BUILD)
127127
@$(call E, ISCC: $@)
128128
$(Q)"$(CFG_ISCC)" $<
129129

branches/auto/src/doc/rust.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ enclosed within two `U+0022` (double-quote) characters,
349349
with the exception of `U+0022` itself,
350350
which must be _escaped_ by a preceding `U+005C` character (`\`),
351351
or a _raw byte string literal_.
352-
It is equivalent to a `&'static [u8]` borrowed vector of unsigned 8-bit integers.
352+
It is equivalent to a `&'static [u8]` borrowed array of unsigned 8-bit integers.
353353

354354
Some additional _escapes_ are available in either byte or non-raw byte string
355355
literals. An escape starts with a `U+005C` (`\`) and continues with one of
@@ -2811,16 +2811,17 @@ When the type providing the field inherits mutabilty, it can be [assigned](#assi
28112811
Also, if the type of the expression to the left of the dot is a pointer,
28122812
it is automatically dereferenced to make the field access possible.
28132813

2814-
### Vector expressions
2814+
### Array expressions
28152815

28162816
~~~~ {.ebnf .gram}
2817-
vec_expr : '[' "mut" ? vec_elems? ']' ;
2817+
array_expr : '[' "mut" ? vec_elems? ']' ;
28182818
2819-
vec_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
2819+
array_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
28202820
~~~~
28212821

2822-
A [_vector_](#vector-types) _expression_ is written by enclosing zero or
2823-
more comma-separated expressions of uniform type in square brackets.
2822+
An [array](#vector,-array,-and-slice-types) _expression_ is written by
2823+
enclosing zero or more comma-separated expressions of uniform type in square
2824+
brackets.
28242825

28252826
In the `[expr ',' ".." expr]` form, the expression after the `".."`
28262827
must be a constant expression that can be evaluated at compile time, such
@@ -2829,7 +2830,7 @@ as a [literal](#literals) or a [static item](#static-items).
28292830
~~~~
28302831
[1i, 2, 3, 4];
28312832
["a", "b", "c", "d"];
2832-
[0i, ..128]; // vector with 128 zeros
2833+
[0i, ..128]; // array with 128 zeros
28332834
[0u8, 0u8, 0u8, 0u8];
28342835
~~~~
28352836

@@ -2839,9 +2840,9 @@ as a [literal](#literals) or a [static item](#static-items).
28392840
idx_expr : expr '[' expr ']' ;
28402841
~~~~
28412842

2842-
[Vector](#vector-types)-typed expressions can be indexed by writing a
2843+
[Array](#vector,-array,-and-slice-types)-typed expressions can be indexed by writing a
28432844
square-bracket-enclosed expression (the index) after them. When the
2844-
vector is mutable, the resulting [lvalue](#lvalues,-rvalues-and-temporaries) can be assigned to.
2845+
array is mutable, the resulting [lvalue](#lvalues,-rvalues-and-temporaries) can be assigned to.
28452846

28462847
Indices are zero-based, and may be of any integral type. Vector access
28472848
is bounds-checked at run-time. When the check fails, it will put the
@@ -2902,7 +2903,7 @@ This means that arithmetic operators can be overridden for user-defined types.
29022903
The default meaning of the operators on standard types is given here.
29032904

29042905
* `+`
2905-
: Addition and vector/string concatenation.
2906+
: Addition and array/string concatenation.
29062907
Calls the `add` method on the `std::ops::Add` trait.
29072908
* `-`
29082909
: Subtraction.
@@ -3205,7 +3206,7 @@ for_expr : "for" pat "in" no_struct_literal_expr '{' block '}' ;
32053206
A `for` expression is a syntactic construct for looping over elements
32063207
provided by an implementation of `std::iter::Iterator`.
32073208

3208-
An example of a for loop over the contents of a vector:
3209+
An example of a for loop over the contents of an array:
32093210

32103211
~~~~
32113212
# type Foo = int;
@@ -3263,7 +3264,7 @@ match_pat : pat [ '|' pat ] * [ "if" expr ] ? ;
32633264

32643265
A `match` expression branches on a *pattern*. The exact form of matching that
32653266
occurs depends on the pattern. Patterns consist of some combination of
3266-
literals, destructured vectors or enum constructors, structures and
3267+
literals, destructured arrays or enum constructors, structures and
32673268
tuples, variable binding specifications, wildcards (`..`), and placeholders
32683269
(`_`). A `match` expression has a *head expression*, which is the value to
32693270
compare to the patterns. The type of the patterns must equal the type of the
@@ -3292,11 +3293,11 @@ between `_` and `..` is that the pattern `C(_)` is only type-correct if `C` has
32923293
exactly one argument, while the pattern `C(..)` is type-correct for any enum
32933294
variant `C`, regardless of how many arguments `C` has.
32943295

3295-
Used inside a vector pattern, `..` stands for any number of elements, when the
3296+
Used inside a array pattern, `..` stands for any number of elements, when the
32963297
`advanced_slice_patterns` feature gate is turned on. This wildcard can be used
3297-
at most once for a given vector, which implies that it cannot be used to
3298+
at most once for a given array, which implies that it cannot be used to
32983299
specifically match elements that are at an unknown distance from both ends of a
3299-
vector, like `[.., 42, ..]`. If followed by a variable name, it will bind the
3300+
array, like `[.., 42, ..]`. If followed by a variable name, it will bind the
33003301
corresponding slice to the variable. Example:
33013302

33023303
~~~~
@@ -3429,7 +3430,7 @@ let message = match x {
34293430
~~~~
34303431

34313432
Range patterns only work on scalar types
3432-
(like integers and characters; not like vectors and structs, which have sub-components).
3433+
(like integers and characters; not like arrays and structs, which have sub-components).
34333434
A range pattern may not be a sub-range of another range pattern inside the same `match`.
34343435

34353436
Finally, match patterns can accept *pattern guards* to further refine the
@@ -3537,10 +3538,10 @@ http://www.unicode.org/glossary/#unicode_scalar_value)
35373538
(ie. a code point that is not a surrogate),
35383539
represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
35393540
or 0xE000 to 0x10FFFF range.
3540-
A `[char]` vector is effectively an UCS-4 / UTF-32 string.
3541+
A `[char]` array is effectively an UCS-4 / UTF-32 string.
35413542

35423543
A value of type `str` is a Unicode string,
3543-
represented as a vector of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
3544+
represented as a array of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
35443545
Since `str` is of unknown size, it is not a _first class_ type,
35453546
but can only be instantiated through a pointer type,
35463547
such as `&str` or `String`.
@@ -3651,7 +3652,7 @@ Such recursion has restrictions:
36513652

36523653
* Recursive types must include a nominal type in the recursion
36533654
(not mere [type definitions](#type-definitions),
3654-
or other structural types such as [vectors](#vector-types) or [tuples](#tuple-types)).
3655+
or other structural types such as [arrays](#vector,-array,-and-slice-types) or [tuples](#tuple-types)).
36553656
* A recursive `enum` item must have at least one non-recursive constructor
36563657
(in order to give the recursion a basis case).
36573658
* The size of a recursive type must be finite;
@@ -4155,7 +4156,7 @@ heap data.
41554156
### Built in types
41564157

41574158
The runtime provides C and Rust code to assist with various built-in types,
4158-
such as vectors, strings, and the low level communication system (ports,
4159+
such as arrays, strings, and the low level communication system (ports,
41594160
channels, tasks).
41604161

41614162
Support for other built-in types such as simple types, tuples and

branches/auto/src/etc/copy-runtime-deps.py

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2+
# file at the top-level directory of this distribution and at
3+
# http://rust-lang.org/COPYRIGHT.
4+
#
5+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
# option. This file may not be copied, modified, or distributed
9+
# except according to those terms.
10+
11+
import sys, os, shutil, subprocess
12+
13+
def find_files(files, path):
14+
found = []
15+
for fname in files:
16+
for dir in path:
17+
filepath = os.path.normpath(os.path.join(dir, fname))
18+
if os.path.isfile(filepath):
19+
found.append(filepath)
20+
break
21+
else:
22+
raise Exception("Could not find '%s' in %s" % (fname, path))
23+
return found
24+
25+
def make_win_dist(dist_root, target_triple):
26+
# Ask gcc where it keeps its' stuff
27+
gcc_out = subprocess.check_output(["gcc.exe", "-print-search-dirs"])
28+
bin_path = os.environ["PATH"].split(os.pathsep)
29+
lib_path = []
30+
for line in gcc_out.splitlines():
31+
key, val = line.split(':', 1)
32+
if key == "programs":
33+
bin_path.extend(val.lstrip(' =').split(';'))
34+
elif key == "libraries":
35+
lib_path.extend(val.lstrip(' =').split(';'))
36+
37+
target_tools = ["gcc.exe", "ld.exe", "ar.exe", "dlltool.exe", "windres.exe"]
38+
39+
rustc_dlls = ["libstdc++-6.dll"]
40+
if target_triple.startswith("i686-"):
41+
rustc_dlls.append("libgcc_s_dw2-1.dll")
42+
else:
43+
rustc_dlls.append("libgcc_s_seh-1.dll")
44+
45+
target_libs = ["crtbegin.o", "crtend.o", "crt2.o", "dllcrt2.o",
46+
"libadvapi32.a", "libcrypt32.a", "libgcc.a", "libgcc_eh.a", "libgcc_s.a",
47+
"libimagehlp.a", "libiphlpapi.a", "libkernel32.a", "libm.a", "libmingw32.a",
48+
"libmingwex.a", "libmsvcrt.a", "libpsapi.a", "libshell32.a", "libstdc++.a",
49+
"libuser32.a", "libws2_32.a", "libiconv.a", "libmoldname.a"]
50+
51+
# Find mingw artifacts we want to bundle
52+
target_tools = find_files(target_tools, bin_path)
53+
rustc_dlls = find_files(rustc_dlls, bin_path)
54+
target_libs = find_files(target_libs, lib_path)
55+
56+
# Copy runtime dlls next to rustc.exe
57+
dist_bin_dir = os.path.join(dist_root, "bin")
58+
for src in rustc_dlls:
59+
shutil.copy(src, dist_bin_dir)
60+
61+
# Copy platform tools (and another copy of runtime dlls) to platform-spcific bin directory
62+
target_bin_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "bin")
63+
if not os.path.exists(target_bin_dir):
64+
os.makedirs(target_bin_dir)
65+
for src in target_tools:
66+
shutil.copy(src, target_bin_dir)
67+
68+
# Copy platform libs to platform-spcific lib directory
69+
target_lib_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "lib")
70+
if not os.path.exists(target_lib_dir):
71+
os.makedirs(target_lib_dir)
72+
for src in target_libs:
73+
shutil.copy(src, target_lib_dir)
74+
75+
# Copy license files
76+
lic_dir = os.path.join(dist_root, "bin", "third-party")
77+
if os.path.exists(lic_dir):
78+
shutil.rmtree(lic_dir) # copytree() won't overwrite existing files
79+
shutil.copytree(os.path.join(os.path.dirname(__file__), "third-party"), lic_dir)
80+
81+
if __name__=="__main__":
82+
make_win_dist(sys.argv[1], sys.argv[2])

branches/auto/src/etc/snapshot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ def get_winnt_runtime_deps(platform):
157157
path_dirs = os.environ["PATH"].split(os.pathsep)
158158
for name in deps:
159159
for dir in path_dirs:
160-
matches = glob.glob(os.path.join(dir, name))
161-
if matches:
162-
runtime_deps.append(matches[0])
160+
filepath = os.path.join(dir, name)
161+
if os.path.isfile(filepath):
162+
runtime_deps.append(filepath)
163163
break
164164
else:
165165
raise Exception("Could not find runtime dependency: %s" % name)
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
Certain files in this distribution are covered by a different license than the rest of the Rust Project.
2-
Specifically:
1+
Certain binaries in this distribution do not originate from the Rust project, but are distributed with it in its binary form. These binaries, including gcc and other parts of the GNU compiler toolchain, are licensed either under the terms of the GNU General Public License, or the GNU General Public License with the GCC Runtime Library Exception, as published by the Free Software Foundation, either version 3, or (at your option) any later version. See the files COPYING3 and COPYING.RUNTIME respectively.
32

4-
- libgcc_s_dw2-1.dll and libstdc++6.dll are distributed under the terms of the GNU General Public License
5-
with the GCC Runtime Library Exception as published by the Free Software Foundation; either version 3,
6-
or (at your option) any later version. See the files COPYING3 and COPYING.RUNTIME respectively.
7-
You can obtain a copy of the source of these libraries either here: http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.5.2-1/,
8-
or from the project website at http://gcc.gnu.org
3+
You can obtain a copy of the source of these libraries from the MinGW-w64 project[1].
4+
5+
[1]: http://mingw-w64.sourceforge.net/

branches/auto/src/librustc/back/link.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,9 @@ fn link_args(cmd: &mut Command,
929929
cmd.arg("-nodefaultlibs");
930930
}
931931

932+
// Rust does its' own LTO
933+
cmd.arg("-fno-lto").arg("-fno-use-linker-plugin");
934+
932935
// If we're building a dylib, we don't use --gc-sections because LLVM has
933936
// already done the best it can do, and we also don't want to eliminate the
934937
// metadata. If we're building an executable, however, --gc-sections drops

branches/auto/src/librustc/driver/driver.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use serialize::{json, Encodable};
3232

3333
use std::io;
3434
use std::io::fs;
35+
use std::os;
3536
use arena::TypedArena;
3637
use syntax::ast;
3738
use syntax::attr;
@@ -258,18 +259,26 @@ pub fn phase_2_configure_and_expand(sess: &Session,
258259
// dependent dlls. Note that this uses cfg!(windows) as opposed to
259260
// targ_cfg because syntax extensions are always loaded for the host
260261
// compiler, not for the target.
262+
let mut _old_path = String::new();
261263
if cfg!(windows) {
262-
sess.host_filesearch().add_dylib_search_paths();
264+
_old_path = os::getenv("PATH").unwrap_or(_old_path);
265+
let mut new_path = sess.host_filesearch().get_dylib_search_paths();
266+
new_path.push_all_move(os::split_paths(_old_path.as_slice()));
267+
os::setenv("PATH", os::join_paths(new_path.as_slice()).unwrap());
263268
}
264269
let cfg = syntax::ext::expand::ExpansionConfig {
265270
deriving_hash_type_parameter: sess.features.default_type_params.get(),
266271
crate_name: crate_name.to_string(),
267272
};
268-
syntax::ext::expand::expand_crate(&sess.parse_sess,
273+
let ret = syntax::ext::expand::expand_crate(&sess.parse_sess,
269274
cfg,
270275
macros,
271276
syntax_exts,
272-
krate)
277+
krate);
278+
if cfg!(windows) {
279+
os::setenv("PATH", _old_path);
280+
}
281+
ret
273282
}
274283
);
275284

@@ -509,11 +518,18 @@ pub fn phase_5_run_llvm_passes(sess: &Session,
509518
pub fn phase_6_link_output(sess: &Session,
510519
trans: &CrateTranslation,
511520
outputs: &OutputFilenames) {
521+
let old_path = os::getenv("PATH").unwrap_or_else(||String::new());
522+
let mut new_path = os::split_paths(old_path.as_slice());
523+
new_path.push_all_move(sess.host_filesearch().get_tools_search_paths());
524+
os::setenv("PATH", os::join_paths(new_path.as_slice()).unwrap());
525+
512526
time(sess.time_passes(), "linking", (), |_|
513527
link::link_binary(sess,
514528
trans,
515529
outputs,
516530
trans.link.crate_name.as_slice()));
531+
532+
os::setenv("PATH", old_path);
517533
}
518534

519535
pub fn stop_after_phase_3(sess: &Session) -> bool {

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use std::cell::RefCell;
1414
use std::os;
1515
use std::io::fs;
16-
use std::dynamic_lib::DynamicLibrary;
1716
use std::collections::HashSet;
1817

1918
use util::fs as myfs;
@@ -134,11 +133,24 @@ impl<'a> FileSearch<'a> {
134133
}
135134
}
136135

137-
pub fn add_dylib_search_paths(&self) {
136+
// Returns a list of directories where target-specific dylibs might be located.
137+
pub fn get_dylib_search_paths(&self) -> Vec<Path> {
138+
let mut paths = Vec::new();
138139
self.for_each_lib_search_path(|lib_search_path| {
139-
DynamicLibrary::prepend_search_path(lib_search_path);
140+
paths.push(lib_search_path.clone());
140141
FileDoesntMatch
141-
})
142+
});
143+
paths
144+
}
145+
146+
// Returns a list of directories where target-specific tool binaries are located.
147+
pub fn get_tools_search_paths(&self) -> Vec<Path> {
148+
let mut p = Path::new(self.sysroot);
149+
p.push(find_libdir(self.sysroot));
150+
p.push(rustlibdir());
151+
p.push(self.triple);
152+
p.push("bin");
153+
vec![p]
142154
}
143155
}
144156

0 commit comments

Comments
 (0)