Skip to content

Commit 89d17aa

Browse files
committed
---
yaml --- r: 212966 b: refs/heads/master c: b5f2b09 h: refs/heads/master v: v3
1 parent 0193469 commit 89d17aa

File tree

251 files changed

+2404
-1227
lines changed

Some content is hidden

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

251 files changed

+2404
-1227
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: 199e60aa220da58f3ce10fe0cc30ce715da3f0c9
2+
refs/heads/master: b5f2b098d7747863b1e647e024777e4baa4907a9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
55
refs/heads/try: 1864973ae17213c5a58c4dd3f9af6d1b6c7d2e05

trunk/configure

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ fi
521521
DEFAULT_BUILD="${CFG_CPUTYPE}-${CFG_OSTYPE}"
522522

523523
CFG_SRC_DIR="$(abs_path $(dirname $0))/"
524+
CFG_SRC_DIR_RELATIVE="$(dirname $0)/"
524525
CFG_BUILD_DIR="$(pwd)/"
525526
CFG_SELF="$0"
526527
CFG_CONFIGURE_ARGS="$@"
@@ -1558,6 +1559,7 @@ done
15581559
step_msg "writing configuration"
15591560

15601561
putvar CFG_SRC_DIR
1562+
putvar CFG_SRC_DIR_RELATIVE
15611563
putvar CFG_BUILD_DIR
15621564
putvar CFG_OSTYPE
15631565
putvar CFG_CPUTYPE

trunk/mk/cfg/x86_64-unknown-linux-musl.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CC_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc
33
CXX_x86_64-unknown-linux-musl=notaprogram
44
CPP_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -E
55
AR_x86_64-unknown-linux-musl=$(AR)
6+
CFG_INSTALL_ONLY_RLIB_x86_64-unknown-linux-musl = 1
67
CFG_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).so
78
CFG_STATIC_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).a
89
CFG_LIB_GLOB_x86_64-unknown-linux-musl=lib$(1)-*.so

trunk/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ DOC_CRATES := std alloc collections core libc rustc_unicode
134134
#
135135
# $(1) is the crate to generate variables for
136136
define RUST_CRATE
137-
CRATEFILE_$(1) := $$(S)src/lib$(1)/lib.rs
137+
CRATEFILE_$(1) := $$(SREL)src/lib$(1)/lib.rs
138138
RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
139139
RUST_DEPS_$(1) := $$(filter-out native:%,$$(DEPS_$(1)))
140140
NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))

