Skip to content

Commit ea7d5e2

Browse files
committed
---
yaml --- r: 233211 b: refs/heads/beta c: 7a3fdfb h: refs/heads/master i: 233209: 00cc4b7 233207: 326b27d v: v3
1 parent 387220d commit ea7d5e2

File tree

233 files changed

+2952
-5230
lines changed

Some content is hidden

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

233 files changed

+2952
-5230
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 75383ea7d7b1a4dff104be737830c1a31a6c0a73
26+
refs/heads/beta: 7a3fdfbf674a08b7f6fd32c9124e52924a2f9a1c
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/mk/clean.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ define CLEAN_TARGET_STAGE_N
101101
clean$(1)_T_$(2)_H_$(3): \
102102
$$(foreach crate,$$(CRATES),clean$(1)_T_$(2)_H_$(3)-lib-$$(crate)) \
103103
$$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool))
104-
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
105104
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a
106105
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix
107106
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/run_pass_stage* # For windows

branches/beta/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ DEPS_libc := core
6565
DEPS_rustc_unicode := core
6666
DEPS_alloc := core libc native:jemalloc
6767
DEPS_std := core libc rand alloc collections rustc_unicode \
68-
native:rust_builtin native:backtrace native:rustrt_native \
68+
native:rust_builtin native:backtrace \
6969
rustc_bitflags
7070
DEPS_graphviz := std
7171
DEPS_syntax := std term serialize log fmt_macros arena libc

branches/beta/mk/main.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ endif
163163
# that the snapshot will be generated with a statically linked rustc so we only
164164
# have to worry about the distribution of one file (with its native dynamic
165165
# dependencies)
166-
RUSTFLAGS_STAGE0 += -C prefer-dynamic
166+
RUSTFLAGS_STAGE0 += -C prefer-dynamic -C no-stack-check
167167
RUSTFLAGS_STAGE1 += -C prefer-dynamic
168168
RUST_LIB_FLAGS_ST2 += -C prefer-dynamic
169169
RUST_LIB_FLAGS_ST3 += -C prefer-dynamic
@@ -400,6 +400,11 @@ TSREQ$(1)_T_$(2)_H_$(3) = \
400400
$$(foreach obj,$$(INSTALLED_OBJECTS_$(2)),\
401401
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj))
402402

403+
ifeq ($(1),0)
404+
TSREQ$(1)_T_$(2)_H_$(3) += \
405+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(call CFG_STATIC_LIB_NAME_$(2),morestack)
406+
endif
407+
403408
# Prerequisites for a working stageN compiler and libraries, for a specific
404409
# target
405410
SREQ$(1)_T_$(2)_H_$(3) = \

