Skip to content

Commit 8bb2f41

Browse files
---
yaml --- r: 233884 b: refs/heads/beta c: 954d6ae h: refs/heads/master v: v3
1 parent d53d18b commit 8bb2f41

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: c016da248f30a9356c967e18b2721ca80d8694de
26+
refs/heads/beta: 954d6ae184b97b5b7a4327d73c277725807450ae
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc_resolve/diagnostics.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,20 @@ example:
406406
```
407407
408408
The `Self` keyword represents the current type, which explains why it
409-
can only be used inside an impl or a trait. For example, it is used
410-
to solve conflicts like this one:
409+
can only be used inside an impl or a trait. It gives access to
410+
associated items of a type:
411+
412+
```
413+
trait Foo {
414+
type Bar;
415+
}
416+
417+
trait Baz : Foo {
418+
fn bar() -> Self::Bar; // like this
419+
}
420+
```
421+
422+
However, be careful when two types has a common associated type:
411423
412424
```
413425
trait Foo {
@@ -424,26 +436,14 @@ trait Baz : Foo + Foo2 {
424436
}
425437
```
426438
427-
Which can be solved by specifying from which trait we want to use
428-
the `Bar` type:
439+
It can be solved by specifying from which trait we want to use the
440+
`Bar` type:
429441
430442
```
431443
trait Baz : Foo + Foo2 {
432444
fn bar() -> <Self as Foo>::Bar; // ok!
433445
}
434446
```
435-
436-
A more simple example gives:
437-
438-
```
439-
trait Foo {
440-
type Bar;
441-
}
442-
443-
trait Baz : Foo {
444-
fn bar() -> <Self as Foo>::Bar; // ok!
445-
}
446-
```
447447
"##,
448448

449449
E0412: r##"
@@ -872,8 +872,8 @@ impl Foo for i32 {}
872872
}
873873

874874
register_diagnostics! {
875-
E0153, // called no where
876-
E0157, // called from no where
875+
// E0153,
876+
// E0157,
877877
E0254, // import conflicts with imported crate in this module
878878
E0257,
879879
E0258,

0 commit comments

Comments
 (0)