Skip to content

Commit fbb8a3d

Browse files
committed
---
yaml --- r: 208223 b: refs/heads/snap-stage3 c: 14d476e h: refs/heads/master i: 208221: 835b95a 208219: 3ce4f6f 208215: ed49e3a 208207: 33e1d14 208191: 37ee328 v: v3
1 parent 865cc67 commit fbb8a3d

File tree

12 files changed

+6
-320
lines changed

12 files changed

+6
-320
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: 79ca74d8e31897b79934a77cd6733fe5f42eb3dc
4+
refs/heads/snap-stage3: 14d476ecbb502d2d085c101b0c41e8e51ca5b4cf
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/doc/trpl/error-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ we can use the `unwrap()` method:
214214
io::stdin().read_line(&mut buffer).unwrap();
215215
```
216216

217-
`unwrap()` will `panic!` if the `Result` is `Err`. This basically says "Give
217+
`unwrap()` will `panic!` if the `Option` is `None`. This basically says "Give
218218
me the value, and if something goes wrong, just crash." This is less reliable
219219
than matching the error and attempting to recover, but is also significantly
220220
shorter. Sometimes, just crashing is appropriate.

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

Lines changed: 2 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,6 @@ fn main() {
271271
See also http://doc.rust-lang.org/book/unsafe.html
272272
"##,
273273

274-
E0137: r##"
275-
This error indicates that the compiler found multiple functions with the
276-
#[main] attribute. This is an error because there must be a unique entry point
277-
into a Rust program.
278-
"##,
279-
280274
E0152: r##"
281275
Lang items are already implemented in the standard library. Unless you are
282276
writing a free-standing application (e.g. a kernel), you do not need to provide
@@ -425,142 +419,6 @@ of a loop. Without a loop to break out of or continue in, no sensible action can
425419
be taken.
426420
"##,
427421

428-
E0271: r##"
429-
This is because of a type mismatch between the associated type of some
430-
trait (e.g. T::Bar, where T implements trait Quux { type Bar; })
431-
and another type U that is required to be equal to T::Bar, but is not.
432-
Examples follow.
433-
434-
Here is a basic example:
435-
436-
```
437-
trait Trait { type AssociatedType; }
438-
fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
439-
println!("in foo");
440-
}
441-
impl Trait for i8 { type AssociatedType = &'static str; }
442-
foo(3_i8);
443-
```
444-
445-
Here is that same example again, with some explanatory comments:
446-
447-
```
448-
trait Trait { type AssociatedType; }
449-
450-
fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
451-
// ~~~~~~~~ ~~~~~~~~~~~~~~~~~~
452-
// | |
453-
// This says `foo` can |
454-
// only be used with |
455-
// some type that |
456-
// implements `Trait`. |
457-
// |
458-
// This says not only must
459-
// `T` be an impl of `Trait`
460-
// but also that the impl
461-
// must assign the type `u32`
462-
// to the associated type.
463-
println!("in foo");
464-
}
465-
466-
impl Trait for i8 { type AssociatedType = &'static str; }
467-
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
468-
// | |
469-
// `i8` does have |
470-
// implementation |
471-
// of `Trait`... |
472-
// ... but it is an implementation
473-
// that assigns `&'static str` to
474-
// the associated type.
475-
476-
foo(3_i8);
477-
// Here, we invoke `foo` with an `i8`, which does not satisfy
478-
// the constraint `<i8 as Trait>::AssociatedType=32`, and
479-
// therefore the type-checker complains with this error code.
480-
```
481-
482-
Here is a more subtle instance of the same problem, that can
483-
arise with for-loops in Rust:
484-
485-
```
486-
let vs: Vec<i32> = vec![1, 2, 3, 4];
487-
for v in &vs {
488-
match v {
489-
1 => {}
490-
_ => {}
491-
}
492-
}
493-
```
494-
495-
The above fails because of an analogous type mismatch,
496-
though may be harder to see. Again, here are some
497-
explanatory comments for the same example:
498-
499-
```
500-
{
501-
let vs = vec![1, 2, 3, 4];
502-
503-
// `for`-loops use a protocol based on the `Iterator`
504-
// trait. Each item yielded in a `for` loop has the
505-
// type `Iterator::Item` -- that is,I `Item` is the
506-
// associated type of the concrete iterator impl.
507-
for v in &vs {
508-
// ~ ~~~
509-
// | |
510-
// | We borrow `vs`, iterating over a sequence of
511-
// | *references* of type `&Elem` (where `Elem` is
512-
// | vector's element type). Thus, the associated
513-
// | type `Item` must be a reference `&`-type ...
514-
// |
515-
// ... and `v` has the type `Iterator::Item`, as dictated by
516-
// the `for`-loop protocol ...
517-
518-
match v {
519-
1 => {}
520-
// ~
521-
// |
522-
// ... but *here*, `v` is forced to have some integral type;
523-
// only types like `u8`,`i8`,`u16`,`i16`, et cetera can
524-
// match the pattern `1` ...
525-
526-
_ => {}
527-
}
528-
529-
// ... therefore, the compiler complains, because it sees
530-
// an attempt to solve the equations
531-
// `some integral-type` = type-of-`v`
532-
// = `Iterator::Item`
533-
// = `&Elem` (i.e. `some reference type`)
534-
//
535-
// which cannot possibly all be true.
536-
537-
}
538-
}
539-
```
540-
541-
To avoid those issues, you have to make the types match correctly.
542-
So we can fix the previous examples like this:
543-
544-
```
545-
// Basic Example:
546-
trait Trait { type AssociatedType; }
547-
fn foo<T>(t: T) where T: Trait<AssociatedType = &'static str> {
548-
println!("in foo");
549-
}
550-
impl Trait for i8 { type AssociatedType = &'static str; }
551-
foo(3_i8);
552-
553-
// For-Loop Example:
554-
let vs = vec![1, 2, 3, 4];
555-
for v in &vs {
556-
match v {
557-
&1 => {}
558-
_ => {}
559-
}
560-
}
561-
```
562-
"##,
563-
564422
E0282: r##"
565423
This error indicates that type inference did not result in one unique possible
566424
type, and extra information is required. In most cases this can be provided
@@ -806,6 +664,7 @@ register_diagnostics! {
806664
E0134,
807665
E0135,
808666
E0136,
667+
E0137,
809668
E0138,
810669
E0139,
811670
E0261, // use of undeclared lifetime name
@@ -815,6 +674,7 @@ register_diagnostics! {
815674
E0266, // expected item
816675
E0269, // not all control paths return a value
817676
E0270, // computation may converge in a function marked as diverging
677+
E0271, // type mismatch resolving
818678
E0272, // rustc_on_unimplemented attribute refers to non-existent type parameter
819679
E0273, // rustc_on_unimplemented must have named format arguments
820680
E0274, // rustc_on_unimplemented must have a value

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@ let x_is_nonzero = x as bool;
3434
```
3535
"##,
3636

37-
E0062: r##"
38-
This error indicates that during an attempt to build a struct or struct-like
39-
enum variant, one of the fields was specified more than once. Each field should
40-
be specified exactly one time.
41-
"##,
42-
43-
E0063: r##"
44-
This error indicates that during an attempt to build a struct or struct-like
45-
enum variant, one of the fields was not provided. Each field should be specified
46-
exactly once.
47-
"##,
48-
4937
E0081: r##"
5038
Enum discriminants are used to differentiate enum variants stored in memory.
5139
This error indicates that the same value was used for two or more variants,
@@ -148,6 +136,8 @@ register_diagnostics! {
148136
E0059,
149137
E0060,
150138
E0061,
139+
E0062,
140+
E0063,
151141
E0066,
152142
E0067,
153143
E0068,

branches/snap-stage3/src/test/auxiliary/crateresolve3-1.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

branches/snap-stage3/src/test/auxiliary/crateresolve3-2.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

branches/snap-stage3/src/test/auxiliary/crateresolve5-1.rs

Lines changed: 0 additions & 34 deletions
This file was deleted.

branches/snap-stage3/src/test/auxiliary/crateresolve5-2.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

branches/snap-stage3/src/test/auxiliary/crateresolve7x.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

branches/snap-stage3/src/test/auxiliary/crateresolve8-1.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

branches/snap-stage3/src/test/auxiliary/crateresolve_calories-1.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

branches/snap-stage3/src/test/auxiliary/crateresolve_calories-2.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)