branches/beta/mk/platform.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ CFG_RLIB_GLOB=lib$(1)-*.rlib
113113
include $(wildcard $(CFG_SRC_DIR)mk/cfg/*.mk)
114114

115115
define ADD_INSTALLED_OBJECTS
116-
INSTALLED_OBJECTS_$(1) += $$(call CFG_STATIC_LIB_NAME_$(1),morestack) \
117-
$$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
116+
INSTALLED_OBJECTS_$(1) += $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
118117
endef
119118

120119
$(foreach target,$(CFG_TARGET), \

branches/beta/mk/rt.mk

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
# that's per-target so you're allowed to conditionally add files based on the
3636
# target.
3737
################################################################################
38-
NATIVE_LIBS := rust_builtin hoedown morestack miniz \
39-
rustrt_native rust_test_helpers
38+
NATIVE_LIBS := rust_builtin hoedown miniz \
39+
rust_test_helpers morestack
4040

4141
# $(1) is the target triple
4242
define NATIVE_LIBRARIES
@@ -53,10 +53,8 @@ NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \
5353
NATIVE_DEPS_miniz_$(1) = miniz.c
5454
NATIVE_DEPS_rust_builtin_$(1) := rust_builtin.c \
5555
rust_android_dummy.c
56-
NATIVE_DEPS_rustrt_native_$(1) := arch/$$(HOST_$(1))/record_sp.S
5756
NATIVE_DEPS_rust_test_helpers_$(1) := rust_test_helpers.c
58-
NATIVE_DEPS_morestack_$(1) := arch/$$(HOST_$(1))/morestack.S
59-
57+
NATIVE_DEPS_morestack_$(1) := empty.c
6058

6159
################################################################################
6260
# You shouldn't find it that necessary to edit anything below this line.

branches/beta/mk/target.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ $(foreach host,$(CFG_HOST), \
5656
# 1. The immediate dependencies are the rust source files
5757
# 2. Each rust crate dependency is listed (based on their stamp files),
5858
# as well as all native dependencies (listed in RT_OUTPUT_DIR)
59-
# 3. The stage (n-1) compiler is required through the TSREQ dependency, along
60-
# with the morestack library
59+
# 3. The stage (n-1) compiler is required through the TSREQ dependency
6160
# 4. When actually executing the rule, the first thing we do is to clean out
6261
# old libs and rlibs via the REMOVE_ALL_OLD_GLOB_MATCHES macro
6362
# 5. Finally, we get around to building the actual crate. It's just one

branches/beta/src/doc/nomicon/exotic-sizes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ support values.
8585
Safe code need not worry about ZSTs, but *unsafe* code must be careful about the
8686
consequence of types with no size. In particular, pointer offsets are no-ops,
8787
and standard allocators (including jemalloc, the one used by default in Rust)
88-
may return `nullptr` when a zero-sized allocation is requested, which is
89-
indistinguishable from out of memory.
88+
generally consider passing in `0` for the size of an allocation as Undefined
89+
Behaviour.
9090

9191

9292

branches/beta/src/doc/nomicon/lifetimes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ likely desugar to the following:
5252
}
5353
```
5454

55-
Wow. That's... awful. Let's all take a moment to thank Rust for making this easier.
55+
Wow. That's... awful. Let's all take a moment to thank Rust for being a
56+
diabetes-inducing torrent of syrupy-goodness.
5657

5758
Actually passing references to outer scopes will cause Rust to infer
5859
a larger lifetime:

branches/beta/src/doc/nomicon/repr-rust.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ struct A {
3636
}
3737
```
3838

39-
will be 32-bit aligned on an architecture that aligns these primitives to their
40-
respective sizes. The whole struct will therefore have a size that is a multiple
41-
of 32-bits. It will potentially become:
39+
will be 32-bit aligned assuming these primitives are aligned to their size.
40+
It will therefore have a size that is a multiple of 32-bits. It will potentially
41+
*really* become:
4242

4343
```rust
4444
struct A {
@@ -50,10 +50,10 @@ struct A {
5050
}
5151
```
5252

53-
There is *no indirection* for these types; all data is stored within the struct,
54-
as you would expect in C. However with the exception of arrays (which are
55-
densely packed and in-order), the layout of data is not by default specified in
56-
Rust. Given the two following struct definitions:
53+
There is *no indirection* for these types; all data is stored contiguously as
54+
you would expect in C. However with the exception of arrays (which are densely
55+
packed and in-order), the layout of data is not by default specified in Rust.
56+
Given the two following struct definitions:
5757

5858
```rust
5959
struct A {
@@ -62,17 +62,18 @@ struct A {
6262
}
6363

6464
struct B {
65-
a: i32,
65+
x: i32,
6666
b: u64,
6767
}
6868
```
6969

7070
Rust *does* guarantee that two instances of A have their data laid out in
71-
exactly the same way. However Rust *does not* currently guarantee that an
72-
instance of A has the same field ordering or padding as an instance of B, though
73-
in practice there's no reason why they wouldn't.
71+
exactly the same way. However Rust *does not* guarantee that an instance of A
72+
has the same field ordering or padding as an instance of B (in practice there's
73+
no particular reason why they wouldn't, other than that its not currently
74+
guaranteed).
7475

75-
With A and B as written, this point would seem to be pedantic, but several other
76+
With A and B as written, this is basically nonsensical, but several other
7677
features of Rust make it desirable for the language to play with data layout in
7778
complex ways.
7879

@@ -132,21 +133,18 @@ struct FooRepr {
132133
}
133134
```
134135

135-
And indeed this is approximately how it would be laid out in general (modulo the
136-
size and position of `tag`).
137-
138-
However there are several cases where such a representation is inefficient. The
139-
classic case of this is Rust's "null pointer optimization": an enum consisting
140-
of a single outer unit variant (e.g. `None`) and a (potentially nested) non-
141-
nullable pointer variant (e.g. `&T`) makes the tag unnecessary, because a null
142-
pointer value can safely be interpreted to mean that the unit variant is chosen
143-
instead. The net result is that, for example, `size_of::<Option<&T>>() ==
144-
size_of::<&T>()`.
136+
And indeed this is approximately how it would be laid out in general
137+
(modulo the size and position of `tag`). However there are several cases where
138+
such a representation is inefficient. The classic case of this is Rust's
139+
"null pointer optimization". Given a pointer that is known to not be null
140+
(e.g. `&u32`), an enum can *store* a discriminant bit *inside* the pointer
141+
by using null as a special value. The net result is that
142+
`size_of::<Option<&T>>() == size_of::<&T>()`
145143

146-
There are many types in Rust that are, or contain, non-nullable pointers such as
144+
There are many types in Rust that are, or contain, "not null" pointers such as
147145
`Box<T>`, `Vec<T>`, `String`, `&T`, and `&mut T`. Similarly, one can imagine
148146
nested enums pooling their tags into a single discriminant, as they are by
149-
definition known to have a limited range of valid values. In principle enums could
147+
definition known to have a limited range of valid values. In principle enums can
150148
use fairly elaborate algorithms to cache bits throughout nested types with
151149
special constrained representations. As such it is *especially* desirable that
152150
we leave enum layout unspecified today.

branches/beta/src/doc/reference.md

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,29 +1501,7 @@ have an implementation for `Shape`. Multiple supertraits are separated by `+`,
15011501
`trait Circle : Shape + PartialEq { }`. In an implementation of `Circle` for a
15021502
given type `T`, methods can refer to `Shape` methods, since the typechecker
15031503
checks that any type with an implementation of `Circle` also has an
1504-
implementation of `Shape`:
1505-
1506-
```rust
1507-
struct Foo;
1508-
1509-
trait Shape { fn area(&self) -> f64; }
1510-
trait Circle : Shape { fn radius(&self) -> f64; }
1511-
# impl Shape for Foo {
1512-
# fn area(&self) -> f64 {
1513-
# 0.0
1514-
# }
1515-
# }
1516-
impl Circle for Foo {
1517-
fn radius(&self) -> f64 {
1518-
println!("calling area: {}", self.area());
1519-
1520-
0.0
1521-
}
1522-
}
1523-
1524-
let c = Foo;
1525-
c.radius();
1526-
```
1504+
implementation of `Shape`.
15271505

15281506
In type-parameterized functions, methods of the supertrait may be called on
15291507
values of subtrait-bound type parameters. Referring to the previous example of

branches/beta/src/doc/trpl/advanced-linking.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ Static linking refers to the process of creating output that contain all
3838
required libraries and so don't need libraries installed on every system where
3939
you want to use your compiled project. Pure-Rust dependencies are statically
4040
linked by default so you can use created binaries and libraries without
41-
installing Rust everywhere. By contrast, native libraries
42-
(e.g. `libc` and `libm`) are usually dynamically linked, but it is possible to
41+
installing the Rust everywhere. By contrast, native libraries
42+
(e.g. `libc` and `libm`) usually dynamically linked, but it is possible to
4343
change this and statically link them as well.
4444

45-
Linking is a very platform-dependent topic, and static linking may not even be
46-
possible on some platforms! This section assumes some basic familiarity with
45+
Linking is a very platform dependent topic — on some platforms, static linking
46+
may not be possible at all! This section assumes some basic familiarity with
4747
linking on your platform of choice.
4848

4949
## Linux
@@ -71,7 +71,8 @@ Dynamic linking on Linux can be undesirable if you wish to use new library
7171
features on old systems or target systems which do not have the required
7272
dependencies for your program to run.
7373

74-
Static linking is supported via an alternative `libc`, `musl`. You can compile
74+
Static linking is supported via an alternative `libc`, `musl` - this must be
75+
enabled at Rust compile-time with some prerequisites available. You can compile
7576
your own version of Rust with `musl` enabled and install it into a custom
7677
directory with the instructions below:
7778

@@ -122,7 +123,7 @@ $ du -h musldist/bin/rustc
122123
```
123124

124125
You now have a build of a `musl`-enabled Rust! Because we've installed it to a
125-
custom prefix we need to make sure our system can find the binaries and appropriate
126+
custom prefix we need to make sure our system can the binaries and appropriate
126127
libraries when we try and run it:
127128

128129
```text

branches/beta/src/doc/trpl/closures.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -316,35 +316,6 @@ assert_eq!(3, answer);
316316
Now we take a trait object, a `&Fn`. And we have to make a reference
317317
to our closure when we pass it to `call_with_one`, so we use `&||`.
318318

319-
# Function pointers and closures
320-
321-
A function pointer is kind of like a closure that has no environment. As such,
322-
you can pass a function pointer to any function expecting a closure argument,
323-
and it will work:
324-
325-
```rust
326-
fn call_with_one(some_closure: &Fn(i32) -> i32) -> i32 {
327-
some_closure(1)
328-
}
329-
330-
fn add_one(i: i32) -> i32 {
331-
i + 1
332-
}
333-
334-
let f = add_one;
335-
336-
let answer = call_with_one(&f);
337-
338-
assert_eq!(2, answer);
339-
```
340-
341-
In this example, we don’t strictly need the intermediate variable `f`,
342-
the name of the function works just fine too:
343-
344-
```ignore
345-
let answer = call_with_one(&add_one);
346-
```
347-
348319
# Returning closures
349320

350321
It’s very common for functional-style code to return closures in various

branches/beta/src/doc/trpl/functions.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -227,34 +227,3 @@ as any type:
227227
let x: i32 = diverges();
228228
let x: String = diverges();
229229
```
230-
231-
## Function pointers
232-
233-
We can also create variable bindings which point to functions:
234-
235-
```rust
236-
let f: fn(i32) -> i32;
237-
```
238-
239-
`f` is a variable binding which points to a function that takes an `i32` as
240-
an argument and returns an `i32`. For example:
241-
242-
```rust
243-
fn plus_one(i: i32) -> i32 {
244-
i + 1
245-
}
246-
247-
// without type inference
248-
let f: fn(i32) -> i32 = plus_one;
249-
250-
// with type inference
251-
let f = plus_one;
252-
```
253-
254-
We can then use `f` to call the function:
255-
256-
```rust
257-
# fn plus_one(i: i32) -> i32 { i + 1 }
258-
# let f = plus_one;
259-
let six = f(5);
260-
```

branches/beta/src/doc/trpl/generics.md

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Generics are called ‘parametric polymorphism’ in type theory,
66
which means that they are types or functions that have multiple forms (‘poly’
77
is multiple, ‘morph’ is form) over a given parameter (‘parametric’).
88

9-
Anyway, enough type theory, let’s check out some generic code. Rust’s
9+
Anyway, enough with type theory, let’s check out some generic code. Rust’s
1010
standard library provides a type, `Option<T>`, that’s generic:
1111

1212
```rust
@@ -27,7 +27,7 @@ let x: Option<i32> = Some(5);
2727

2828
In the type declaration, we say `Option<i32>`. Note how similar this looks to
2929
`Option<T>`. So, in this particular `Option`, `T` has the value of `i32`. On
30-
the right-hand side of the binding, we make a `Some(T)`, where `T` is `5`.
30+
the right-hand side of the binding, we do make a `Some(T)`, where `T` is `5`.
3131
Since that’s an `i32`, the two sides match, and Rust is happy. If they didn’t
3232
match, we’d get an error:
3333

@@ -101,6 +101,11 @@ fn takes_two_things<T, U>(x: T, y: U) {
101101
}
102102
```
103103

104+
Generic functions are most useful with ‘trait bounds’, which we’ll cover in the
105+
[section on traits][traits].
106+
107+
[traits]: traits.html
108+
104109
## Generic structs
105110

106111
You can store a generic type in a `struct` as well:
@@ -117,28 +122,3 @@ let float_origin = Point { x: 0.0, y: 0.0 };
117122

118123
Similarly to functions, the `<T>` is where we declare the generic parameters,
119124
and we then use `x: T` in the type declaration, too.
120-
121-
When you want to add an implementation for the generic struct, you just
122-
declare the type parameter after the `impl`:
123-
124-
```rust
125-
# struct Point<T> {
126-
# x: T,
127-
# y: T,
128-
# }
129-
#
130-
impl<T> Point<T> {
131-
fn swap(&mut self) {
132-
std::mem::swap(&mut self.x, &mut self.y);
133-
}
134-
}
135-
```
136-
137-
So far you’ve seen generics that take absolutely any type. These are useful in
138-
many cases: you’ve already seen `Option<T>`, and later you’ll meet universal
139-
container types like [`Vec<T>`][Vec]. On the other hand, often you want to
140-
trade that flexibility for increased expressive power. Read about [trait
141-
bounds][traits] to see why and how.
142-
143-
[traits]: traits.html
144-
[Vec]: ../std/vec/struct.Vec.html

0 commit comments

Comments
 (0)