pub static METADATA_FILENAME: &'static str = "rust.metadata.bin";
pub struct Archive<'a> {
- priv sess: &'a Session,
- priv dst: Path,
+ sess: &'a Session,
+ dst: Path,
}
pub struct ArchiveRO {
- priv ptr: ArchiveRef,
+ ptr: ArchiveRef,
}
fn run_ar(sess: &Session, args: &str, cwd: Option<&Path>,
#[deriving(Clone, Eq)]
pub struct Svh {
- priv hash: ~str,
+ hash: ~str,
}
impl Svh {
#![allow(non_camel_case_types)]
pub struct t {
- module_asm: ~str,
- meta_sect_name: ~str,
- data_layout: ~str,
- target_triple: ~str,
- cc_args: Vec<~str> ,
+ pub module_asm: ~str,
+ pub meta_sect_name: ~str,
+ pub data_layout: ~str,
+ pub target_triple: ~str,
+ pub cc_args: Vec<~str> ,
}
}
pub struct CrateAnalysis {
- exp_map2: middle::resolve::ExportMap2,
- exported_items: middle::privacy::ExportedItems,
- public_items: middle::privacy::PublicItems,
- ty_cx: ty::ctxt,
- maps: astencode::Maps,
- reachable: NodeSet,
+ pub exp_map2: middle::resolve::ExportMap2,
+ pub exported_items: middle::privacy::ExportedItems,
+ pub public_items: middle::privacy::PublicItems,
+ pub ty_cx: ty::ctxt,
+ pub maps: astencode::Maps,
+ pub reachable: NodeSet,
}
/// Run the resolution, typechecking, region checking and other
}
pub struct CrateTranslation {
- context: ContextRef,
- module: ModuleRef,
- metadata_module: ModuleRef,
- link: LinkMeta,
- metadata: Vec<u8> ,
- reachable: Vec<~str> ,
+ pub context: ContextRef,
+ pub module: ModuleRef,
+ pub metadata_module: ModuleRef,
+ pub link: LinkMeta,
+ pub metadata: Vec<u8>,
+ pub reachable: Vec<~str>,
}
/// Run the translation phase to LLVM, after which the AST and analysis can
}
pub struct OutputFilenames {
- out_directory: Path,
- out_filestem: ~str,
- single_output_file: Option<Path>,
+ pub out_directory: Path,
+ pub out_filestem: ~str,
+ pub single_output_file: Option<Path>,
}
impl OutputFilenames {
use collections::HashSet;
pub struct Config {
- os: abi::Os,
- arch: abi::Architecture,
- target_strs: target_strs::t,
- int_type: IntTy,
- uint_type: UintTy,
+ pub os: abi::Os,
+ pub arch: abi::Architecture,
+ pub target_strs: target_strs::t,
+ pub int_type: IntTy,
+ pub uint_type: UintTy,
}
macro_rules! debugging_opts(
pub struct Options {
// The crate config requested for the session, which may be combined
// with additional crate configurations during the compile process
- crate_types: Vec<CrateType> ,
+ pub crate_types: Vec<CrateType> ,
- gc: bool,
- optimize: OptLevel,
- debuginfo: DebugInfoLevel,
- lint_opts: Vec<(lint::Lint, lint::level)> ,
- output_types: Vec<back::link::OutputType> ,
+ pub gc: bool,
+ pub optimize: OptLevel,
+ pub debuginfo: DebugInfoLevel,
+ pub lint_opts: Vec<(lint::Lint, lint::level)> ,
+ pub output_types: Vec<back::link::OutputType> ,
// This was mutable for rustpkg, which updates search paths based on the
// parsed code. It remains mutable in case its replacements wants to use
// this.
- addl_lib_search_paths: RefCell<HashSet<Path>>,
- maybe_sysroot: Option<Path>,
- target_triple: ~str,
+ pub addl_lib_search_paths: RefCell<HashSet<Path>>,
+ pub maybe_sysroot: Option<Path>,
+ pub target_triple: ~str,
// User-specified cfg meta items. The compiler itself will add additional
// items to the crate config, and during parsing the entire crate config
// will be added to the crate AST node. This should not be used for
// anything except building the full crate config prior to parsing.
- cfg: ast::CrateConfig,
- test: bool,
- parse_only: bool,
- no_trans: bool,
- no_analysis: bool,
- debugging_opts: u64,
+ pub cfg: ast::CrateConfig,
+ pub test: bool,
+ pub parse_only: bool,
+ pub no_trans: bool,
+ pub no_analysis: bool,
+ pub debugging_opts: u64,
/// Whether to write dependency files. It's (enabled, optional filename).
- write_dependency_info: (bool, Option<Path>),
+ pub write_dependency_info: (bool, Option<Path>),
/// Crate id-related things to maybe print. It's (crate_id, crate_name, crate_file_name).
- print_metas: (bool, bool, bool),
- cg: CodegenOptions,
+ pub print_metas: (bool, bool, bool),
+ pub cg: CodegenOptions,
}
// The type of entry function, so
}
pub struct Session {
- targ_cfg: Config,
- opts: Options,
- cstore: metadata::cstore::CStore,
- parse_sess: ParseSess,
+ pub targ_cfg: Config,
+ pub opts: Options,
+ pub cstore: metadata::cstore::CStore,
+ pub parse_sess: ParseSess,
// For a library crate, this is always none
- entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,
- entry_type: Cell<Option<EntryFnType>>,
- macro_registrar_fn: RefCell<Option<ast::DefId>>,
- default_sysroot: Option<Path>,
- building_library: Cell<bool>,
+ pub entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,
+ pub entry_type: Cell<Option<EntryFnType>>,
+ pub macro_registrar_fn: RefCell<Option<ast::DefId>>,
+ pub default_sysroot: Option<Path>,
+ pub building_library: Cell<bool>,
// The name of the root source file of the crate, in the local file system. The path is always
// expected to be absolute. `None` means that there is no source file.
- local_crate_source_file: Option<Path>,
- working_dir: Path,
- lints: RefCell<NodeMap<Vec<(lint::Lint, codemap::Span, ~str)>>>,
- node_id: Cell<ast::NodeId>,
- crate_types: RefCell<Vec<CrateType>>,
- features: front::feature_gate::Features,
+ pub local_crate_source_file: Option<Path>,
+ pub working_dir: Path,
+ pub lints: RefCell<NodeMap<Vec<(lint::Lint, codemap::Span, ~str)>>>,
+ pub node_id: Cell<ast::NodeId>,
+ pub crate_types: RefCell<Vec<CrateType>>,
+ pub features: front::feature_gate::Features,
/// The maximum recursion limit for potentially infinitely recursive
/// operations such as auto-dereference and monomorphization.
- recursion_limit: Cell<uint>,
+ pub recursion_limit: Cell<uint>,
}
impl Session {
($($opt:ident : $t:ty = ($init:expr, $parse:ident, $desc:expr)),* ,) =>
(
#[deriving(Clone)]
- pub struct CodegenOptions { $($opt: $t),* }
+ pub struct CodegenOptions { $(pub $opt: $t),* }
pub fn basic_codegen_options() -> CodegenOptions {
CodegenOptions { $($opt: $init),* }
/// A set of features to be used by later passes.
pub struct Features {
- default_type_params: Cell<bool>
+ pub default_type_params: Cell<bool>
}
impl Features {
#![feature(macro_rules, globs, struct_variant, managed_boxes, quote,
default_type_params, phase)]
+#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
+#![allow(unrecognized_lint)] // NOTE: remove after a stage0 snap
+
extern crate flate;
extern crate arena;
extern crate syntax;
/* Memory-managed interface to target data. */
pub struct target_data_res {
- td: TargetDataRef,
+ pub td: TargetDataRef,
}
impl Drop for target_data_res {
}
pub struct TargetData {
- lltd: TargetDataRef,
+ pub lltd: TargetDataRef,
dtor: @target_data_res
}
/* Memory-managed interface to pass managers. */
pub struct pass_manager_res {
- pm: PassManagerRef,
+ pub pm: PassManagerRef,
}
impl Drop for pass_manager_res {
}
pub struct PassManager {
- llpm: PassManagerRef,
+ pub llpm: PassManagerRef,
dtor: @pass_manager_res
}
/* Memory-managed interface to object files. */
pub struct ObjectFile {
- llof: ObjectFileRef,
+ pub llof: ObjectFileRef,
}
impl ObjectFile {
/* Memory-managed interface to section iterators. */
pub struct section_iter_res {
- si: SectionIteratorRef,
+ pub si: SectionIteratorRef,
}
impl Drop for section_iter_res {
}
pub struct SectionIter {
- llsi: SectionIteratorRef,
+ pub llsi: SectionIteratorRef,
dtor: @section_iter_res
}
#[deriving(Clone, Show)]
pub struct LinkMeta {
- crateid: CrateId,
- crate_hash: Svh,
+ pub crateid: CrateId,
+ pub crate_hash: Svh,
}
}
pub struct Loader<'a> {
- priv env: Env<'a>,
+ env: Env<'a>,
}
impl<'a> Loader<'a> {
use syntax::parse::token;
pub struct StaticMethodInfo {
- ident: ast::Ident,
- def_id: ast::DefId,
- purity: ast::Purity,
- vis: ast::Visibility,
+ pub ident: ast::Ident,
+ pub def_id: ast::DefId,
+ pub purity: ast::Purity,
+ pub vis: ast::Visibility,
}
pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> ~str {
}
pub struct crate_metadata {
- name: ~str,
- data: MetadataBlob,
- cnum_map: cnum_map,
- cnum: ast::CrateNum
+ pub name: ~str,
+ pub data: MetadataBlob,
+ pub cnum_map: cnum_map,
+ pub cnum: ast::CrateNum,
}
#[deriving(Eq)]
// must be non-None.
#[deriving(Eq, Clone)]
pub struct CrateSource {
- dylib: Option<Path>,
- rlib: Option<Path>,
- cnum: ast::CrateNum,
+ pub dylib: Option<Path>,
+ pub rlib: Option<Path>,
+ pub cnum: ast::CrateNum,
}
pub struct CStore {
- priv metas: RefCell<HashMap<ast::CrateNum, @crate_metadata>>,
- priv extern_mod_crate_map: RefCell<extern_mod_crate_map>,
- priv used_crate_sources: RefCell<Vec<CrateSource> >,
- priv used_libraries: RefCell<Vec<(~str, NativeLibaryKind)> >,
- priv used_link_args: RefCell<Vec<~str> >,
- intr: Rc<IdentInterner>
+ metas: RefCell<HashMap<ast::CrateNum, @crate_metadata>>,
+ extern_mod_crate_map: RefCell<extern_mod_crate_map>,
+ used_crate_sources: RefCell<Vec<CrateSource>>,
+ used_libraries: RefCell<Vec<(~str, NativeLibaryKind)>>,
+ used_link_args: RefCell<Vec<~str>>,
+ pub intr: Rc<IdentInterner>,
}
// Map from NodeId's of local extern crate statements to crate numbers
#[deriving(Clone)]
pub struct CrateDep {
- cnum: ast::CrateNum,
- crate_id: CrateId,
- hash: Svh,
+ pub cnum: ast::CrateNum,
+ pub crate_id: CrateId,
+ pub hash: Svh,
}
pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
ii: InlinedItemRef|;
pub struct EncodeParams<'a> {
- diag: &'a SpanHandler,
- tcx: &'a ty::ctxt,
- reexports2: middle::resolve::ExportMap2,
- item_symbols: &'a RefCell<NodeMap<~str>>,
- non_inlineable_statics: &'a RefCell<NodeSet>,
- link_meta: &'a LinkMeta,
- cstore: &'a cstore::CStore,
- encode_inlined_item: EncodeInlinedItem<'a>,
+ pub diag: &'a SpanHandler,
+ pub tcx: &'a ty::ctxt,
+ pub reexports2: middle::resolve::ExportMap2,
+ pub item_symbols: &'a RefCell<NodeMap<~str>>,
+ pub non_inlineable_statics: &'a RefCell<NodeSet>,
+ pub link_meta: &'a LinkMeta,
+ pub cstore: &'a cstore::CStore,
+ pub encode_inlined_item: EncodeInlinedItem<'a>,
}
pub struct Stats {
}
pub struct EncodeContext<'a> {
- diag: &'a SpanHandler,
- tcx: &'a ty::ctxt,
- stats: @Stats,
- reexports2: middle::resolve::ExportMap2,
- item_symbols: &'a RefCell<NodeMap<~str>>,
- non_inlineable_statics: &'a RefCell<NodeSet>,
- link_meta: &'a LinkMeta,
- cstore: &'a cstore::CStore,
- encode_inlined_item: EncodeInlinedItem<'a>,
- type_abbrevs: abbrev_map,
+ pub diag: &'a SpanHandler,
+ pub tcx: &'a ty::ctxt,
+ pub stats: @Stats,
+ pub reexports2: middle::resolve::ExportMap2,
+ pub item_symbols: &'a RefCell<NodeMap<~str>>,
+ pub non_inlineable_statics: &'a RefCell<NodeSet>,
+ pub link_meta: &'a LinkMeta,
+ pub cstore: &'a cstore::CStore,
+ pub encode_inlined_item: EncodeInlinedItem<'a>,
+ pub type_abbrevs: abbrev_map,
}
fn encode_name(ebml_w: &mut Encoder, name: Name) {
pub type pick<'a> = 'a |path: &Path| -> FileMatch;
pub struct FileSearch<'a> {
- sysroot: &'a Path,
- addl_lib_search_paths: &'a RefCell<HashSet<Path>>,
- target_triple: &'a str
+ pub sysroot: &'a Path,
+ pub addl_lib_search_paths: &'a RefCell<HashSet<Path>>,
+ pub target_triple: &'a str
}
impl<'a> FileSearch<'a> {
}
pub struct Context<'a> {
- sess: &'a Session,
- span: Span,
- ident: &'a str,
- crate_id: &'a CrateId,
- id_hash: &'a str,
- hash: Option<&'a Svh>,
- os: Os,
- intr: Rc<IdentInterner>,
- rejected_via_hash: bool,
+ pub sess: &'a Session,
+ pub span: Span,
+ pub ident: &'a str,
+ pub crate_id: &'a CrateId,
+ pub id_hash: &'a str,
+ pub hash: Option<&'a Svh>,
+ pub os: Os,
+ pub intr: Rc<IdentInterner>,
+ pub rejected_via_hash: bool,
}
pub struct Library {
- dylib: Option<Path>,
- rlib: Option<Path>,
- metadata: MetadataBlob,
+ pub dylib: Option<Path>,
+ pub rlib: Option<Path>,
+ pub metadata: MetadataBlob,
}
pub struct ArchiveMetadata {
- priv archive: ArchiveRO,
+ archive: ArchiveRO,
// See comments in ArchiveMetadata::new for why this is static
- priv data: &'static [u8],
+ data: &'static [u8],
}
// FIXME(#11857) this should be a "real" realpath
) )
pub struct ctxt<'a> {
- diag: &'a SpanHandler,
+ pub diag: &'a SpanHandler,
// Def -> str Callback:
- ds: fn(DefId) -> ~str,
+ pub ds: fn(DefId) -> ~str,
// The type context.
- tcx: &'a ty::ctxt,
- abbrevs: abbrev_ctxt
+ pub tcx: &'a ty::ctxt,
+ pub abbrevs: abbrev_ctxt
}
// Compact string representation for ty.t values. API ty_str & parse_from_str.
// Auxiliary maps of things to be encoded
pub struct Maps {
- root_map: middle::borrowck::root_map,
- method_map: middle::typeck::MethodMap,
- vtable_map: middle::typeck::vtable_map,
- capture_map: RefCell<middle::moves::CaptureMap>,
+ pub root_map: middle::borrowck::root_map,
+ pub method_map: middle::typeck::MethodMap,
+ pub vtable_map: middle::typeck::vtable_map,
+ pub capture_map: RefCell<middle::moves::CaptureMap>,
}
struct DecodeContext<'a> {
// is T, which is not a box.
#[deriving(Eq, TotalEq, Hash)]
pub struct root_map_key {
- id: ast::NodeId,
- derefs: uint
+ pub id: ast::NodeId,
+ pub derefs: uint
}
pub type BckResult<T> = Result<T, BckError>;
// uncovered after a certain number of auto-derefs.
pub struct RootInfo {
- scope: ast::NodeId,
+ pub scope: ast::NodeId,
}
pub type root_map = @RefCell<HashMap<root_map_key, RootInfo>>;
pub struct MoveData {
/// Move paths. See section "Move paths" in `doc.rs`.
- paths: RefCell<Vec<MovePath>>,
+ pub paths: RefCell<Vec<MovePath>>,
/// Cache of loan path to move path index, for easy lookup.
- path_map: RefCell<HashMap<@LoanPath, MovePathIndex>>,
+ pub path_map: RefCell<HashMap<@LoanPath, MovePathIndex>>,
/// Each move or uninitialized variable gets an entry here.
- moves: RefCell<Vec<Move>>,
+ pub moves: RefCell<Vec<Move>>,
/// Assignments to a variable, like `x = foo`. These are assigned
/// bits for dataflow, since we must track them to ensure that
/// immutable variables are assigned at most once along each path.
- var_assignments: RefCell<Vec<Assignment>>,
+ pub var_assignments: RefCell<Vec<Assignment>>,
/// Assignments to a path, like `x.f = foo`. These are not
/// assigned dataflow bits, but we track them because they still
/// kill move bits.
- path_assignments: RefCell<Vec<Assignment>>,
+ pub path_assignments: RefCell<Vec<Assignment>>,
/// Assignments to a variable or path, like `x = foo`, but not `x += foo`.
- assignee_ids: RefCell<HashSet<ast::NodeId>>,
+ pub assignee_ids: RefCell<HashSet<ast::NodeId>>,
}
pub struct FlowedMoveData<'a> {
- move_data: MoveData,
+ pub move_data: MoveData,
- dfcx_moves: MoveDataFlow<'a>,
+ pub dfcx_moves: MoveDataFlow<'a>,
// We could (and maybe should, for efficiency) combine both move
// and assign data flow into one, but this way it's easier to
// distinguish the bits that correspond to moves and assignments.
- dfcx_assign: AssignDataFlow<'a>
+ pub dfcx_assign: AssignDataFlow<'a>
}
/// Index into `MoveData.paths`, used like a pointer
pub struct MovePath {
/// Loan path corresponding to this move path
- loan_path: @LoanPath,
+ pub loan_path: @LoanPath,
/// Parent pointer, `InvalidMovePathIndex` if root
- parent: MovePathIndex,
+ pub parent: MovePathIndex,
/// Head of linked list of moves to this path,
/// `InvalidMoveIndex` if not moved
- first_move: MoveIndex,
+ pub first_move: MoveIndex,
/// First node in linked list of children, `InvalidMovePathIndex` if leaf
- first_child: MovePathIndex,
+ pub first_child: MovePathIndex,
/// Next node in linked list of parent's children (siblings),
/// `InvalidMovePathIndex` if none.
- next_sibling: MovePathIndex,
+ pub next_sibling: MovePathIndex,
}
pub enum MoveKind {
pub struct Move {
/// Path being moved.
- path: MovePathIndex,
+ pub path: MovePathIndex,
/// id of node that is doing the move.
- id: ast::NodeId,
+ pub id: ast::NodeId,
/// Kind of move, for error messages.
- kind: MoveKind,
+ pub kind: MoveKind,
/// Next node in linked list of moves from `path`, or `InvalidMoveIndex`
- next_move: MoveIndex
+ pub next_move: MoveIndex
}
pub struct Assignment {
/// Path being assigned.
- path: MovePathIndex,
+ pub path: MovePathIndex,
/// id where assignment occurs
- id: ast::NodeId,
+ pub id: ast::NodeId,
/// span of node where assignment occurs
- span: Span,
+ pub span: Span,
}
pub struct MoveDataFlowOperator;
#[deriving(Clone)]
pub struct DataFlowContext<'a, O> {
- priv tcx: &'a ty::ctxt,
- priv method_map: typeck::MethodMap,
+ tcx: &'a ty::ctxt,
+ method_map: typeck::MethodMap,
/// the data flow operator
- priv oper: O,
+ oper: O,
/// number of bits to propagate per id
- priv bits_per_id: uint,
+ bits_per_id: uint,
/// number of words we will use to store bits_per_id.
/// equal to bits_per_id/uint::BITS rounded up.
- priv words_per_id: uint,
+ words_per_id: uint,
// mapping from node to bitset index.
- priv nodeid_to_bitset: NodeMap<uint>,
+ nodeid_to_bitset: NodeMap<uint>,
// Bit sets per id. The following three fields (`gens`, `kills`,
// and `on_entry`) all have the same structure. For each id in
// the full vector (see the method `compute_id_range()`).
/// bits generated as we exit the scope `id`. Updated by `add_gen()`.
- priv gens: Vec<uint> ,
+ gens: Vec<uint>,
/// bits killed as we exit the scope `id`. Updated by `add_kill()`.
- priv kills: Vec<uint> ,
+ kills: Vec<uint>,
/// bits that are valid on entry to the scope `id`. Updated by
/// `propagate()`.
- priv on_entry: Vec<uint> }
+ on_entry: Vec<uint>,
+}
/// Parameterization for the precise form of data flow that is used.
pub trait DataFlowOperator {
// (The def_upvar will already have been stripped).
#[deriving(Encodable, Decodable)]
pub struct freevar_entry {
- def: ast::Def, //< The variable being accessed free.
- span: Span //< First span where it is accessed (there can be multiple)
+ pub def: ast::Def, //< The variable being accessed free.
+ pub span: Span //< First span where it is accessed (there can be multiple)
}
pub type freevar_info = @Vec<@freevar_entry> ;
pub type freevar_map = NodeMap<freevar_info>;
use std::uint;
pub struct Graph<N,E> {
- priv nodes: Vec<Node<N>> ,
- priv edges: Vec<Edge<E>> ,
+ nodes: Vec<Node<N>> ,
+ edges: Vec<Edge<E>> ,
}
pub struct Node<N> {
- priv first_edge: [EdgeIndex, ..2], // see module comment
- data: N,
+ first_edge: [EdgeIndex, ..2], // see module comment
+ pub data: N,
}
pub struct Edge<E> {
- priv next_edge: [EdgeIndex, ..2], // see module comment
- priv source: NodeIndex,
- priv target: NodeIndex,
- data: E,
+ next_edge: [EdgeIndex, ..2], // see module comment
+ source: NodeIndex,
+ target: NodeIndex,
+ pub data: E,
}
#[deriving(Eq)]
pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
// Use a private field here to guarantee no more instances are created:
-pub struct Direction { priv repr: uint }
+pub struct Direction { repr: uint }
pub static Outgoing: Direction = Direction { repr: 0 };
pub static Incoming: Direction = Direction { repr: 1 };
}
pub struct LanguageItems {
- items: Vec<Option<ast::DefId>> ,
+ pub items: Vec<Option<ast::DefId>> ,
}
impl LanguageItems {
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)]
pub struct LintSpec {
- default: level,
- lint: Lint,
- desc: &'static str,
+ pub default: level,
+ pub lint: Lint,
+ pub desc: &'static str,
}
pub type LintDict = HashMap<&'static str, LintSpec>;
#[deriving(Eq)]
pub struct CopiedUpvar {
- upvar_id: ast::NodeId,
- onceness: ast::Onceness,
+ pub upvar_id: ast::NodeId,
+ pub onceness: ast::Onceness,
}
// different kinds of pointers:
// fashion. For more details, see the method `cat_pattern`
#[deriving(Eq)]
pub struct cmt_ {
- id: ast::NodeId, // id of expr/pat producing this value
- span: Span, // span of same expr/pat
- cat: categorization, // categorization of expr
- mutbl: MutabilityCategory, // mutability of expr as lvalue
- ty: ty::t // type of the expr (*see WARNING above*)
+ pub id: ast::NodeId, // id of expr/pat producing this value
+ pub span: Span, // span of same expr/pat
+ pub cat: categorization, // categorization of expr
+ pub mutbl: MutabilityCategory, // mutability of expr as lvalue
+ pub ty: ty::t // type of the expr (*see WARNING above*)
}
pub type cmt = @cmt_;
}
pub struct MemCategorizationContext<TYPER> {
- typer: TYPER
+ pub typer: TYPER
}
pub type McResult<T> = Result<T, ()>;
#[deriving(Encodable, Decodable)]
pub struct CaptureVar {
- def: Def, // Variable being accessed free
- span: Span, // Location of an access to this variable
- mode: CaptureMode // How variable is being accessed
+ pub def: Def, // Variable being accessed free
+ pub span: Span, // Location of an access to this variable
+ pub mode: CaptureMode // How variable is being accessed
}
pub type CaptureMap = NodeMap<Rc<Vec<CaptureVar>>>;
/** See the section Output on the module comment for explanation. */
#[deriving(Clone)]
pub struct MoveMaps {
- moves_map: NodeSet,
+ pub moves_map: NodeSet,
/**
* Set of variable node-ids that are moved.
*
- * Note: The `moves_map` stores expression ids that are moves,
+ * pub Note: The `moves_map` stores expression ids that are moves,
* whereas this set stores the ids of the variables that are
* moved at some point */
- moved_variables_set: NodeSet,
- capture_map: CaptureMap
+ pub moved_variables_set: NodeSet,
+ pub capture_map: CaptureMap
}
#[deriving(Clone)]
for dynamic checks and/or arbitrary amounts of stack space.
*/
pub struct RegionMaps {
- priv scope_map: RefCell<NodeMap<ast::NodeId>>,
- priv var_map: RefCell<NodeMap<ast::NodeId>>,
- priv free_region_map: RefCell<HashMap<FreeRegion, Vec<FreeRegion> >>,
- priv rvalue_scopes: RefCell<NodeMap<ast::NodeId>>,
- priv terminating_scopes: RefCell<HashSet<ast::NodeId>>,
+ scope_map: RefCell<NodeMap<ast::NodeId>>,
+ var_map: RefCell<NodeMap<ast::NodeId>>,
+ free_region_map: RefCell<HashMap<FreeRegion, Vec<FreeRegion> >>,
+ rvalue_scopes: RefCell<NodeMap<ast::NodeId>>,
+ terminating_scopes: RefCell<HashSet<ast::NodeId>>,
}
#[deriving(Clone)]
pub type ExportMap2 = @RefCell<NodeMap<Vec<Export2> >>;
pub struct Export2 {
- name: ~str, // The name of the target.
- def_id: DefId, // The definition of the target.
+ pub name: ~str, // The name of the target.
+ pub def_id: DefId, // The definition of the target.
}
// This set contains all exported definitions from external crates. The set does
// and whether the import is in fact used for each.
// If the Option<PrivateDep> fields are None, it means there is no defintion
// in that namespace.
- LastImport{value_priv: Option<PrivateDep>,
- value_used: ImportUse,
- type_priv: Option<PrivateDep>,
- type_used: ImportUse},
+ LastImport{pub value_priv: Option<PrivateDep>,
+ pub value_used: ImportUse,
+ pub type_priv: Option<PrivateDep>,
+ pub type_used: ImportUse},
}
pub enum PrivateDep {
}
pub struct CrateMap {
- def_map: DefMap,
- exp_map2: ExportMap2,
- trait_map: TraitMap,
- external_exports: ExternalExports,
- last_private_map: LastPrivateMap,
+ pub def_map: DefMap,
+ pub exp_map2: ExportMap2,
+ pub trait_map: TraitMap,
+ pub external_exports: ExternalExports,
+ pub last_private_map: LastPrivateMap,
}
/// Entry point to crate resolution.
* General-case enums: for each case there is a struct, and they
* all start with a field for the discriminant.
*/
- General(IntType, Vec<Struct> ),
+ General(IntType, Vec<Struct>),
/**
* Two cases distinguished by a nullable pointer: the case with discriminant
* `nndiscr` is represented by the struct `nonnull`, where the `ptrfield`th
* is represented such that `None` is a null pointer and `Some` is the
* identity function.
*/
- NullablePointer{ nonnull: Struct, nndiscr: Disr, ptrfield: uint,
- nullfields: Vec<ty::t> }
+ NullablePointer {
+ pub nonnull: Struct,
+ pub nndiscr: Disr,
+ pub ptrfield: uint,
+ pub nullfields: Vec<ty::t>,
+ }
}
/// For structs, and struct-like parts of anything fancier.
pub struct Struct {
- size: u64,
- align: u64,
- packed: bool,
- fields: Vec<ty::t> }
+ pub size: u64,
+ pub align: u64,
+ pub packed: bool,
+ pub fields: Vec<ty::t>,
+}
/**
* Convenience for `represent_type`. There should probably be more or
}
pub struct MallocResult<'a> {
- bcx: &'a Block<'a>,
- smart_ptr: ValueRef,
- body: ValueRef
+ pub bcx: &'a Block<'a>,
+ pub smart_ptr: ValueRef,
+ pub body: ValueRef
}
// malloc_general_dyn: usefully wraps malloc_raw_dyn; allocates a smart
}
pub struct TransItemVisitor<'a> {
- ccx: &'a CrateContext,
+ pub ccx: &'a CrateContext,
}
impl<'a> Visitor<()> for TransItemVisitor<'a> {
use syntax::codemap::Span;
pub struct Builder<'a> {
- llbuilder: BuilderRef,
- ccx: &'a CrateContext,
+ pub llbuilder: BuilderRef,
+ pub ccx: &'a CrateContext,
}
// This is a really awful way to get a zero-length c-string, but better (and a
/// This is borrowed from clang's ABIInfo.h
#[deriving(Clone)]
pub struct ArgType {
- kind: ArgKind,
+ pub kind: ArgKind,
/// Original LLVM type
- ty: Type,
+ pub ty: Type,
/// Coerced LLVM Type
- cast: option::Option<Type>,
+ pub cast: option::Option<Type>,
/// Dummy argument, which is emitted before the real argument
- pad: option::Option<Type>,
+ pub pad: option::Option<Type>,
/// LLVM attribute of argument
- attr: option::Option<Attribute>
+ pub attr: option::Option<Attribute>
}
impl ArgType {
/// comments are reverse-engineered and may be inaccurate. -NDM
pub struct FnType {
/// The LLVM types of each argument.
- arg_tys: Vec<ArgType> ,
+ pub arg_tys: Vec<ArgType> ,
/// LLVM return type.
- ret_ty: ArgType,
+ pub ret_ty: ArgType,
}
pub fn compute_abi_info(ccx: &CrateContext,
use syntax::ast_map;
pub struct MethodData {
- llfn: ValueRef,
- llself: ValueRef,
+ pub llfn: ValueRef,
+ pub llself: ValueRef,
}
pub enum CalleeData {
}
pub struct Callee<'a> {
- bcx: &'a Block<'a>,
- data: CalleeData
+ pub bcx: &'a Block<'a>,
+ pub data: CalleeData
}
fn trans<'a>(bcx: &'a Block<'a>, expr: &ast::Expr) -> Callee<'a> {
}
pub struct CustomScopeIndex {
- priv index: uint
+ index: uint
}
pub static EXIT_BREAK: uint = 0;
}
pub struct tydesc_info {
- ty: ty::t,
- tydesc: ValueRef,
- size: ValueRef,
- align: ValueRef,
- name: ValueRef,
- visit_glue: Cell<Option<ValueRef>>,
+ pub ty: ty::t,
+ pub tydesc: ValueRef,
+ pub size: ValueRef,
+ pub align: ValueRef,
+ pub name: ValueRef,
+ pub visit_glue: Cell<Option<ValueRef>>,
}
/*
*/
pub struct NodeInfo {
- id: ast::NodeId,
- span: Span,
+ pub id: ast::NodeId,
+ pub span: Span,
}
pub fn expr_info(expr: &ast::Expr) -> NodeInfo {
}
pub struct Stats {
- n_static_tydescs: Cell<uint>,
- n_glues_created: Cell<uint>,
- n_null_glues: Cell<uint>,
- n_real_glues: Cell<uint>,
- n_fns: Cell<uint>,
- n_monos: Cell<uint>,
- n_inlines: Cell<uint>,
- n_closures: Cell<uint>,
- n_llvm_insns: Cell<uint>,
- llvm_insns: RefCell<HashMap<~str, uint>>,
+ pub n_static_tydescs: Cell<uint>,
+ pub n_glues_created: Cell<uint>,
+ pub n_null_glues: Cell<uint>,
+ pub n_real_glues: Cell<uint>,
+ pub n_fns: Cell<uint>,
+ pub n_monos: Cell<uint>,
+ pub n_inlines: Cell<uint>,
+ pub n_closures: Cell<uint>,
+ pub n_llvm_insns: Cell<uint>,
+ pub llvm_insns: RefCell<HashMap<~str, uint>>,
// (ident, time-in-ms, llvm-instructions)
- fn_stats: RefCell<Vec<(~str, uint, uint)> >,
+ pub fn_stats: RefCell<Vec<(~str, uint, uint)> >,
}
pub struct BuilderRef_res {
- b: BuilderRef,
+ pub b: BuilderRef,
}
impl Drop for BuilderRef_res {
// Here `self_ty` is the real type of the self parameter to this method. It
// will only be set in the case of default methods.
pub struct param_substs {
- tys: Vec<ty::t> ,
- self_ty: Option<ty::t>,
- vtables: Option<typeck::vtable_res>,
- self_vtables: Option<typeck::vtable_param_res>
+ pub tys: Vec<ty::t> ,
+ pub self_ty: Option<ty::t>,
+ pub vtables: Option<typeck::vtable_res>,
+ pub self_vtables: Option<typeck::vtable_param_res>
}
impl param_substs {
// address of the first instruction in the sequence of
// instructions for this function that will go in the .text
// section of the executable we're generating.
- llfn: ValueRef,
+ pub llfn: ValueRef,
// The environment argument in a closure.
- llenv: Option<ValueRef>,
+ pub llenv: Option<ValueRef>,
// The place to store the return value. If the return type is immediate,
// this is an alloca in the function. Otherwise, it's the hidden first
// parameter to the function. After function construction, this should
// always be Some.
- llretptr: Cell<Option<ValueRef>>,
+ pub llretptr: Cell<Option<ValueRef>>,
- entry_bcx: RefCell<Option<&'a Block<'a>>>,
+ pub entry_bcx: RefCell<Option<&'a Block<'a>>>,
- // These elements: "hoisted basic blocks" containing
+ // These pub elements: "hoisted basic blocks" containing
// administrative activities that have to happen in only one place in
// the function, due to LLVM's quirks.
// A marker for the place where we want to insert the function's static
// allocas, so that LLVM will coalesce them into a single alloca call.
- alloca_insert_pt: Cell<Option<ValueRef>>,
- llreturn: Cell<Option<BasicBlockRef>>,
+ pub alloca_insert_pt: Cell<Option<ValueRef>>,
+ pub llreturn: Cell<Option<BasicBlockRef>>,
// The a value alloca'd for calls to upcalls.rust_personality. Used when
// outputting the resume instruction.
- personality: Cell<Option<ValueRef>>,
+ pub personality: Cell<Option<ValueRef>>,
// True if the caller expects this fn to use the out pointer to
// return. Either way, your code should write into llretptr, but if
// this value is false, llretptr will be a local alloca.
- caller_expects_out_pointer: bool,
+ pub caller_expects_out_pointer: bool,
// Maps arguments to allocas created for them in llallocas.
- llargs: RefCell<NodeMap<LvalueDatum>>,
+ pub llargs: RefCell<NodeMap<LvalueDatum>>,
// Maps the def_ids for local variables to the allocas created for
// them in llallocas.
- lllocals: RefCell<NodeMap<LvalueDatum>>,
+ pub lllocals: RefCell<NodeMap<LvalueDatum>>,
// Same as above, but for closure upvars
- llupvars: RefCell<NodeMap<ValueRef>>,
+ pub llupvars: RefCell<NodeMap<ValueRef>>,
// The NodeId of the function, or -1 if it doesn't correspond to
// a user-defined function.
- id: ast::NodeId,
+ pub id: ast::NodeId,
// If this function is being monomorphized, this contains the type
// substitutions used.
- param_substs: Option<@param_substs>,
+ pub param_substs: Option<@param_substs>,
// The source span and nesting context where this function comes from, for
// error reporting and symbol generation.
- span: Option<Span>,
+ pub span: Option<Span>,
// The arena that blocks are allocated from.
- block_arena: &'a TypedArena<Block<'a>>,
+ pub block_arena: &'a TypedArena<Block<'a>>,
// This function's enclosing crate context.
- ccx: &'a CrateContext,
+ pub ccx: &'a CrateContext,
// Used and maintained by the debuginfo module.
- debug_context: debuginfo::FunctionDebugContext,
+ pub debug_context: debuginfo::FunctionDebugContext,
// Cleanup scopes.
- scopes: RefCell<Vec<cleanup::CleanupScope<'a>> >,
+ pub scopes: RefCell<Vec<cleanup::CleanupScope<'a>> >,
}
impl<'a> FunctionContext<'a> {
// block to the function pointed to by llfn. We insert
// instructions into that block by way of this block context.
// The block pointing to this one in the function's digraph.
- llbb: BasicBlockRef,
- terminated: Cell<bool>,
- unreachable: Cell<bool>,
+ pub llbb: BasicBlockRef,
+ pub terminated: Cell<bool>,
+ pub unreachable: Cell<bool>,
// Is this block part of a landing pad?
- is_lpad: bool,
+ pub is_lpad: bool,
// AST node-id associated with this block, if any. Used for
// debugging purposes only.
- opt_node_id: Option<ast::NodeId>,
+ pub opt_node_id: Option<ast::NodeId>,
// The function context for the function to which this block is
// attached.
- fcx: &'a FunctionContext<'a>,
+ pub fcx: &'a FunctionContext<'a>,
}
impl<'a> Block<'a> {
}
pub struct Result<'a> {
- bcx: &'a Block<'a>,
- val: ValueRef
+ pub bcx: &'a Block<'a>,
+ pub val: ValueRef
}
pub fn rslt<'a>(bcx: &'a Block<'a>, val: ValueRef) -> Result<'a> {
#[deriving(Eq, TotalEq, Hash)]
pub struct mono_id_ {
- def: ast::DefId,
- params: Vec<mono_param_id> }
+ pub def: ast::DefId,
+ pub params: Vec<mono_param_id> }
pub type mono_id = @mono_id_;
use syntax::parse::token::InternedString;
pub struct CrateContext {
- llmod: ModuleRef,
- llcx: ContextRef,
- metadata_llmod: ModuleRef,
- td: TargetData,
- tn: TypeNames,
- externs: RefCell<ExternMap>,
- intrinsics: HashMap<&'static str, ValueRef>,
- item_vals: RefCell<NodeMap<ValueRef>>,
- exp_map2: resolve::ExportMap2,
- reachable: NodeSet,
- item_symbols: RefCell<NodeMap<~str>>,
- link_meta: LinkMeta,
- drop_glues: RefCell<HashMap<ty::t, ValueRef>>,
- tydescs: RefCell<HashMap<ty::t, @tydesc_info>>,
+ pub llmod: ModuleRef,
+ pub llcx: ContextRef,
+ pub metadata_llmod: ModuleRef,
+ pub td: TargetData,
+ pub tn: TypeNames,
+ pub externs: RefCell<ExternMap>,
+ pub intrinsics: HashMap<&'static str, ValueRef>,
+ pub item_vals: RefCell<NodeMap<ValueRef>>,
+ pub exp_map2: resolve::ExportMap2,
+ pub reachable: NodeSet,
+ pub item_symbols: RefCell<NodeMap<~str>>,
+ pub link_meta: LinkMeta,
+ pub drop_glues: RefCell<HashMap<ty::t, ValueRef>>,
+ pub tydescs: RefCell<HashMap<ty::t, @tydesc_info>>,
// Set when running emit_tydescs to enforce that no more tydescs are
// created.
- finished_tydescs: Cell<bool>,
+ pub finished_tydescs: Cell<bool>,
// Track mapping of external ids to local items imported for inlining
- external: RefCell<DefIdMap<Option<ast::NodeId>>>,
+ pub external: RefCell<DefIdMap<Option<ast::NodeId>>>,
// Backwards version of the `external` map (inlined items to where they
// came from)
- external_srcs: RefCell<NodeMap<ast::DefId>>,
+ pub external_srcs: RefCell<NodeMap<ast::DefId>>,
// A set of static items which cannot be inlined into other crates. This
// will pevent in IIItem() structures from being encoded into the metadata
// that is generated
- non_inlineable_statics: RefCell<NodeSet>,
+ pub non_inlineable_statics: RefCell<NodeSet>,
// Cache instances of monomorphized functions
- monomorphized: RefCell<HashMap<mono_id, ValueRef>>,
- monomorphizing: RefCell<DefIdMap<uint>>,
+ pub monomorphized: RefCell<HashMap<mono_id, ValueRef>>,
+ pub monomorphizing: RefCell<DefIdMap<uint>>,
// Cache generated vtables
- vtables: RefCell<HashMap<(ty::t, mono_id), ValueRef>>,
+ pub vtables: RefCell<HashMap<(ty::t, mono_id), ValueRef>>,
// Cache of constant strings,
- const_cstr_cache: RefCell<HashMap<InternedString, ValueRef>>,
+ pub const_cstr_cache: RefCell<HashMap<InternedString, ValueRef>>,
// Reverse-direction for const ptrs cast from globals.
// Key is an int, cast from a ValueRef holding a *T,
// when we ptrcast, and we have to ptrcast during translation
// of a [T] const because we form a slice, a [*T,int] pair, not
// a pointer to an LLVM array type.
- const_globals: RefCell<HashMap<int, ValueRef>>,
+ pub const_globals: RefCell<HashMap<int, ValueRef>>,
// Cache of emitted const values
- const_values: RefCell<NodeMap<ValueRef>>,
+ pub const_values: RefCell<NodeMap<ValueRef>>,
// Cache of external const values
- extern_const_values: RefCell<DefIdMap<ValueRef>>,
+ pub extern_const_values: RefCell<DefIdMap<ValueRef>>,
- impl_method_cache: RefCell<HashMap<(ast::DefId, ast::Name), ast::DefId>>,
+ pub impl_method_cache: RefCell<HashMap<(ast::DefId, ast::Name), ast::DefId>>,
// Cache of closure wrappers for bare fn's.
- closure_bare_wrapper_cache: RefCell<HashMap<ValueRef, ValueRef>>,
+ pub closure_bare_wrapper_cache: RefCell<HashMap<ValueRef, ValueRef>>,
- lltypes: RefCell<HashMap<ty::t, Type>>,
- llsizingtypes: RefCell<HashMap<ty::t, Type>>,
- adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
- symbol_hasher: RefCell<Sha256>,
- type_hashcodes: RefCell<HashMap<ty::t, ~str>>,
- all_llvm_symbols: RefCell<HashSet<~str>>,
- tcx: ty::ctxt,
- maps: astencode::Maps,
- stats: @Stats,
- int_type: Type,
- opaque_vec_type: Type,
- builder: BuilderRef_res,
+ pub lltypes: RefCell<HashMap<ty::t, Type>>,
+ pub llsizingtypes: RefCell<HashMap<ty::t, Type>>,
+ pub adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
+ pub symbol_hasher: RefCell<Sha256>,
+ pub type_hashcodes: RefCell<HashMap<ty::t, ~str>>,
+ pub all_llvm_symbols: RefCell<HashSet<~str>>,
+ pub tcx: ty::ctxt,
+ pub maps: astencode::Maps,
+ pub stats: @Stats,
+ pub int_type: Type,
+ pub opaque_vec_type: Type,
+ pub builder: BuilderRef_res,
// Set when at least one function uses GC. Needed so that
// decl_gc_metadata knows whether to link to the module metadata, which
// is not emitted by LLVM's GC pass when no functions use GC.
- uses_gc: bool,
- dbg_cx: Option<debuginfo::CrateDebugContext>,
+ pub uses_gc: bool,
+ pub dbg_cx: Option<debuginfo::CrateDebugContext>,
}
impl CrateContext {
pub struct Datum<K> {
/// The llvm value. This is either a pointer to the Rust value or
/// the value itself, depending on `kind` below.
- val: ValueRef,
+ pub val: ValueRef,
/// The rust type of the value.
- ty: ty::t,
+ pub ty: ty::t,
/// Indicates whether this is by-ref or by-value.
- kind: K,
+ pub kind: K,
}
pub struct DatumBlock<'a, K> {
- bcx: &'a Block<'a>,
- datum: Datum<K>,
+ pub bcx: &'a Block<'a>,
+ pub datum: Datum<K>,
}
pub enum Expr {
pub struct Lvalue;
pub struct Rvalue {
- mode: RvalueMode
+ pub mode: RvalueMode
}
pub fn Rvalue(m: RvalueMode) -> Rvalue {
/// A context object for maintaining all state needed by the debuginfo module.
pub struct CrateDebugContext {
- priv llcontext: ContextRef,
- priv builder: DIBuilderRef,
- priv current_debug_location: Cell<DebugLocation>,
- priv created_files: RefCell<HashMap<~str, DIFile>>,
- priv created_types: RefCell<HashMap<uint, DIType>>,
- priv namespace_map: RefCell<HashMap<Vec<ast::Name> , @NamespaceTreeNode>>,
+ llcontext: ContextRef,
+ builder: DIBuilderRef,
+ current_debug_location: Cell<DebugLocation>,
+ created_files: RefCell<HashMap<~str, DIFile>>,
+ created_types: RefCell<HashMap<uint, DIType>>,
+ namespace_map: RefCell<HashMap<Vec<ast::Name> , @NamespaceTreeNode>>,
// This collection is used to assert that composite types (structs, enums, ...) have their
// members only set once:
- priv composite_types_completed: RefCell<HashSet<DIType>>,
+ composite_types_completed: RefCell<HashSet<DIType>>,
}
impl CrateDebugContext {
}
pub struct VecTypes {
- vec_ty: ty::t,
- unit_ty: ty::t,
- llunit_ty: Type,
- llunit_size: ValueRef,
- llunit_alloc_size: u64
+ pub vec_ty: ty::t,
+ pub unit_ty: ty::t,
+ pub llunit_ty: Type,
+ pub llunit_size: ValueRef,
+ pub llunit_alloc_size: u64
}
impl VecTypes {
#[deriving(Clone, Eq, Show)]
pub struct Type {
- priv rf: TypeRef
+ rf: TypeRef
}
macro_rules! ty (
/// Iterator for the users of a value
pub struct Users {
- priv next: Option<Use>
+ next: Option<Use>
}
impl Iterator<Value> for Users {
#[deriving(Eq, TotalEq, Hash)]
pub struct field {
- ident: ast::Ident,
- mt: mt
+ pub ident: ast::Ident,
+ pub mt: mt
}
#[deriving(Clone)]
#[deriving(Clone)]
pub struct Method {
- ident: ast::Ident,
- generics: ty::Generics,
- fty: BareFnTy,
- explicit_self: ast::ExplicitSelf_,
- vis: ast::Visibility,
- def_id: ast::DefId,
- container: MethodContainer,
+ pub ident: ast::Ident,
+ pub generics: ty::Generics,
+ pub fty: BareFnTy,
+ pub explicit_self: ast::ExplicitSelf_,
+ pub vis: ast::Visibility,
+ pub def_id: ast::DefId,
+ pub container: MethodContainer,
// If this method is provided, we need to know where it came from
- provided_source: Option<ast::DefId>
+ pub provided_source: Option<ast::DefId>
}
impl Method {
}
pub struct Impl {
- did: DefId,
- ident: Ident,
- methods: Vec<@Method> }
+ pub did: DefId,
+ pub ident: Ident,
+ pub methods: Vec<@Method>,
+}
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct mt {
- ty: t,
- mutbl: ast::Mutability,
+ pub ty: t,
+ pub mutbl: ast::Mutability,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)]
}
pub struct field_ty {
- name: Name,
- id: DefId,
- vis: ast::Visibility,
+ pub name: Name,
+ pub id: DefId,
+ pub vis: ast::Visibility,
}
// Contains information needed to resolve types and (in the future) look up
// the types of AST nodes.
#[deriving(Eq, TotalEq, Hash)]
pub struct creader_cache_key {
- cnum: CrateNum,
- pos: uint,
- len: uint
+ pub cnum: CrateNum,
+ pub pos: uint,
+ pub len: uint
}
pub type creader_cache = RefCell<HashMap<creader_cache_key, t>>;
#[deriving(Clone, Eq, Decodable, Encodable)]
pub struct ItemVariances {
- self_param: Option<Variance>,
- type_params: OwnedSlice<Variance>,
- region_params: OwnedSlice<Variance>
+ pub self_param: Option<Variance>,
+ pub type_params: OwnedSlice<Variance>,
+ pub region_params: OwnedSlice<Variance>
}
#[deriving(Clone, Eq, Decodable, Encodable, Show)]
#[deriving(Decodable, Encodable)]
pub struct AutoDerefRef {
- autoderefs: uint,
- autoref: Option<AutoRef>
+ pub autoderefs: uint,
+ pub autoref: Option<AutoRef>
}
#[deriving(Decodable, Encodable, Eq, Show)]
pub struct ctxt {
// Specifically use a speedy hash algorithm for this hash map, it's used
// quite often.
- interner: RefCell<FnvHashMap<intern_key, ~t_box_>>,
- next_id: Cell<uint>,
- sess: Session,
- def_map: resolve::DefMap,
+ pub interner: RefCell<FnvHashMap<intern_key, ~t_box_>>,
+ pub next_id: Cell<uint>,
+ pub sess: Session,
+ pub def_map: resolve::DefMap,
- named_region_map: resolve_lifetime::NamedRegionMap,
+ pub named_region_map: resolve_lifetime::NamedRegionMap,
- region_maps: middle::region::RegionMaps,
+ pub region_maps: middle::region::RegionMaps,
// Stores the types for various nodes in the AST. Note that this table
// is not guaranteed to be populated until after typeck. See
// typeck::check::fn_ctxt for details.
- node_types: node_type_table,
+ pub node_types: node_type_table,
// Stores the type parameters which were substituted to obtain the type
// of this node. This only applies to nodes that refer to entities
// parameterized by type parameters, such as generic fns, types, or
// other items.
- node_type_substs: RefCell<NodeMap<Vec<t>>>,
+ pub node_type_substs: RefCell<NodeMap<Vec<t>>>,
// Maps from a method to the method "descriptor"
- methods: RefCell<DefIdMap<@Method>>,
+ pub methods: RefCell<DefIdMap<@Method>>,
// Maps from a trait def-id to a list of the def-ids of its methods
- trait_method_def_ids: RefCell<DefIdMap<@Vec<DefId> >>,
+ pub trait_method_def_ids: RefCell<DefIdMap<@Vec<DefId> >>,
// A cache for the trait_methods() routine
- trait_methods_cache: RefCell<DefIdMap<@Vec<@Method> >>,
-
- impl_trait_cache: RefCell<DefIdMap<Option<@ty::TraitRef>>>,
-
- trait_refs: RefCell<NodeMap<@TraitRef>>,
- trait_defs: RefCell<DefIdMap<@TraitDef>>,
-
- map: ast_map::Map,
- intrinsic_defs: RefCell<DefIdMap<t>>,
- freevars: RefCell<freevars::freevar_map>,
- tcache: type_cache,
- rcache: creader_cache,
- short_names_cache: RefCell<HashMap<t, ~str>>,
- needs_unwind_cleanup_cache: RefCell<HashMap<t, bool>>,
- tc_cache: RefCell<HashMap<uint, TypeContents>>,
- ast_ty_to_ty_cache: RefCell<NodeMap<ast_ty_to_ty_cache_entry>>,
- enum_var_cache: RefCell<DefIdMap<@Vec<@VariantInfo> >>,
- ty_param_defs: RefCell<NodeMap<TypeParameterDef>>,
- adjustments: RefCell<NodeMap<@AutoAdjustment>>,
- normalized_cache: RefCell<HashMap<t, t>>,
- lang_items: @middle::lang_items::LanguageItems,
+ pub trait_methods_cache: RefCell<DefIdMap<@Vec<@Method> >>,
+
+ pub impl_trait_cache: RefCell<DefIdMap<Option<@ty::TraitRef>>>,
+
+ pub trait_refs: RefCell<NodeMap<@TraitRef>>,
+ pub trait_defs: RefCell<DefIdMap<@TraitDef>>,
+
+ pub map: ast_map::Map,
+ pub intrinsic_defs: RefCell<DefIdMap<t>>,
+ pub freevars: RefCell<freevars::freevar_map>,
+ pub tcache: type_cache,
+ pub rcache: creader_cache,
+ pub short_names_cache: RefCell<HashMap<t, ~str>>,
+ pub needs_unwind_cleanup_cache: RefCell<HashMap<t, bool>>,
+ pub tc_cache: RefCell<HashMap<uint, TypeContents>>,
+ pub ast_ty_to_ty_cache: RefCell<NodeMap<ast_ty_to_ty_cache_entry>>,
+ pub enum_var_cache: RefCell<DefIdMap<@Vec<@VariantInfo> >>,
+ pub ty_param_defs: RefCell<NodeMap<TypeParameterDef>>,
+ pub adjustments: RefCell<NodeMap<@AutoAdjustment>>,
+ pub normalized_cache: RefCell<HashMap<t, t>>,
+ pub lang_items: @middle::lang_items::LanguageItems,
// A mapping of fake provided method def_ids to the default implementation
- provided_method_sources: RefCell<DefIdMap<ast::DefId>>,
- supertraits: RefCell<DefIdMap<@Vec<@TraitRef> >>,
+ pub provided_method_sources: RefCell<DefIdMap<ast::DefId>>,
+ pub supertraits: RefCell<DefIdMap<@Vec<@TraitRef> >>,
// Maps from def-id of a type or region parameter to its
// (inferred) variance.
- item_variance_map: RefCell<DefIdMap<@ItemVariances>>,
+ pub item_variance_map: RefCell<DefIdMap<@ItemVariances>>,
// A mapping from the def ID of an enum or struct type to the def ID
// of the method that implements its destructor. If the type is not
// present in this map, it does not have a destructor. This map is
// populated during the coherence phase of typechecking.
- destructor_for_type: RefCell<DefIdMap<ast::DefId>>,
+ pub destructor_for_type: RefCell<DefIdMap<ast::DefId>>,
// A method will be in this list if and only if it is a destructor.
- destructors: RefCell<DefIdSet>,
+ pub destructors: RefCell<DefIdSet>,
// Maps a trait onto a list of impls of that trait.
- trait_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
+ pub trait_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
// Maps a def_id of a type to a list of its inherent impls.
// Contains implementations of methods that are inherent to a type.
// Methods in these implementations don't need to be exported.
- inherent_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
+ pub inherent_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
// Maps a def_id of an impl to an Impl structure.
// Note that this contains all of the impls that we know about,
// including ones in other crates. It's not clear that this is the best
// way to do it.
- impls: RefCell<DefIdMap<@Impl>>,
+ pub impls: RefCell<DefIdMap<@Impl>>,
// Set of used unsafe nodes (functions or blocks). Unsafe nodes not
// present in this set can be warned about.
- used_unsafe: RefCell<NodeSet>,
+ pub used_unsafe: RefCell<NodeSet>,
// Set of nodes which mark locals as mutable which end up getting used at
// some point. Local variable definitions not in this set can be warned
// about.
- used_mut_nodes: RefCell<NodeSet>,
+ pub used_mut_nodes: RefCell<NodeSet>,
// vtable resolution information for impl declarations
- impl_vtables: typeck::impl_vtable_map,
+ pub impl_vtables: typeck::impl_vtable_map,
// The set of external nominal types whose implementations have been read.
// This is used for lazy resolution of methods.
- populated_external_types: RefCell<DefIdSet>,
+ pub populated_external_types: RefCell<DefIdSet>,
// The set of external traits whose implementations have been read. This
// is used for lazy resolution of traits.
- populated_external_traits: RefCell<DefIdSet>,
+ pub populated_external_traits: RefCell<DefIdSet>,
// Borrows
- upvar_borrow_map: RefCell<UpvarBorrowMap>,
+ pub upvar_borrow_map: RefCell<UpvarBorrowMap>,
// These two caches are used by const_eval when decoding external statics
// and variants that are found.
- extern_const_statics: RefCell<DefIdMap<Option<@ast::Expr>>>,
- extern_const_variants: RefCell<DefIdMap<Option<@ast::Expr>>>,
+ pub extern_const_statics: RefCell<DefIdMap<Option<@ast::Expr>>>,
+ pub extern_const_variants: RefCell<DefIdMap<Option<@ast::Expr>>>,
}
pub enum tbox_flag {
has_ty_err = 16,
has_ty_bot = 32,
- // a meta-flag: subst may be required if the type has parameters, a self
+ // 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
}
pub type t_box = &'static t_box_;
pub struct t_box_ {
- sty: sty,
- id: uint,
- flags: uint,
+ pub sty: sty,
+ pub id: uint,
+ pub flags: uint,
}
// To reduce refcounting cost, we're representing types as unsafe pointers
#[allow(raw_pointer_deriving)]
#[deriving(Clone, Eq, TotalEq, Hash)]
-pub struct t { priv inner: *t_opaque }
+pub struct t { inner: *t_opaque }
impl fmt::Show for t {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct BareFnTy {
- purity: ast::Purity,
- abis: AbiSet,
- sig: FnSig
+ pub purity: ast::Purity,
+ pub abis: AbiSet,
+ pub sig: FnSig
}
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct ClosureTy {
- purity: ast::Purity,
- sigil: ast::Sigil,
- onceness: ast::Onceness,
- region: Region,
- bounds: BuiltinBounds,
- sig: FnSig,
+ pub purity: ast::Purity,
+ pub sigil: ast::Sigil,
+ pub onceness: ast::Onceness,
+ pub region: Region,
+ pub bounds: BuiltinBounds,
+ pub sig: FnSig,
}
/**
*/
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct FnSig {
- binder_id: ast::NodeId,
- inputs: Vec<t>,
- output: t,
- variadic: bool
+ pub binder_id: ast::NodeId,
+ pub inputs: Vec<t>,
+ pub output: t,
+ pub variadic: bool
}
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct param_ty {
- idx: uint,
- def_id: DefId
+ pub idx: uint,
+ pub def_id: DefId
}
/// Representation of regions:
*/
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct UpvarId {
- var_id: ast::NodeId,
- closure_expr_id: ast::NodeId,
+ pub var_id: ast::NodeId,
+ pub closure_expr_id: ast::NodeId,
}
#[deriving(Clone, Eq, TotalEq, Hash)]
*/
#[deriving(Eq, Clone)]
pub struct UpvarBorrow {
- kind: BorrowKind,
- region: ty::Region,
+ pub kind: BorrowKind,
+ pub region: ty::Region,
}
pub type UpvarBorrowMap = HashMap<UpvarId, UpvarBorrow>;
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
pub struct FreeRegion {
- scope_id: NodeId,
- bound_region: BoundRegion
+ pub scope_id: NodeId,
+ pub bound_region: BoundRegion
}
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
* always substituted away to the implementing type for a trait. */
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct substs {
- self_ty: Option<ty::t>,
- tps: Vec<t>,
- regions: RegionSubsts,
+ pub self_ty: Option<ty::t>,
+ pub tps: Vec<t>,
+ pub regions: RegionSubsts,
}
mod primitives {
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct TyTrait {
- def_id: DefId,
- substs: substs,
- store: TraitStore,
- mutability: ast::Mutability,
- bounds: BuiltinBounds
+ pub def_id: DefId,
+ pub substs: substs,
+ pub store: TraitStore,
+ pub mutability: ast::Mutability,
+ pub bounds: BuiltinBounds
}
#[deriving(Eq, TotalEq, Hash)]
pub struct TraitRef {
- def_id: DefId,
- substs: substs
+ pub def_id: DefId,
+ pub substs: substs
}
#[deriving(Clone, Eq)]
#[deriving(Clone, Show)]
pub struct expected_found<T> {
- expected: T,
- found: T
+ pub expected: T,
+ pub found: T
}
// Data structures used in type unification
#[deriving(Eq, TotalEq, Hash)]
pub struct ParamBounds {
- builtin_bounds: BuiltinBounds,
- trait_bounds: Vec<@TraitRef> }
+ pub builtin_bounds: BuiltinBounds,
+ pub trait_bounds: Vec<@TraitRef> }
pub type BuiltinBounds = EnumSet<BuiltinBound>;
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct RegionVid {
- id: uint
+ pub id: uint
}
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone)]
pub struct TypeParameterDef {
- ident: ast::Ident,
- def_id: ast::DefId,
- bounds: @ParamBounds,
- default: Option<ty::t>
+ pub ident: ast::Ident,
+ pub def_id: ast::DefId,
+ pub bounds: @ParamBounds,
+ pub default: Option<ty::t>
}
#[deriving(Encodable, Decodable, Clone)]
pub struct RegionParameterDef {
- name: ast::Name,
- def_id: ast::DefId,
+ pub name: ast::Name,
+ pub def_id: ast::DefId,
}
/// Information about the type/lifetime parameters associated with an item.
#[deriving(Clone)]
pub struct Generics {
/// List of type parameters declared on the item.
- type_param_defs: Rc<Vec<TypeParameterDef> >,
+ pub type_param_defs: Rc<Vec<TypeParameterDef>>,
/// List of region parameters declared on the item.
/// For a fn or method, only includes *early-bound* lifetimes.
- region_param_defs: Rc<Vec<RegionParameterDef> >,
+ pub region_param_defs: Rc<Vec<RegionParameterDef>>,
}
impl Generics {
/// In general, this means converting from bound parameters to
/// free parameters. Since we currently represent bound/free type
/// parameters in the same way, this only has an affect on regions.
- free_substs: ty::substs,
+ pub free_substs: ty::substs,
/// Bound on the Self parameter
- self_param_bound: Option<@TraitRef>,
+ pub self_param_bound: Option<@TraitRef>,
/// Bounds on each numbered type parameter
- type_param_bounds: Vec<ParamBounds> ,
+ pub type_param_bounds: Vec<ParamBounds> ,
}
/// A polytype.
/// region `&self` or to (unsubstituted) ty_param types
#[deriving(Clone)]
pub struct ty_param_bounds_and_ty {
- generics: Generics,
- ty: t
+ pub generics: Generics,
+ pub ty: t
}
/// As `ty_param_bounds_and_ty` but for a trait ref.
pub struct TraitDef {
- generics: Generics,
- bounds: BuiltinBounds,
- trait_ref: @ty::TraitRef,
+ pub generics: Generics,
+ pub bounds: BuiltinBounds,
+ pub trait_ref: @ty::TraitRef,
}
pub struct ty_param_substs_and_ty {
- substs: ty::substs,
- ty: ty::t
+ pub substs: ty::substs,
+ pub ty: ty::t
}
pub type type_cache = RefCell<DefIdMap<ty_param_bounds_and_ty>>;
* a type than to think about what is *not* contained within a type.
*/
pub struct TypeContents {
- bits: u64
+ pub bits: u64
}
macro_rules! def_type_content_sets(
}
pub struct ParamsTy {
- params: Vec<t>,
- ty: t
+ pub params: Vec<t>,
+ pub ty: t
}
pub fn expr_ty_params_and_ty(cx: &ctxt,
// Enum information
#[deriving(Clone)]
pub struct VariantInfo {
- args: Vec<t>,
- arg_names: Option<Vec<ast::Ident> >,
- ctor_ty: t,
- name: ast::Ident,
- id: ast::DefId,
- disr_val: Disr,
- vis: Visibility
+ pub args: Vec<t>,
+ pub arg_names: Option<Vec<ast::Ident> >,
+ pub ctor_ty: t,
+ pub name: ast::Ident,
+ pub id: ast::DefId,
+ pub disr_val: Disr,
+ pub vis: Visibility
}
impl VariantInfo {
// Some sample folders
pub struct BottomUpFolder<'a> {
- tcx: &'a ty::ctxt,
- fldop: 'a |ty::t| -> ty::t,
+ pub tcx: &'a ty::ctxt,
+ pub fldop: 'a |ty::t| -> ty::t,
}
impl<'a> TypeFolder for BottomUpFolder<'a> {
}
pub struct pat_ctxt<'a> {
- fcx: &'a FnCtxt<'a>,
- map: PatIdMap,
+ pub fcx: &'a FnCtxt<'a>,
+ pub map: PatIdMap,
}
pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,
#[deriving(Clone)]
pub struct PurityState {
- def: ast::NodeId,
- purity: ast::Purity,
- priv from_fn: bool
+ pub def: ast::NodeId,
+ pub purity: ast::Purity,
+ from_fn: bool
}
impl PurityState {
/// A vtable context includes an inference context, a crate context, and a
/// callback function to call in case of type error.
pub struct VtableContext<'a> {
- infcx: &'a infer::InferCtxt<'a>,
- param_env: &'a ty::ParameterEnvironment,
+ pub infcx: &'a infer::InferCtxt<'a>,
+ pub param_env: &'a ty::ParameterEnvironment,
}
impl<'a> VtableContext<'a> {
}
pub struct CombineFields<'a> {
- infcx: &'a InferCtxt<'a>,
- a_is_expected: bool,
- trace: TypeTrace,
+ pub infcx: &'a InferCtxt<'a>,
+ pub a_is_expected: bool,
+ pub trace: TypeTrace,
}
pub fn expected_found<C:Combine,T>(
pub type CoerceResult = cres<Option<@ty::AutoAdjustment>>;
pub struct InferCtxt<'a> {
- tcx: &'a ty::ctxt,
+ pub tcx: &'a ty::ctxt,
// We instantiate ValsAndBindings with bounds<ty::t> because the
// types that might instantiate a general type variable have an
// order, represented by its upper and lower bounds.
- ty_var_bindings: RefCell<ValsAndBindings<ty::TyVid, Bounds<ty::t>>>,
- ty_var_counter: Cell<uint>,
+ pub ty_var_bindings: RefCell<ValsAndBindings<ty::TyVid, Bounds<ty::t>>>,
+ pub ty_var_counter: Cell<uint>,
// Map from integral variable to the kind of integer it represents
- int_var_bindings: RefCell<ValsAndBindings<ty::IntVid,
+ pub int_var_bindings: RefCell<ValsAndBindings<ty::IntVid,
Option<IntVarValue>>>,
- int_var_counter: Cell<uint>,
+ pub int_var_counter: Cell<uint>,
// Map from floating variable to the kind of float it represents
- float_var_bindings: RefCell<ValsAndBindings<ty::FloatVid,
+ pub float_var_bindings: RefCell<ValsAndBindings<ty::FloatVid,
Option<ast::FloatTy>>>,
- float_var_counter: Cell<uint>,
+ pub float_var_counter: Cell<uint>,
// For region variables.
- region_vars: RegionVarBindings<'a>,
+ pub region_vars: RegionVarBindings<'a>,
}
/// Why did we require that the two types be related?
/// 'a and 'b together inside a SameRegions struct
#[deriving(Clone)]
pub struct SameRegions {
- scope_id: ast::NodeId,
- regions: Vec<BoundRegion>
+ pub scope_id: ast::NodeId,
+ pub regions: Vec<BoundRegion>
}
impl SameRegions {
}
pub struct ValsAndBindings<V, T> {
- vals: SmallIntMap<VarValue<V, T>>,
- bindings: Vec<(V, VarValue<V, T>)> ,
+ pub vals: SmallIntMap<VarValue<V, T>>,
+ pub bindings: Vec<(V, VarValue<V, T>)> ,
}
pub struct Node<V, T> {
- root: V,
- possible_types: T,
- rank: uint,
+ pub root: V,
+ pub possible_types: T,
+ pub rank: uint,
}
pub trait UnifyVid<T> {
#[deriving(Clone, Encodable, Decodable)]
pub struct MethodParam {
// the trait containing the method to be invoked
- trait_id: ast::DefId,
+ pub trait_id: ast::DefId,
// index of the method to be invoked amongst the trait's methods
- method_num: uint,
+ pub method_num: uint,
// index of the type parameter (from those that are in scope) that is
// the type of the receiver
- param_num: param_index,
+ pub param_num: param_index,
// index of the bound for this type parameter which specifies the trait
- bound_num: uint,
+ pub bound_num: uint,
}
// details for a method invoked with a receiver whose type is an object
#[deriving(Clone, Encodable, Decodable)]
pub struct MethodObject {
// the (super)trait containing the method to be invoked
- trait_id: ast::DefId,
+ pub trait_id: ast::DefId,
// the actual base trait id of the object
- object_trait_id: ast::DefId,
+ pub object_trait_id: ast::DefId,
// index of the method to be invoked amongst the trait's methods
- method_num: uint,
+ pub method_num: uint,
// index into the actual runtime vtable.
// the vtable is formed by concatenating together the method lists of
// the base object trait and all supertraits; this is the index into
// that vtable
- real_index: uint,
+ pub real_index: uint,
}
#[deriving(Clone)]
pub struct MethodCallee {
- origin: MethodOrigin,
- ty: ty::t,
- substs: ty::substs
+ pub origin: MethodOrigin,
+ pub ty: ty::t,
+ pub substs: ty::substs
}
#[deriving(Clone, Eq, TotalEq, Hash, Show)]
pub struct MethodCall {
- expr_id: ast::NodeId,
- autoderef: u32
+ pub expr_id: ast::NodeId,
+ pub autoderef: u32
}
impl MethodCall {
#[deriving(Clone)]
pub struct impl_res {
// resolutions for any bounded params on the trait definition
- trait_vtables: vtable_res,
+ pub trait_vtables: vtable_res,
// resolutions for the trait /itself/ (and for supertraits)
- self_vtables: vtable_param_res
+ pub self_vtables: vtable_param_res
}
impl Repr for impl_res {
/// The SHA-256 hash algorithm
pub struct Sha256 {
- priv engine: Engine256
+ engine: Engine256
}
impl Sha256 {