Skip to content

Commit 91ae541

Browse files
committed
rustc: Merge module and type namespaces. r=brson
1 parent c5b82a6 commit 91ae541

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+877
-951
lines changed

src/fuzzer/fuzzer.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pure fn safe_to_use_expr(e: ast::expr, tm: test_mode) -> bool {
104104
}
105105
}
106106

107-
fn safe_to_steal_ty(t: @ast::ty, tm: test_mode) -> bool {
107+
fn safe_to_steal_ty(t: @ast::Ty, tm: test_mode) -> bool {
108108
// Restrictions happen to be the same.
109109
safe_to_replace_ty(t.node, tm)
110110
}
@@ -119,16 +119,16 @@ fn stash_expr_if(c: fn@(@ast::expr, test_mode)->bool,
119119
} else {/* now my indices are wrong :( */ }
120120
}
121121

122-
fn stash_ty_if(c: fn@(@ast::ty, test_mode)->bool,
123-
es: @mut ~[ast::ty],
124-
e: @ast::ty,
122+
fn stash_ty_if(c: fn@(@ast::Ty, test_mode)->bool,
123+
es: @mut ~[ast::Ty],
124+
e: @ast::Ty,
125125
tm: test_mode) {
126126
if c(e, tm) {
127127
es.push(*e);
128128
} else {/* now my indices are wrong :( */ }
129129
}
130130

131-
type stolen_stuff = {exprs: ~[ast::expr], tys: ~[ast::ty]};
131+
type stolen_stuff = {exprs: ~[ast::expr], tys: ~[ast::Ty]};
132132

133133
fn steal(crate: ast::crate, tm: test_mode) -> stolen_stuff {
134134
let exprs = @mut ~[];
@@ -195,7 +195,7 @@ fn replace_expr_in_crate(crate: ast::crate, i: uint,
195195

196196

197197
// Replace the |i|th ty (in fold order) of |crate| with |newty|.
198-
fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::ty,
198+
fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::Ty,
199199
tm: test_mode) -> ast::crate {
200200
let j: @mut uint = @mut 0u;
201201
fn fold_ty_rep(j_: @mut uint, i_: uint, newty_: ast::ty_,
@@ -225,7 +225,7 @@ fn as_str(f: fn@(+x: io::Writer)) -> ~str {
225225
io::with_str_writer(f)
226226
}
227227

228-
fn check_variants_of_ast(crate: ast::crate, codemap: codemap::codemap,
228+
fn check_variants_of_ast(crate: ast::crate, codemap: codemap::CodeMap,
229229
filename: &Path, cx: context) {
230230
let stolen = steal(crate, cx.mode);
231231
let extra_exprs = vec::filter(common_exprs(),
@@ -239,7 +239,7 @@ fn check_variants_of_ast(crate: ast::crate, codemap: codemap::codemap,
239239

240240
fn check_variants_T<T: Copy>(
241241
crate: ast::crate,
242-
codemap: codemap::codemap,
242+
codemap: codemap::CodeMap,
243243
filename: &Path,
244244
thing_label: ~str,
245245
things: ~[T],
@@ -444,7 +444,7 @@ fn parse_and_print(code: @~str) -> ~str {
444444

445445
fn has_raw_pointers(c: ast::crate) -> bool {
446446
let has_rp = @mut false;
447-
fn visit_ty(flag: @mut bool, t: @ast::ty) {
447+
fn visit_ty(flag: @mut bool, t: @ast::Ty) {
448448
match t.node {
449449
ast::ty_ptr(_) => { *flag = true; }
450450
_ => { }

src/libcore/cmath.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use libc::c_double;
1212

1313
#[link_name = "m"]
1414
#[abi = "cdecl"]
15-
pub extern mod c_double {
15+
pub extern mod c_double_utils {
1616

1717
// Alpabetically sorted by link_name
1818

@@ -87,7 +87,7 @@ pub extern mod c_double {
8787

8888
#[link_name = "m"]
8989
#[abi = "cdecl"]
90-
pub extern mod c_float {
90+
pub extern mod c_float_utils {
9191

9292
// Alpabetically sorted by link_name
9393

src/libcore/f32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//! Operations and constants for `f32`
66
7-
pub use cmath::c_float::*;
7+
pub use cmath::c_float_utils::*;
88
pub use cmath::c_float_targ_consts::*;
99

1010
// These are not defined inside consts:: for consistency with

src/libcore/f64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//! Operations and constants for `f64`
66
7-
pub use cmath::c_double::*;
7+
pub use cmath::c_double_utils::*;
88
pub use cmath::c_double_targ_consts::*;
99

1010
// FIXME (#1433): obtain these in a different way
@@ -59,7 +59,7 @@ pub pure fn ge(x: f64, y: f64) -> bool { return x >= y; }
5959
pub pure fn gt(x: f64, y: f64) -> bool { return x > y; }
6060

6161
pub pure fn sqrt(x: f64) -> f64 {
62-
cmath::c_double::sqrt(x as libc::c_double) as f64
62+
cmath::c_double_utils::sqrt(x as libc::c_double) as f64
6363
}
6464

6565
/// Returns true if `x` is a positive number, including +0.0f640 and +Infinity

src/libcore/libc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub use funcs::extra::*;
8787

8888
pub use size_t;
8989
pub use c_float, c_double, c_void, FILE, fpos_t;
90-
pub use DIR, dirent;
90+
pub use DIR, dirent_t;
9191
pub use c_char, c_schar, c_uchar;
9292
pub use c_short, c_ushort, c_int, c_uint, c_long, c_ulong;
9393
pub use size_t, ptrdiff_t, clock_t, time_t;
@@ -147,7 +147,7 @@ mod types {
147147
}
148148
pub mod posix88 {
149149
pub enum DIR {}
150-
pub enum dirent {}
150+
pub enum dirent_t {}
151151
}
152152
pub mod posix01 {}
153153
pub mod posix08 {}
@@ -1019,7 +1019,7 @@ pub mod funcs {
10191019
pub extern mod dirent {
10201020
fn opendir(dirname: *c_char) -> *DIR;
10211021
fn closedir(dirp: *DIR) -> c_int;
1022-
fn readdir(dirp: *DIR) -> *dirent;
1022+
fn readdir(dirp: *DIR) -> *dirent_t;
10231023
fn rewinddir(dirp: *DIR);
10241024
fn seekdir(dirp: *DIR, loc: c_long);
10251025
fn telldir(dirp: *DIR) -> c_long;

src/libsyntax/ast.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ type path = {span: span,
129129
global: bool,
130130
idents: ~[ident],
131131
rp: Option<@region>,
132-
types: ~[@ty]};
132+
types: ~[@Ty]};
133133

134134
type crate_num = int;
135135

@@ -156,7 +156,7 @@ enum ty_param_bound {
156156
bound_send,
157157
bound_const,
158158
bound_owned,
159-
bound_trait(@ty),
159+
bound_trait(@Ty),
160160
}
161161

162162
#[auto_serialize]
@@ -702,7 +702,7 @@ type initializer = {op: init_op, expr: @expr};
702702
// a refinement on pat.
703703
#[auto_serialize]
704704
#[auto_deserialize]
705-
type local_ = {is_mutbl: bool, ty: @ty, pat: @pat,
705+
type local_ = {is_mutbl: bool, ty: @Ty, pat: @pat,
706706
init: Option<initializer>, id: node_id};
707707

708708
type local = spanned<local_>;
@@ -764,7 +764,7 @@ enum expr_ {
764764
expr_binary(binop, @expr, @expr),
765765
expr_unary(unop, @expr),
766766
expr_lit(@lit),
767-
expr_cast(@expr, @ty),
767+
expr_cast(@expr, @Ty),
768768
expr_if(@expr, blk, Option<@expr>),
769769
expr_while(@expr, blk),
770770
/* Conditionless loop (can be exited with break, cont, ret, or fail)
@@ -788,7 +788,7 @@ enum expr_ {
788788
expr_assign(@expr, @expr),
789789
expr_swap(@expr, @expr),
790790
expr_assign_op(binop, @expr, @expr),
791-
expr_field(@expr, ident, ~[@ty]),
791+
expr_field(@expr, ident, ~[@Ty]),
792792
expr_index(@expr, @expr),
793793
expr_path(@path),
794794
expr_addr_of(mutability, @expr),
@@ -843,10 +843,10 @@ type capture_clause = @~[capture_item];
843843
#[auto_deserialize]
844844
#[doc="For macro invocations; parsing is delegated to the macro"]
845845
enum token_tree {
846-
tt_tok(span, token::token),
846+
tt_tok(span, token::Token),
847847
tt_delim(~[token_tree]),
848848
// These only make sense for right-hand-sides of MBE macros
849-
tt_seq(span, ~[token_tree], Option<token::token>, bool),
849+
tt_seq(span, ~[token_tree], Option<token::Token>, bool),
850850
tt_nonterminal(span, ident)
851851
}
852852

@@ -908,10 +908,10 @@ type matcher = spanned<matcher_>;
908908
#[auto_deserialize]
909909
enum matcher_ {
910910
// match one token
911-
match_tok(token::token),
911+
match_tok(token::Token),
912912
// match repetitions of a sequence: body, separator, zero ok?,
913913
// lo, hi position-in-match-array used:
914-
match_seq(~[matcher], Option<token::token>, bool, uint, uint),
914+
match_seq(~[matcher], Option<token::Token>, bool, uint, uint),
915915
// parse a Rust NT: name to bind, name of NT, position in match array:
916916
match_nonterminal(ident, ident, uint)
917917
}
@@ -984,7 +984,7 @@ impl ast::lit_: cmp::Eq {
984984
// type structure in middle/ty.rs as well.
985985
#[auto_serialize]
986986
#[auto_deserialize]
987-
type mt = {ty: @ty, mutbl: mutability};
987+
type mt = {ty: @Ty, mutbl: mutability};
988988

989989
#[auto_serialize]
990990
#[auto_deserialize]
@@ -1087,7 +1087,7 @@ impl float_ty : cmp::Eq {
10871087

10881088
#[auto_serialize]
10891089
#[auto_deserialize]
1090-
type ty = {id: node_id, node: ty_, span: span};
1090+
type Ty = {id: node_id, node: ty_, span: span};
10911091

10921092
// Not represented directly in the AST, referred to by name through a ty_path.
10931093
#[auto_serialize]
@@ -1163,9 +1163,9 @@ enum ty_ {
11631163
ty_rptr(@region, mt),
11641164
ty_rec(~[ty_field]),
11651165
ty_fn(proto, purity, @~[ty_param_bound], fn_decl),
1166-
ty_tup(~[@ty]),
1166+
ty_tup(~[@Ty]),
11671167
ty_path(@path, node_id),
1168-
ty_fixed_length(@ty, Option<uint>),
1168+
ty_fixed_length(@Ty, Option<uint>),
11691169
ty_mac(mac),
11701170
// ty_infer means the type should be inferred instead of it having been
11711171
// specified. This should only appear at the "top level" of a type and not
@@ -1175,16 +1175,16 @@ enum ty_ {
11751175

11761176
// Equality and byte-iter (hashing) can be quite approximate for AST types.
11771177
// since we only care about this for normalizing them to "real" types.
1178-
impl ty : cmp::Eq {
1179-
pure fn eq(other: &ty) -> bool {
1178+
impl Ty : cmp::Eq {
1179+
pure fn eq(other: &Ty) -> bool {
11801180
ptr::addr_of(&self) == ptr::addr_of(&(*other))
11811181
}
1182-
pure fn ne(other: &ty) -> bool {
1182+
pure fn ne(other: &Ty) -> bool {
11831183
ptr::addr_of(&self) != ptr::addr_of(&(*other))
11841184
}
11851185
}
11861186

1187-
impl ty : to_bytes::IterBytes {
1187+
impl Ty : to_bytes::IterBytes {
11881188
pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
11891189
to_bytes::iter_bytes_2(&self.span.lo, &self.span.hi, lsb0, f);
11901190
}
@@ -1193,13 +1193,13 @@ impl ty : to_bytes::IterBytes {
11931193

11941194
#[auto_serialize]
11951195
#[auto_deserialize]
1196-
type arg = {mode: mode, ty: @ty, ident: ident, id: node_id};
1196+
type arg = {mode: mode, ty: @Ty, ident: ident, id: node_id};
11971197

11981198
#[auto_serialize]
11991199
#[auto_deserialize]
12001200
type fn_decl =
12011201
{inputs: ~[arg],
1202-
output: @ty,
1202+
output: @Ty,
12031203
cf: ret_style};
12041204

12051205
#[auto_serialize]
@@ -1362,7 +1362,7 @@ type foreign_mod =
13621362

13631363
#[auto_serialize]
13641364
#[auto_deserialize]
1365-
type variant_arg = {ty: @ty, id: node_id};
1365+
type variant_arg = {ty: @Ty, id: node_id};
13661366

13671367
#[auto_serialize]
13681368
#[auto_deserialize]
@@ -1495,7 +1495,7 @@ impl visibility : cmp::Eq {
14951495
type struct_field_ = {
14961496
kind: struct_field_kind,
14971497
id: node_id,
1498-
ty: @ty
1498+
ty: @Ty
14991499
};
15001500

15011501
type struct_field = spanned<struct_field_>;
@@ -1531,17 +1531,17 @@ type item = {ident: ident, attrs: ~[attribute],
15311531
#[auto_serialize]
15321532
#[auto_deserialize]
15331533
enum item_ {
1534-
item_const(@ty, @expr),
1534+
item_const(@Ty, @expr),
15351535
item_fn(fn_decl, purity, ~[ty_param], blk),
15361536
item_mod(_mod),
15371537
item_foreign_mod(foreign_mod),
1538-
item_ty(@ty, ~[ty_param]),
1538+
item_ty(@Ty, ~[ty_param]),
15391539
item_enum(enum_def, ~[ty_param]),
15401540
item_class(@struct_def, ~[ty_param]),
15411541
item_trait(~[ty_param], ~[@trait_ref], ~[trait_method]),
15421542
item_impl(~[ty_param],
15431543
Option<@trait_ref>, /* (optional) trait this impl implements */
1544-
@ty, /* self */
1544+
@Ty, /* self */
15451545
~[@method]),
15461546
item_mac(mac),
15471547
}
@@ -1601,7 +1601,7 @@ type foreign_item =
16011601
#[auto_deserialize]
16021602
enum foreign_item_ {
16031603
foreign_item_fn(fn_decl, purity, ~[ty_param]),
1604-
foreign_item_const(@ty)
1604+
foreign_item_const(@Ty)
16051605
}
16061606

16071607
// The data we save and restore about an inlined item or method. This is not

src/libsyntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
471471
visit_expr_post: fn@(_e: @expr) {
472472
},
473473

474-
visit_ty: fn@(t: @ty) {
474+
visit_ty: fn@(t: @Ty) {
475475
match t.node {
476476
ty_path(_, id) => vfn(id),
477477
_ => { /* fall through */ }

0 commit comments

Comments
 (0)