File tree Expand file tree Collapse file tree 2 files changed +19
-19
lines changed
branches/beta/src/librustc_resolve Expand file tree Collapse file tree 2 files changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
23
23
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
24
24
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
25
25
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26
- refs/heads/beta: c016da248f30a9356c967e18b2721ca80d8694de
26
+ refs/heads/beta: 954d6ae184b97b5b7a4327d73c277725807450ae
27
27
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28
28
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
Original file line number Diff line number Diff line change @@ -406,8 +406,20 @@ example:
406
406
```
407
407
408
408
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:
411
423
412
424
```
413
425
trait Foo {
@@ -424,26 +436,14 @@ trait Baz : Foo + Foo2 {
424
436
}
425
437
```
426
438
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:
429
441
430
442
```
431
443
trait Baz : Foo + Foo2 {
432
444
fn bar() -> <Self as Foo>::Bar; // ok!
433
445
}
434
446
```
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
- ```
447
447
"## ,
448
448
449
449
E0412 : r##"
@@ -872,8 +872,8 @@ impl Foo for i32 {}
872
872
}
873
873
874
874
register_diagnostics ! {
875
- E0153 , // called no where
876
- E0157 , // called from no where
875
+ // E0153,
876
+ // E0157,
877
877
E0254 , // import conflicts with imported crate in this module
878
878
E0257 ,
879
879
E0258 ,
You can’t perform that action at this time.
0 commit comments