Skip to content

Commit 18f6a51

Browse files
committed
rustc: rename ast::self_ty and related fields to explicit_self
1 parent 70e02cf commit 18f6a51

38 files changed

+184
-184
lines changed

src/librustc/metadata/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub static tag_mod_impl_trait: uint = 0x47u;
100100
different tags.
101101
*/
102102
pub static tag_item_impl_method: uint = 0x48u;
103-
pub static tag_item_trait_method_self_ty: uint = 0x4b;
103+
pub static tag_item_trait_method_explicit_self: uint = 0x4b;
104104
pub static tag_item_trait_method_self_ty_region: uint = 0x4c;
105105

106106

src/librustc/metadata/csearch.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,12 @@ pub fn get_method(tcx: ty::ctxt,
135135
decoder::get_method(tcx.cstore.intr, cdata, def.node, tcx)
136136
}
137137

138-
pub fn get_method_name_and_self_ty(cstore: @mut cstore::CStore,
139-
def: ast::def_id) -> (ast::ident, ast::self_ty_)
138+
pub fn get_method_name_and_explicit_self(cstore: @mut cstore::CStore,
139+
def: ast::def_id)
140+
-> (ast::ident, ast::explicit_self_)
140141
{
141142
let cdata = cstore::get_crate_data(cstore, def.crate);
142-
decoder::get_method_name_and_self_ty(cstore.intr, cdata, def.node)
143+
decoder::get_method_name_and_explicit_self(cstore.intr, cdata, def.node)
143144
}
144145

145146
pub fn get_trait_method_def_ids(cstore: @mut cstore::CStore,

src/librustc/metadata/decoder.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
670670
return infos;
671671
}
672672

673-
fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ {
673+
fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
674674
fn get_mutability(ch: u8) -> ast::mutability {
675675
match ch as char {
676676
'i' => { ast::m_imm }
@@ -682,11 +682,11 @@ fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ {
682682
}
683683
}
684684

685-
let self_type_doc = reader::get_doc(item, tag_item_trait_method_self_ty);
686-
let string = reader::doc_as_str(self_type_doc);
685+
let explicit_self_doc = reader::get_doc(item, tag_item_trait_method_explicit_self);
686+
let string = reader::doc_as_str(explicit_self_doc);
687687

688-
let self_ty_kind = string[0];
689-
match self_ty_kind as char {
688+
let explicit_self_kind = string[0];
689+
match explicit_self_kind as char {
690690
's' => { return ast::sty_static; }
691691
'v' => { return ast::sty_value; }
692692
'@' => { return ast::sty_box(get_mutability(string[1])); }
@@ -696,7 +696,7 @@ fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ {
696696
return ast::sty_region(None, get_mutability(string[1]));
697697
}
698698
_ => {
699-
fail!("unknown self type code: `%c`", self_ty_kind as char);
699+
fail!("unknown self type code: `%c`", explicit_self_kind as char);
700700
}
701701
}
702702
}
@@ -707,12 +707,12 @@ fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc,
707707
for reader::tagged_docs(item, tag_item_impl_method) |doc| {
708708
let m_did = reader::with_doc_data(doc, |d| parse_def_id(d));
709709
let mth_item = lookup_item(m_did.node, cdata.data);
710-
let self_ty = get_self_ty(mth_item);
710+
let explicit_self = get_explicit_self(mth_item);
711711
rslt.push(@resolve::MethodInfo {
712712
did: translate_def_id(cdata, m_did),
713713
n_tps: item_ty_param_count(mth_item) - base_tps,
714714
ident: item_name(intr, mth_item),
715-
self_type: self_ty});
715+
explicit_self: explicit_self});
716716
}
717717
rslt
718718
}
@@ -748,15 +748,15 @@ pub fn get_impls_for_mod(intr: @ident_interner,
748748
@result
749749
}
750750

751-
pub fn get_method_name_and_self_ty(
751+
pub fn get_method_name_and_explicit_self(
752752
intr: @ident_interner,
753753
cdata: cmd,
754-
id: ast::node_id) -> (ast::ident, ast::self_ty_)
754+
id: ast::node_id) -> (ast::ident, ast::explicit_self_)
755755
{
756756
let method_doc = lookup_item(id, cdata.data);
757757
let name = item_name(intr, method_doc);
758-
let self_ty = get_self_ty(method_doc);
759-
(name, self_ty)
758+
let explicit_self = get_explicit_self(method_doc);
759+
(name, explicit_self)
760760
}
761761

762762
pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
@@ -770,7 +770,7 @@ pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
770770
let transformed_self_ty = doc_transformed_self_ty(method_doc, tcx, cdata);
771771
let fty = doc_method_fty(method_doc, tcx, cdata);
772772
let vis = item_visibility(method_doc);
773-
let self_ty = get_self_ty(method_doc);
773+
let explicit_self = get_explicit_self(method_doc);
774774
ty::method {
775775
ident: name,
776776
generics: ty::Generics {
@@ -779,7 +779,7 @@ pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
779779
},
780780
transformed_self_ty: transformed_self_ty,
781781
fty: fty,
782-
self_ty: self_ty,
782+
explicit_self: explicit_self,
783783
vis: vis,
784784
def_id: def_id
785785
}
@@ -823,7 +823,7 @@ pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
823823
};
824824

