Skip to content

Commit 25129ee

Browse files
committed
librustc: Remove use mod from the language
1 parent 2c5afa4 commit 25129ee

File tree

8 files changed

+15
-53
lines changed

8 files changed

+15
-53
lines changed

src/librustc/front/test.rs

-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ fn mk_std(cx: &TestCtxt) -> @ast::view_item {
274274
ast::view_item_use(
275275
~[@nospan(ast::view_path_simple(id_std,
276276
path_node(~[id_std]),
277-
ast::type_value_ns,
278277
cx.sess.next_node_id()))])
279278
} else {
280279
ast::view_item_extern_mod(id_std, ~[@mi],

src/librustc/middle/resolve.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ pub impl Resolver {
14131413
14141414
let mut module_path = ~[];
14151415
match view_path.node {
1416-
view_path_simple(_, full_path, _, _) => {
1416+
view_path_simple(_, full_path, _) => {
14171417
let path_len = full_path.idents.len();
14181418
assert!(path_len != 0);
14191419
@@ -1435,7 +1435,7 @@ pub impl Resolver {
14351435
// Build up the import directives.
14361436
let module_ = self.get_module_from_parent(parent);
14371437
match view_path.node {
1438-
view_path_simple(binding, full_path, _, _) => {
1438+
view_path_simple(binding, full_path, _) => {
14391439
let source_ident = *full_path.idents.last();
14401440
let subclass = @SingleImport(binding,
14411441
source_ident);

src/libsyntax/ast.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1100,11 +1100,6 @@ pub struct path_list_ident_ {
11001100
11011101
pub type path_list_ident = spanned<path_list_ident_>;
11021102
1103-
#[auto_encode]
1104-
#[auto_decode]
1105-
#[deriving(Eq)]
1106-
pub enum namespace { module_ns, type_value_ns }
1107-
11081103
pub type view_path = spanned<view_path_>;
11091104
11101105
#[auto_encode]
@@ -1117,7 +1112,7 @@ pub enum view_path_ {
11171112
// or just
11181113
//
11191114
// foo::bar::baz (with 'baz =' implicitly on the left)
1120-
view_path_simple(ident, @Path, namespace, node_id),
1115+
view_path_simple(ident, @Path, node_id),
11211116
11221117
// foo::bar::*
11231118
view_path_glob(@Path, node_id),

src/libsyntax/ast_util.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
413413
view_item_use(ref vps) => {
414414
for vps.each |vp| {
415415
match vp.node {
416-
view_path_simple(_, _, _, id) => vfn(id),
416+
view_path_simple(_, _, id) => vfn(id),
417417
view_path_glob(_, id) => vfn(id),
418418
view_path_list(_, _, id) => vfn(id)
419419
}
@@ -551,7 +551,8 @@ pub fn walk_pat(pat: @pat, it: &fn(@pat)) {
551551
552552
pub fn view_path_id(p: @view_path) -> node_id {
553553
match p.node {
554-
view_path_simple(_, _, _, id) | view_path_glob(_, id) |
554+
view_path_simple(_, _, id) |
555+
view_path_glob(_, id) |
555556
view_path_list(_, _, id) => id
556557
}
557558
}

src/libsyntax/ext/pipes/ast_builder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
374374
],
375375
codemap::dummy_sp()
376376
),
377-
ast::type_value_ns,
378377
self.next_id()
379378
),
380379
span: codemap::dummy_sp()

src/libsyntax/parse/parser.rs

+8-13
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use ast::{item_mac, item_mod, item_struct, item_trait, item_ty, lit, lit_};
4040
use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int};
4141
use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, m_const};
4242
use ast::{m_imm, m_mutbl, mac_, mac_invoc_tt, matcher, match_nonterminal};
43-
use ast::{match_seq, match_tok, method, mode, module_ns, mt, mul, mutability};
43+
use ast::{match_seq, match_tok, method, mode, mt, mul, mutability};
4444
use ast::{named_field, neg, node_id, noreturn, not, pat, pat_box, pat_enum};
4545
use ast::{pat_ident, pat_lit, pat_range, pat_region, pat_struct};
4646
use ast::{pat_tup, pat_uniq, pat_wild, private};
@@ -54,7 +54,7 @@ use ast::{tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, ty_box};
5454
use ast::{ty_field, ty_fixed_length_vec, ty_closure, ty_bare_fn};
5555
use ast::{ty_infer, ty_method};
5656
use ast::{ty_nil, TyParam, TyParamBound, ty_path, ty_ptr, ty_rptr};
57-
use ast::{ty_tup, ty_u32, ty_uniq, ty_vec, type_value_ns, uniq};
57+
use ast::{ty_tup, ty_u32, ty_uniq, ty_vec, uniq};
5858
use ast::{unnamed_field, unsafe_blk, unsafe_fn, view_item};
5959
use ast::{view_item_, view_item_extern_mod, view_item_use};
6060
use ast::{view_path, view_path_glob, view_path_list, view_path_simple};
@@ -4224,13 +4224,6 @@ pub impl Parser {
42244224
fn parse_view_path(&self) -> @view_path {
42254225
let lo = self.span.lo;
42264226

4227-
let namespace;
4228-
if self.eat_keyword(&~"mod") {
4229-
namespace = module_ns;
4230-
} else {
4231-
namespace = type_value_ns;
4232-
}
4233-
42344227
let first_ident = self.parse_ident();
42354228
let mut path = ~[first_ident];
42364229
debug!("parsed view_path: %s", *self.id_to_str(first_ident));
@@ -4250,8 +4243,9 @@ pub impl Parser {
42504243
rp: None,
42514244
types: ~[] };
42524245
return @spanned(lo, self.span.hi,
4253-
view_path_simple(first_ident, path, namespace,
4254-
self.get_id()));
4246+
view_path_simple(first_ident,
4247+
path,
4248+
self.get_id()));
42554249
}
42564250

42574251
token::MOD_SEP => {
@@ -4306,8 +4300,9 @@ pub impl Parser {
43064300
idents: path,
43074301
rp: None,
43084302
types: ~[] };
4309-
return @spanned(lo, self.span.hi,
4310-
view_path_simple(last, path, namespace, self.get_id()));
4303+
return @spanned(lo,
4304+
self.span.hi,
4305+
view_path_simple(last, path, self.get_id()));
43114306
}
43124307

43134308
// matches view_paths = view_path | view_path , view_paths

src/libsyntax/print/pprust.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1816,10 +1816,7 @@ pub fn print_meta_item(s: @ps, item: @ast::meta_item) {
18161816
18171817
pub fn print_view_path(s: @ps, vp: @ast::view_path) {
18181818
match vp.node {
1819-
ast::view_path_simple(ident, path, namespace, _) => {
1820-
if namespace == ast::module_ns {
1821-
word_space(s, ~"mod");
1822-
}
1819+
ast::view_path_simple(ident, path, _) => {
18231820
if path.idents[vec::len(path.idents)-1u] != ident {
18241821
print_ident(s, ident);
18251822
space(s.s);

src/test/run-pass/use-mod.rs

-24
This file was deleted.

0 commit comments

Comments
 (0)