diff options
| author | Charles Gleason <charles_gleason@alumni.brown.edu> | 2019-09-03 18:42:58 -0400 |
|---|---|---|
| committer | Charles Gleason <charles_gleason@alumni.brown.edu> | 2019-09-16 11:46:44 -0400 |
| commit | 194d357e03dcee73bfdb32a45175c97f4c3ce422 (patch) | |
| tree | e82d2d8d6ca4ac30f842a731c2e453f00c1a5e27 /src/libsyntax/parse | |
| parent | b9de4ef89e0e53099a084001b26ec3207c5f8391 (diff) | |
| download | rust-194d357e03dcee73bfdb32a45175c97f4c3ce422.tar.gz rust-194d357e03dcee73bfdb32a45175c97f4c3ce422.zip | |
Document `From` trait for `LhsExpr`
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser/expr.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser/expr.rs b/src/libsyntax/parse/parser/expr.rs index 5b9f0f1df67..c38b134154d 100644 --- a/src/libsyntax/parse/parser/expr.rs +++ b/src/libsyntax/parse/parser/expr.rs @@ -66,6 +66,10 @@ pub(super) enum LhsExpr { } impl From<Option<ThinVec<Attribute>>> for LhsExpr { + /// Converts `Some(attrs)` into `LhsExpr::AttributesParsed(attrs)` + /// and `None` into `LhsExpr::NotYetParsed`. + /// + /// This conversion does not allocate. fn from(o: Option<ThinVec<Attribute>>) -> Self { if let Some(attrs) = o { LhsExpr::AttributesParsed(attrs) @@ -76,6 +80,9 @@ impl From<Option<ThinVec<Attribute>>> for LhsExpr { } impl From<P<Expr>> for LhsExpr { + /// Converts the `expr: P<Expr>` into `LhsExpr::AlreadyParsed(expr)`. + /// + /// This conversion does not allocate. fn from(expr: P<Expr>) -> Self { LhsExpr::AlreadyParsed(expr) } |
