Skip to content

Commit a2dee35

Browse files
committed
auto merge of #18841 : Manishearth/rust/doc-ty, r=alexcrichton
I'll probably start documenting the rest of `syntax::ast` whenever I get time.
2 parents 4d5e7f3 + 37afc52 commit a2dee35

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/libsyntax/ast.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,24 +1084,40 @@ pub struct BareFnTy {
10841084
}
10851085

10861086
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
1087+
/// The different kinds of types recognized by the compiler
10871088
pub enum Ty_ {
1089+
/// The unit type (`()`)
10881090
TyNil,
1089-
TyBot, /* bottom type */
1091+
/// The bottom type (`!`)
1092+
TyBot,
10901093
TyUniq(P<Ty>),
1094+
/// An array (`[T]`)
10911095
TyVec(P<Ty>),
1096+
/// A fixed length array (`[T, ..n]`)
10921097
TyFixedLengthVec(P<Ty>, P<Expr>),
1098+
/// A raw pointer (`*const T` or `*mut T`)
10931099
TyPtr(MutTy),
1100+
/// A reference (`&'a T` or `&'a mut T`)
10941101
TyRptr(Option<Lifetime>, MutTy),
1102+
/// A closure (e.g. `|uint| -> bool`)
10951103
TyClosure(P<ClosureTy>),
1104+
/// A procedure (e.g `proc(uint) -> bool`)
10961105
TyProc(P<ClosureTy>),
1106+
/// A bare function (e.g. `fn(uint) -> bool`)
10971107
TyBareFn(P<BareFnTy>),
1108+
/// A tuple (`(A, B, C, D,...)`)
10981109
TyTup(Vec<P<Ty>> ),
1110+
/// A path (`module::module::...::Type`) or primitive
1111+
///
1112+
/// Type parameters are stored in the Path itself
10991113
TyPath(Path, Option<TyParamBounds>, NodeId), // for #7264; see above
1100-
TyPolyTraitRef(P<PolyTraitRef>), // a type like `for<'a> Foo<&'a Bar>`
1114+
/// A type like `for<'a> Foo<&'a Bar>`
1115+
TyPolyTraitRef(P<PolyTraitRef>),
11011116
/// A "qualified path", e.g. `<Vec<T> as SomeTrait>::SomeType`
11021117
TyQPath(P<QPath>),
11031118
/// No-op; kept solely so that we can pretty-print faithfully
11041119
TyParen(P<Ty>),
1120+
/// Unused for now
11051121
TyTypeof(P<Expr>),
11061122
/// TyInfer means the type should be inferred instead of it having been
11071123
/// specified. This can appear anywhere in a type.

0 commit comments

Comments
 (0)