]> git.lizzy.rs Git - rust.git/blob - src/test/ui/self/elision/README.md
793eb16b0377c930bade2a0c58ab58e59df24a86
[rust.git] / src / test / ui / self / elision / README.md
1 Test cases intended to to document behavior and try to exhaustively
2 explore the combinations.
3
4 ## Confidence
5
6 These tests are not yet considered 100% normative, in that some
7 aspects of the current behavior are not desirable. This is expressed
8 in the "confidence" field in the following table. Values:
9
10 | Confidence | Interpretation |
11 | --- | --- |
12 | 100% | this will remain recommended behavior |
13 | 75% | unclear whether we will continue to accept this |
14 | 50% | this will likely be deprecated but remain valid |
15 | 25% | this could change in the future |
16 | 0% | this is definitely bogus and will likely change in the future in *some* way |
17
18 ## Tests
19
20 | Test file | `Self` type | Pattern | Current elision behavior | Confidence |
21 | --- | --- | --- | --- | --- |
22 | `self.rs` | `Struct` | `Self` | ignore `self` parameter | 100% |
23 | `struct.rs` | `Struct` | `Struct` | ignore `self` parameter | 100% |
24 | `alias.rs` | `Struct` | `Alias` | ignore `self` parameter | 100% |
25 | `ref-self.rs` | `Struct` | `&Self` | take lifetime from `&Self` | 100% |
26 | `ref-mut-self.rs` | `Struct` | `&mut Self` | take lifetime from `&mut Self` | 100% |
27 | `ref-struct.rs` | `Struct` | `&Struct` | take lifetime from `&Self` | 50% |
28 | `ref-mut-struct.rs` | `Struct` | `&mut Struct` | take lifetime from `&mut Self` | 50% |
29 | `ref-alias.rs` | `Struct` | `&Alias` | ignore `Alias` | 0% |
30 | `ref-mut-alias.rs` | `Struct` | `&mut Alias` | ignore `Alias` | 0% |
31 | `lt-self.rs` | `Struct<'a>` | `Self` | ignore `Self` (and hence `'a`) | 25% |
32 | `lt-struct.rs` | `Struct<'a>` | `Self` | ignore `Self` (and hence `'a`) | 0% |
33 | `lt-alias.rs`   | `Alias<'a>` | `Self` | ignore `Self` (and hence `'a`) | 0% |
34 | `lt-ref-self.rs` | `Struct<'a>` | `&Self` | take lifetime from `&Self` | 75% |
35
36 In each case, we test the following patterns:
37
38 - `self: XXX`
39 - `self: Box<XXX>`
40 - `self: Pin<XXX>`
41 - `self: Box<Box<XXX>>`
42 - `self: Box<Pin<XXX>>`
43
44 In the non-reference cases, `Pin` causes errors so we substitute `Rc`.