Skip to content

Commit 6e886d1

Browse files
committed
---
yaml --- r: 208109 b: refs/heads/snap-stage3 c: 9f84260 h: refs/heads/master i: 208107: 5f74622 v: v3
1 parent 244ed3e commit 6e886d1

32 files changed

+129
-200
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: 0084ba934d087c8c9737079d376e63d759803c5c
4+
refs/heads/snap-stage3: 9f84260138d2100682e2c99900e7c3dc3a7fb30b
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#ffi-attributes
42+
[repr]: reference.html#miscellaneous-attributes
4343

4444
## There is no GC
4545

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,12 +1867,13 @@ 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`. To use this, the `static_assert`
1871-
feature gate must be enabled.
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
18721874
- `unsafe_no_drop_flag` - on structs, remove the flag that prevents
18731875
destructors from being run twice. Destructors might be run multiple times on
1874-
the same object with this attribute. To use this, the `unsafe_no_drop_flag` feature
1875-
gate must be enabled.
1876+
the same object with this attribute.
18761877
- `doc` - Doc comments such as `/// foo` are equivalent to `#[doc = "foo"]`.
18771878
- `rustc_on_unimplemented` - Write a custom note to be shown along with the error
18781879
when the trait is found to be unimplemented on a type.

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

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ fn main() {
8282
8383
let mut guess = String::new();
8484
85-
io::stdin().read_line(&mut guess)
85+
let input = io::stdin().read_line(&mut guess)
8686
.ok()
8787
.expect("Failed to read line");
8888
89-
println!("You guessed: {}", guess);
89+
println!("You guessed: {}", input);
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: {}", guess);
305+
println!("You guessed: {}", input);
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 `guess` as an argument. If we had multiple `{}`s, we would
310+
and so we pass it `input` as an argument. If we had multiple `{}`s, we would
311311
pass multiple arguments:
312312

313313
```rust
@@ -410,29 +410,24 @@ $ cargo build
410410
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
411411
```
412412

413-
So, we told Cargo we wanted any version of `rand`, and so it fetched the latest
414-
version at the time this was written, `v0.3.8`. But what happens when next
415-
week, version `v0.3.9` comes out, with an important bugfix? While getting
416-
bugfixes is important, what if `0.3.9` contains a regression that breaks our
417-
code?
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.
418418

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

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

437432
There’s a lot more to say about [Cargo][doccargo] and [its
438433
ecosystem][doccratesio], but for now, that’s all we need to know. Cargo makes
@@ -848,7 +843,7 @@ fn main() {
848843
Ordering::Less => println!("Too small!"),
849844
Ordering::Greater => println!("Too big!"),
850845
Ordering::Equal => {
851-
println!("You win!"),
846+
println!("You win!");
852847
break;
853848
}
854849
}
@@ -965,6 +960,8 @@ fn main() {
965960
966961
let secret_number = rand::thread_rng().gen_range(1, 101);
967962
963+
println!("The secret number is: {}", secret_number);
964+
968965
loop {
969966
println!("Please input your guess.");
970967

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, PLUS,
11+
EQ, LT, LE, EQEQ, NE, GE, GT, ANDAND, OROR, NOT, TILDE, PLUT,
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, LIT_BYTE,
15+
LBRACE, RBRACE, POUND, DOLLAR, UNDERSCORE, LIT_CHAR,
1616
LIT_INTEGER, LIT_FLOAT, LIT_STR, LIT_STR_RAW, LIT_BINARY,
17-
LIT_BINARY_RAW, QUESTION, IDENT, LIFETIME, WHITESPACE, DOC_COMMENT,
18-
COMMENT, SHEBANG, UTF8_BOM
17+
LIT_BINARY_RAW, IDENT, LIFETIME, WHITESPACE, DOC_COMMENT,
18+
COMMENT, SHEBANG
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-
_ => panic!("Bad token str `{}`", val),
114+
_ => continue,
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, Cons(2, Nil))`.
40+
//! This will print `Cons(1, Box(Cons(2, Box(Nil))))`.
4141
//!
4242
//! Recursive structures must be boxed, because if the definition of `Cons` looked like this:
4343
//!

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,6 @@ 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-
///
607605
/// # Examples
608606
///
609607
/// ```

branches/snap-stage3/src/librustc/diagnostics.rs

Lines changed: 4 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -419,74 +419,6 @@ of a loop. Without a loop to break out of or continue in, no sensible action can
419419
be taken.
420420
"##,
421421

422-
E0282: r##"
423-
This error indicates that type inference did not result in one unique possible
424-
type, and extra information is required. In most cases this can be provided
425-
by adding a type annotation. Sometimes you need to specify a generic type
426-
parameter manually.
427-
428-
A common example is the `collect` method on `Iterator`. It has a generic type
429-
parameter with a `FromIterator` bound, which for a `char` iterator is
430-
implemented by `Vec` and `String` among others. Consider the following snippet
431-
that reverses the characters of a string:
432-
433-
```
434-
let x = "hello".chars().rev().collect();
435-
```
436-
437-
In this case, the compiler cannot infer what the type of `x` should be:
438-
`Vec<char>` and `String` are both suitable candidates. To specify which type to
439-
use, you can use a type annotation on `x`:
440-
441-
```
442-
let x: Vec<char> = "hello".chars().rev().collect();
443-
```
444-
445-
It is not necessary to annotate the full type. Once the ambiguity is resolved,
446-
the compiler can infer the rest:
447-
448-
```
449-
let x: Vec<_> = "hello".chars().rev().collect();
450-
```
451-
452-
Another way to provide the compiler with enough information, is to specify the
453-
generic type parameter:
454-
455-
```
456-
let x = "hello".chars().rev().collect::<Vec<char>>();
457-
```
458-
459-
Again, you need not specify the full type if the compiler can infer it:
460-
461-
```
462-
let x = "hello".chars().rev().collect::<Vec<_>>();
463-
```
464-
465-
Apart from a method or function with a generic type parameter, this error can
466-
occur when a type parameter of a struct or trait cannot be inferred. In that
467-
case it is not always possible to use a type annotation, because all candidates
468-
have the same return type. For instance:
469-
470-
```
471-
struct Foo<T> {
472-
// Some fields omitted.
473-
}
474-
475-
impl<T> Foo<T> {
476-
fn bar() -> i32 {
477-
0
478-
}
479-
480-
fn baz() {
481-
let number = Foo::bar();
482-
}
483-
}
484-
```
485-
486-
This will fail because the compiler does not know which instance of `Foo` to
487-
call `bar` on. Change `Foo::bar()` to `Foo::<T>::bar()` to resolve the error.
488-
"##,
489-
490422
E0296: r##"
491423
This error indicates that the given recursion limit could not be parsed. Ensure
492424
that the value provided is a positive integer between quotes, like so:
@@ -592,65 +524,10 @@ number cannot be negative.
592524
E0307: r##"
593525
The length of an array is part of its type. For this reason, this length must be
594526
a compile-time constant.
595-
"##,
596-
597-
E0308: r##"
598-
This error occurs when the compiler was unable to infer the concrete type of a
599-
variable. This error can occur for several cases, the most common of which is a
600-
mismatch in the expected type that the compiler inferred for a variable's
601-
initializing expression, and the actual type explicitly assigned to the
602-
variable.
603-
604-
For example:
605-
606-
let x: i32 = "I am not a number!";
607-
// ~~~ ~~~~~~~~~~~~~~~~~~~~
608-
// | |
609-
// | initializing expression;
610-
// | compiler infers type `&str`
611-
// |
612-
// type `i32` assigned to variable `x`
613-
"##,
614-
615-
E0309: r##"
616-
Types in type definitions have lifetimes associated with them that represent
617-
how long the data stored within them is guaranteed to be live. This lifetime
618-
must be as long as the data needs to be alive, and missing the constraint that
619-
denotes this will cause this error.
620-
621-
// This won't compile because T is not constrained, meaning the data
622-
// stored in it is not guaranteed to last as long as the reference
623-
struct Foo<'a, T> {
624-
foo: &'a T
625-
}
626-
627-
// This will compile, because it has the constraint on the type parameter
628-
struct Foo<'a, T: 'a> {
629-
foo: &'a T
630-
}
631-
"##,
632-
633-
E0310: r##"
634-
Types in type definitions have lifetimes associated with them that represent
635-
how long the data stored within them is guaranteed to be live. This lifetime
636-
must be as long as the data needs to be alive, and missing the constraint that
637-
denotes this will cause this error.
638-
639-
// This won't compile because T is not constrained to the static lifetime
640-
// the reference needs
641-
struct Foo<T> {
642-
foo: &'static T
643-
}
644-
645-
// This will compile, because it has the constraint on the type parameter
646-
struct Foo<T: 'static> {
647-
foo: &'static T
648-
}
649527
"##
650528

