Skip to content

Commit 4d3ae68

Browse files
committed
---
yaml --- r: 208151 b: refs/heads/snap-stage3 c: b022709 h: refs/heads/master i: 208149: 9a309a9 208147: 24f8cde 208143: 5b9368b v: v3
1 parent e1646fe commit 4d3ae68

Some content is hidden

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

85 files changed

+615
-422
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: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 07499918b3dac890cab8f932a3be2ab48be8f447
4+
refs/heads/snap-stage3: b02270963c1678867d144f4621db86d606290ecb
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/doc/complement-design-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ representation as a primitive. This allows using Rust `enum`s in FFI where C
3939
`enum`s are also used, for most use cases. The attribute can also be applied
4040
to `struct`s to get the same layout as a C struct would.
4141

42-
[repr]: reference.html#miscellaneous-attributes
42+
[repr]: reference.html#ffi-attributes
4343

4444
## There is no GC
4545

branches/snap-stage3/src/doc/reference.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,13 +1867,12 @@ macro scope.
18671867
lower to the target's SIMD instructions, if any; the `simd` feature gate
18681868
is necessary to use this attribute.
18691869
- `static_assert` - on statics whose type is `bool`, terminates compilation
1870-
with an error if it is not initialized to `true`.
1871-
- `unsafe_destructor` - allow implementations of the "drop" language item
1872-
where the type it is implemented for does not implement the "send" language
1873-
item; the `unsafe_destructor` feature gate is needed to use this attribute
1870+
with an error if it is not initialized to `true`. To use this, the `static_assert`
1871+
feature gate must be enabled.
18741872
- `unsafe_no_drop_flag` - on structs, remove the flag that prevents
18751873
destructors from being run twice. Destructors might be run multiple times on
1876-
the same object with this attribute.
1874+
the same object with this attribute. To use this, the `unsafe_no_drop_flag` feature
1875+
gate must be enabled.
18771876
- `doc` - Doc comments such as `/// foo` are equivalent to `#[doc = "foo"]`.
18781877
- `rustc_on_unimplemented` - Write a custom note to be shown along with the error
18791878
when the trait is found to be unimplemented on a type.

branches/snap-stage3/src/doc/trpl/guessing-game.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ fn main() {
8282
8383
let mut guess = String::new();
8484
85-
let input = io::stdin().read_line(&mut guess)
85+
io::stdin().read_line(&mut guess)
8686
.ok()
8787
.expect("Failed to read line");
8888
89-
println!("You guessed: {}", input);
89+
println!("You guessed: {}", guess);
9090
}
9191
```
9292

@@ -302,12 +302,12 @@ project.
302302
There’s just one line of this first example left:
303303

304304
```rust,ignore
305-
println!("You guessed: {}", input);
305+
println!("You guessed: {}", guess);
306306
}
307307
```
308308

309309
This prints out the string we saved our input in. The `{}`s are a placeholder,
310-
and so we pass it `input` as an argument. If we had multiple `{}`s, we would
310+
and so we pass it `guess` as an argument. If we had multiple `{}`s, we would
311311
pass multiple arguments:
312312

313313
```rust
@@ -358,11 +358,10 @@ rand="0.3.0"
358358
The `[dependencies]` section of `Cargo.toml` is like the `[package]` section:
359359
everything that follows it is part of it, until the next section starts.
360360
Cargo uses the dependencies section to know what dependencies on external
361-
crates you have, and what versions you require. In this case, we’ve used `*`,
362-
which means that we’ll use the latest version of `rand`. Cargo understands
363-
[Semantic Versioning][semver], which is a standard for writing version
364-
numbers. If we wanted a specific version or range of versions, we could be
365-
more specific here. [Cargo’s documentation][cargodoc] contains more details.
361+
crates you have, and what versions you require. In this case, we’ve used version `0.3.0`.
362+
Cargo understands [Semantic Versioning][semver], which is a standard for writing version
363+
numbers. If we wanted to use the latest version we could use `*` or we could use a range
364+
of versions. [Cargo’s documentation][cargodoc] contains more details.
366365

