Skip to content

Commit 1188143

Browse files
committed
---
yaml --- r: 217915 b: refs/heads/master c: ee43c5e h: refs/heads/master i: 217913: 3d25974 217911: 263c3db v: v3
1 parent ecd1b74 commit 1188143

File tree

114 files changed

+2186
-2451
lines changed

Some content is hidden

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

114 files changed

+2186
-2451
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: b959f256bf52e1fef23c197289693a67d373565f
2+
refs/heads/master: ee43c5e2f0d838de2721b8c5a30aa25d882398d9
33
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Read ["Installing Rust"] from [The Book].
7373
```
7474
7575
3. Run `mingw32_shell.bat` or `mingw64_shell.bat` from wherever you installed
76-
MSYS2 (i.e. `C:\msys`), depending on whether you want 32-bit or 64-bit Rust.
76+
MYSY2 (i.e. `C:\msys`), depending on whether you want 32-bit or 64-bit Rust.
7777
7878
4. Navigate to Rust's source code, configure and build it:
7979

trunk/mk/main.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
295295
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
296296
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
297297
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
298+
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
298299
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
299300
ifeq ($$(findstring freebsd,$(1)),freebsd)
300301
# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),

trunk/mk/target.mk

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,11 @@ endef
249249

250250
$(foreach host,$(CFG_HOST), \
251251
$(foreach target,$(CFG_TARGET), \
252-
$(foreach crate,$(CRATES), \
253-
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,0,$(target),$(host),$(crate))))))
252+
$(foreach stage,$(STAGES), \
253+
$(foreach crate,$(CRATES), \
254+
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,$(stage),$(target),$(host),$(crate)))))))
254255
$(foreach host,$(CFG_HOST), \
255256
$(foreach target,$(CFG_TARGET), \
256-
$(foreach tool,$(TOOLS), \
257-
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,0,$(target),$(host),$(tool))))))
257+
$(foreach stage,$(STAGES), \
258+
$(foreach tool,$(TOOLS), \
259+
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,$(stage),$(target),$(host),$(tool)))))))

trunk/src/compiletest/runtest.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,10 +1126,16 @@ impl fmt::Display for Status {
11261126

11271127
fn compile_test(config: &Config, props: &TestProps,
11281128
testfile: &Path) -> ProcRes {
1129+
compile_test_(config, props, testfile, &[])
1130+
}
1131+
1132+
fn compile_test_(config: &Config, props: &TestProps,
1133+
testfile: &Path, extra_args: &[String]) -> ProcRes {
11291134
let aux_dir = aux_output_dir_name(config, testfile);
11301135
// FIXME (#9639): This needs to handle non-utf8 paths
1131-
let link_args = vec!("-L".to_string(),
1132-
aux_dir.to_str().unwrap().to_string());
1136+
let mut link_args = vec!("-L".to_string(),
1137+
aux_dir.to_str().unwrap().to_string());
1138+
link_args.extend(extra_args.iter().cloned());
11331139
let args = make_compile_args(config,
11341140
props,
11351141
link_args,
@@ -1138,7 +1144,7 @@ fn compile_test(config: &Config, props: &TestProps,
11381144
}
11391145

11401146
fn document(config: &Config, props: &TestProps,
1141-
testfile: &Path) -> (ProcRes, PathBuf) {
1147+
testfile: &Path, extra_args: &[String]) -> (ProcRes, PathBuf) {
11421148
let aux_dir = aux_output_dir_name(config, testfile);
11431149
let out_dir = output_base_name(config, testfile);
11441150
let _ = fs::remove_dir_all(&out_dir);
@@ -1148,6 +1154,7 @@ fn document(config: &Config, props: &TestProps,
11481154
"-o".to_string(),
11491155
out_dir.to_str().unwrap().to_string(),
11501156
testfile.to_str().unwrap().to_string()];
1157+
args.extend(extra_args.iter().cloned());
11511158
args.extend(split_maybe_args(&props.compile_flags));
11521159
let args = ProcArgs {
11531160
prog: config.rustdoc_path.to_str().unwrap().to_string(),
@@ -1710,7 +1717,7 @@ fn charset() -> &'static str {
17101717
}
17111718

17121719
fn run_rustdoc_test(config: &Config, props: &TestProps, testfile: &Path) {
1713-
let (proc_res, out_dir) = document(config, props, testfile);
1720+
let (proc_res, out_dir) = document(config, props, testfile, &[]);
17141721
if !proc_res.status.success() {
17151722
fatal_proc_rec("rustdoc failed!", &proc_res);
17161723
}

trunk/src/doc/reference.md

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -338,16 +338,12 @@ type of the literal. The integer suffix must be the name of one of the
338338
integral types: `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64`,
339339
`isize`, or `usize`.
340340

341-
The type of an _unsuffixed_ integer literal is determined by type inference:
342-
343-
* If an integer type can be _uniquely_ determined from the surrounding
344-
program context, the unsuffixed integer literal has that type.
345-
346-
* If the program context underconstrains the type, it defaults to the
347-
signed 32-bit integer `i32`.
348-
349-
* If the program context overconstrains the type, it is considered a
350-
static type error.
341+
The type of an _unsuffixed_ integer literal is determined by type inference.
342+
If an integer type can be _uniquely_ determined from the surrounding program
343+
context, the unsuffixed integer literal has that type. If the program context
344+
underconstrains the type, it defaults to the signed 32-bit integer `i32`; if
345+
the program context overconstrains the type, it is considered a static type
346+
error.
351347

352348
Examples of integer literals of various forms:
353349

@@ -375,17 +371,12 @@ The suffix forcibly sets the type of the literal. There are two valid
375371
_floating-point suffixes_, `f32` and `f64` (the 32-bit and 64-bit floating point
376372
types), which explicitly determine the type of the literal.
377373

378-
The type of an _unsuffixed_ floating-point literal is determined by
379-
type inference:
380-
381-
* If a floating-point type can be _uniquely_ determined from the
382-
surrounding program context, the unsuffixed floating-point literal
383-
has that type.
384-
385-
* If the program context underconstrains the type, it defaults to `f64`.
386-
387-
* If the program context overconstrains the type, it is considered a
388-
static type error.
374+
The type of an _unsuffixed_ floating-point literal is determined by type
375+
inference. If a floating-point type can be _uniquely_ determined from the
376+
surrounding program context, the unsuffixed floating-point literal has that type.
377+
If the program context underconstrains the type, it defaults to double-precision `f64`;
378+
if the program context overconstrains the type, it is considered a static type
379+
error.
389380

390381
Examples of floating-point literals of various forms:
391382

@@ -2972,12 +2963,14 @@ move values (depending on their type) from the environment into the lambda
29722963
expression's captured environment.
29732964

29742965
In this example, we define a function `ten_times` that takes a higher-order
2975-
function argument, and we then call it with a lambda expression as an argument:
2966+
function argument, and call it with a lambda expression as an argument:
29762967

29772968
```
29782969
fn ten_times<F>(f: F) where F: Fn(i32) {
2979-
for index in 0..10 {
2980-
f(index);
2970+
let mut i = 0i32;
2971+
while i < 10 {
2972+
f(i);
2973+
i += 1;
29812974
}
29822975
}
29832976
@@ -3326,13 +3319,10 @@ An example of a tuple type and its use:
33263319

33273320
```
33283321
type Pair<'a> = (i32, &'a str);
3329-
let p: Pair<'static> = (10, "ten");
3322+
let p: Pair<'static> = (10, "hello");
33303323
let (a, b) = p;
3331-
3332-
assert_eq!(a, 10);
3333-
assert_eq!(b, "ten");
3334-
assert_eq!(p.0, 10);
3335-
assert_eq!(p.1, "ten");
3324+
assert!(b != "world");
3325+
assert!(p.0 == 10);
33363326
```
33373327

33383328
For historical reasons and convenience, the tuple type with no elements (`()`)
@@ -3342,32 +3332,27 @@ is often called ‘unit’ or ‘the unit type’.
33423332

33433333
Rust has two different types for a list of items:
33443334

3345-
* `[T; N]`, an 'array'
3346-
* `&[T]`, a 'slice'
3335+
* `[T; N]`, an 'array'.
3336+
* `&[T]`, a 'slice'.
33473337

33483338
An array has a fixed size, and can be allocated on either the stack or the
33493339
heap.
33503340

33513341
A slice is a 'view' into an array. It doesn't own the data it points
33523342
to, it borrows it.
33533343

3354-
Examples:
3344+
An example of each kind:
33553345

33563346
```{rust}
3357-
// A stack-allocated array
3358-
let array: [i32; 3] = [1, 2, 3];
3359-
3360-
// A heap-allocated array
3361-
let vector: Vec<i32> = vec![1, 2, 3];
3362-
3363-
// A slice into an array
3364-
let slice: &[i32] = &vector[..];
3347+
let vec: Vec<i32> = vec![1, 2, 3];
3348+
let arr: [i32; 3] = [1, 2, 3];
3349+
let s: &[i32] = &vec[..];
33653350
```
33663351

33673352
As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The
33683353
`vec!` macro is also part of the standard library, rather than the language.
33693354

3370-
All in-bounds elements of arrays and slices are always initialized, and access
3355+
All in-bounds elements of arrays, and slices are always initialized, and access
33713356
to an array or slice is always bounds-checked.
33723357

33733358
### Structure types
@@ -3501,7 +3486,7 @@ x = bo(5,7);
35013486

35023487
#### Function types for specific items
35033488

3504-
Internal to the compiler, there are also function types that are specific to a particular
3489+
Internally to the compiler, there are also function types that are specific to a particular
35053490
function item. In the following snippet, for example, the internal types of the functions
35063491
`foo` and `bar` are different, despite the fact that they have the same signature:
35073492

@@ -3529,14 +3514,13 @@ more of the closure traits:
35293514

35303515
* `FnMut`
35313516
: The closure can be called multiple times as mutable. A closure called as
3532-
`FnMut` can mutate values from its environment. `FnMut` inherits from
3533-
`FnOnce` (i.e. anything implementing `FnMut` also implements `FnOnce`).
3517+
`FnMut` can mutate values from its environment. `FnMut` implies
3518+
`FnOnce`.
35343519

35353520
* `Fn`
35363521
: The closure can be called multiple times through a shared reference.
35373522
A closure called as `Fn` can neither move out from nor mutate values
3538-
from its environment. `Fn` inherits from `FnMut`, which itself
3539-
inherits from `FnOnce`.
3523+
from its environment. `Fn` implies `FnMut` and `FnOnce`.
35403524

35413525

35423526
### Trait objects
@@ -3659,7 +3643,7 @@ Coercions are defined in [RFC401]. A coercion is implicit and has no syntax.
36593643
### Coercion sites
36603644

36613645
A coercion can only occur at certain coercion sites in a program; these are
3662-
typically places where the desired type is explicit or can be derived by
3646+
typically places where the desired type is explicit or can be dervied by
36633647
propagation from explicit types (without type inference). Possible coercion
36643648
sites are:
36653649

trunk/src/doc/trpl/comments.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,6 @@ fn add_one(x: i32) -> i32 {
3838
}
3939
```
4040

41-
There is another style of doc comment, `//!`, to comment containing items (e.g.
42-
crates, modules or functions), instead of the items following it. Commonly used
43-
inside crates root (lib.rs) or modules root (mod.rs):
44-
45-
```
46-
//! # The Rust Standard Library
47-
//!
48-
//! The Rust Standard Library provides the essential runtime
49-
//! functionality for building portable Rust software.
50-
```
51-
5241
When writing doc comments, providing some examples of usage is very, very
5342
helpful. You’ll notice we’ve used a new macro here: `assert_eq!`. This compares
5443
two values, and `panic!`s if they’re not equal to each other. It’s very helpful

