librustc: De-export back, lib, and util. rs=deexporting

This commit is contained in:
Patrick Walton 2013-01-29 15:48:50 -08:00
parent 3105bcfdc1
commit 2ea2628ca9
16 changed files with 758 additions and 725 deletions

View File

@ -11,72 +11,72 @@
const rc_base_field_refcnt: uint = 0u;
pub const rc_base_field_refcnt: uint = 0u;
const task_field_refcnt: uint = 0u;
pub const task_field_refcnt: uint = 0u;
const task_field_stk: uint = 2u;
pub const task_field_stk: uint = 2u;
const task_field_runtime_sp: uint = 3u;
pub const task_field_runtime_sp: uint = 3u;
const task_field_rust_sp: uint = 4u;
pub const task_field_rust_sp: uint = 4u;
const task_field_gc_alloc_chain: uint = 5u;
pub const task_field_gc_alloc_chain: uint = 5u;
const task_field_dom: uint = 6u;
pub const task_field_dom: uint = 6u;
const n_visible_task_fields: uint = 7u;
pub const n_visible_task_fields: uint = 7u;
const dom_field_interrupt_flag: uint = 1u;
pub const dom_field_interrupt_flag: uint = 1u;
const frame_glue_fns_field_mark: uint = 0u;
pub const frame_glue_fns_field_mark: uint = 0u;
const frame_glue_fns_field_drop: uint = 1u;
pub const frame_glue_fns_field_drop: uint = 1u;
const frame_glue_fns_field_reloc: uint = 2u;
pub const frame_glue_fns_field_reloc: uint = 2u;
const box_field_refcnt: uint = 0u;
const box_field_tydesc: uint = 1u;
const box_field_prev: uint = 2u;
const box_field_next: uint = 3u;
const box_field_body: uint = 4u;
pub const box_field_refcnt: uint = 0u;
pub const box_field_tydesc: uint = 1u;
pub const box_field_prev: uint = 2u;
pub const box_field_next: uint = 3u;
pub const box_field_body: uint = 4u;
const general_code_alignment: uint = 16u;
pub const general_code_alignment: uint = 16u;
const tydesc_field_size: uint = 0u;
const tydesc_field_align: uint = 1u;
const tydesc_field_take_glue: uint = 2u;
const tydesc_field_drop_glue: uint = 3u;
const tydesc_field_free_glue: uint = 4u;
const tydesc_field_visit_glue: uint = 5u;
const tydesc_field_shape: uint = 6u;
const tydesc_field_shape_tables: uint = 7u;
const n_tydesc_fields: uint = 8u;
pub const tydesc_field_size: uint = 0u;
pub const tydesc_field_align: uint = 1u;
pub const tydesc_field_take_glue: uint = 2u;
pub const tydesc_field_drop_glue: uint = 3u;
pub const tydesc_field_free_glue: uint = 4u;
pub const tydesc_field_visit_glue: uint = 5u;
pub const tydesc_field_shape: uint = 6u;
pub const tydesc_field_shape_tables: uint = 7u;
pub const n_tydesc_fields: uint = 8u;
// The two halves of a closure: code and environment.
const fn_field_code: uint = 0u;
const fn_field_box: uint = 1u;
pub const fn_field_code: uint = 0u;
pub const fn_field_box: uint = 1u;
const vec_elt_fill: uint = 0u;
pub const vec_elt_fill: uint = 0u;
const vec_elt_alloc: uint = 1u;
pub const vec_elt_alloc: uint = 1u;
const vec_elt_elems: uint = 2u;
pub const vec_elt_elems: uint = 2u;
const slice_elt_base: uint = 0u;
const slice_elt_len: uint = 1u;
pub const slice_elt_base: uint = 0u;
pub const slice_elt_len: uint = 1u;
const worst_case_glue_call_args: uint = 7u;
pub const worst_case_glue_call_args: uint = 7u;
const abi_version: uint = 1u;
pub const abi_version: uint = 1u;
fn memcpy_glue_name() -> ~str { return ~"rust_memcpy_glue"; }
pub fn memcpy_glue_name() -> ~str { return ~"rust_memcpy_glue"; }
fn bzero_glue_name() -> ~str { return ~"rust_bzero_glue"; }
pub fn bzero_glue_name() -> ~str { return ~"rust_bzero_glue"; }
fn yield_glue_name() -> ~str { return ~"rust_yield_glue"; }
pub fn yield_glue_name() -> ~str { return ~"rust_yield_glue"; }
fn no_op_type_glue_name() -> ~str { return ~"rust_no_op_type_glue"; }
pub fn no_op_type_glue_name() -> ~str { return ~"rust_no_op_type_glue"; }
//
// Local Variables:
// mode: rust