367366
[semver]: http://semver.org
368367
[cargodoc]: http://doc.crates.io/crates-io.html
@@ -410,24 +409,29 @@ $ cargo build
410409
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
411410
```
412411

413-
So, we told Cargo we wanted any version of `rand`, and so it fetched the
414-
latest version at the time this was written, `v0.3.8`. But what happens
415-
when next week, version `v0.4.0` comes out, which changes something with
416-
`rand`, and it includes a breaking change? After all, a `v0.y.z` version
417-
in SemVer can change every release.
412+
So, we told Cargo we wanted any `0.3.x` version of `rand`, and so it fetched the latest
413+
version at the time this was written, `v0.3.8`. But what happens when next
414+
week, version `v0.3.9` comes out, with an important bugfix? While getting
415+
bugfixes is important, what if `0.3.9` contains a regression that breaks our
416+
code?
418417

419418
The answer to this problem is the `Cargo.lock` file you’ll now find in your
420419
project directory. When you build your project for the first time, Cargo
421420
figures out all of the versions that fit your criteria, and then writes them
422421
to the `Cargo.lock` file. When you build your project in the future, Cargo
423422
will see that the `Cargo.lock` file exists, and then use that specific version
424423
rather than do all the work of figuring out versions again. This lets you
425-
have a repeatable build automatically.
424+
have a repeatable build automatically. In other words, we’ll stay at `0.3.8`
425+
until we explicitly upgrade, and so will anyone who we share our code with,
426+
thanks to the lock file.
426427

427-
What about when we _do_ want to use `v0.4.0`? Cargo has another command,
428+
What about when we _do_ want to use `v0.3.9`? Cargo has another command,
428429
`update`, which says ‘ignore the lock, figure out all the latest versions that
429430
fit what we’ve specified. If that works, write those versions out to the lock
430-
file’.
431+
file’. But, by default, Cargo will only look for versions larger than `0.3.0`
432+
and smaller than `0.4.0`. If we want to move to `0.4.x`, we’d have to update
433+
the `Cargo.toml` directly. When we do, the next time we `cargo build`, Cargo
434+
will update the index and re-evaluate our `rand` requirements.
431435

432436
There’s a lot more to say about [Cargo][doccargo] and [its
433437
ecosystem][doccratesio], but for now, that’s all we need to know. Cargo makes
@@ -843,7 +847,7 @@ fn main() {
843847
Ordering::Less => println!("Too small!"),
844848
Ordering::Greater => println!("Too big!"),
845849
Ordering::Equal => {
846-
println!("You win!"),
850+
println!("You win!");
847851
break;
848852
}
849853
}
@@ -960,8 +964,6 @@ fn main() {
960964
961965
let secret_number = rand::thread_rng().gen_range(1, 101);
962966
963-
println!("The secret number is: {}", secret_number);
964-
965967
loop {
966968
println!("Please input your guess.");
967969

branches/snap-stage3/src/doc/trpl/mutability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ safety, and the mechanism by which Rust guarantees it, the
8585
> You may have one or the other of these two kinds of borrows, but not both at
8686
> the same time:
8787
>
88-
> * 0 to N references (`&T`) to a resource.
88+
> * one or more references (`&T`) to a resource.
8989
> * exactly one mutable reference (`&mut T`)
9090
9191
[ownership]: ownership.html

branches/snap-stage3/src/doc/trpl/strings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ individual bytes, or as codepoints:
7373
let hachiko = "忠犬ハチ公";
7474

7575
for b in hachiko.as_bytes() {
76-
print!("{}, ", b);
76+
print!("{}, ", b);
7777
}
7878

7979
println!("");
8080

8181
for c in hachiko.chars() {
82-
print!("{}, ", c);
82+
print!("{}, ", c);
8383
}
8484

8585
println!("");

branches/snap-stage3/src/grammar/RustLexer.g4

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ lexer grammar RustLexer;
88

99

1010
tokens {
11-
EQ, LT, LE, EQEQ, NE, GE, GT, ANDAND, OROR, NOT, TILDE, PLUT,
11+
EQ, LT, LE, EQEQ, NE, GE, GT, ANDAND, OROR, NOT, TILDE, PLUS,
1212
MINUS, STAR, SLASH, PERCENT, CARET, AND, OR, SHL, SHR, BINOP,
1313
BINOPEQ, AT, DOT, DOTDOT, DOTDOTDOT, COMMA, SEMI, COLON,
1414
MOD_SEP, RARROW, FAT_ARROW, LPAREN, RPAREN, LBRACKET, RBRACKET,
15-
LBRACE, RBRACE, POUND, DOLLAR, UNDERSCORE, LIT_CHAR,
15+
LBRACE, RBRACE, POUND, DOLLAR, UNDERSCORE, LIT_CHAR, LIT_BYTE,
1616
LIT_INTEGER, LIT_FLOAT, LIT_STR, LIT_STR_RAW, LIT_BINARY,
17-
LIT_BINARY_RAW, IDENT, LIFETIME, WHITESPACE, DOC_COMMENT,
18-
COMMENT, SHEBANG
17+
LIT_BINARY_RAW, QUESTION, IDENT, LIFETIME, WHITESPACE, DOC_COMMENT,
18+
COMMENT, SHEBANG, UTF8_BOM
1919
}
2020

2121
import xidstart , xidcontinue;

branches/snap-stage3/src/grammar/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
111111
"LIT_BINARY_RAW" => token::Literal(token::BinaryRaw(Name(0), 0), None),
112112
"QUESTION" => token::Question,
113113
"SHEBANG" => token::Shebang(Name(0)),
114-
_ => continue,
114+
_ => panic!("Bad token str `{}`", val),
115115
};
116116

117117
res.insert(num.to_string(), tok);

branches/snap-stage3/src/liballoc/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
//! }
3838
//! ```
3939
//!
40-
//! This will print `Cons(1, Box(Cons(2, Box(Nil))))`.
40+
//! This will print `Cons(1, Cons(2, Nil))`.
4141
//!
4242
//! Recursive structures must be boxed, because if the definition of `Cons` looked like this:
4343
//!