trunk/mk/main.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ $(foreach host,$(CFG_HOST), \
322322
# exported
323323

324324
export CFG_SRC_DIR
325+
export CFG_SRC_DIR_RELATIVE
325326
export CFG_BUILD_DIR
326327
ifdef CFG_VER_DATE
327328
export CFG_VER_DATE

trunk/mk/prepare.mk

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,34 @@ DEFAULT_PREPARE_MAN_CMD = install -m644
2929

3030
# Create a directory
3131
# $(1) is the directory
32+
#
33+
# XXX: These defines are called to generate make steps.
34+
# Adding blank lines means two steps from different defines will not end up on
35+
# the same line.
3236
define PREPARE_DIR
33-
@$(Q)$(call E, prepare: $(1))
37+
38+
@$(call E, prepare: $(1))
3439
$(Q)$(PREPARE_DIR_CMD) $(1)
40+
3541
endef
3642

3743
# Copy an executable
3844
# $(1) is the filename/libname-glob
3945
#
40-
# Gee, what's up with that $(nop)? See comment below.
46+
# See above for an explanation on the surrounding blank lines
4147
define PREPARE_BIN
42-
$(nop)
48+
4349
@$(call E, prepare: $(PREPARE_DEST_BIN_DIR)/$(1))
4450
$(Q)$(PREPARE_BIN_CMD) $(PREPARE_SOURCE_BIN_DIR)/$(1) $(PREPARE_DEST_BIN_DIR)/$(1)
51+
4552
endef
4653

4754
# Copy a dylib or rlib
4855
# $(1) is the filename/libname-glob
4956
#
50-
# XXX: Don't remove the $(nop) command below!
51-
# Yeah, that's right, it's voodoo. Something in the way this macro is being expanded
52-
# causes it to parse incorrectly. Throwing in that empty command seems to fix the
53-
# problem. I'm sorry, just don't remove the $(nop), alright?
57+
# See above for an explanation on the surrounding blank lines
5458
define PREPARE_LIB
55-
$(nop)
59+
5660
@$(call E, prepare: $(PREPARE_WORKING_DEST_LIB_DIR)/$(1))
5761
$(Q)LIB_NAME="$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1))))"; \
5862
MATCHES="$(filter-out %$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1)))), \
@@ -64,13 +68,18 @@ define PREPARE_LIB
6468
echo $$MATCHES ; \
6569
fi
6670
$(Q)$(PREPARE_LIB_CMD) `ls -drt1 $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1)` $(PREPARE_WORKING_DEST_LIB_DIR)/
71+
6772
endef
6873

6974
# Copy a man page
7075
# $(1) - source dir
76+
#
77+
# See above for an explanation on the surrounding blank lines
7178
define PREPARE_MAN
79+
7280
@$(call E, prepare: $(PREPARE_DEST_MAN_DIR)/$(1))
7381
$(Q)$(PREPARE_MAN_CMD) $(PREPARE_SOURCE_MAN_DIR)/$(1) $(PREPARE_DEST_MAN_DIR)/$(1)
82+
7483
endef
7584

7685
PREPARE_TOOLS = $(filter-out compiletest rustbook error-index-generator, $(TOOLS))

trunk/mk/reconfig.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ Makefile config.mk: config.stamp
3434

3535
config.stamp: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
3636
@$(call E, cfg: reconfiguring)
37-
$(S)configure $(CFG_CONFIGURE_ARGS)
37+
$(SREL)configure $(CFG_CONFIGURE_ARGS)

trunk/mk/util.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ print-%:
2020
@echo $*=$($*)
2121

2222
S := $(CFG_SRC_DIR)
23+
SREL := $(CFG_SRC_DIR_RELATIVE)

trunk/src/compiletest/common.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ pub struct Config {
124124
// Flags to pass to the compiler when building for the target
125125
pub target_rustcflags: Option<String>,
126126

127-
// Run tests using the JIT
128-
pub jit: bool,
129-
130127
// Target system to be tested
131128
pub target: String,
132129

trunk/src/compiletest/compiletest.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
7979
optopt("", "target-rustcflags", "flags to pass to rustc for target", "FLAGS"),
8080
optflag("", "verbose", "run tests verbosely, showing all output"),
8181
optopt("", "logfile", "file to log test execution to", "FILE"),
82-
optflag("", "jit", "run tests under the JIT"),
8382
optopt("", "target", "the target to build for", "TARGET"),
8483
optopt("", "host", "the host to build for", "HOST"),
8584
optopt("", "gdb-version", "the version of GDB used", "VERSION STRING"),
@@ -146,7 +145,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
146145
runtool: matches.opt_str("runtool"),
147146
host_rustcflags: matches.opt_str("host-rustcflags"),
148147
target_rustcflags: matches.opt_str("target-rustcflags"),
149-
jit: matches.opt_present("jit"),
150148
target: opt_str2(matches.opt_str("target")),
151149
host: opt_str2(matches.opt_str("host")),
152150
gdb_version: extract_gdb_version(matches.opt_str("gdb-version")),
@@ -186,7 +184,6 @@ pub fn log_config(config: &Config) {
186184
opt_str(&config.host_rustcflags)));
187185
logv(c, format!("target-rustcflags: {}",
188186
opt_str(&config.target_rustcflags)));
189-
logv(c, format!("jit: {}", config.jit));
190187
logv(c, format!("target: {}", config.target));
191188
logv(c, format!("host: {}", config.host));
192189
logv(c, format!("android-cross-path: {:?}",

trunk/src/compiletest/runtest.rs

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,13 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
9898
}
9999

100100
fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
101-
let proc_res = if !config.jit {
102-
let proc_res = compile_test(config, props, testfile);
101+
let proc_res = compile_test(config, props, testfile);
103102

104-
if !proc_res.status.success() {
105-
fatal_proc_rec("compilation failed!", &proc_res);
106-
}
103+
if !proc_res.status.success() {
104+
fatal_proc_rec("compilation failed!", &proc_res);
105+
}
107106

108-
exec_compiled_test(config, props, testfile)
109-
} else {
110-
jit_test(config, props, testfile)
111-
};
107+
let proc_res = exec_compiled_test(config, props, testfile);
112108

113109
// The value our Makefile configures valgrind to return on failure
114110
const VALGRIND_ERR: i32 = 100;
@@ -133,24 +129,16 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
133129
}
134130

135131
fn run_rpass_test(config: &Config, props: &TestProps, testfile: &Path) {
136-
if !config.jit {
137-
let mut proc_res = compile_test(config, props, testfile);
138-
139-
if !proc_res.status.success() {
140-
fatal_proc_rec("compilation failed!", &proc_res);
141-
}
132+
let proc_res = compile_test(config, props, testfile);
142133

143-
proc_res = exec_compiled_test(config, props, testfile);
134+
if !proc_res.status.success() {
135+
fatal_proc_rec("compilation failed!", &proc_res);
136+
}
144137

145-
if !proc_res.status.success() {
146-
fatal_proc_rec("test run failed!", &proc_res);
147-
}
148-
} else {
149-
let proc_res = jit_test(config, props, testfile);
138+
let proc_res = exec_compiled_test(config, props, testfile);
150139

151-
if !proc_res.status.success() {
152-
fatal_proc_rec("jit failed!", &proc_res);
153-
}
140+
if !proc_res.status.success() {
141+
fatal_proc_rec("test run failed!", &proc_res);
154142
}
155143
}
156144

@@ -1141,10 +1129,6 @@ fn compile_test(config: &Config, props: &TestProps,
11411129
compile_test_(config, props, testfile, &[])
11421130
}
11431131

1144-
fn jit_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes {
1145-
compile_test_(config, props, testfile, &["--jit".to_string()])
1146-
}
1147-
11481132
fn compile_test_(config: &Config, props: &TestProps,
11491133
testfile: &Path, extra_args: &[String]) -> ProcRes {
11501134
let aux_dir = aux_output_dir_name(config, testfile);

trunk/src/doc/reference.md

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ apply to the crate as a whole.
638638
```
639639

640640
A crate that contains a `main` function can be compiled to an executable. If a
641-
`main` function is present, its return type must be [`unit`](#primitive-types)
641+
`main` function is present, its return type must be [`unit`](#tuple-types)
642642
and it must take no arguments.
643643

644644
# Items and attributes
@@ -928,26 +928,36 @@ A _generic function_ allows one or more _parameterized types_ to appear in its
928928
signature. Each type parameter must be explicitly declared, in an
929929
angle-bracket-enclosed, comma-separated list following the function name.
930930

931-
```{.ignore}
932-
fn iter<T, F>(seq: &[T], f: F) where T: Copy, F: Fn(T) {
933-
for elt in seq { f(*elt); }
934-
}
935-
fn map<T, U, F>(seq: &[T], f: F) -> Vec<U> where T: Copy, U: Copy, F: Fn(T) -> U {
936-
let mut acc = vec![];
937-
for elt in seq { acc.push(f(*elt)); }
938-
acc
939-
}
931+
```rust,ignore
932+
// foo is generic over A and B
933+
934+
fn foo<A, B>(x: A, y: B) {
940935
```
941936

942937
Inside the function signature and body, the name of the type parameter can be
943938
used as a type name. [Trait](#traits) bounds can be specified for type parameters
944939
to allow methods with that trait to be called on values of that type. This is
945-
specified using the `where` syntax, as in the above example.
940+
specified using the `where` syntax:
941+
942+
```rust,ignore
943+
fn foo<T>(x: T) where T: Debug {
944+
```
946945

947946
When a generic function is referenced, its type is instantiated based on the
948-
context of the reference. For example, calling the `iter` function defined
949-
above on `[1, 2]` will instantiate type parameter `T` with `i32`, and require
950-
the closure parameter to have type `Fn(i32)`.
947+
context of the reference. For example, calling the `foo` function here:
948+
949+
```
950+
use std::fmt::Debug;
951+
952+
fn foo<T>(x: &[T]) where T: Debug {
953+
// details elided
954+
# ()
955+
}
956+
957+
foo(&[1, 2]);
958+
```
959+
960+
will instantiate type parameter `T` with `i32`.
951961

952962
The type parameters can also be explicitly supplied in a trailing
953963
[path](#paths) component after the function name. This might be necessary if
@@ -2874,7 +2884,7 @@ The `+`, `-`, `*`, `/`, `%`, `&`, `|`, `^`, `<<`, and `>>` operators may be
28742884
composed with the `=` operator. The expression `lval OP= val` is equivalent to
28752885
`lval = lval OP val`. For example, `x = x + 1` may be written as `x += 1`.
28762886

2877-
Any such expression always has the [`unit`](#primitive-types) type.
2887+
Any such expression always has the [`unit`](#tuple-types) type.
28782888

28792889
#### Operator precedence
28802890

@@ -3316,6 +3326,9 @@ assert!(b != "world");
33163326
assert!(p.0 == 10);
33173327
```
33183328

3329+
For historical reasons and convenience, the tuple type with no elements (`()`)
3330+
is often called ‘unit’ or ‘the unit type’.
3331+
33193332
### Array, and Slice types
33203333

33213334
Rust has two different types for a list of items:

trunk/src/doc/trpl/closures.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ let y = &mut num;
120120
```
121121

122122
If your closure requires it, however, Rust will take ownership and move
123-
the environment instead:
123+
the environment instead. This doesn’t work:
124124

125125
```rust,ignore
126126
let nums = vec![1, 2, 3];
@@ -130,7 +130,7 @@ let takes_nums = || nums;
130130
println!("{:?}", nums);
131131
```
132132

133-
This gives us:
133+
We get this error:
134134

135135
```text
136136
note: `nums` moved into closure environment here because it has type

trunk/src/doc/trpl/rust-inside-other-languages.md

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,14 @@ threads = []
6666
5_000_000.times do
6767
count += 1
6868
end
69+
70+
count
6971
end
7072
end
7173

72-
threads.each { |t| t.join }
74+
threads.each do |t|
75+
puts "Thread finished with count=#{t.value}"
76+
end
7377
puts "done!"
7478
```
7579

@@ -103,50 +107,26 @@ use std::thread;
103107
fn process() {
104108
let handles: Vec<_> = (0..10).map(|_| {
105109
thread::spawn(|| {
106-
let mut _x = 0;
110+
let mut x = 0;
107111
for _ in (0..5_000_000) {
108-
_x += 1
112+
x += 1
109113
}
114+
x
110115
})
111116
}).collect();
112117

113118
for h in handles {
114-
h.join().ok().expect("Could not join a thread!");
119+
println!("Thread finished with count={}",
120+
h.join().map_err(|_| "Could not join a thread!").unwrap());
115121
}
122+
println!("done!");
116123
}
117124
```
118125

119126
Some of this should look familiar from previous examples. We spin up ten
120127
threads, collecting them into a `handles` vector. Inside of each thread, we
121-
loop five million times, and add one to `_x` each time. Why the underscore?
122-
Well, if we remove it and compile:
123-
124-
```bash
125-
$ cargo build
126-
Compiling embed v0.1.0 (file:///home/steve/src/embed)
127-
src/lib.rs:3:1: 16:2 warning: function is never used: `process`, #[warn(dead_code)] on by default
128-
src/lib.rs:3 fn process() {
129-
src/lib.rs:4 let handles: Vec<_> = (0..10).map(|_| {
130-
src/lib.rs:5 thread::spawn(|| {
131-
src/lib.rs:6 let mut x = 0;
132-
src/lib.rs:7 for _ in (0..5_000_000) {
133-
src/lib.rs:8 x += 1
134-
...
135-
src/lib.rs:6:17: 6:22 warning: variable `x` is assigned to, but never used, #[warn(unused_variables)] on by default
136-
src/lib.rs:6 let mut x = 0;
137-
^~~~~
138-
```
139-
140-
That first warning is because we are building a library. If we had a test
141-
for this function, the warning would go away. But for now, it’s never
142-
called.
143-
144-
The second is related to `x` versus `_x`. Because we never actually _do_
145-
anything with `x`, we get a warning about it. In our case, that’s perfectly
146-
okay, as we’re just trying to waste CPU cycles. Prefixing `x` with the
147-
underscore removes the warning.
148-
149-
Finally, we join on each thread.
128+
loop five million times, and add one to `x` each time. Finally, we join on
129+
each thread.
150130

151131
Right now, however, this is a Rust library, and it doesn’t expose anything
152132
that’s callable from C. If we tried to hook this up to another language right

trunk/src/doc/trpl/trait-objects.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,3 @@ let y = TraitObject {
300300
// y.method();
301301
(y.vtable.method)(y.data);
302302
```
303-
304-
If `b` or `y` were owning trait objects (`Box<Foo>`), there would be a
305-
`(b.vtable.destructor)(b.data)` (respectively `y`) call when they went out of
306-
scope.

0 commit comments

Comments
 (0)