Skip to content

Commit ba11e96

Browse files
committed
librustc: De-export trans. rs=deexporting
1 parent 7ad0716 commit ba11e96

20 files changed

+1021
-1061
lines changed

src/librustc/middle/trans/_match.rs

Lines changed: 136 additions & 126 deletions
Large diffs are not rendered by default.

src/librustc/middle/trans/base.rs

Lines changed: 292 additions & 285 deletions
Large diffs are not rendered by default.

src/librustc/middle/trans/build.rs

Lines changed: 119 additions & 118 deletions
Large diffs are not rendered by default.

src/librustc/middle/trans/cabi.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,26 @@ use middle::trans::base::*;
1313
use middle::trans::build::*;
1414
use middle::trans::common::*;
1515

16-
export ABIInfo, LLVMType, FnType;
17-
export llvm_abi_info;
18-
19-
trait ABIInfo {
16+
pub trait ABIInfo {
2017
fn compute_info(&self,
2118
atys: &[TypeRef],
2219
rty: TypeRef,
2320
ret_def: bool) -> FnType;
2421
}
2522

26-
struct LLVMType {
23+
pub struct LLVMType {
2724
cast: bool,
2825
ty: TypeRef
2926
}
3027

31-
struct FnType {
28+
pub struct FnType {
3229
arg_tys: ~[LLVMType],
3330
ret_ty: LLVMType,
3431
attrs: ~[Option<Attribute>],
3532
sret: bool
3633
}
3734

38-
impl FnType {
35+
pub impl FnType {
3936
fn decl_fn(&self, decl: fn(fnty: TypeRef) -> ValueRef) -> ValueRef {
4037
let atys = vec::map(self.arg_tys, |t| t.ty);
4138
let rty = self.ret_ty.ty;
@@ -208,7 +205,7 @@ impl LLVM_ABIInfo: ABIInfo {
208205
}
209206
}
210207

211-
fn llvm_abi_info() -> ABIInfo {
208+
pub fn llvm_abi_info() -> ABIInfo {
212209
return LLVM_ABIInfo as ABIInfo;
213210
}
214211

src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ use lib::llvm::{StructRetAttribute, ByValAttribute};
1717
use middle::trans::common::*;
1818
use middle::trans::cabi::*;
1919

20-
export x86_64_abi_info;
21-
2220
enum x86_64_reg_class {
2321
no_class,
2422
integer_class,
@@ -412,6 +410,6 @@ impl X86_64_ABIInfo: ABIInfo {
412410
}
413411
}
414412

415-
fn x86_64_abi_info() -> ABIInfo {
413+
pub fn x86_64_abi_info() -> ABIInfo {
416414
return X86_64_ABIInfo as ABIInfo;
417415
}

src/librustc/middle/trans/closure.rs

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use middle::trans::common::*;
2323
use middle::trans::datum::{Datum, INIT, ByRef, ByValue, FromLvalue};
2424
use middle::trans::expr;
2525
use middle::trans::glue;
26+
use middle::trans::machine;
2627
use middle::trans::type_of::*;
2728
use util::ppaux::ty_to_str;
2829

@@ -103,7 +104,7 @@ use syntax::print::pprust::expr_to_str;
103104
//
104105
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105106

106-
enum EnvAction {
107+
pub enum EnvAction {
107108
/// Copy the value from this llvm ValueRef into the environment.
108109
EnvStore,
109110

@@ -114,12 +115,12 @@ enum EnvAction {
114115
EnvRef
115116
}
116117

117-
struct EnvValue {
118+
pub struct EnvValue {
118119
action: EnvAction,
119120
datum: Datum
120121
}
121122

122-
impl EnvAction {
123+
pub impl EnvAction {
123124
fn to_str() -> ~str {
124125
match self {
125126
EnvStore => ~"EnvStore",
@@ -129,21 +130,21 @@ impl EnvAction {
129130
}
130131
}
131132

132-
impl EnvValue {
133+
pub impl EnvValue {
133134
fn to_str(ccx: @crate_ctxt) -> ~str {
134135
fmt!("%s(%s)", self.action.to_str(), self.datum.to_str(ccx))
135136
}
136137
}
137138

138-
fn mk_tuplified_uniq_cbox_ty(tcx: ty::ctxt, cdata_ty: ty::t) -> ty::t {
139+
pub fn mk_tuplified_uniq_cbox_ty(tcx: ty::ctxt, cdata_ty: ty::t) -> ty::t {
139140
let cbox_ty = tuplify_box_ty(tcx, cdata_ty);
140141
return ty::mk_imm_uniq(tcx, cbox_ty);
141142
}
142143

143144
// Given a closure ty, emits a corresponding tuple ty
144-
fn mk_closure_tys(tcx: ty::ctxt,
145-
bound_values: ~[EnvValue])
146-
-> ty::t {
145+
pub fn mk_closure_tys(tcx: ty::ctxt,
146+
bound_values: ~[EnvValue])
147+
-> ty::t {
147148
// determine the types of the values in the env. Note that this
148149
// is the actual types that will be stored in the map, not the
149150
// logical types as the user sees them, so by-ref upvars must be
@@ -159,9 +160,8 @@ fn mk_closure_tys(tcx: ty::ctxt,
159160
return cdata_ty;
160161
}
161162

162-
fn allocate_cbox(bcx: block, proto: ast::Proto, cdata_ty: ty::t)
163-
-> Result
164-
{
163+
pub fn allocate_cbox(bcx: block, proto: ast::Proto, cdata_ty: ty::t)
164+
-> Result {
165165
let _icx = bcx.insn_ctxt("closure::allocate_cbox");
166166
let ccx = bcx.ccx(), tcx = ccx.tcx;
167167

@@ -196,7 +196,7 @@ fn allocate_cbox(bcx: block, proto: ast::Proto, cdata_ty: ty::t)
196196
}
197197
}
198198

199-
type closure_result = {
199+
pub type closure_result = {
200200
llbox: ValueRef, // llvalue of ptr to closure
201201
cdata_ty: ty::t, // type of the closure data
202202
bcx: block // final bcx
@@ -206,9 +206,9 @@ type closure_result = {
206206
// construct a closure out of them. If copying is true, it is a
207207
// heap allocated closure that copies the upvars into environment.
208208
// Otherwise, it is stack allocated and copies pointers to the upvars.
209-
fn store_environment(bcx: block,
210-
bound_values: ~[EnvValue],
211-
proto: ast::Proto) -> closure_result {
209+
pub fn store_environment(bcx: block,
210+
bound_values: ~[EnvValue],
211+
proto: ast::Proto) -> closure_result {
212212
let _icx = bcx.insn_ctxt("closure::store_environment");
213213
let ccx = bcx.ccx(), tcx = ccx.tcx;
214214

@@ -263,10 +263,10 @@ fn store_environment(bcx: block,
263263

264264
// Given a context and a list of upvars, build a closure. This just
265265
// collects the upvars and packages them up for store_environment.
266-
fn build_closure(bcx0: block,
267-
cap_vars: ~[capture::capture_var],
268-
proto: ast::Proto,
269-
include_ret_handle: Option<ValueRef>) -> closure_result {
266+
pub fn build_closure(bcx0: block,
267+
cap_vars: ~[capture::capture_var],
268+
proto: ast::Proto,
269+
include_ret_handle: Option<ValueRef>) -> closure_result {
270270
let _icx = bcx0.insn_ctxt("closure::build_closure");
271271
// If we need to, package up the iterator body to call
272272
let mut bcx = bcx0;;
@@ -326,11 +326,11 @@ fn build_closure(bcx0: block,
326326
// Given an enclosing block context, a new function context, a closure type,
327327
// and a list of upvars, generate code to load and populate the environment
328328
// with the upvars and type descriptors.
329-
fn load_environment(fcx: fn_ctxt,
330-
cdata_ty: ty::t,
331-
cap_vars: ~[capture::capture_var],
332-
load_ret_handle: bool,
333-
proto: ast::Proto) {
329+
pub fn load_environment(fcx: fn_ctxt,
330+
cdata_ty: ty::t,
331+
cap_vars: ~[capture::capture_var],
332+
load_ret_handle: bool,
333+
proto: ast::Proto) {
334334
let _icx = fcx.insn_ctxt("closure::load_environment");
335335

336336
let llloadenv = match fcx.llloadenv {
@@ -377,16 +377,15 @@ fn load_environment(fcx: fn_ctxt,
377377
}
378378
}
379379

380-
fn trans_expr_fn(bcx: block,
381-
proto: ast::Proto,
382-
+decl: ast::fn_decl,
383-
+body: ast::blk,
384-
outer_id: ast::node_id,
385-
user_id: ast::node_id,
386-
cap_clause: ast::capture_clause,
387-
is_loop_body: Option<Option<ValueRef>>,
388-
dest: expr::Dest) -> block
389-
{
380+
pub fn trans_expr_fn(bcx: block,
381+
proto: ast::Proto,
382+
+decl: ast::fn_decl,
383+
+body: ast::blk,
384+
outer_id: ast::node_id,
385+
user_id: ast::node_id,
386+
cap_clause: ast::capture_clause,
387+
is_loop_body: Option<Option<ValueRef>>,
388+
dest: expr::Dest) -> block {
390389
/*!
391390
*
392391
* Translates the body of a closure expression.
@@ -462,13 +461,11 @@ fn trans_expr_fn(bcx: block,
462461
return bcx;
463462
}
464463

465-
fn make_fn_glue(
466-
cx: block,
467-
v: ValueRef,
468-
t: ty::t,
469-
glue_fn: fn@(block, v: ValueRef, t: ty::t) -> block)
470-
-> block
471-
{
464+
pub fn make_fn_glue(cx: block,
465+
v: ValueRef,
466+
t: ty::t,
467+
glue_fn: fn@(block, v: ValueRef, t: ty::t) -> block)
468+
-> block {
472469
let _icx = cx.insn_ctxt("closure::make_fn_glue");
473470
let bcx = cx;
474471
let tcx = cx.tcx();
@@ -487,12 +484,11 @@ fn make_fn_glue(
487484
}
488485
}
489486

490-
fn make_opaque_cbox_take_glue(
487+
pub fn make_opaque_cbox_take_glue(
491488
bcx: block,
492489
proto: ast::Proto,
493490
cboxptr: ValueRef) // ptr to ptr to the opaque closure
494-
-> block
495-
{
491+
-> block {
496492
// Easy cases:
497493
let _icx = bcx.insn_ctxt("closure::make_opaque_cbox_take_glue");
498494
match proto {
@@ -521,7 +517,7 @@ fn make_opaque_cbox_take_glue(
521517
let sz = Load(bcx, GEPi(bcx, tydesc, [0u, abi::tydesc_field_size]));
522518

523519
// Adjust sz to account for the rust_opaque_box header fields
524-
let sz = Add(bcx, sz, shape::llsize_of(ccx, T_box_header(ccx)));
520+
let sz = Add(bcx, sz, machine::llsize_of(ccx, T_box_header(ccx)));
525521

526522
// Allocate memory, update original ptr, and copy existing data
527523
let opaque_tydesc = PointerCast(bcx, tydesc, T_ptr(T_i8()));
@@ -547,7 +543,7 @@ fn make_opaque_cbox_take_glue(
547543
}
548544
}
549545

550-
fn make_opaque_cbox_drop_glue(
546+
pub fn make_opaque_cbox_drop_glue(
551547
bcx: block,
552548
proto: ast::Proto,
553549
cboxptr: ValueRef) // ptr to the opaque closure
@@ -568,7 +564,7 @@ fn make_opaque_cbox_drop_glue(
568564
}
569565
}
570566

571-
fn make_opaque_cbox_free_glue(
567+
pub fn make_opaque_cbox_free_glue(
572568
bcx: block,
573569
proto: ast::Proto,
574570
cbox: ValueRef) // ptr to ptr to the opaque closure

0 commit comments

Comments
 (0)