Commit b3cbf290c8

Andrew Kelley <andrew@ziglang.org>
2019-12-16 18:07:05
remove misleading documentation
1 parent 496f271
Changed files (1)
doc/langref.html.in
@@ -8315,216 +8315,15 @@ pub const TypeId = enum {
       {#header_close#}
 
       {#header_open|@typeInfo#}
-      <pre>{#syntax#}@typeInfo(comptime T: type) @import("builtin").TypeInfo{#endsyntax#}</pre>
+      <pre>{#syntax#}@typeInfo(comptime T: type) @import("std").builtin.TypeInfo{#endsyntax#}</pre>
       <p>
-      Returns information on the type. Returns a value of the following union:
+      Provides type reflection.
       </p>
-      {#code_begin|syntax#}
-pub const TypeInfo = union(TypeId) {
-    Type: void,
-    Void: void,
-    Bool: void,
-    NoReturn: void,
-    Int: Int,
-    Float: Float,
-    Pointer: Pointer,
-    Array: Array,
-    Struct: Struct,
-    ComptimeFloat: void,
-    ComptimeInt: void,
-    Undefined: void,
-    Null: void,
-    Optional: Optional,
-    ErrorUnion: ErrorUnion,
-    ErrorSet: ErrorSet,
-    Enum: Enum,
-    Union: Union,
-    Fn: Fn,
-    BoundFn: Fn,
-    Opaque: void,
-    Promise: Promise,
-    Vector: Vector,
-    EnumLiteral: void,
-
-
-    pub const Int = struct {
-        is_signed: bool,
-        bits: comptime_int,
-    };
-
-    pub const Float = struct {
-        bits: comptime_int,
-    };
-
-    pub const Pointer = struct {
-        size: Size,
-        is_const: bool,
-        is_volatile: bool,
-        alignment: comptime_int,
-        child: type,
-        is_allowzero: bool,
-        sentinel: var,
-
-        pub const Size = enum {
-            One,
-            Many,
-            Slice,
-            C,
-        };
-    };
-
-    pub const Array = struct {
-        len: comptime_int,
-        child: type,
-        sentinel: var,
-    };
-
-    pub const ContainerLayout = enum {
-        Auto,
-        Extern,
-        Packed,
-    };
-
-    pub const StructField = struct {
-        name: []const u8,
-        offset: ?comptime_int,
-        field_type: type,
-    };
-
-    pub const Struct = struct {
-        layout: ContainerLayout,
-        fields: []StructField,
-        decls: []Declaration,
-    };
-
-    pub const Optional = struct {
-        child: type,
-    };
-
-    pub const ErrorUnion = struct {
-        error_set: type,
-        payload: type,
-    };
-
-    pub const Error = struct {
-        name: []const u8,
-        value: comptime_int,
-    };
-
-    pub const ErrorSet = ?[]Error;
-
-    pub const EnumField = struct {
-        name: []const u8,
-        value: comptime_int,
-    };
-
-    pub const Enum = struct {
-        layout: ContainerLayout,
-        tag_type: type,
-        fields: []EnumField,
-        decls: []Declaration,
-    };
-
-    pub const UnionField = struct {
-        name: []const u8,
-        enum_field: ?EnumField,
-        field_type: type,
-    };
-
-    pub const Union = struct {
-        layout: ContainerLayout,
-        tag_type: ?type,
-        fields: []UnionField,
-        decls: []Declaration,
-    };
-
-    pub const CallingConvention = enum {
-        Unspecified,
-        C,
-        Cold,
-        Naked,
-        Stdcall,
-        Async,
-    };
-
-    pub const FnArg = struct {
-        is_generic: bool,
-        is_noalias: bool,
-        arg_type: ?type,
-    };
-
-    pub const Fn = struct {
-        calling_convention: CallingConvention,
-        is_generic: bool,
-        is_var_args: bool,
-        return_type: ?type,
-        async_allocator_type: ?type,
-        args: []FnArg,
-    };
-
-    pub const Promise = struct {
-        child: ?type,
-    };
-
-    pub const Vector = struct {
-        len: comptime_int,
-        child: type,
-    };
-
-    pub const Declaration = struct {
-        name: []const u8,
-        is_pub: bool,
-        data: Data,
-
-        pub const Data = union(enum) {
-            Type: type,
-            Var: type,
-            Fn: FnDecl,
-
-            pub const FnDecl = struct {
-                fn_type: type,
-                inline_type: Inline,
-                calling_convention: CallingConvention,
-                is_var_args: bool,
-                is_extern: bool,
-                is_export: bool,
-                lib_name: ?[]const u8,
-                return_type: type,
-                arg_names: [][] const u8,
-
-                pub const Inline = enum {
-                    Auto,
-                    Always,
-                    Never,
-                };
-            };
-        };
-    };
-};
-      {#code_end#}
       <p>
       For {#link|structs|struct#}, {#link|unions|union#}, {#link|enums|enum#}, and
       {#link|error sets|Error Set Type#}, the fields are guaranteed to be in the same
       order as declared. For declarations, the order is unspecified.
       </p>
-      <p>
-      Note that the {#syntax#}sentinel{#endsyntax#} field in {#syntax#}TypeInfo.Pointer{#endsyntax#}
-      and {#syntax#}TypeInfo.Array{#endsyntax#} is of type {#syntax#}var{#endsyntax#} rather
-      than {#syntax#}?child{#endsyntax#}. {#syntax#}TypeInfo.Pointer{#endsyntax#}
-      and {#syntax#}TypeInfo.Array{#endsyntax#} can be constructed with any comptime value for the
-      {#syntax#}sentinel{#endsyntax#} field.  However, the {#syntax#}@Type{#endsyntax#} builtin will
-      only accept the TypeInfo struct if the sentinel value is implicitly convertible to
-      {#syntax#}child{#endsyntax#}. Furthermore, any {#syntax#}TypeInfo.Pointer{#endsyntax#}
-      or {#syntax#}TypeInfo.Array{#endsyntax#} retreived from {#syntax#}@typeInfo{#endsyntax#} will
-      guarantee that {#syntax#}@typeOf(sentinel){#endsyntax#} is equal to
-      {#syntax#}?child{#endsyntax#}.  For example, {#syntax#}@typeOf(sentinel){#endsyntax#} for a
-      {#syntax#}TypeInfo.Pointer{#endsyntax#} constructed with
-      {#syntax#}TypeInfo.Pointer { ... .sentinel = 0; ... }{#endsyntax#} would be
-      {#syntax#}comptime_int{#endsyntax#} rather than {#syntax#}?u8{#endsyntax#}.  However, if you
-      passed that {#syntax#}TypeInfo.Pointer{#endsyntax#} struct to
-      {#syntax#}@typeInfo(@Type(myPointerInfo)){#endsyntax#} then {#syntax#}@typeOf(sentinel){#endsyntax#}
-      would be {#syntax#}?u8{#endsyntax#}.
-      </p>
       {#header_close#}
 
       {#header_open|@typeName#}