Skip to content

Commit 38357eb

Browse files
committed
typeck/check/method: Remove pub from most methods
1 parent 38b2e29 commit 38357eb

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

src/librustc/middle/typeck/check/method.rs

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl<'self> LookupContext<'self> {
247247
self.search_for_autosliced_method(self_ty, autoderefs)
248248
}
249249

250-
pub fn deref(&self, ty: ty::t)
250+
fn deref(&self, ty: ty::t)
251251
-> Option<ty::t> {
252252
match ty::deref(self.tcx(), ty, false) {
253253
None => None,
@@ -262,7 +262,12 @@ impl<'self> LookupContext<'self> {
262262
// ______________________________________________________________________
263263
// Candidate collection (see comment at start of file)
264264

265-
pub fn push_inherent_candidates(&self, self_ty: ty::t) {
265+
fn reset_candidates(&self) {
266+
*self.inherent_candidates = ~[];
267+
*self.extension_candidates = ~[];
268+
}
269+
270+
fn push_inherent_candidates(&self, self_ty: ty::t) {
266271
/*!
267272
* Collect all inherent candidates into
268273
* `self.inherent_candidates`. See comment at the start of
@@ -403,7 +408,7 @@ impl<'self> LookupContext<'self> {
403408
}
404409

405410

406-
pub fn push_inherent_candidates_from_self(&self,
411+
fn push_inherent_candidates_from_self(&self,
407412
self_ty: ty::t,
408413
did: def_id) {
409414
let tcx = self.tcx();
@@ -413,7 +418,7 @@ impl<'self> LookupContext<'self> {
413418
self_ty, &[trait_ref], param_self);
414419
}
415420

416-
pub fn push_inherent_candidates_from_bounds(&self,
421+
fn push_inherent_candidates_from_bounds(&self,
417422
self_ty: ty::t,
418423
bounds: &[@TraitRef],
419424
param: param_index) {
@@ -459,7 +464,7 @@ impl<'self> LookupContext<'self> {
459464
}
460465

461466

462-
pub fn push_inherent_impl_candidates_for_type(&self, did: def_id) {
467+
fn push_inherent_impl_candidates_for_type(&self, did: def_id) {
463468
let opt_impl_infos = self.tcx().inherent_impls.find(&did);
464469
for impl_infos in opt_impl_infos.iter() {
465470
for impl_info in impl_infos.iter() {
@@ -469,7 +474,7 @@ impl<'self> LookupContext<'self> {
469474
}
470475
}
471476

472-
pub fn push_candidates_from_impl(&self,
477+
fn push_candidates_from_impl(&self,
473478
candidates: &mut ~[Candidate],
474479
impl_info: &ty::Impl) {
475480
if !self.impl_dups.insert(impl_info.did) {
@@ -512,7 +517,7 @@ impl<'self> LookupContext<'self> {
512517
// ______________________________________________________________________
513518
// Candidate selection (see comment at start of file)
514519

515-
pub fn search_for_autoderefd_method(&self,
520+
fn search_for_autoderefd_method(&self,
516521
self_ty: ty::t,
517522
autoderefs: uint)
518523
-> Option<method_map_entry> {
@@ -531,12 +536,11 @@ impl<'self> LookupContext<'self> {
531536
}
532537
}
533538

534-
pub fn consider_reborrow(&self,
539+
fn consider_reborrow(&self,
535540
self_ty: ty::t,
536541
autoderefs: uint)
537542
-> (ty::t, ty::AutoAdjustment) {
538543
/*!
539-
*
540544
* In the event that we are invoking a method with a receiver
541545
* of a borrowed type like `&T`, `&mut T`, or `&mut [T]`,
542546
* we will "reborrow" the receiver implicitly. For example, if
@@ -598,7 +602,7 @@ impl<'self> LookupContext<'self> {
598602
}
599603
}
600604

601-
pub fn search_for_autosliced_method(&self,
605+
fn search_for_autosliced_method(&self,
602606
self_ty: ty::t,
603607
autoderefs: uint)
604608
-> Option<method_map_entry> {
@@ -664,7 +668,7 @@ impl<'self> LookupContext<'self> {
664668
}
665669
}
666670

667-
pub fn search_for_autoptrd_method(&self, self_ty: ty::t, autoderefs: uint)
671+
fn search_for_autoptrd_method(&self, self_ty: ty::t, autoderefs: uint)
668672
-> Option<method_map_entry> {
669673
/*!
670674
*
@@ -696,7 +700,7 @@ impl<'self> LookupContext<'self> {
696700
}
697701
}
698702

699-
pub fn search_for_some_kind_of_autorefd_method(
703+
fn search_for_some_kind_of_autorefd_method(
700704
&self,
701705
kind: &fn(Region, ast::mutability) -> ty::AutoRef,
702706
autoderefs: uint,
@@ -725,7 +729,7 @@ impl<'self> LookupContext<'self> {
725729
return None;
726730
}
727731

728-
pub fn search_for_method(&self, rcvr_ty: ty::t)
732+
fn search_for_method(&self, rcvr_ty: ty::t)
729733
-> Option<method_map_entry> {
730734
debug!("search_for_method(rcvr_ty=%s)", self.ty_to_str(rcvr_ty));
731735
let _indenter = indenter();
@@ -753,7 +757,7 @@ impl<'self> LookupContext<'self> {
753757
}
754758
}
755759

756-
pub fn consider_candidates(&self,
760+
fn consider_candidates(&self,
757761
rcvr_ty: ty::t,
758762
candidates: &mut ~[Candidate])
759763
-> Option<method_map_entry> {
@@ -780,7 +784,7 @@ impl<'self> LookupContext<'self> {
780784
Some(self.confirm_candidate(rcvr_ty, &relevant_candidates[0]))
781785
}
782786

783-
pub fn merge_candidates(&self, candidates: &[Candidate]) -> ~[Candidate] {
787+
fn merge_candidates(&self, candidates: &[Candidate]) -> ~[Candidate] {
784788
let mut merged = ~[];
785789
let mut i = 0;
786790
while i < candidates.len() {
@@ -826,7 +830,7 @@ impl<'self> LookupContext<'self> {
826830
return merged;
827831
}
828832

829-
pub fn confirm_candidate(&self, rcvr_ty: ty::t, candidate: &Candidate)
833+
fn confirm_candidate(&self, rcvr_ty: ty::t, candidate: &Candidate)
830834
-> method_map_entry {
831835
let tcx = self.tcx();
832836
let fty = self.fn_ty_from_origin(&candidate.origin);
@@ -1108,7 +1112,7 @@ impl<'self> LookupContext<'self> {
11081112
}
11091113
}
11101114

1111-
pub fn fn_ty_from_origin(&self, origin: &method_origin) -> ty::t {
1115+
fn fn_ty_from_origin(&self, origin: &method_origin) -> ty::t {
11121116
return match *origin {
11131117
method_static(did) => {
11141118
ty::lookup_item_type(self.tcx(), did).ty
@@ -1129,7 +1133,7 @@ impl<'self> LookupContext<'self> {
11291133
}
11301134
}
11311135

1132-
pub fn report_candidate(&self, idx: uint, origin: &method_origin) {
1136+
fn report_candidate(&self, idx: uint, origin: &method_origin) {
11331137
match *origin {
11341138
method_static(impl_did) => {
11351139
self.report_static_candidate(idx, impl_did)
@@ -1143,7 +1147,7 @@ impl<'self> LookupContext<'self> {
11431147
}
11441148
}
11451149

1146-
pub fn report_static_candidate(&self, idx: uint, did: def_id) {
1150+
fn report_static_candidate(&self, idx: uint, did: def_id) {
11471151
let span = if did.crate == ast::LOCAL_CRATE {
11481152
match self.tcx().items.find(&did.node) {
11491153
Some(&ast_map::node_method(m, _, _)) => m.span,
@@ -1159,15 +1163,15 @@ impl<'self> LookupContext<'self> {
11591163
ty::item_path_str(self.tcx(), did)));
11601164
}
11611165

1162-
pub fn report_param_candidate(&self, idx: uint, did: def_id) {
1166+
fn report_param_candidate(&self, idx: uint, did: def_id) {
11631167
self.tcx().sess.span_note(
11641168
self.expr.span,
11651169
fmt!("candidate #%u derives from the bound `%s`",
11661170
(idx+1u),
11671171
ty::item_path_str(self.tcx(), did)));
11681172
}
11691173

1170-
pub fn report_trait_candidate(&self, idx: uint, did: def_id) {
1174+
fn report_trait_candidate(&self, idx: uint, did: def_id) {
11711175
self.tcx().sess.span_note(
11721176
self.expr.span,
11731177
fmt!("candidate #%u derives from the type of the receiver, \
@@ -1176,31 +1180,31 @@ impl<'self> LookupContext<'self> {
11761180
ty::item_path_str(self.tcx(), did)));
11771181
}
11781182

1179-
pub fn infcx(&self) -> @mut infer::InferCtxt {
1183+
fn infcx(&self) -> @mut infer::InferCtxt {
11801184
self.fcx.inh.infcx
11811185
}
11821186

1183-
pub fn tcx(&self) -> ty::ctxt {
1187+
fn tcx(&self) -> ty::ctxt {
11841188
self.fcx.tcx()
11851189
}
11861190

1187-
pub fn ty_to_str(&self, t: ty::t) -> ~str {
1191+
fn ty_to_str(&self, t: ty::t) -> ~str {
11881192
self.fcx.infcx().ty_to_str(t)
11891193
}
11901194

1191-
pub fn cand_to_str(&self, cand: &Candidate) -> ~str {
1195+
fn cand_to_str(&self, cand: &Candidate) -> ~str {
11921196
fmt!("Candidate(rcvr_ty=%s, rcvr_substs=%s, origin=%?)",
1193-
self.ty_to_str(cand.rcvr_ty),
1197+
cand.rcvr_match_condition.repr(self.tcx()),
11941198
ty::substs_to_str(self.tcx(), &cand.rcvr_substs),
11951199
cand.origin)
11961200
}
11971201

1198-
pub fn did_to_str(&self, did: def_id) -> ~str {
1202+
fn did_to_str(&self, did: def_id) -> ~str {
11991203
ty::item_path_str(self.tcx(), did)
12001204
}
12011205

1202-
pub fn bug(&self, s: ~str) -> ! {
1203-
self.tcx().sess.bug(s)
1206+
fn bug(&self, s: ~str) -> ! {
1207+
self.tcx().sess.span_bug(self.self_expr.span, s)
12041208
}
12051209
}
12061210

0 commit comments

Comments
 (0)