Skip to content

Commit d75ab4a

Browse files
committed
auto merge of #8107 : michaelwoerister/rust/end_of_spanned, r=cmr
Contiunation of naming cleanup in `libsyntax::ast`: ```rust ast::node_id => ast::NodeId ast::local_crate => ast::LOCAL_CRATE ast::crate_node_id => ast::CRATE_NODE_ID ast::blk_check_mode => ast::BlockCheckMode ast::ty_field => ast::TypeField ast::ty_method => ast::TypeMethod ``` Also moved span field directly into `TypeField` struct and cleaned up overlooked `ast::CrateConfig` renamings from last pull request. Cheers, Michael
2 parents 8695bc7 + 8a32977 commit d75ab4a

Some content is hidden

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

83 files changed

+713
-718
lines changed

src/librustc/driver/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub struct CrateAnalysis {
201201
exp_map2: middle::resolve::ExportMap2,
202202
ty_cx: ty::ctxt,
203203
maps: astencode::Maps,
204-
reachable: @mut HashSet<ast::node_id>
204+
reachable: @mut HashSet<ast::NodeId>
205205
}
206206

207207
/// Run the resolution, typechecking, region checking and other

src/librustc/driver/session.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use metadata::filesearch;
1818
use metadata;
1919
use middle::lint;
2020

21-
use syntax::ast::node_id;
21+
use syntax::ast::NodeId;
2222
use syntax::ast::{int_ty, uint_ty, float_ty};
2323
use syntax::codemap::span;
2424
use syntax::diagnostic;
@@ -189,13 +189,13 @@ pub struct Session_ {
189189
parse_sess: @mut ParseSess,
190190
codemap: @codemap::CodeMap,
191191
// For a library crate, this is always none
192-
entry_fn: @mut Option<(node_id, codemap::span)>,
192+
entry_fn: @mut Option<(NodeId, codemap::span)>,
193193
entry_type: @mut Option<EntryFnType>,
194194
span_diagnostic: @diagnostic::span_handler,
195195
filesearch: @filesearch::FileSearch,
196196
building_library: @mut bool,
197197
working_dir: Path,
198-
lints: @mut HashMap<ast::node_id, ~[(lint::lint, codemap::span, ~str)]>,
198+
lints: @mut HashMap<ast::NodeId, ~[(lint::lint, codemap::span, ~str)]>,
199199
}
200200

