Test cases intended to document behavior and try to exhaustively explore the combinations.

Confidence

These tests are not yet considered 100% normative, in that some aspects of the current behavior are not desirable. This is expressed in the “confidence” field in the following table. Values:

ConfidenceInterpretation
100%this will remain recommended behavior
75%unclear whether we will continue to accept this
50%this will likely be deprecated but remain valid
25%this could change in the future
0%this is definitely bogus and will likely change in the future in some way

Tests

Test fileSelf typePatternCurrent elision behaviorConfidence
self.rsStructSelfignore self parameter100%
struct.rsStructStructignore self parameter100%
alias.rsStructAliasignore self parameter100%
ref-self.rsStruct&Selftake lifetime from &Self100%
ref-mut-self.rsStruct&mut Selftake lifetime from &mut Self100%
ref-struct.rsStruct&Structtake lifetime from &Self50%
ref-mut-struct.rsStruct&mut Structtake lifetime from &mut Self50%
ref-alias.rsStruct&Aliasignore Alias0%
ref-mut-alias.rsStruct&mut Aliasignore Alias0%
lt-self.rsStruct<'a>Selfignore Self (and hence 'a)25%
lt-struct.rsStruct<'a>Selfignore Self (and hence 'a)0%
lt-alias.rsAlias<'a>Selfignore Self (and hence 'a)0%
lt-ref-self.rsStruct<'a>&Selftake lifetime from &Self75%

In each case, we test the following patterns:

  • self: XXX
  • self: Box<XXX>
  • self: Pin<XXX>
  • self: Box<Box<XXX>>
  • self: Box<Pin<XXX>>

In the non-reference cases, Pin causes errors so we substitute Rc.

async fn

For each of the tests above we also check that async fn behaves as an fn would. These tests are in files named *-async.rs.

Legends:

  • ✓ ⟹ Yes / Pass
  • X ⟹ No
  • α ⟹ lifetime mismatch
  • β ⟹ cannot infer an appropriate lifetime
  • γ ⟹ missing lifetime specifier
async filePass?Conforms to fn?How does it diverge?
fnasync fn
self-async.rsN/A
struct-async.rsN/A
alias-async.rsN/A
assoc-async.rsN/A
ref-self-async.rsXN/A
ref-mut-self-async.rsXN/A
ref-struct-async.rsXN/A
ref-mut-struct-async.rsXN/A
ref-alias-async.rsN/A
ref-assoc-async.rsN/A
ref-mut-alias-async.rsN/A
lt-self-async.rsN/A
lt-struct-async.rsN/A
lt-alias-async.rsN/A
lt-assoc-async.rsN/A
lt-ref-self-async.rsXN/A