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