From 4c2353adee4094ebcd99653ef168d607fe843144 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 2 Mar 2014 15:26:39 -0800 Subject: [PATCH] Make visible types public in rustc --- src/librustc/lib.rs | 2 -- src/librustc/metadata/decoder.rs | 2 +- src/librustc/metadata/encoder.rs | 4 ++-- src/librustc/metadata/tydecode.rs | 2 +- src/librustc/middle/borrowck/mod.rs | 2 +- src/librustc/middle/check_const.rs | 2 +- src/librustc/middle/liveness.rs | 24 +++++++++---------- src/librustc/middle/trans/base.rs | 4 ++-- src/librustc/middle/trans/cleanup.rs | 6 ++--- src/librustc/middle/trans/common.rs | 4 ++-- src/librustc/middle/ty.rs | 6 ++--- src/librustc/middle/typeck/check/_match.rs | 2 +- src/librustc/middle/typeck/check/method.rs | 2 +- src/librustc/middle/typeck/infer/mod.rs | 2 +- .../typeck/infer/region_inference/mod.rs | 12 +++++----- src/libsyntax/ext/expand.rs | 4 ++-- src/libsyntax/lib.rs | 1 - src/libsyntax/parse/parser.rs | 2 +- src/libsyntax/print/pp.rs | 4 ++-- src/libsyntax/print/pprust.rs | 2 +- 20 files changed, 43 insertions(+), 46 deletions(-) diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 235e1c72455c2..4018e70b4f58b 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -30,8 +30,6 @@ This API is completely unstable and subject to change. #[feature(macro_rules, globs, struct_variant, managed_boxes)]; #[feature(quote)]; -#[allow(visible_private_types)]; - extern crate extra; extern crate flate; extern crate arena; diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 1e90748158fd8..2bf54e0373d2b 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -46,7 +46,7 @@ use syntax::ast; use syntax::codemap; use syntax::crateid::CrateId; -type Cmd = @crate_metadata; +pub type Cmd = @crate_metadata; // A function that takes a def_id relative to the crate being searched and // returns a def_id relative to the compilation environment, i.e. if we hit a diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 3a490845c6098..80bb5d23aa446 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -52,7 +52,7 @@ use syntax; use writer = serialize::ebml::writer; // used by astencode: -type abbrev_map = @RefCell>; +pub type abbrev_map = @RefCell>; /// A borrowed version of ast::InlinedItem. pub enum InlinedItemRef<'a> { @@ -76,7 +76,7 @@ pub struct EncodeParams<'a> { encode_inlined_item: EncodeInlinedItem<'a>, } -struct Stats { +pub struct Stats { inline_bytes: Cell, attr_bytes: Cell, dep_bytes: Cell, diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 21fe0e7539438..f566571d0eb3c 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -54,7 +54,7 @@ pub enum DefIdSource { // Identifies a region parameter (`fn foo<'X>() { ... }`). RegionParameter, } -type conv_did<'a> = +pub type conv_did<'a> = 'a |source: DefIdSource, ast::DefId| -> ast::DefId; pub struct PState<'a> { diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 94c3867b31845..e9a96b0c47e5c 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -907,7 +907,7 @@ impl Repr for LoanPath { /////////////////////////////////////////////////////////////////////////// -struct TcxTyper { +pub struct TcxTyper { tcx: ty::ctxt, method_map: typeck::MethodMap, } diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index 864b447333602..3b8e708676235 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -20,7 +20,7 @@ use syntax::{ast_util, ast_map}; use syntax::visit::Visitor; use syntax::visit; -struct CheckCrateVisitor { +pub struct CheckCrateVisitor { sess: Session, def_map: resolve::DefMap, method_map: typeck::MethodMap, diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index ab4de1ed71d79..cf909bbd1af1b 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -126,9 +126,9 @@ use syntax::{visit, ast_util}; use syntax::visit::{Visitor, FnKind}; #[deriving(Eq)] -struct Variable(uint); +pub struct Variable(uint); #[deriving(Eq)] -struct LiveNode(uint); +pub struct LiveNode(uint); impl Variable { fn get(&self) -> uint { let Variable(v) = *self; v } @@ -145,7 +145,7 @@ impl Clone for LiveNode { } #[deriving(Eq)] -enum LiveNodeKind { +pub enum LiveNodeKind { FreeVarNode(Span), ExprNode(Span), VarDefNode(Span), @@ -226,32 +226,32 @@ impl LiveNode { fn invalid_node() -> LiveNode { LiveNode(uint::MAX) } -struct CaptureInfo { +pub struct CaptureInfo { ln: LiveNode, is_move: bool, var_nid: NodeId } -enum LocalKind { +pub enum LocalKind { FromMatch(BindingMode), FromLetWithInitializer, FromLetNoInitializer } -struct LocalInfo { +pub struct LocalInfo { id: NodeId, ident: Ident, is_mutbl: bool, kind: LocalKind, } -enum VarKind { +pub enum VarKind { Arg(NodeId, Ident), Local(LocalInfo), ImplicitRet } -struct IrMaps { +pub struct IrMaps { tcx: ty::ctxt, method_map: typeck::MethodMap, capture_map: moves::CaptureMap, @@ -560,7 +560,7 @@ fn visit_expr(v: &mut LivenessVisitor, expr: &Expr, this: @IrMaps) { // the same basic propagation framework in all cases. #[deriving(Clone)] -struct Users { +pub struct Users { reader: LiveNode, writer: LiveNode, used: bool @@ -574,7 +574,7 @@ fn invalid_users() -> Users { } } -struct Specials { +pub struct Specials { exit_ln: LiveNode, fallthrough_ln: LiveNode, no_ret_var: Variable @@ -584,7 +584,7 @@ static ACC_READ: uint = 1u; static ACC_WRITE: uint = 2u; static ACC_USE: uint = 4u; -type LiveNodeMap = @RefCell>; +pub type LiveNodeMap = @RefCell>; pub struct Liveness { tcx: ty::ctxt, @@ -1554,7 +1554,7 @@ fn check_fn(_v: &Liveness, // do not check contents of nested fns } -enum ReadKind { +pub enum ReadKind { PossiblyUninitializedVariable, PossiblyUninitializedField, MovedValue, diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index b8301cbc33abf..a9682eada93f9 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -1322,8 +1322,8 @@ fn arg_kind(cx: &FunctionContext, t: ty::t) -> datum::Rvalue { } // work around bizarre resolve errors -type RvalueDatum = datum::Datum; -type LvalueDatum = datum::Datum; +pub type RvalueDatum = datum::Datum; +pub type LvalueDatum = datum::Datum; // create_datums_for_fn_args: creates rvalue datums for each of the // incoming function arguments. These will later be stored into diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs index dfff05966cb99..2cf24ff123a3c 100644 --- a/src/librustc/middle/trans/cleanup.rs +++ b/src/librustc/middle/trans/cleanup.rs @@ -51,20 +51,20 @@ pub static EXIT_BREAK: uint = 0; pub static EXIT_LOOP: uint = 1; pub static EXIT_MAX: uint = 2; -enum CleanupScopeKind<'a> { +pub enum CleanupScopeKind<'a> { CustomScopeKind, AstScopeKind(ast::NodeId), LoopScopeKind(ast::NodeId, [&'a Block<'a>, ..EXIT_MAX]) } #[deriving(Eq)] -enum EarlyExitLabel { +pub enum EarlyExitLabel { UnwindExit, ReturnExit, LoopExit(ast::NodeId, uint) } -struct CachedEarlyExit { +pub struct CachedEarlyExit { label: EarlyExitLabel, cleanup_block: BasicBlockRef, } diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 037ea3e14f336..e7e69917ebba0 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -212,8 +212,8 @@ impl Repr for param_substs { } // work around bizarre resolve errors -type RvalueDatum = datum::Datum; -type LvalueDatum = datum::Datum; +pub type RvalueDatum = datum::Datum; +pub type LvalueDatum = datum::Datum; // Function context. Every LLVM function we create will have one of // these. diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 210adc1d0a5ec..e043bc8683f48 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -158,9 +158,9 @@ pub struct creader_cache_key { len: uint } -type creader_cache = RefCell>; +pub type creader_cache = RefCell>; -struct intern_key { +pub struct intern_key { sty: *sty, } @@ -1068,7 +1068,7 @@ pub struct ty_param_substs_and_ty { ty: ty::t } -type type_cache = RefCell>; +pub type type_cache = RefCell>; pub type node_type_table = RefCell>; diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index def80e39821ee..bef3de532011a 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -729,4 +729,4 @@ pub fn check_pointer_pat(pcx: &pat_ctxt, } #[deriving(Eq)] -enum PointerKind { Send, Borrowed } +pub enum PointerKind { Send, Borrowed } diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index aff41ce1979c0..d7f85bd01234e 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -236,7 +236,7 @@ pub struct Candidate { /// now we must check that the type `T` is correct). Unfortunately, /// because traits are not types, this is a pain to do. #[deriving(Clone)] -enum RcvrMatchCondition { +pub enum RcvrMatchCondition { RcvrMatchesIfObject(ast::DefId), RcvrMatchesIfSubtype(ty::t) } diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index dceef9e38d50e..28a3e822a1ae9 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -500,7 +500,7 @@ fn rollback_to(vb: &mut ValsAndBindings, } } -struct Snapshot { +pub struct Snapshot { ty_var_bindings_len: uint, int_var_bindings_len: uint, float_var_bindings_len: uint, diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs index 55d33f9691855..98fe0bedb3be8 100644 --- a/src/librustc/middle/typeck/infer/region_inference/mod.rs +++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs @@ -35,7 +35,7 @@ use syntax::opt_vec::OptVec; mod doc; #[deriving(Eq, Hash)] -enum Constraint { +pub enum Constraint { ConstrainVarSubVar(RegionVid, RegionVid), ConstrainRegSubVar(Region, RegionVid), ConstrainVarSubReg(RegionVid, Region), @@ -43,19 +43,19 @@ enum Constraint { } #[deriving(Eq, Hash)] -struct TwoRegions { +pub struct TwoRegions { a: Region, b: Region, } -enum UndoLogEntry { +pub enum UndoLogEntry { Snapshot, AddVar(RegionVid), AddConstraint(Constraint), AddCombination(CombineMapType, TwoRegions) } -enum CombineMapType { +pub enum CombineMapType { Lub, Glb } @@ -84,7 +84,7 @@ pub enum RegionResolutionError { SubregionOrigin, Region), } -type CombineMap = HashMap; +pub type CombineMap = HashMap; pub struct RegionVarBindings { tcx: ty::ctxt, @@ -764,7 +764,7 @@ impl RegionVarBindings { #[deriving(Eq, Show)] enum Classification { Expanding, Contracting } -enum VarValue { NoValue, Value(Region), ErrorValue } +pub enum VarValue { NoValue, Value(Region), ErrorValue } struct VarData { classification: Classification, diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index b162e17f53de1..d8b4334c8678a 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -660,7 +660,7 @@ fn expand_non_macro_stmt(s: &Stmt, fld: &mut MacroExpander) // from a given thingy and puts them in a mutable // array (passed in to the traversal) #[deriving(Clone)] -struct NewNameFinderContext { +pub struct NewNameFinderContext { ident_accumulator: Vec , } @@ -748,7 +748,7 @@ pub fn expand_block_elts(b: &Block, fld: &mut MacroExpander) -> P { }) } -struct IdentRenamer<'a> { +pub struct IdentRenamer<'a> { renames: &'a mut RenameList, } diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 260375b5f81d6..42c9ab461aa00 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -31,7 +31,6 @@ This API is completely unstable and subject to change. #[feature(quote)]; #[deny(non_camel_case_types)]; -#[allow(visible_private_types)]; extern crate serialize; extern crate term; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 9b209aadf19e5..2557af5e436a2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -87,7 +87,7 @@ use std::vec_ng; #[allow(non_camel_case_types)] #[deriving(Eq)] -enum restriction { +pub enum restriction { UNRESTRICTED, RESTRICT_STMT_EXPR, RESTRICT_NO_BAR_OP, diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index e9e0e4835933b..b3e7ac667d839 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -139,12 +139,12 @@ pub fn buf_str(toks: Vec , szs: Vec , left: uint, right: uint, return s; } -enum PrintStackBreak { +pub enum PrintStackBreak { Fits, Broken(Breaks), } -struct PrintStackElem { +pub struct PrintStackElem { offset: int, pbreak: PrintStackBreak } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index d027efc1d42f6..ec8c474d19402 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1027,7 +1027,7 @@ pub fn print_block_with_attrs(s: &mut State, true) } -enum EmbedType { +pub enum EmbedType { BlockBlockFn, BlockNormal, }