trunk/src/doc/trpl/ffi.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -533,19 +533,10 @@ attribute turns off Rust's name mangling, so that it is easier to link to.
533533

534534
# FFI and panics
535535

536-
It’s important to be mindful of `panic!`s when working with FFI. This code,
537-
when called from C, will `abort`:
538-
539-
```rust
540-
#[no_mangle]
541-
pub extern fn oh_no() -> ! {
542-
panic!("Oops!");
543-
}
544-
# fn main() {}
545-
```
546-
547-
If you’re writing code that may panic, you should run it in another thread,
548-
so that the panic doesn’t bubble up to C:
536+
It’s important to be mindful of `panic!`s when working with FFI. A `panic!`
537+
across an FFI boundary is undefined behavior. If you’re writing code that may
538+
panic, you should run it in another thread, so that the panic doesn’t bubble up
539+
to C:
549540

550541
```rust
551542
use std::thread;

trunk/src/etc/mklldeps.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
f = open(sys.argv[1], 'wb')
1616

17-
components = sys.argv[2].split() # splits on whitespace
17+
components = sys.argv[2].split(' ')
18+
components = [i for i in components if i] # ignore extra whitespaces
1819
enable_static = sys.argv[3]
19-
llvm_config = sys.argv[4]
20+
llconfig = sys.argv[4]
2021

2122
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2223
// file at the top-level directory of this distribution and at
@@ -38,15 +39,15 @@ def run(args):
3839
out, err = proc.communicate()
3940

4041
if err:
41-
print("failed to run llvm_config: args = `{}`".format(args))
42+
print("failed to run llconfig: args = `{}`".format(args))
4243
print(err)
4344
sys.exit(1)
4445
return out
4546

4647
f.write("\n")
4748

4849
# LLVM libs
49-
args = [llvm_config, '--libs', '--system-libs']
50+
args = [llconfig, '--libs', '--system-libs']
5051

5152
args.extend(components)
5253
out = run(args)
@@ -68,13 +69,13 @@ def run(args):
6869
f.write(")]\n")
6970

7071
# LLVM ldflags
71-
out = run([llvm_config, '--ldflags'])
72+
out = run([llconfig, '--ldflags'])
7273
for lib in out.strip().split(' '):
7374
if lib[:2] == "-l":
7475
f.write("#[link(name = \"" + lib[2:] + "\")]\n")
7576

7677
# C++ runtime library
77-
out = run([llvm_config, '--cxxflags'])
78+
out = run([llconfig, '--cxxflags'])
7879
if enable_static == '1':
7980
assert('stdlib=libc++' not in out)
8081
f.write("#[link(name = \"stdc++\", kind = \"static\")]\n")

trunk/src/libcollections/str.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ impl str {
483483
/// considered to be
484484
/// boundaries.
485485
///
486-
/// Returns `false` if `index` is greater than `self.len()`.
486+
/// # Panics
487+
///
488+
/// Panics if `index` is greater than `self.len()`.
487489
///
488490
/// # Examples
489491
///
@@ -1857,6 +1859,8 @@ impl str {
18571859
/// # Examples
18581860
///
18591861
/// ```
1862+
/// #![feature(str_casing)]
1863+
///
18601864
/// let s = "HELLO";
18611865
/// assert_eq!(s.to_lowercase(), "hello");
18621866
/// ```
@@ -1901,6 +1905,8 @@ impl str {
19011905
/// # Examples
19021906
///
19031907
/// ```
1908+
/// #![feature(str_casing)]
1909+
///
19041910
/// let s = "hello";
19051911
/// assert_eq!(s.to_uppercase(), "HELLO");
19061912
/// ```

trunk/src/libcollections/vec.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ pub struct Vec<T> {
157157
cap: usize,
158158
}
159159

160+
unsafe impl<T: Send> Send for Vec<T> { }
161+
unsafe impl<T: Sync> Sync for Vec<T> { }
162+
160163
////////////////////////////////////////////////////////////////////////////////
161164
// Inherent methods
162165
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)