Skip to content

Instantly share code, notes, and snippets.

@aturon
Created May 14, 2014 21:24
Show Gist options
  • Save aturon/c20615b26fb31c337afd to your computer and use it in GitHub Desktop.
Save aturon/c20615b26fb31c337afd to your computer and use it in GitHub Desktop.
Places where custom discriminants are (possibly) used
./librand/distributions/gamma.rs:enum ChiSquaredRepr {
// k == 1, Gamma(alpha, ..) is particularly slow for alpha < 1,
// e.g. when alpha = 1/2 as it would be for this case, so special-
// casing and using the definition of N(0,1)^2 is faster.
DoFExactlyOne,
DoFAnythingElse(Gamma),
}
./librustc/lib/llvm.rs:pub enum CallConv {
CCallConv = 0,
FastCallConv = 8,
ColdCallConv = 9,
X86StdcallCallConv = 64,
X86FastcallCallConv = 65,
X86_64_Win64 = 79,
}
./librustc/lib/llvm.rs:pub enum Visibility {
LLVMDefaultVisibility = 0,
HiddenVisibility = 1,
ProtectedVisibility = 2,
}
./librustc/lib/llvm.rs:pub enum Linkage {
ExternalLinkage = 0,
AvailableExternallyLinkage = 1,
LinkOnceAnyLinkage = 2,
LinkOnceODRLinkage = 3,
WeakAnyLinkage = 5,
WeakODRLinkage = 6,
AppendingLinkage = 7,
InternalLinkage = 8,
PrivateLinkage = 9,
ExternalWeakLinkage = 12,
CommonLinkage = 14,
}
./librustc/lib/llvm.rs:pub enum Attribute {
ZExtAttribute = 1 << 0,
SExtAttribute = 1 << 1,
NoReturnAttribute = 1 << 2,
InRegAttribute = 1 << 3,
StructRetAttribute = 1 << 4,
NoUnwindAttribute = 1 << 5,
NoAliasAttribute = 1 << 6,
ByValAttribute = 1 << 7,
NestAttribute = 1 << 8,
ReadNoneAttribute = 1 << 9,
ReadOnlyAttribute = 1 << 10,
NoInlineAttribute = 1 << 11,
AlwaysInlineAttribute = 1 << 12,
OptimizeForSizeAttribute = 1 << 13,
StackProtectAttribute = 1 << 14,
StackProtectReqAttribute = 1 << 15,
AlignmentAttribute = 31 << 16,
NoCaptureAttribute = 1 << 21,
NoRedZoneAttribute = 1 << 22,
NoImplicitFloatAttribute = 1 << 23,
NakedAttribute = 1 << 24,
InlineHintAttribute = 1 << 25,
StackAttribute = 7 << 26,
ReturnsTwiceAttribute = 1 << 29,
UWTableAttribute = 1 << 30,
NonLazyBindAttribute = 1 << 31,
}
./librustc/lib/llvm.rs:pub enum IntPredicate {
IntEQ = 32,
IntNE = 33,
IntUGT = 34,
IntUGE = 35,
IntULT = 36,
IntULE = 37,
IntSGT = 38,
IntSGE = 39,
IntSLT = 40,
IntSLE = 41,
}
./librustc/lib/llvm.rs:pub enum RealPredicate {
RealPredicateFalse = 0,
RealOEQ = 1,
RealOGT = 2,
RealOGE = 3,
RealOLT = 4,
RealOLE = 5,
RealONE = 6,
RealORD = 7,
RealUNO = 8,
RealUEQ = 9,
RealUGT = 10,
RealUGE = 11,
RealULT = 12,
RealULE = 13,
RealUNE = 14,
RealPredicateTrue = 15,
}
./librustc/lib/llvm.rs:pub enum TypeKind {
Void = 0,
Half = 1,
Float = 2,
Double = 3,
X86_FP80 = 4,
FP128 = 5,
PPC_FP128 = 6,
Label = 7,
Integer = 8,
Function = 9,
Struct = 10,
Array = 11,
Pointer = 12,
Vector = 13,
Metadata = 14,
X86_MMX = 15,
}
./librustc/lib/llvm.rs:pub enum AtomicBinOp {
Xchg = 0,
Add = 1,
Sub = 2,
And = 3,
Nand = 4,
Or = 5,
Xor = 6,
Max = 7,
Min = 8,
UMax = 9,
UMin = 10,
}
./librustc/lib/llvm.rs:pub enum AtomicOrdering {
NotAtomic = 0,
Unordered = 1,
Monotonic = 2,
// Consume = 3, // Not specified yet.
Acquire = 4,
Release = 5,
AcquireRelease = 6,
SequentiallyConsistent = 7
}
./librustc/lib/llvm.rs:pub enum FileType {
AssemblyFile = 0,
ObjectFile = 1
}
./librustc/lib/llvm.rs:pub enum Metadata {
MD_dbg = 0,
MD_tbaa = 1,
MD_prof = 2,
MD_fpmath = 3,
MD_range = 4,
MD_tbaa_struct = 5
}
./librustc/lib/llvm.rs:pub enum AsmDialect {
AD_ATT = 0,
AD_Intel = 1
}
./librustc/lib/llvm.rs:pub enum CodeGenOptLevel {
CodeGenLevelNone = 0,
CodeGenLevelLess = 1,
CodeGenLevelDefault = 2,
CodeGenLevelAggressive = 3,
}
./librustc/lib/llvm.rs:pub enum RelocMode {
RelocDefault = 0,
RelocStatic = 1,
RelocPIC = 2,
RelocDynamicNoPic = 3,
}
./librustc/lib/llvm.rs:pub enum CodeGenModel {
CodeModelDefault = 0,
CodeModelJITDefault = 1,
CodeModelSmall = 2,
CodeModelKernel = 3,
CodeModelMedium = 4,
CodeModelLarge = 5,
}
./librustc/lib/llvm.rs: pub enum DIDescriptorFlags {
FlagPrivate = 1 << 0,
FlagProtected = 1 << 1,
FlagFwdDecl = 1 << 2,
FlagAppleBlock = 1 << 3,
FlagBlockByrefStruct = 1 << 4,
FlagVirtual = 1 << 5,
FlagArtificial = 1 << 6,
FlagExplicit = 1 << 7,
FlagPrototyped = 1 << 8,
FlagObjcClassComplete = 1 << 9,
FlagObjectPointer = 1 << 10,
FlagVector = 1 << 11,
FlagStaticMember = 1 << 12
}
./librustc/metadata/common.rs:pub enum astencode_tag { // Reserves 0x40 -- 0x5f
tag_ast = 0x40,
tag_tree = 0x41,
tag_id_range = 0x42,
tag_table = 0x43,
tag_table_id = 0x44,
tag_table_val = 0x45,
tag_table_def = 0x46,
tag_table_node_type = 0x47,
tag_table_node_type_subst = 0x48,
tag_table_freevars = 0x49,
tag_table_tcache = 0x4a,
tag_table_param_defs = 0x4b,
tag_table_mutbl = 0x4c,
tag_table_last_use = 0x4d,
tag_table_spill = 0x4e,
tag_table_method_map = 0x4f,
tag_table_vtable_map = 0x50,
tag_table_adjustments = 0x51,
tag_table_moves_map = 0x52,
tag_table_capture_map = 0x53
}
./librustc/metadata/tydecode.rs:pub enum DefIdSource {
// Identifies a struct, trait, enum, etc.
NominalType,
// Identifies a type alias (`type X = ...`).
TypeWithId,
// Identifies a type parameter (`fn foo<X>() { ... }`).
./librustc/middle/expr_use_visitor.rs:pub enum MutateMode {
JustWrite, // x = y
WriteAndRead, // x += y
}
./librustc/middle/resolve_lifetime.rs:enum ScopeChain<'a> {
/// EarlyScope(i, ['a, 'b, ...], s) extends s with early-bound
/// lifetimes, assigning indexes 'a => i, 'b => i+1, ... etc.
EarlyScope(uint, &'a Vec<ast::Lifetime>, Scope<'a>),
/// LateScope(binder_id, ['a, 'b, ...], s) extends s with late-bound
/// lifetimes introduced by the declaration binder_id.
LateScope(ast::NodeId, &'a Vec<ast::Lifetime>, Scope<'a>),
/// lifetimes introduced by items within a code block are scoped
/// to that block.
BlockScope(ast::NodeId, Scope<'a>),
RootScope
}
./librustc/middle/ty.rs:pub enum Variance {
Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type
Invariant, // T<A> <: T<B> iff B == A -- e.g., type of mutable cell
Contravariant, // T<A> <: T<B> iff B <: A -- e.g., function param type
Bivariant, // T<A> <: T<B> -- e.g., unused type parameter
}
./librustc/middle/ty.rs:pub enum tbox_flag {
has_params = 1,
has_self = 2,
needs_infer = 4,
has_regions = 8,
has_ty_err = 16,
has_ty_bot = 32,
// a meta-pub flag: subst may be required if the type has parameters, a self
// type, or references bound regions
needs_subst = 1 | 2 | 8
}
./librustc/middle/ty.rs:pub enum BorrowKind {
/// Data must be immutable and is aliasable.
ImmBorrow,
/// Data must be immutable but not aliasable. This kind of borrow
/// cannot currently be expressed by the user and is used only in
/// implicit closure bindings. It is needed when you the closure
/// is borrowing or mutating a mutable referent, e.g.:
///
/// let x: &mut int = ...;
/// let y = || *x += 5;
///
/// If we were to try to translate this closure into a more explicit
/// form, we'd encounter an error with the code as written:
///
/// struct Env { x: & &mut int }
./librustc/middle/typeck/infer/mod.rs:pub enum SubregionOrigin {
// Arose from a subtyping relation
Subtype(TypeTrace),
// Stack-allocated closures cannot outlive innermost loop
// or function so as to ensure we only require finite stack
InfStackClosure(Span),
// Invocation of closure must be within its lifetime
InvokeClosure(Span),
// Dereference of reference must be within its lifetime
DerefPointer(Span),
// Closure bound must not outlive captured free variables
FreeVariable(Span, ast::NodeId),
// Index into slice must be within its lifetime
IndexSlice(Span),
// When casting `&'a T` to an `&'b Trait` object,
// relating `'a` to `'b`
RelateObjectBound(Span),
// Creating a pointer `b` to contents of another reference
Reborrow(Span),
// Creating a pointer `b` to contents of an upvar
ReborrowUpvar(Span, ty::UpvarId),
// (&'a &'b T) where a >= b
ReferenceOutlivesReferent(ty::t, Span),
// A `ref b` whose region does not enclose the decl site
BindingTypeIsNotValidAtDecl(Span),
// Regions appearing in a method receiver must outlive method call
CallRcvr(Span),
// Regions appearing in a function argument must outlive func call
CallArg(Span),
// Region in return type of invoked fn must enclose call
CallReturn(Span),
// Region resulting from a `&` expr must enclose the `&` expr
AddrOf(Span),
// An auto-borrow that does not enclose the expr where it occurs
AutoBorrow(Span),
}
./librustc/middle/typeck/infer/region_inference/mod.rs:pub enum RegionResolutionError {
/// `ConcreteFailure(o, a, b)`:
///
/// `o` requires that `a <= b`, but this does not hold
ConcreteFailure(SubregionOrigin, Region, Region),
/// `SubSupConflict(v, sub_origin, sub_r, sup_origin, sup_r)`:
///
/// Could not infer a value for `v` because `sub_r <= v` (due to
/// `sub_origin`) but `v <= sup_r` (due to `sup_origin`) and
/// `sub_r <= sup_r` does not hold.
SubSupConflict(RegionVariableOrigin,
SubregionOrigin, Region,
SubregionOrigin, Region),
/// `SupSupConflict(v, origin1, r1, origin2, r2)`:
///
/// Could not infer a value for `v` because `v <= r1` (due to
/// `origin1`) and `v <= r2` (due to `origin2`) and
/// `r1` and `r2` have no intersection.
SupSupConflict(RegionVariableOrigin,
SubregionOrigin, Region,
SubregionOrigin, Region),
/// For subsets of `ConcreteFailure` and `SubSupConflict`, we can derive
/// more specific errors message by suggesting to the user where they
/// should put a lifetime. In those cases we process and put those errors
/// into `ProcessedErrors` before we do any reporting.
ProcessedErrors(Vec<RegionVariableOrigin>,
Vec<(TypeTrace, ty::type_err)>,
Vec<SameRegions>),
}
./librustdoc/clean.rs:pub enum ViewPath {
// use str = source;
SimpleImport(~str, ImportSource),
// use source::*;
GlobImport(ImportSource),
// use source::{a, b, c};
./librustdoc/html/item_type.rs:pub enum ItemType {
Module = 0,
Struct = 1,
Enum = 2,
Function = 3,
Typedef = 4,
Static = 5,
Trait = 6,
Impl = 7,
ViewItem = 8,
TyMethod = 9,
Method = 10,
StructField = 11,
Variant = 12,
ForeignFunction = 13,
ForeignStatic = 14,
Macro = 15,
}
./librustuv/uvll.rs:pub enum uv_run_mode {
RUN_DEFAULT = 0,
RUN_ONCE,
RUN_NOWAIT,
}
./libstd/cmp.rs:pub enum Ordering {
/// An ordering where a compared value is less [than another].
Less = -1,
/// An ordering where a compared value is equal [to another].
Equal = 0,
/// An ordering where a compared value is greater [than another].
Greater = 1
}
./libstd/io/signal.rs:pub enum Signum {
/// Equivalent to SIGBREAK, delivered when the user presses Ctrl-Break.
Break = 21i,
/// Equivalent to SIGHUP, delivered when the user closes the terminal
/// window. On delivery of HangUp, the program is given approximately
/// 10 seconds to perform any cleanup. After that, Windows will
/// unconditionally terminate it.
HangUp = 1i,
/// Equivalent to SIGINT, delivered when the user presses Ctrl-c.
Interrupt = 2i,
/// Equivalent to SIGQUIT, delivered when the user presses Ctrl-\.
Quit = 3i,
/// Equivalent to SIGTSTP, delivered when the user presses Ctrl-z.
StopTemporarily = 20i,
/// Equivalent to SIGUSR1.
User1 = 10i,
/// Equivalent to SIGUSR2.
User2 = 12i,
/// Equivalent to SIGWINCH, delivered when the console has been resized.
/// WindowSizeChange may not be delivered in a timely manner; size change
/// will only be detected when the cursor is being moved.
WindowSizeChange = 28i,
}
./libstd/rt/libunwind.rs:pub enum _Unwind_Action {
_UA_SEARCH_PHASE = 1,
_UA_CLEANUP_PHASE = 2,
_UA_HANDLER_FRAME = 4,
_UA_FORCE_UNWIND = 8,
_UA_END_OF_STACK = 16,
}
./libstd/rt/libunwind.rs:pub enum _Unwind_State {
_US_VIRTUAL_UNWIND_FRAME = 0,
_US_UNWIND_FRAME_STARTING = 1,
_US_UNWIND_FRAME_RESUME = 2,
_US_ACTION_MASK = 3,
_US_FORCE_UNWIND = 8,
_US_END_OF_STACK = 16
}
./libstd/rt/libunwind.rs:pub enum _Unwind_Reason_Code {
_URC_NO_REASON = 0,
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
_URC_FATAL_PHASE2_ERROR = 2,
_URC_FATAL_PHASE1_ERROR = 3,
_URC_NORMAL_STOP = 4,
_URC_END_OF_STACK = 5,
_URC_HANDLER_FOUND = 6,
_URC_INSTALL_CONTEXT = 7,
_URC_CONTINUE_UNWIND = 8,
_URC_FAILURE = 9, // used only by ARM EABI
}
./libstd/rt/libunwind.rs: enum _Unwind_VRS_Result {
_UVRSR_OK = 0,
_UVRSR_NOT_IMPLEMENTED = 1,
_UVRSR_FAILED = 2,
}
./libstd/rt/libunwind.rs: enum _Unwind_VRS_RegClass {
_UVRSC_CORE = 0,
_UVRSC_VFP = 1,
_UVRSC_FPA = 2,
_UVRSC_WMMXD = 3,
_UVRSC_WMMXC = 4,
}
./libstd/rt/libunwind.rs: enum _Unwind_VRS_DataRepresentation {
_UVRSD_UINT32 = 0,
_UVRSD_VFPX = 1,
_UVRSD_FPAX = 2,
_UVRSD_UINT64 = 3,
_UVRSD_FLOAT = 4,
_UVRSD_DOUBLE = 5,
}
./libstd/unstable/dynamic_lib.rs: pub enum RTLD {
Lazy = 1,
Now = 2,
Global = 256,
Local = 0,
}
./libsyntax/ast.rs:pub enum ViewPath_ {
// quux = foo::bar::baz
//
// or just
//
// foo::bar::baz (with 'baz =' implicitly on the left)
ViewPathSimple(Ident, Path, NodeId),
// foo::bar::*
ViewPathGlob(Path, NodeId),
// foo::bar::{a,b,c}
./libsyntax/ast.rs:pub enum ViewItem_ {
// ident: name used to refer to this crate in the code
// optional (InternedString,StrStyle): if present, this is a location
// (containing arbitrary characters) from which to fetch the crate sources
// For example, extern crate whatever = "github.com/mozilla/rust"
ViewItemExternCrate(Ident, Option<(InternedString,StrStyle)>, NodeId),
ViewItemUse(@ViewPath),
}
./libuuid/lib.rs:pub enum UuidVersion {
/// Version 1: MAC address
Version1Mac = 1,
/// Version 2: DCE Security
Version2Dce = 2,
/// Version 3: MD5 hash
Version3Md5 = 3,
/// Version 4: Random
Version4Random = 4,
/// Version 5: SHA-1 hash
Version5Sha1 = 5,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment