Skip to content

Commit be4a3ef

Browse files
committed
---
yaml --- r: 232939 b: refs/heads/try c: 3903ea9 h: refs/heads/master i: 232937: b458dee 232935: 782f7a1 v: v3
1 parent 5744651 commit be4a3ef

File tree

22 files changed

+642
-740
lines changed

22 files changed

+642
-740
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 67616f71916c94b194164278f685fc7d82b3b4d0
4+
refs/heads/try: 3903ea96f557dc923cf73d3905554083cd921a01
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/doc/trpl/rust-inside-other-languages.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,6 @@ And finally, we can try running it:
217217

218218
```bash
219219
$ ruby embed.rb
220-
Thread finished with count=5000000
221-
Thread finished with count=5000000
222-
Thread finished with count=5000000
223-
Thread finished with count=5000000
224-
Thread finished with count=5000000
225-
Thread finished with count=5000000
226-
Thread finished with count=5000000
227-
Thread finished with count=5000000
228-
Thread finished with count=5000000
229-
Thread finished with count=5000000
230-
done!
231220
done!
232221
$
233222
```

branches/try/src/doc/trpl/structs.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% Structs
22

3-
`struct`s are a way of creating more complex data types. For example, if we were
3+
Structs are a way of creating more complex data types. For example, if we were
44
doing calculations involving coordinates in 2D space, we would need both an `x`
55
and a `y` value:
66

@@ -9,7 +9,7 @@ let origin_x = 0;
99
let origin_y = 0;
1010
```
1111

12-
A `struct` lets us combine these two into a single, unified datatype:
12+
A struct lets us combine these two into a single, unified datatype:
1313

1414
```rust
1515
struct Point {
@@ -28,14 +28,14 @@ There’s a lot going on here, so let’s break it down. We declare a `struct` w
2828
the `struct` keyword, and then with a name. By convention, `struct`s begin with
2929
a capital letter and are camel cased: `PointInSpace`, not `Point_In_Space`.
3030

31-
We can create an instance of our `struct` via `let`, as usual, but we use a `key:
31+
We can create an instance of our struct via `let`, as usual, but we use a `key:
3232
value` style syntax to set each field. The order doesn’t need to be the same as
3333
in the original declaration.
3434

3535
Finally, because fields have names, we can access the field through dot
3636
notation: `origin.x`.
3737

38-
The values in `struct`s are immutable by default, like other bindings in Rust.
38+
The values in structs are immutable by default, like other bindings in Rust.
3939
Use `mut` to make them mutable:
4040

4141
```rust
@@ -91,7 +91,7 @@ fn main() {
9191
# Update syntax
9292

9393
A `struct` can include `..` to indicate that you want to use a copy of some
94-
other `struct` for some of the values. For example:
94+
other struct for some of the values. For example:
9595

9696
```rust
9797
struct Point3d {
@@ -121,7 +121,7 @@ let point = Point3d { z: 1, x: 2, .. origin };
121121
# Tuple structs
122122

123123
Rust has another data type that’s like a hybrid between a [tuple][tuple] and a
124-
`struct`, called a ‘tuple struct’. Tuple structs have a name, but
124+
struct, called a ‘tuple struct’. Tuple structs have a name, but
125125
their fields don’t:
126126

127127
```rust
@@ -140,7 +140,7 @@ let black = Color(0, 0, 0);
140140
let origin = Point(0, 0, 0);
141141
```
142142

143-
It is almost always better to use a `struct` than a tuple struct. We would write
143+
It is almost always better to use a struct than a tuple struct. We would write
144144
`Color` and `Point` like this instead:
145145

146146
```rust
@@ -158,7 +158,7 @@ struct Point {
158158
```
159159

160160
Now, we have actual names, rather than positions. Good names are important,
161-
and with a `struct`, we have actual names.
161+
and with a struct, we have actual names.
162162

163163
There _is_ one case when a tuple struct is very useful, though, and that’s a
164164
tuple struct with only one element. We call this the ‘newtype’ pattern, because
@@ -180,13 +180,13 @@ destructuring `let`, just as with regular tuples. In this case, the
180180

181181
# Unit-like structs
182182

183-
You can define a `struct` with no members at all:
183+
You can define a struct with no members at all:
184184

185185
```rust
186186
struct Electron;
187187
```
188188

189-
Such a `struct` is called ‘unit-like’ because it resembles the empty
189+
Such a struct is called ‘unit-like’ because it resembles the empty
190190
tuple, `()`, sometimes called ‘unit’. Like a tuple struct, it defines a
191191
new type.
192192

@@ -195,6 +195,6 @@ marker type), but in combination with other features, it can become
195195
useful. For instance, a library may ask you to create a structure that
196196
implements a certain [trait][trait] to handle events. If you don’t have
197197
any data you need to store in the structure, you can just create a
198-
unit-like `struct`.
198+
unit-like struct.
199199

200200
[trait]: traits.html

branches/try/src/doc/trpl/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ fn normal<T: ConvertTo<i64>>(x: &T) -> i64 {
390390

391391
// can be called with T == i64
392392
fn inverse<T>() -> T
393-
// this is using ConvertTo as if it were "ConvertTo<i64>"
393+
// this is using ConvertTo as if it were "ConvertFrom<i32>"
394394
where i32: ConvertTo<T> {
395395
42.convert()
396396
}

branches/try/src/libcore/ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub use intrinsics::write_bytes;
5151
/// ```
5252
#[inline]
5353
#[stable(feature = "rust1", since = "1.0.0")]
54-
pub fn null<T>() -> *const T { 0 as *const T }
54+
pub const fn null<T>() -> *const T { 0 as *const T }
5555

5656
/// Creates a null mutable raw pointer.
5757
///
@@ -65,7 +65,7 @@ pub fn null<T>() -> *const T { 0 as *const T }
6565
/// ```
6666
#[inline]
6767
#[stable(feature = "rust1", since = "1.0.0")]
68-
pub fn null_mut<T>() -> *mut T { 0 as *mut T }
68+
pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
6969

7070
/// Swaps the values at two mutable locations of the same type, without
7171
/// deinitialising either. They may overlap, unlike `mem::swap` which is
@@ -163,7 +163,7 @@ impl<T: ?Sized> *const T {
163163
#[stable(feature = "rust1", since = "1.0.0")]
164164
#[inline]
165165
pub fn is_null(self) -> bool where T: Sized {
166-
self == 0 as *const T
166+
self == null()
167167
}
168168

169169
/// Returns `None` if the pointer is null, or else returns a reference to
@@ -212,7 +212,7 @@ impl<T: ?Sized> *mut T {
212212
#[stable(feature = "rust1", since = "1.0.0")]
213213
#[inline]
214214
pub fn is_null(self) -> bool where T: Sized {
215-
self == 0 as *mut T
215+
self == null_mut()
216216
}
217217

218218
/// Returns `None` if the pointer is null, or else returns a reference to

branches/try/src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#![feature(rustc_diagnostic_macros)]
5252
#![feature(rustc_private)]
5353
#![feature(scoped_tls)]
54+
#![feature(slice_bytes)]
5455
#![feature(slice_splits)]
5556
#![feature(slice_patterns)]
5657
#![feature(staged_api)]

0 commit comments

Comments
 (0)