201201
pub type Session = @Session_;
@@ -248,7 +248,7 @@ impl Session_ {
248248
}
249249
pub fn add_lint(@self,
250250
lint: lint::lint,
251-
id: ast::node_id,
251+
id: ast::NodeId,
252252
sp: span,
253253
msg: ~str) {
254254
match self.lints.find_mut(&id) {
@@ -257,7 +257,7 @@ impl Session_ {
257257
}
258258
self.lints.insert(id, ~[(lint, sp, msg)]);
259259
}
260-
pub fn next_node_id(@self) -> ast::node_id {
260+
pub fn next_node_id(@self) -> ast::NodeId {
261261
return syntax::parse::next_node_id(self.parse_sess);
262262
}
263263
pub fn diagnostic(@self) -> @diagnostic::span_handler {

src/librustc/front/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use syntax::print::pprust;
2525
use syntax::{ast, ast_util};
2626
use syntax::attr::AttrMetaMethods;
2727

28-
type node_id_gen = @fn() -> ast::node_id;
28+
type node_id_gen = @fn() -> ast::NodeId;
2929

3030
struct Test {
3131
span: span,

src/librustc/metadata/csearch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn get_type_param_count(cstore: @mut cstore::CStore, def: ast::def_id)
4444
/// Iterates over all the language items in the given crate.
4545
pub fn each_lang_item(cstore: @mut cstore::CStore,
4646
cnum: ast::CrateNum,
47-
f: &fn(ast::node_id, uint) -> bool) -> bool {
47+
f: &fn(ast::NodeId, uint) -> bool) -> bool {
4848
let crate_data = cstore::get_crate_data(cstore, cnum);
4949
decoder::each_lang_item(crate_data, f)
5050
}

src/librustc/metadata/cstore.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ pub struct CStore {
4343
intr: @ident_interner
4444
}
4545

46-
// Map from node_id's of local extern mod statements to crate numbers
47-
type extern_mod_crate_map = HashMap<ast::node_id, ast::CrateNum>;
46+
// Map from NodeId's of local extern mod statements to crate numbers
47+
type extern_mod_crate_map = HashMap<ast::NodeId, ast::CrateNum>;
4848

4949
pub fn mk_cstore(intr: @ident_interner) -> CStore {
5050
return CStore {
@@ -125,13 +125,13 @@ pub fn get_used_link_args<'a>(cstore: &'a CStore) -> &'a [@str] {
125125
}
126126

127127
pub fn add_extern_mod_stmt_cnum(cstore: &mut CStore,
128-
emod_id: ast::node_id,
128+
emod_id: ast::NodeId,
129129
cnum: ast::CrateNum) {
130130
cstore.extern_mod_crate_map.insert(emod_id, cnum);
131131
}
132132

133133
pub fn find_extern_mod_stmt_cnum(cstore: &CStore,
134-
emod_id: ast::node_id)
134+
emod_id: ast::NodeId)
135135
-> Option<ast::CrateNum> {
136136
cstore.extern_mod_crate_map.find(&emod_id).map_consume(|x| *x)
137137
}

src/librustc/metadata/decoder.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ pub fn lookup_def(cnum: ast::CrateNum, data: @~[u8], did_: ast::def_id) ->
361361
}
362362

363363
pub fn get_trait_def(cdata: cmd,
364-
item_id: ast::node_id,
364+
item_id: ast::NodeId,
365365
tcx: ty::ctxt) -> ty::TraitDef
366366
{
367367
let item_doc = lookup_item(item_id, cdata.data);
@@ -375,7 +375,7 @@ pub fn get_trait_def(cdata: cmd,
375375
}
376376
}
377377

378-
pub fn get_type(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
378+
pub fn get_type(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt)
379379
-> ty::ty_param_bounds_and_ty {
380380

381381
let item = lookup_item(id, cdata.data);
@@ -392,19 +392,19 @@ pub fn get_type(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
392392
}
393393
}
394394

395-
pub fn get_region_param(cdata: cmd, id: ast::node_id)
395+
pub fn get_region_param(cdata: cmd, id: ast::NodeId)
396396
-> Option<ty::region_variance> {
397397

398398
let item = lookup_item(id, cdata.data);
399399
return item_ty_region_param(item);
400400
}
401401

402-
pub fn get_type_param_count(data: @~[u8], id: ast::node_id) -> uint {
402+
pub fn get_type_param_count(data: @~[u8], id: ast::NodeId) -> uint {
403403
item_ty_param_count(lookup_item(id, data))
404404
}
405405

406406
pub fn get_impl_trait(cdata: cmd,
407-
id: ast::node_id,
407+
id: ast::NodeId,
408408
tcx: ty::ctxt) -> Option<@ty::TraitRef>
409409
{
410410
let item_doc = lookup_item(id, cdata.data);
@@ -414,7 +414,7 @@ pub fn get_impl_trait(cdata: cmd,
414414
}
415415

416416
pub fn get_impl_vtables(cdata: cmd,
417-
id: ast::node_id,
417+
id: ast::NodeId,
418418
tcx: ty::ctxt) -> typeck::impl_res
419419
{
420420
let item_doc = lookup_item(id, cdata.data);
@@ -428,7 +428,7 @@ pub fn get_impl_vtables(cdata: cmd,
428428
}
429429

430430

431-
pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
431+
pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
432432
name: ast::ident) -> Option<ast::def_id> {
433433
let items = reader::get_doc(reader::Doc(cdata.data), tag_items);
434434
let mut found = None;
@@ -442,7 +442,7 @@ pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
442442
found
443443
}
444444

445-
pub fn get_symbol(data: @~[u8], id: ast::node_id) -> ~str {
445+
pub fn get_symbol(data: @~[u8], id: ast::NodeId) -> ~str {
446446
return item_symbol(lookup_item(id, data));
447447
}
448448

@@ -462,15 +462,15 @@ fn def_like_to_def(def_like: def_like) -> ast::def {
462462
}
463463

464464
/// Iterates over the language items in the given crate.
465-
pub fn each_lang_item(cdata: cmd, f: &fn(ast::node_id, uint) -> bool) -> bool {
465+
pub fn each_lang_item(cdata: cmd, f: &fn(ast::NodeId, uint) -> bool) -> bool {
466466
let root = reader::Doc(cdata.data);
467467
let lang_items = reader::get_doc(root, tag_lang_items);
468468
for reader::tagged_docs(lang_items, tag_lang_items_item) |item_doc| {
469469
let id_doc = reader::get_doc(item_doc, tag_lang_items_item_id);
470470
let id = reader::doc_as_u32(id_doc) as uint;
471471
let node_id_doc = reader::get_doc(item_doc,
472472
tag_lang_items_item_node_id);
473-
let node_id = reader::doc_as_u32(node_id_doc) as ast::node_id;
473+
let node_id = reader::doc_as_u32(node_id_doc) as ast::NodeId;
474474

475475
if !f(node_id, id) {
476476
return false;
@@ -716,7 +716,7 @@ pub fn each_path(intr: @ident_interner,
716716
context.each_child_of_module_or_crate(crate_items_doc)
717717
}
718718

719-
pub fn get_item_path(cdata: cmd, id: ast::node_id) -> ast_map::path {
719+
pub fn get_item_path(cdata: cmd, id: ast::NodeId) -> ast_map::path {
720720
item_path(lookup_item(id, cdata.data))
721721
}
722722

@@ -727,7 +727,7 @@ pub type decode_inlined_item<'self> = &'self fn(
727727
par_doc: ebml::Doc) -> Option<ast::inlined_item>;
728728

729729
pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
730-
id: ast::node_id,
730+
id: ast::NodeId,
731731
decode_inlined_item: decode_inlined_item)
732732
-> csearch::found_ast {
733733
debug!("Looking up item: %d", id);
@@ -754,7 +754,7 @@ pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
754754
}
755755
}
756756

757-
pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
757+
pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
758758
tcx: ty::ctxt) -> ~[@ty::VariantInfo] {
759759
let data = cdata.data;
760760
let items = reader::get_doc(reader::Doc(data), tag_items);
@@ -833,7 +833,7 @@ fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc,
833833
}
834834

835835
/// Returns information about the given implementation.
836-
pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::node_id,
836+
pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::NodeId,
837837
tcx: ty::ctxt)
838838
-> ty::Impl {
839839
let data = cdata.data;
@@ -851,15 +851,15 @@ pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::node_id,
851851
pub fn get_method_name_and_explicit_self(
852852
intr: @ident_interner,
853853
cdata: cmd,
854-
id: ast::node_id) -> (ast::ident, ast::explicit_self_)
854+
id: ast::NodeId) -> (ast::ident, ast::explicit_self_)
855855
{
856856
let method_doc = lookup_item(id, cdata.data);
857857
let name = item_name(intr, method_doc);
858858
let explicit_self = get_explicit_self(method_doc);
859859
(name, explicit_self)
860860
}
861861

862-
pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
862+
pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
863863
tcx: ty::ctxt) -> ty::Method
864864
{
865865
let method_doc = lookup_item(id, cdata.data);
@@ -892,7 +892,7 @@ pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
892892
}
893893

894894
pub fn get_trait_method_def_ids(cdata: cmd,
895-
id: ast::node_id) -> ~[ast::def_id] {
895+
id: ast::NodeId) -> ~[ast::def_id] {
896896
let data = cdata.data;
897897
let item = lookup_item(id, data);
898898
let mut result = ~[];
@@ -903,7 +903,7 @@ pub fn get_trait_method_def_ids(cdata: cmd,
903903
}
904904

905905
pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
906-
id: ast::node_id, tcx: ty::ctxt) ->
906+
id: ast::NodeId, tcx: ty::ctxt) ->
907907
~[@ty::Method] {
908908
let data = cdata.data;
909909
let item = lookup_item(id, data);
@@ -922,7 +922,7 @@ pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
922922
}
923923

924924
/// Returns the supertraits of the given trait.
925-
pub fn get_supertraits(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
925+
pub fn get_supertraits(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt)
926926
-> ~[@ty::TraitRef] {
927927
let mut results = ~[];
928928
let item_doc = lookup_item(id, cdata.data);
@@ -933,7 +933,7 @@ pub fn get_supertraits(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
933933
}
934934

935935
pub fn get_type_name_if_impl(cdata: cmd,
936-
node_id: ast::node_id) -> Option<ast::ident> {
936+
node_id: ast::NodeId) -> Option<ast::ident> {
937937
let item = lookup_item(node_id, cdata.data);
938938
if item_family(item) != Impl {
939939
return None;
@@ -948,7 +948,7 @@ pub fn get_type_name_if_impl(cdata: cmd,
948948

949949
pub fn get_static_methods_if_impl(intr: @ident_interner,
950950
cdata: cmd,
951-
node_id: ast::node_id)
951+
node_id: ast::NodeId)
952952
-> Option<~[StaticMethodInfo]> {
953953
let item = lookup_item(node_id, cdata.data);
954954
if item_family(item) != Impl {
@@ -992,7 +992,7 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
992992
}
993993

994994
pub fn get_item_attrs(cdata: cmd,
995-
node_id: ast::node_id,
995+
node_id: ast::NodeId,
996996
f: &fn(~[@ast::MetaItem])) {
997997

998998
let item = lookup_item(node_id, cdata.data);
@@ -1012,7 +1012,7 @@ fn struct_field_family_to_visibility(family: Family) -> ast::visibility {
10121012
}
10131013
}
10141014

1015-
pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id)
1015+
pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::NodeId)
10161016
-> ~[ty::field_ty] {
10171017
let data = cdata.data;
10181018
let item = lookup_item(id, data);
@@ -1040,7 +1040,7 @@ pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id)
10401040
result
10411041
}
10421042

1043-
pub fn get_item_visibility(cdata: cmd, id: ast::node_id)
1043+
pub fn get_item_visibility(cdata: cmd, id: ast::NodeId)
10441044
-> ast::visibility {
10451045
item_visibility(lookup_item(id, cdata.data))
10461046
}
@@ -1068,7 +1068,7 @@ fn read_path(d: ebml::Doc) -> (~str, uint) {
10681068
}
10691069

10701070
fn describe_def(items: ebml::Doc, id: ast::def_id) -> ~str {
1071-
if id.crate != ast::local_crate { return ~"external"; }
1071+
if id.crate != ast::LOCAL_CRATE { return ~"external"; }
10721072
let it = match maybe_find_item(id.node, items) {
10731073
Some(it) => it,
10741074
None => fail!("describe_def: item not found %?", id)
@@ -1260,7 +1260,7 @@ pub fn list_crate_metadata(intr: @ident_interner, bytes: @~[u8],
12601260
// then we must translate the crate number from that encoded in the external
12611261
// crate to the correct local crate number.
12621262
pub fn translate_def_id(cdata: cmd, did: ast::def_id) -> ast::def_id {
1263-
if did.crate == ast::local_crate {
1263+
if did.crate == ast::LOCAL_CRATE {
12641264
return ast::def_id { crate: cdata.cnum, node: did.node };
12651265
}
12661266

0 commit comments

Comments
 (0)