651529
}
652530

653-
654531
register_diagnostics! {
655532
E0011,
656533
E0012,
@@ -685,6 +562,7 @@ register_diagnostics! {
685562
E0279, // requirement is not satisfied
686563
E0280, // requirement is not satisfied
687564
E0281, // type implements trait but other trait is required
565+
E0282, // unable to infer enough type information about
688566
E0283, // cannot resolve type
689567
E0284, // cannot resolve type
690568
E0285, // overflow evaluation builtin bounds
@@ -693,6 +571,9 @@ register_diagnostics! {
693571
E0300, // unexpanded macro
694572
E0304, // expected signed integer constant
695573
E0305, // expected constant
574+
E0308,
575+
E0309, // thing may not live long enough
576+
E0310, // thing may not live long enough
696577
E0311, // thing may not live long enough
697578
E0312, // lifetime of reference outlives lifetime of borrowed content
698579
E0313, // lifetime of borrowed pointer outlives lifetime of captured variable

branches/snap-stage3/src/librustc/middle/resolve_lifetime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ fn extract_labels<'v, 'a>(ctxt: &mut LifetimeContext<'a>, b: &'v ast::Block) {
374374
fn visit_expr(&mut self, ex: &'v ast::Expr) {
375375
if let Some(label) = expression_label(ex) {
376376
for &(prior, prior_span) in &self.labels_in_fn[..] {
377-
// FIXME (#24278): non-hygienic comparison
377+
// FIXME (#24278): non-hygienic comparision
378378
if label.name == prior.name {
379379
signal_shadowing_problem(self.sess,
380380
label.name,
@@ -420,7 +420,7 @@ fn extract_labels<'v, 'a>(ctxt: &mut LifetimeContext<'a>, b: &'v ast::Block) {
420420
EarlyScope(_, lifetimes, s) |
421421
LateScope(lifetimes, s) => {
422422
for lifetime_def in lifetimes {
423-
// FIXME (#24278): non-hygienic comparison
423+
// FIXME (#24278): non-hygienic comparision
424424
if label.name == lifetime_def.lifetime.name {
425425
signal_shadowing_problem(
426426
sess,
@@ -677,7 +677,7 @@ impl<'a> LifetimeContext<'a> {
677677
lifetime: &ast::Lifetime)
678678
{
679679
for &(label, label_span) in &self.labels_in_fn {
680-
// FIXME (#24278): non-hygienic comparison
680+
// FIXME (#24278): non-hygienic comparision
681681
if lifetime.name == label.name {
682682
signal_shadowing_problem(self.sess,
683683
lifetime.name,

branches/snap-stage3/src/librustc/middle/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn maybe_report_ambiguity<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
290290
{
291291
span_err!(infcx.tcx.sess, obligation.cause.span, E0282,
292292
"unable to infer enough type information about `{}`; \
293-
type annotations or generic parameter binding required",
293+
type annotations required",
294294
self_ty.user_string(infcx.tcx));
295295
} else {
296296
span_err!(infcx.tcx.sess, obligation.cause.span, E0283,

0 commit comments

Comments
 (0)