branches/snap-stage3/src/libcollections/vec.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use core::intrinsics::assume;
6767
use core::iter::{repeat, FromIterator};
6868
use core::marker::PhantomData;
6969
use core::mem;
70-
use core::ops::{Index, IndexMut, Deref, Add};
70+
use core::ops::{Index, IndexMut, Deref};
7171
use core::ops;
7272
use core::ptr;
7373
use core::ptr::Unique;
@@ -1622,17 +1622,6 @@ impl<T: Ord> Ord for Vec<T> {
16221622
}
16231623
}
16241624

1625-
#[stable(feature = "rust1", since = "1.0.0")]
1626-
impl<'a, T: Clone> Add<&'a [T]> for Vec<T> {
1627-
type Output = Vec<T>;
1628-
1629-
#[inline]
1630-
fn add(mut self, rhs: &[T]) -> Vec<T> {
1631-
self.push_all(rhs);
1632-
self
1633-
}
1634-
}
1635-
16361625
#[stable(feature = "rust1", since = "1.0.0")]
16371626
impl<T> Drop for Vec<T> {
16381627
fn drop(&mut self) {

branches/snap-stage3/src/libcore/iter.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,8 @@ pub trait Iterator {
602602
/// Performs a fold operation over the entire iterator, returning the
603603
/// eventual state at the end of the iteration.
604604
///
605+
/// This operation is sometimes called 'reduce' or 'inject'.
606+
///
605607
/// # Examples
606608
///
607609
/// ```

branches/snap-stage3/src/libcore/slice.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,14 @@ fn size_from_ptr<T>(_: *const T) -> usize {
631631
}
632632

633633

634-
// Use macro to be generic over const/mut
635-
macro_rules! slice_offset {
634+
// Use macros to be generic over const/mut
635+
//
636+
// They require non-negative `$by` because otherwise the expression
637+
// `(ptr as usize + $by)` would interpret `-1` as `usize::MAX` (and
638+
// thus trigger a panic when overflow checks are on).
639+
640+
// Use this to do `$ptr + $by`, where `$by` is non-negative.
641+
macro_rules! slice_add_offset {
636642
($ptr:expr, $by:expr) => {{
637643
let ptr = $ptr;
638644
if size_from_ptr(ptr) == 0 {
@@ -643,6 +649,18 @@ macro_rules! slice_offset {
643649
}};
644650
}
645651

652+
// Use this to do `$ptr - $by`, where `$by` is non-negative.
653+
macro_rules! slice_sub_offset {
654+
($ptr:expr, $by:expr) => {{
655+
let ptr = $ptr;
656+
if size_from_ptr(ptr) == 0 {
657+
transmute(ptr as usize - $by)
658+
} else {
659+
ptr.offset(-$by)
660+
}
661+
}};
662+
}
663+
646664
macro_rules! slice_ref {
647665
($ptr:expr) => {{
648666
let ptr = $ptr;
@@ -672,7 +690,7 @@ macro_rules! iterator {
672690
None
673691
} else {
674692
let old = self.ptr;
675-
self.ptr = slice_offset!(self.ptr, 1);
693+
self.ptr = slice_add_offset!(self.ptr, 1);
676694
Some(slice_ref!(old))
677695
}
678696
}
@@ -714,7 +732,7 @@ macro_rules! iterator {
714732
if self.end == self.ptr {
715733
None
716734
} else {
717-
self.end = slice_offset!(self.end, -1);
735+
self.end = slice_sub_offset!(self.end, 1);
718736
Some(slice_ref!(self.end))
719737
}
720738
}
@@ -776,7 +794,7 @@ impl<'a, T> Iter<'a, T> {
776794
fn iter_nth(&mut self, n: usize) -> Option<&'a T> {
777795
match self.as_slice().get(n) {
778796
Some(elem_ref) => unsafe {
779-
self.ptr = slice_offset!(elem_ref as *const _, 1);
797+
self.ptr = slice_add_offset!(elem_ref as *const _, 1);
780798
Some(slice_ref!(elem_ref))
781799
},
782800
None => {
@@ -849,7 +867,7 @@ impl<'a, T> IterMut<'a, T> {
849867
fn iter_nth(&mut self, n: usize) -> Option<&'a mut T> {
850868
match make_mut_slice!(T => &'a mut [T]: self.ptr, self.end).get_mut(n) {
851869
Some(elem_ref) => unsafe {
852-
self.ptr = slice_offset!(elem_ref as *mut _, 1);
870+
self.ptr = slice_add_offset!(elem_ref as *mut _, 1);
853871
Some(slice_ref!(elem_ref))
854872
},
855873
None => {

branches/snap-stage3/src/liblibc/lib.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3624,6 +3624,30 @@ pub mod consts {
36243624
pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
36253625

36263626
pub const TCP_NODELAY: c_int = 1;
3627+
pub const TCP_MAXSEG: c_int = 2;
3628+
pub const TCP_CORK: c_int = 3;
3629+
pub const TCP_KEEPIDLE: c_int = 4;
3630+
pub const TCP_KEEPINTVL: c_int = 5;
3631+
pub const TCP_KEEPCNT: c_int = 6;
3632+
pub const TCP_SYNCNT: c_int = 7;
3633+
pub const TCP_LINGER2: c_int = 8;
3634+
pub const TCP_DEFER_ACCEPT: c_int = 9;
3635+
pub const TCP_WINDOW_CLAMP: c_int = 10;
3636+
pub const TCP_INFO: c_int = 11;
3637+
pub const TCP_QUICKACK: c_int = 12;
3638+
pub const TCP_CONGESTION: c_int = 13;
3639+
pub const TCP_MD5SIG: c_int = 14;
3640+
pub const TCP_COOKIE_TRANSACTIONS: c_int = 15;
3641+
pub const TCP_THIN_LINEAR_TIMEOUTS: c_int = 16;
3642+
pub const TCP_THIN_DUPACK: c_int = 17;
3643+
pub const TCP_USER_TIMEOUT: c_int = 18;
3644+
pub const TCP_REPAIR: c_int = 19;
3645+
pub const TCP_REPAIR_QUEUE: c_int = 20;
3646+
pub const TCP_QUEUE_SEQ: c_int = 21;
3647+
pub const TCP_REPAIR_OPTIONS: c_int = 22;
3648+
pub const TCP_FASTOPEN: c_int = 23;
3649+
pub const TCP_TIMESTAMP: c_int = 24;
3650+
36273651
pub const SOL_SOCKET: c_int = 65535;
36283652

36293653
pub const SO_DEBUG: c_int = 0x0001;

0 commit comments

Comments
 (0)