View File

@ -13,7 +13,7 @@ use driver::session;
use session::sess_os_to_meta_os;
use metadata::loader::meta_section_name;
fn get_target_strs(target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
return {
module_asm: ~"",

View File

@ -43,7 +43,8 @@ use syntax::ast_map::{path, path_mod, path_name};
use syntax::attr;
use syntax::print::pprust;
enum output_type {
#[deriving_eq]
pub enum output_type {
output_type_none,
output_type_bitcode,
output_type_assembly,
@ -52,13 +53,6 @@ enum output_type {
output_type_exe,
}
impl output_type : cmp::Eq {
pure fn eq(&self, other: &output_type) -> bool {
((*self) as uint) == ((*other) as uint)
}
pure fn ne(&self, other: &output_type) -> bool { !(*self).eq(other) }
}
pub fn llvm_err(sess: Session, +msg: ~str) -> ! {
unsafe {
let cstr = llvm::LLVMRustGetLastError();
@ -170,15 +164,15 @@ pub mod jit {
}
}
mod write {
pub mod write {
use back::link::jit;
use back::link::{ModuleRef, WriteOutputFile, output_type};
use back::link::{WriteOutputFile, output_type};
use back::link::{output_type_assembly, output_type_bitcode};
use back::link::{output_type_exe, output_type_llvm_assembly};
use back::link::{output_type_object};
use driver::session;
use lib::llvm::llvm;
use lib::llvm::{False, True, mk_pass_manager, mk_target_data};
use lib::llvm::{False, True, ModuleRef, mk_pass_manager, mk_target_data};
use lib;
use session::Session;
@ -456,7 +450,7 @@ mod write {
*
*/
fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
symbol_hasher: &hash::State) -> link_meta {
type provided_metas =
@ -575,7 +569,7 @@ fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
return {name: name, vers: vers, extras_hash: extras_hash};
}
fn truncated_hash_result(symbol_hasher: &hash::State) -> ~str {
pub fn truncated_hash_result(symbol_hasher: &hash::State) -> ~str {
unsafe {
symbol_hasher.result_str()
}
@ -583,7 +577,7 @@ fn truncated_hash_result(symbol_hasher: &hash::State) -> ~str {
// This calculates STH for a symbol, as defined above
fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
pub fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
link_meta: link_meta) -> @str {
// NB: do *not* use abbrevs here as we want the symbol names
// to be independent of one another in the crate.
@ -601,7 +595,7 @@ fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
hash.to_managed()
}
fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
pub fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
match ccx.type_hashcodes.find(t) {
Some(h) => h,
None => {
@ -615,7 +609,7 @@ fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
// Name sanitation. LLVM will happily accept identifiers with weird names, but
// gas doesn't!
fn sanitize(s: ~str) -> ~str {
pub fn sanitize(s: ~str) -> ~str {
let mut result = ~"";
for str::chars_each(s) |c| {
match c {
@ -648,7 +642,7 @@ fn sanitize(s: ~str) -> ~str {
return result;
}
fn mangle(sess: Session, ss: path) -> ~str {
pub fn mangle(sess: Session, ss: path) -> ~str {
// Follow C++ namespace-mangling style
let mut n = ~"_ZN"; // Begin name-sequence.
@ -663,26 +657,26 @@ fn mangle(sess: Session, ss: path) -> ~str {
n
}
fn exported_name(sess: Session,
+path: path,
hash: &str,
vers: &str) -> ~str {
pub fn exported_name(sess: Session,
+path: path,
hash: &str,
vers: &str) -> ~str {
return mangle(sess,
vec::append_one(
vec::append_one(path, path_name(sess.ident_of(hash.to_owned()))),
path_name(sess.ident_of(vers.to_owned()))));
}
fn mangle_exported_name(ccx: @crate_ctxt, +path: path, t: ty::t) -> ~str {
pub fn mangle_exported_name(ccx: @crate_ctxt, +path: path, t: ty::t) -> ~str {
let hash = get_symbol_hash(ccx, t);
return exported_name(ccx.sess, path,
hash,
ccx.link_meta.vers);
}
fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
t: ty::t,
name: &str) -> ~str {
pub fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
t: ty::t,
name: &str) -> ~str {
let s = ppaux::ty_to_short_str(ccx.tcx, t);
let hash = get_symbol_hash(ccx, t);
return mangle(ccx.sess,
@ -691,23 +685,23 @@ fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
path_name(ccx.sess.ident_of(hash.to_owned()))]);
}
fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt,
+path: path,
+flav: ~str) -> ~str {
pub fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt,
+path: path,
+flav: ~str) -> ~str {
return mangle(ccx.sess,
vec::append_one(path, path_name((ccx.names)(flav))));
}
fn mangle_internal_name_by_path(ccx: @crate_ctxt, +path: path) -> ~str {
pub fn mangle_internal_name_by_path(ccx: @crate_ctxt, +path: path) -> ~str {
return mangle(ccx.sess, path);
}
fn mangle_internal_name_by_seq(ccx: @crate_ctxt, +flav: ~str) -> ~str {
pub fn mangle_internal_name_by_seq(ccx: @crate_ctxt, +flav: ~str) -> ~str {
return fmt!("%s_%u", flav, (ccx.names)(flav).repr);
}
fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
pub fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
let libname = fmt!("%s-%s-%s", lm.name, lm.extras_hash, lm.vers);
let (dll_prefix, dll_suffix) = match os {
session::os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
@ -722,10 +716,10 @@ fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
// If the user wants an exe generated we need to invoke
// cc to link the object file with some libs
fn link_binary(sess: Session,
obj_filename: &Path,
out_filename: &Path,
lm: link_meta) {
pub fn link_binary(sess: Session,
obj_filename: &Path,
out_filename: &Path,
lm: link_meta) {
// Converts a library file-stem into a cc -l argument
fn unlib(config: @session::config, +stem: ~str) -> ~str {
if stem.starts_with("lib") &&

View File

@ -21,14 +21,6 @@ use core::vec;
use std::map::HashMap;
use std::map;
export get_absolute_rpath;
export get_install_prefix_rpath;
export get_relative_to;
export get_rpath_flags;
export get_rpath_relative_to_output;
export minimize_rpaths;
export rpaths_to_flags;
pure fn not_win32(os: session::os) -> bool {
match os {
session::os_win32 => false,
@ -36,7 +28,8 @@ pure fn not_win32(os: session::os) -> bool {
}
}
fn get_rpath_flags(sess: session::Session, out_filename: &Path) -> ~[~str] {
pub fn get_rpath_flags(sess: session::Session, out_filename: &Path)
-> ~[~str] {
let os = sess.targ_cfg.os;
// No rpath on windows
@ -63,7 +56,7 @@ fn get_sysroot_absolute_rt_lib(sess: session::Session) -> Path {
sess.filesearch.sysroot().push_rel(&r).push(os::dll_filename("rustrt"))
}
fn rpaths_to_flags(rpaths: &[Path]) -> ~[~str] {
pub fn rpaths_to_flags(rpaths: &[Path]) -> ~[~str] {
vec::map(rpaths, |rpath| fmt!("-Wl,-rpath,%s",rpath.to_str()))
}
@ -120,10 +113,10 @@ fn get_rpaths_relative_to_output(os: session::os,
})
}
fn get_rpath_relative_to_output(os: session::os,
output: &Path,
lib: &Path)
-> Path {
pub fn get_rpath_relative_to_output(os: session::os,
output: &Path,
lib: &Path)
-> Path {
use core::os;
assert not_win32(os);
@ -141,7 +134,7 @@ fn get_rpath_relative_to_output(os: session::os,
}
// Find the relative path from one file to another
fn get_relative_to(abs1: &Path, abs2: &Path) -> Path {
pub fn get_relative_to(abs1: &Path, abs2: &Path) -> Path {
assert abs1.is_absolute;
assert abs2.is_absolute;
let abs1 = abs1.normalize();
@ -178,11 +171,11 @@ fn get_absolute_rpaths(libs: &[Path]) -> ~[Path] {
vec::map(libs, |a| get_absolute_rpath(a) )
}
fn get_absolute_rpath(lib: &Path) -> Path {
pub fn get_absolute_rpath(lib: &Path) -> Path {
os::make_absolute(lib).dir_path()
}
fn get_install_prefix_rpath(target_triple: &str) -> Path {
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
let install_prefix = env!("CFG_PREFIX");
if install_prefix == ~"" {
@ -193,7 +186,7 @@ fn get_install_prefix_rpath(target_triple: &str) -> Path {
os::make_absolute(&Path(install_prefix).push_rel(&tlib))
}
fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
let set = map::HashMap();
let mut minimized = ~[];
for rpaths.each |rpath| {

View File

@ -9,7 +9,7 @@
// except according to those terms.
type t = {
pub type t = {
module_asm: ~str,
meta_sect_name: ~str,
data_layout: ~str,

View File

@ -17,15 +17,15 @@ use middle::trans::common::{T_fn, T_i1, T_i8, T_i32,
T_size_t, T_void, T_vec2};
use lib::llvm::{type_names, ModuleRef, ValueRef, TypeRef};
type upcalls =
pub type upcalls =
{trace: ValueRef,
call_shim_on_c_stack: ValueRef,
call_shim_on_rust_stack: ValueRef,
rust_personality: ValueRef,
reset_stack_limit: ValueRef};
fn declare_upcalls(targ_cfg: @session::config,
llmod: ModuleRef) -> @upcalls {
pub fn declare_upcalls(targ_cfg: @session::config,
llmod: ModuleRef) -> @upcalls {
fn decl(llmod: ModuleRef, prefix: ~str, name: ~str,
tys: ~[TypeRef], rv: TypeRef) ->
ValueRef {

View File

@ -14,7 +14,7 @@ use driver::session;
use metadata::loader::meta_section_name;
use session::sess_os_to_meta_os;
fn get_target_strs(target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
return {
module_asm: ~"",

View File

@ -14,7 +14,7 @@ use driver::session;
use metadata::loader::meta_section_name;
use session::sess_os_to_meta_os;
fn get_target_strs(target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
return {
module_asm: ~"",

View File

@ -15,10 +15,6 @@ use syntax::{ast, fold, attr};
use core::option;
use core::vec;
export strip_unconfigured_items;
export metas_in_cfg;
export strip_items;
type in_cfg_pred = fn@(+attrs: ~[ast::attribute]) -> bool;
type ctxt = @{
@ -27,13 +23,13 @@ type ctxt = @{
// Support conditional compilation by transforming the AST, stripping out
// any items that do not belong in the current configuration
fn strip_unconfigured_items(crate: @ast::crate) -> @ast::crate {
pub fn strip_unconfigured_items(crate: @ast::crate) -> @ast::crate {
do strip_items(crate) |attrs| {
in_cfg(/*bad*/copy crate.node.config, attrs)
}
}
fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred)
pub fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred)
-> @ast::crate {
let ctxt = @{in_cfg: in_cfg};
@ -179,7 +175,8 @@ fn in_cfg(+cfg: ast::crate_cfg, +attrs: ~[ast::attribute]) -> bool {
metas_in_cfg(cfg, attr::attr_metas(attrs))
}
fn metas_in_cfg(cfg: ast::crate_cfg, +metas: ~[@ast::meta_item]) -> bool {
pub fn metas_in_cfg(cfg: ast::crate_cfg,
+metas: ~[@ast::meta_item]) -> bool {
// The "cfg" attributes on the item
let cfg_metas = attr::find_meta_items_by_name(metas, ~"cfg");

View File

@ -19,12 +19,10 @@ use syntax::attr;
use syntax::codemap;
use syntax::fold;
export maybe_inject_libcore_ref;
const CORE_VERSION: &static/str = "0.6";
fn maybe_inject_libcore_ref(sess: Session,
crate: @ast::crate) -> @ast::crate {
pub fn maybe_inject_libcore_ref(sess: Session,
crate: @ast::crate) -> @ast::crate {
if use_core(crate) {
inject_libcore_ref(sess, crate)
} else {

View File

@ -16,9 +16,7 @@ use syntax::ast;
use core::vec;
export inject_intrinsic;
fn inject_intrinsic(sess: Session, crate: @ast::crate) -> @ast::crate {
pub fn inject_intrinsic(sess: Session, crate: @ast::crate) -> @ast::crate {
let intrinsic_module = @(include_str!("intrinsic.rs").to_owned());
let item = parse::parse_item_from_source_str(~"<intrinsic>",

View File

@ -27,8 +27,6 @@ use syntax::print::pprust;
use syntax::{ast, ast_util};
use syntax::attr::attrs_contains_name;
export modify_for_testing;
type node_id_gen = fn@() -> ast::node_id;
type test = {span: span, path: ~[ast::ident],
@ -42,8 +40,8 @@ type test_ctxt =
// Traverse the crate, collecting all the test functions, eliding any
// existing main functions, and synthesizing a main test harness
fn modify_for_testing(sess: session::Session,
crate: @ast::crate) -> @ast::crate {
pub fn modify_for_testing(sess: session::Session,
crate: @ast::crate) -> @ast::crate {
// We generate the test harness when building in the 'test'
// configuration, either with the '--test' or '--cfg test'

File diff suppressed because it is too large Load Diff

View File

@ -144,32 +144,20 @@ pub mod middle {
}
pub mod front {
#[legacy_exports]
pub mod config;
#[legacy_exports]
pub mod test;
#[legacy_exports]
pub mod core_inject;
#[legacy_exports]
pub mod intrinsic_inject;
}
pub mod back {
#[legacy_exports]
pub mod link;
#[legacy_exports]
pub mod abi;
#[legacy_exports]
pub mod upcall;
#[legacy_exports]
pub mod arm;
#[legacy_exports]
pub mod x86;
#[legacy_exports]
pub mod x86_64;
#[legacy_exports]
pub mod rpath;
#[legacy_exports]
pub mod target_strs;
}
@ -180,14 +168,11 @@ pub mod metadata;
pub mod driver;
pub mod util {
#[legacy_exports]
pub mod common;
#[legacy_exports]
pub mod ppaux;
}
pub mod lib {
#[legacy_exports]
pub mod llvm;
}

View File

@ -21,7 +21,7 @@ use core::str;
use core::vec;
use std::map::HashMap;
fn indent<R>(op: fn() -> R) -> R {
pub fn indent<R>(op: fn() -> R) -> R {
// Use in conjunction with the log post-processor like `src/etc/indenter`
// to make debug output more readable.
debug!(">>");
@ -30,33 +30,33 @@ fn indent<R>(op: fn() -> R) -> R {
move r
}
struct _indenter {
pub struct _indenter {
_i: (),
drop { debug!("<<"); }
}
fn _indenter(_i: ()) -> _indenter {
pub fn _indenter(_i: ()) -> _indenter {
_indenter {
_i: ()
}
}
fn indenter() -> _indenter {
pub fn indenter() -> _indenter {
debug!(">>");
_indenter(())
}
type flag = HashMap<~str, ()>;
pub type flag = HashMap<~str, ()>;
fn field_expr(f: ast::field) -> @ast::expr { return f.node.expr; }
pub fn field_expr(f: ast::field) -> @ast::expr { return f.node.expr; }
fn field_exprs(fields: ~[ast::field]) -> ~[@ast::expr] {
pub fn field_exprs(fields: ~[ast::field]) -> ~[@ast::expr] {
fields.map(|f| f.node.expr)
}
// Takes a predicate p, returns true iff p is true for any subexpressions
// of b -- skipping any inner loops (loop, while, loop_body)
fn loop_query(b: ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
pub fn loop_query(b: ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
let rs = @mut false;
let visit_expr: @fn(@ast::expr,
&&flag: @mut bool,
@ -79,7 +79,7 @@ fn loop_query(b: ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
// Takes a predicate p, returns true iff p is true for any subexpressions
// of b -- skipping any inner loops (loop, while, loop_body)
fn block_query(b: ast::blk, p: fn@(@ast::expr) -> bool) -> bool {
pub fn block_query(b: ast::blk, p: fn@(@ast::expr) -> bool) -> bool {
let rs = @mut false;
let visit_expr: @fn(@ast::expr,
&&flag: @mut bool,
@ -94,20 +94,20 @@ fn block_query(b: ast::blk, p: fn@(@ast::expr) -> bool) -> bool {
return *rs;
}
fn local_rhs_span(l: @ast::local, def: span) -> span {
pub fn local_rhs_span(l: @ast::local, def: span) -> span {
match l.node.init {
Some(i) => return i.span,
_ => return def
}
}
fn pluralize(n: uint, +s: ~str) -> ~str {
pub fn pluralize(n: uint, +s: ~str) -> ~str {
if n == 1 { s }
else { str::concat([s, ~"s"]) }
}
// A set of node IDs (used to keep track of which node IDs are for statements)
type stmt_set = HashMap<ast::node_id, ()>;
pub type stmt_set = HashMap<ast::node_id, ()>;
//
// Local Variables:

View File

@ -38,10 +38,10 @@ use core::str;
use core::vec;
use std::map::HashMap;
fn note_and_explain_region(cx: ctxt,
prefix: ~str,
region: ty::Region,
suffix: ~str) {
pub fn note_and_explain_region(cx: ctxt,
prefix: ~str,
region: ty::Region,
suffix: ~str) {
match explain_region_and_span(cx, region) {
(ref str, Some(span)) => {
cx.sess.span_note(
@ -57,15 +57,14 @@ fn note_and_explain_region(cx: ctxt,
/// Returns a string like "the block at 27:31" that attempts to explain a
/// lifetime in a way it might plausibly be understood.
fn explain_region(cx: ctxt, region: ty::Region) -> ~str {
pub fn explain_region(cx: ctxt, region: ty::Region) -> ~str {
let (res, _) = explain_region_and_span(cx, region);
return res;
}
fn explain_region_and_span(cx: ctxt, region: ty::Region)
-> (~str, Option<span>)
{
pub fn explain_region_and_span(cx: ctxt, region: ty::Region)
-> (~str, Option<span>) {
return match region {
re_scope(node_id) => {
match cx.items.find(node_id) {
@ -136,12 +135,12 @@ fn explain_region_and_span(cx: ctxt, region: ty::Region)
}
}
fn bound_region_to_str(cx: ctxt, br: bound_region) -> ~str {
pub fn bound_region_to_str(cx: ctxt, br: bound_region) -> ~str {
bound_region_to_str_adorned(cx, "&", br, "")
}
fn bound_region_to_str_adorned(cx: ctxt, prefix: &str,
br: bound_region, sep: &str) -> ~str {
pub fn bound_region_to_str_adorned(cx: ctxt, prefix: &str,
br: bound_region, sep: &str) -> ~str {
if cx.sess.verbose() { return fmt!("%s%?%s", prefix, br, sep); }
match br {
@ -154,7 +153,7 @@ fn bound_region_to_str_adorned(cx: ctxt, prefix: &str,
}
}
fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
pub fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
match cx.items.find(node_id) {
Some(ast_map::node_block(ref blk)) => {
fmt!("<block at %s>",
@ -197,12 +196,12 @@ fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
// In general, if you are giving a region error message,
// you should use `explain_region()` or, better yet,
// `note_and_explain_region()`
fn region_to_str(cx: ctxt, region: Region) -> ~str {
pub fn region_to_str(cx: ctxt, region: Region) -> ~str {
region_to_str_adorned(cx, "&", region, "")
}
fn region_to_str_adorned(cx: ctxt, prefix: &str,
region: Region, sep: &str) -> ~str {
pub fn region_to_str_adorned(cx: ctxt, prefix: &str,
region: Region, sep: &str) -> ~str {
if cx.sess.verbose() {
return fmt!("%s%?%s", prefix, region, sep);
}
@ -223,7 +222,7 @@ fn region_to_str_adorned(cx: ctxt, prefix: &str,
}
}
fn mt_to_str(cx: ctxt, m: mt) -> ~str {
pub fn mt_to_str(cx: ctxt, m: mt) -> ~str {
let mstr = match m.mutbl {
ast::m_mutbl => "mut ",
ast::m_imm => "",
@ -232,7 +231,7 @@ fn mt_to_str(cx: ctxt, m: mt) -> ~str {
return fmt!("%s%s", mstr, ty_to_str(cx, m.ty));
}
fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
pub fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
match vs {
ty::vstore_fixed(n) => fmt!("%u", n),
ty::vstore_uniq => ~"~",
@ -241,7 +240,7 @@ fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
}
}
fn vstore_ty_to_str(cx: ctxt, ty: ~str, vs: ty::vstore) -> ~str {
pub fn vstore_ty_to_str(cx: ctxt, ty: ~str, vs: ty::vstore) -> ~str {
match vs {
ty::vstore_fixed(_) => {
fmt!("%s/%s", ty, vstore_to_str(cx, vs))
@ -253,8 +252,8 @@ fn vstore_ty_to_str(cx: ctxt, ty: ~str, vs: ty::vstore) -> ~str {
}
}
fn proto_ty_to_str(_cx: ctxt, proto: ast::Proto,
followed_by_word: bool) -> &static/str {
pub fn proto_ty_to_str(_cx: ctxt, proto: ast::Proto,
followed_by_word: bool) -> &static/str {
match proto {
ast::ProtoBare if followed_by_word => "extern ",
ast::ProtoBare => "extern",
@ -264,34 +263,34 @@ fn proto_ty_to_str(_cx: ctxt, proto: ast::Proto,
}
}
fn expr_repr(cx: ctxt, expr: @ast::expr) -> ~str {
pub fn expr_repr(cx: ctxt, expr: @ast::expr) -> ~str {
fmt!("expr(%d: %s)",
expr.id,
pprust::expr_to_str(expr, cx.sess.intr()))
}
fn pat_repr(cx: ctxt, pat: @ast::pat) -> ~str {
pub fn pat_repr(cx: ctxt, pat: @ast::pat) -> ~str {
fmt!("pat(%d: %s)",
pat.id,
pprust::pat_to_str(pat, cx.sess.intr()))
}
fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str {
pub fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str {
let tstrs = ts.map(|t| ty_to_str(cx, *t));
fmt!("(%s)", str::connect(tstrs, ", "))
}
fn bound_to_str(cx: ctxt, b: param_bound) -> ~str {
pub fn bound_to_str(cx: ctxt, b: param_bound) -> ~str {
ty::param_bound_to_str(cx, &b)
}
fn fn_sig_to_str(cx: ctxt, typ: &ty::FnSig) -> ~str {
pub fn fn_sig_to_str(cx: ctxt, typ: &ty::FnSig) -> ~str {
fmt!("fn%s -> %s",
tys_to_str(cx, typ.inputs.map(|a| a.ty)),
ty_to_str(cx, typ.output))
}
fn ty_to_str(cx: ctxt, typ: t) -> ~str {
pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
fn fn_input_to_str(cx: ctxt, input: ty::arg) -> ~str {
let ty::arg {mode: mode, ty: ty} = input;
let modestr = match canon_mode(cx, mode) {
@ -449,10 +448,10 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str {
}
}
fn parameterized(cx: ctxt,
base: &str,
self_r: Option<ty::Region>,
tps: &[ty::t]) -> ~str {
pub fn parameterized(cx: ctxt,
base: &str,
self_r: Option<ty::Region>,
tps: &[ty::t]) -> ~str {
let r_str = match self_r {
None => ~"",
@ -469,7 +468,7 @@ fn parameterized(cx: ctxt,
}
}
fn ty_to_short_str(cx: ctxt, typ: t) -> ~str {
pub fn ty_to_short_str(cx: ctxt, typ: t) -> ~str {
let mut s = encoder::encoded_ty(cx, typ);
if str::len(s) >= 32u { s = str::slice(s, 0u, 32u); }
return s;