825825
let transformed_self_ty = doc_transformed_self_ty(mth, tcx, cdata);
826-
let self_ty = get_self_ty(mth);
826+
let explicit_self = get_explicit_self(mth);
827827
let ty_method = ty::method {
828828
ident: name,
829829
generics: ty::Generics {
@@ -832,7 +832,7 @@ pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
832832
},
833833
transformed_self_ty: transformed_self_ty,
834834
fty: fty,
835-
self_ty: self_ty,
835+
explicit_self: explicit_self,
836836
vis: ast::public,
837837
def_id: did
838838
};

src/librustc/metadata/encoder.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ fn encode_reexported_static_methods(ecx: @EncodeContext,
389389
Some(&ast_map::node_item(_, path)) => {
390390
if mod_path != *path {
391391
for methods.each |&m| {
392-
if m.self_ty == ast::sty_static {
392+
if m.explicit_self == ast::sty_static {
393393
encode_reexported_static_method(ecx,
394394
ebml_w,
395395
exp, m);
@@ -486,11 +486,11 @@ fn encode_visibility(ebml_w: &mut writer::Encoder, visibility: visibility) {
486486
ebml_w.end_tag();
487487
}
488488

489-
fn encode_self_type(ebml_w: &mut writer::Encoder, self_type: ast::self_ty_) {
490-
ebml_w.start_tag(tag_item_trait_method_self_ty);
489+
fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::explicit_self_) {
490+
ebml_w.start_tag(tag_item_trait_method_explicit_self);
491491

492492
// Encode the base self type.
493-
match self_type {
493+
match explicit_self {
494494
sty_static => {
495495
ebml_w.writer.write(&[ 's' as u8 ]);
496496
}
@@ -634,7 +634,7 @@ fn encode_method_ty_fields(ecx: @EncodeContext,
634634
encode_transformed_self_ty(ecx, ebml_w, method_ty.transformed_self_ty);
635635
encode_method_fty(ecx, ebml_w, &method_ty.fty);
636636
encode_visibility(ebml_w, method_ty.vis);
637-
encode_self_type(ebml_w, method_ty.self_ty);
637+
encode_explicit_self(ebml_w, method_ty.explicit_self);
638638
}
639639

640640
fn encode_info_for_method(ecx: @EncodeContext,
@@ -655,7 +655,7 @@ fn encode_info_for_method(ecx: @EncodeContext,
655655
let method_ty: @ty::method = ty::method(ecx.tcx, method_def_id);
656656
encode_method_ty_fields(ecx, ebml_w, method_ty);
657657

658-
match m.self_ty.node {
658+
match m.explicit_self.node {
659659
ast::sty_static => {
660660
encode_family(ebml_w, purity_static_method_family(m.purity));
661661
}
@@ -962,7 +962,7 @@ fn encode_info_for_item(ecx: @EncodeContext,
962962
trait_path.push(ast_map::path_name(item.ident));
963963
encode_path(ecx, ebml_w, trait_path, ast_map::path_name(method_ty.ident));
964964

965-
match method_ty.self_ty {
965+
match method_ty.explicit_self {
966966
sty_static => {
967967
encode_family(ebml_w,
968968
purity_static_method_family(
@@ -991,7 +991,7 @@ fn encode_info_for_item(ecx: @EncodeContext,
991991
// This is obviously a bogus assert but I don't think this
992992
// ever worked before anyhow...near as I can tell, before
993993
// we would emit two items.
994-
if method_ty.self_ty == sty_static {
994+
if method_ty.explicit_self == sty_static {
995995
tcx.sess.span_unimpl(
996996
item.span,
997997
fmt!("Method %s is both provided and static",

src/librustc/middle/astencode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,8 @@ impl read_method_map_entry_helper for reader::Decoder {
552552
explicit_self: this.read_struct_field("explicit_self",
553553
2,
554554
|this| {
555-
let self_type: ast::self_ty_ = Decodable::decode(this);
556-
self_type
555+
let explicit_self: ast::explicit_self_ = Decodable::decode(this);
556+
explicit_self
557557
}),
558558
origin: this.read_struct_field("origin", 1, |this| {
559559
let method_origin: method_origin =

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ fn visit_fn(fk: &visit::fn_kind,
381381
// Add `this`, whether explicit or implicit.
382382
match *fk {
383383
fk_method(_, _, method) => {
384-
match method.self_ty.node {
384+
match method.explicit_self.node {
385385
sty_value | sty_region(*) | sty_box(_) | sty_uniq(_) => {
386386
fn_maps.add_variable(Arg(method.self_id,
387387
special_idents::self_));

src/librustc/middle/resolve.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use driver::session::Session;
1212
use metadata::csearch::{each_path, get_trait_method_def_ids};
13-
use metadata::csearch::get_method_name_and_self_ty;
13+
use metadata::csearch::get_method_name_and_explicit_self;
1414
use metadata::csearch::get_static_methods_if_impl;
1515
use metadata::csearch::get_type_name_if_impl;
1616
use metadata::cstore::find_extern_mod_stmt_cnum;
@@ -28,7 +28,7 @@ use syntax::ast::{def_const, def_foreign_mod, def_fn, def_id, def_label};
2828
use syntax::ast::{def_local, def_mod, def_prim_ty, def_region, def_self};
2929
use syntax::ast::{def_self_ty, def_static_method, def_struct, def_ty};
3030
use syntax::ast::{def_ty_param, def_typaram_binder, def_trait};
31-
use syntax::ast::{def_upvar, def_use, def_variant, expr, expr_assign_op};
31+
use syntax::ast::{def_upvar, def_use, def_variant, explicit_self_, expr, expr_assign_op};
3232
use syntax::ast::{expr_binary, expr_break, expr_field};
3333
use syntax::ast::{expr_fn_block, expr_index, expr_method_call, expr_path};
3434
use syntax::ast::{def_prim_ty, def_region, def_self, def_ty, def_ty_param};
@@ -45,7 +45,7 @@ use syntax::ast::{local, local_crate, lt, method, mul};
4545
use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident};
4646
use syntax::ast::{Path, pat_lit, pat_range, pat_struct};
4747
use syntax::ast::{prim_ty, private, provided};
48-
use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl};
48+
use syntax::ast::{public, required, rem, shl, shr, stmt_decl};
4949
use syntax::ast::{struct_field, struct_variant_kind};
5050
use syntax::ast::{sty_static, subtract, trait_ref, tuple_variant_kind, Ty};
5151
use syntax::ast::{ty_bool, ty_char, ty_f, ty_f32, ty_f64, ty_float, ty_i};
@@ -96,7 +96,7 @@ pub struct MethodInfo {
9696
did: def_id,
9797
n_tps: uint,
9898
ident: ident,
99-
self_type: self_ty_
99+
explicit_self: explicit_self_
100100
}
101101

102102
pub struct Impl {
@@ -1203,7 +1203,7 @@ pub impl Resolver {
12031203
// Bail out early if there are no static methods.
12041204
let mut has_static_methods = false;
12051205
for methods.each |method| {
1206-
match method.self_ty.node {
1206+
match method.explicit_self.node {
12071207
sty_static => has_static_methods = true,
12081208
_ => {}
12091209
}
@@ -1236,7 +1236,7 @@ pub impl Resolver {
12361236

12371237
// For each static method...
12381238
for methods.each |method| {
1239-
match method.self_ty.node {
1239+
match method.explicit_self.node {
12401240
sty_static => {
12411241
// Add the static method to the
12421242
// module.
@@ -1274,7 +1274,7 @@ pub impl Resolver {
12741274
let mut has_static_methods = false;
12751275
for (*methods).each |method| {
12761276
let ty_m = trait_method_to_ty_method(method);
1277-
match ty_m.self_ty.node {
1277+
match ty_m.explicit_self.node {
12781278
sty_static => {
12791279
has_static_methods = true;
12801280
break;
@@ -1306,7 +1306,7 @@ pub impl Resolver {
13061306
let ident = ty_m.ident;
13071307
// Add it to the trait info if not static,
13081308
// add it as a name in the trait module otherwise.
1309-
match ty_m.self_ty.node {
1309+
match ty_m.explicit_self.node {
13101310
sty_static => {
13111311
let def = def_static_method(
13121312
local_def(ty_m.id),
@@ -1612,17 +1612,17 @@ pub impl Resolver {
16121612
def_id);
16131613
let mut interned_method_names = HashSet::new();
16141614
for method_def_ids.each |&method_def_id| {
1615-
let (method_name, self_ty) =
1616-
get_method_name_and_self_ty(self.session.cstore,
1617-
method_def_id);
1615+
let (method_name, explicit_self) =
1616+
get_method_name_and_explicit_self(self.session.cstore,
1617+
method_def_id);
16181618

16191619
debug!("(building reduced graph for \
16201620
external crate) ... adding \
16211621
trait method '%s'",
16221622
*self.session.str_of(method_name));
16231623

16241624
// Add it to the trait info if not static.
1625-
if self_ty != sty_static {
1625+
if explicit_self != sty_static {
16261626
interned_method_names.insert(method_name);
16271627
}
16281628
}
@@ -3774,7 +3774,7 @@ pub impl Resolver {
37743774
outer_type_parameter_count,
37753775
rib_kind);
37763776
// we only have self ty if it is a non static method
3777-
let self_binding = match method.self_ty.node {
3777+
let self_binding = match method.explicit_self.node {
37783778
sty_static => { NoSelfBinding }
37793779
_ => { HasSelfBinding(method.self_id, false) }
37803780
};

0 commit comments

Comments
 (0)