From 37afc528eacf4a0a874f8e97f6e7d4d7b63e8ac6 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 10 Nov 2014 19:11:27 +0530 Subject: [PATCH] Document ast::Ty_ --- src/libsyntax/ast.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 145978bb73f4b..639adb450783f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1084,24 +1084,40 @@ pub struct BareFnTy { } #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] +/// The different kinds of types recognized by the compiler pub enum Ty_ { + /// The unit type (`()`) TyNil, - TyBot, /* bottom type */ + /// The bottom type (`!`) + TyBot, TyUniq(P), + /// An array (`[T]`) TyVec(P), + /// A fixed length array (`[T, ..n]`) TyFixedLengthVec(P, P), + /// A raw pointer (`*const T` or `*mut T`) TyPtr(MutTy), + /// A reference (`&'a T` or `&'a mut T`) TyRptr(Option, MutTy), + /// A closure (e.g. `|uint| -> bool`) TyClosure(P), + /// A procedure (e.g `proc(uint) -> bool`) TyProc(P), + /// A bare function (e.g. `fn(uint) -> bool`) TyBareFn(P), + /// A tuple (`(A, B, C, D,...)`) TyTup(Vec> ), + /// A path (`module::module::...::Type`) or primitive + /// + /// Type parameters are stored in the Path itself TyPath(Path, Option, NodeId), // for #7264; see above - TyPolyTraitRef(P), // a type like `for<'a> Foo<&'a Bar>` + /// A type like `for<'a> Foo<&'a Bar>` + TyPolyTraitRef(P), /// A "qualified path", e.g. ` as SomeTrait>::SomeType` TyQPath(P), /// No-op; kept solely so that we can pretty-print faithfully TyParen(P), + /// Unused for now TyTypeof(P), /// TyInfer means the type should be inferred instead of it having been /// specified. This can appear anywhere in a type.