Skip to content

Commit c3b0e4e

Browse files
committed
---
yaml --- r: 182719 b: refs/heads/beta c: 0dac568 h: refs/heads/master i: 182717: f8b428f 182715: 36130f4 182711: 6f2d172 182703: 29c0589 182687: 389493a 182655: 8e96d1e v: v3
1 parent b2f1d40 commit c3b0e4e

File tree

117 files changed

+1112
-1610
lines changed

Some content is hidden

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

117 files changed

+1112
-1610
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 16286f5cf921a9de463d8a744c33f49837698c3d
34+
refs/heads/beta: 0dac5685783631dc4ecf3e865229a3747fe81943
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f

branches/beta/configure

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ need_ok() {
2828

2929
need_cmd() {
3030
if command -v $1 >/dev/null 2>&1
31-
then msg "found program $1"
32-
else err "need program $1"
31+
then msg "found $1"
32+
else err "need $1"
3333
fi
3434
}
3535

@@ -340,7 +340,6 @@ need_cmd date
340340
need_cmd tr
341341
need_cmd sed
342342
need_cmd file
343-
need_cmd make
344343

345344
msg "inspecting environment"
346345

branches/beta/mk/main.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
3030
CFG_DISABLE_UNSTABLE_FEATURES=1
3131
endif
3232
ifeq ($(CFG_RELEASE_CHANNEL),beta)
33-
CFG_RELEASE=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
34-
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
33+
CFG_RELEASE=$(CFG_RELEASE_NUM)-beta(CFG_PRERELEASE_VERSION)
34+
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-beta(CFG_PRERELEASE_VERSION)
3535
CFG_DISABLE_UNSTABLE_FEATURES=1
3636
endif
3737
ifeq ($(CFG_RELEASE_CHANNEL),nightly)

branches/beta/src/compiletest/common.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,6 @@ pub use self::Mode::*;
1212
use std::fmt;
1313
use std::str::FromStr;
1414

15-
#[cfg(stage0)] // NOTE: remove impl after snapshot
16-
#[derive(Clone, PartialEq, Show)]
17-
pub enum Mode {
18-
CompileFail,
19-
RunFail,
20-
RunPass,
21-
RunPassValgrind,
22-
Pretty,
23-
DebugInfoGdb,
24-
DebugInfoLldb,
25-
Codegen
26-
}
27-
28-
#[cfg(not(stage0))] // NOTE: remove cfg after snapshot
2915
#[derive(Clone, PartialEq, Debug)]
3016
pub enum Mode {
3117
CompileFail,
@@ -38,7 +24,6 @@ pub enum Mode {
3824
Codegen
3925
}
4026

41-
4227
impl Copy for Mode {}
4328

4429
impl FromStr for Mode {

branches/beta/src/doc/reference.md

Lines changed: 137 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,7 +2291,136 @@ The name `str_eq` has a special meaning to the Rust compiler, and the presence
22912291
of this definition means that it will use this definition when generating calls
22922292
to the string equality function.
22932293

2294-
A complete list of the built-in language items will be added in the future.
2294+
A complete list of the built-in language items follows:
2295+
2296+
#### Built-in Traits
2297+
2298+
* `copy`
2299+
: Types that do not move ownership when used by-value.
2300+
* `drop`
2301+
: Have destructors.
2302+
* `send`
2303+
: Able to be sent across thread boundaries.
2304+
* `sized`
2305+
: Has a size known at compile time.
2306+
* `sync`
2307+
: Able to be safely shared between threads when aliased.
2308+
2309+
#### Operators
2310+
2311+
These language items are traits:
2312+
2313+
* `add`
2314+
: Elements can be added (for example, integers and floats).
2315+
* `sub`
2316+
: Elements can be subtracted.
2317+
* `mul`
2318+
: Elements can be multiplied.
2319+
* `div`
2320+
: Elements have a division operation.
2321+
* `rem`
2322+
: Elements have a remainder operation.
2323+
* `neg`
2324+
: Elements can be negated arithmetically.
2325+
* `not`
2326+
: Elements can be negated logically.
2327+
* `bitxor`
2328+
: Elements have an exclusive-or operation.
2329+
* `bitand`
2330+
: Elements have a bitwise `and` operation.
2331+
* `bitor`
2332+
: Elements have a bitwise `or` operation.
2333+
* `shl`
2334+
: Elements have a left shift operation.
2335+
* `shr`
2336+
: Elements have a right shift operation.
2337+
* `index`
2338+
: Elements can be indexed.
2339+
* `index_mut`
2340+
: ___Needs filling in___
2341+
* `eq`
2342+
: Elements can be compared for equality.
2343+
* `ord`
2344+
: Elements have a partial ordering.
2345+
* `deref`
2346+
: `*` can be applied, yielding a reference to another type.
2347+
* `deref_mut`
2348+
: `*` can be applied, yielding a mutable reference to another type.
2349+
2350+
These are functions:
2351+
2352+
* `fn`
2353+
: ___Needs filling in___
2354+
* `fn_mut`
2355+
: ___Needs filling in___
2356+
* `fn_once`
2357+
: ___Needs filling in___
2358+
* `str_eq`
2359+
: Compare two strings (`&str`) for equality.
2360+
* `strdup_uniq`
2361+
: Return a new unique string
2362+
containing a copy of the contents of a unique string.
2363+
2364+
#### Types
2365+
2366+
* `type_id`
2367+
: The type returned by the `type_id` intrinsic.
2368+
* `unsafe`
2369+
: A type whose contents can be mutated through an immutable reference.
2370+
2371+
#### Marker types
2372+
2373+
These types help drive the compiler's analysis
2374+
2375+
* `begin_unwind`
2376+
: ___Needs filling in___
2377+
* `no_copy_bound`
2378+
: This type does not implement "copy", even if eligible.
2379+
* `eh_personality`
2380+
: ___Needs filling in___
2381+
* `exchange_free`
2382+
: Free memory that was allocated on the exchange heap.
2383+
* `exchange_malloc`
2384+
: Allocate memory on the exchange heap.
2385+
* `closure_exchange_malloc`
2386+
: ___Needs filling in___
2387+
* `panic`
2388+
: Abort the program with an error.
2389+
* `fail_bounds_check`
2390+
: Abort the program with a bounds check error.
2391+
* `free`
2392+
: Free memory that was allocated on the managed heap.
2393+
* `gc`
2394+
: ___Needs filling in___
2395+
* `exchange_heap`
2396+
: ___Needs filling in___
2397+
* `iterator`
2398+
: ___Needs filling in___
2399+
* `contravariant_lifetime`
2400+
: The lifetime parameter should be considered contravariant.
2401+
* `covariant_lifetime`
2402+
: The lifetime parameter should be considered covariant.
2403+
* `invariant_lifetime`
2404+
: The lifetime parameter should be considered invariant.
2405+
* `malloc`
2406+
: Allocate memory on the managed heap.
2407+
* `owned_box`
2408+
: ___Needs filling in___
2409+
* `stack_exhausted`
2410+
: ___Needs filling in___
2411+
* `start`
2412+
: ___Needs filling in___
2413+
* `contravariant_type`
2414+
: The type parameter should be considered contravariant.
2415+
* `covariant_type`
2416+
: The type parameter should be considered covariant.
2417+
* `invariant_type`
2418+
: The type parameter should be considered invariant.
2419+
* `ty_desc`
2420+
: ___Needs filling in___
2421+
2422+
> **Note:** This list is likely to become out of date. We should auto-generate
2423+
> it from `librustc/middle/lang_items.rs`.
22952424
22962425
### Inline attributes
22972426

@@ -2489,6 +2618,10 @@ The currently implemented features of the reference compiler are:
24892618
for now until the specification of identifiers is fully
24902619
fleshed out.
24912620

2621+
* `once_fns` - Onceness guarantees a closure is only executed once. Defining a
2622+
closure as `once` is unlikely to be supported going forward. So
2623+
they are hidden behind this feature until they are to be removed.
2624+
24922625
* `plugin` - Usage of [compiler plugins][plugin] for custom lints or syntax extensions.
24932626
These depend on compiler internals and are subject to change.
24942627

@@ -2519,7 +2652,9 @@ The currently implemented features of the reference compiler are:
25192652
declare a `static` as being unique per-thread leveraging
25202653
LLVM's implementation which works in concert with the kernel
25212654
loader and dynamic linker. This is not necessarily available
2522-
on all platforms, and usage of it is discouraged.
2655+
on all platforms, and usage of it is discouraged (rust
2656+
focuses more on thread-local data instead of thread-local
2657+
data).
25232658

25242659
* `trace_macros` - Allows use of the `trace_macros` macro, which is a nasty
25252660
hack that will certainly be removed.

branches/beta/src/doc/trpl/installing-rust.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ If not, there are a number of places where you can get help. The easiest is
8383
you can access through
8484
[Mibbit](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust). Click
8585
that link, and you'll be chatting with other Rustaceans (a silly nickname we
86-
call ourselves), and we can help you out. Other great resources include [the
87-
/r/rust subreddit](http://www.reddit.com/r/rust), and [Stack
86+
call ourselves), and we can help you out. Other great resources include [our
87+
forum](http://discuss.rust-lang.org/), [the /r/rust
88+
subreddit](http://www.reddit.com/r/rust), and [Stack
8889
Overflow](http://stackoverflow.com/questions/tagged/rust).

branches/beta/src/doc/trpl/method-syntax.md

Lines changed: 2 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ x.foo().bar().baz();
1818
Luckily, as you may have guessed with the leading question, you can! Rust provides
1919
the ability to use this *method call syntax* via the `impl` keyword.
2020

21-
## Method calls
22-
2321
Here's how it works:
2422

2523
```{rust}
@@ -58,56 +56,11 @@ other parameter. Because we know it's a `Circle`, we can access the `radius`
5856
just like we would with any other struct. An import of π and some
5957
multiplications later, and we have our area.
6058

61-
## Chaining method calls
62-
63-
So, now we know how to call a method, such as `foo.bar()`. But what about our
64-
original example, `foo.bar().baz()`? This is called 'method chaining', and we
65-
can do it by returning `self`.
66-
67-
```
68-
struct Circle {
69-
x: f64,
70-
y: f64,
71-
radius: f64,
72-
}
73-
74-
impl Circle {
75-
fn area(&self) -> f64 {
76-
std::f64::consts::PI * (self.radius * self.radius)
77-
}
78-
79-
fn grow(&self) -> Circle {
80-
Circle { x: self.x, y: self.y, radius: (self.radius * 10.0) }
81-
}
82-
}
83-
84-
fn main() {
85-
let c = Circle { x: 0.0, y: 0.0, radius: 2.0 };
86-
println!("{}", c.area());
87-
88-
let d = c.grow().area();
89-
println!("{}", d);
90-
}
91-
```
92-
93-
Check the return type:
94-
95-
```
96-
# struct Circle;
97-
# impl Circle {
98-
fn grow(&self) -> Circle {
99-
# Circle } }
100-
```
101-
102-
We just say we're returning a `Circle`. With this, we can grow a new circle
103-
that's twice as big as the old one.
104-
105-
## Static methods
106-
10759
You can also define methods that do not take a `self` parameter. Here's a
10860
pattern that's very common in Rust code:
10961

110-
```
62+
```{rust}
63+
# #![allow(non_shorthand_field_patterns)]
11164
struct Circle {
11265
x: f64,
11366
y: f64,
@@ -133,66 +86,3 @@ This *static method* builds a new `Circle` for us. Note that static methods
13386
are called with the `Struct::method()` syntax, rather than the `ref.method()`
13487
syntax.
13588

136-
## Builder Pattern
137-
138-
Let's say that we want our users to be able to create Circles, but we will
139-
allow them to only set the properties they care about. Otherwise, the `x`
140-
and `y` attributes will be `0.0`, and the `radius` will be `1.0`. Rust doesn't
141-
have method overloading, named arguments, or variable arguments. We employ
142-
the builder pattern instead. It looks like this:
143-
144-
```
145-
struct Circle {
146-
x: f64,
147-
y: f64,
148-
radius: f64,
149-
}
150-
151-
impl Circle {
152-
fn area(&self) -> f64 {
153-
std::f64::consts::PI * (self.radius * self.radius)
154-
}
155-
}
156-
157-
struct CircleBuilder {
158-
coordinate: f64,
159-
radius: f64,
160-
}
161-
162-
impl CircleBuilder {
163-
fn new() -> CircleBuilder {
164-
CircleBuilder { coordinate: 0.0, radius: 0.0, }
165-
}
166-
167-
fn coordinate(&mut self, coordinate: f64) -> &mut CircleBuilder {
168-
self.coordinate = coordinate;
169-
self
170-
}
171-
172-
fn radius(&mut self, radius: f64) -> &mut CircleBuilder {
173-
self.radius = radius;
174-
self
175-
}
176-
177-
fn finalize(&self) -> Circle {
178-
Circle { x: self.coordinate, y: self.coordinate, radius: self.radius }
179-
}
180-
}
181-
182-
fn main() {
183-
let c = CircleBuilder::new()
184-
.coordinate(10.0)
185-
.radius(5.0)
186-
.finalize();
187-
188-
189-
println!("area: {}", c.area());
190-
}
191-
```
192-
193-
What we've done here is make another struct, `CircleBuilder`. We've defined our
194-
builder methods on it. We've also defined our `area()` method on `Circle`. We
195-
also made one more method on `CircleBuilder`: `finalize()`. This method creates
196-
our final `Circle` from the builder. Now, we've used the type system to enforce
197-
our concerns: we can use the methods on `CircleBuilder` to constrain making
198-
`Circle`s in any way we choose.

0 commit comments

Comments
 (0)