Skip to content

Commit 07c3f5c

Browse files
committed
librustc: Forbid pub or priv before trait implementations
1 parent 573a31d commit 07c3f5c

Some content is hidden

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

67 files changed

+304
-288
lines changed

src/libcore/at_vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub mod traits {
168168
use kinds::Copy;
169169
use ops::Add;
170170

171-
pub impl<T:Copy> Add<&[const T],@[T]> for @[T] {
171+
impl<T:Copy> Add<&[const T],@[T]> for @[T] {
172172
#[inline(always)]
173173
pure fn add(&self, rhs: & &self/[const T]) -> @[T] {
174174
append(*self, (*rhs))

src/libcore/num/f32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl num::One for f32 {
284284
static pure fn one() -> f32 { 1.0 }
285285
}
286286

287-
pub impl NumCast for f32 {
287+
impl NumCast for f32 {
288288
/**
289289
* Cast `n` to an `f32`
290290
*/

src/libcore/num/f64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl cmp::Ord for f64 {
299299
pure fn gt(&self, other: &f64) -> bool { (*self) > (*other) }
300300
}
301301

302-
pub impl NumCast for f64 {
302+
impl NumCast for f64 {
303303
/**
304304
* Cast `n` to an `f64`
305305
*/

src/libcore/num/float.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl num::One for float {
420420
static pure fn one() -> float { 1.0 }
421421
}
422422
423-
pub impl NumCast for float {
423+
impl NumCast for float {
424424
/**
425425
* Cast `n` to a `float`
426426
*/

src/libcore/num/int-template/i16.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod inst {
1717
pub const bits: uint = ::u16::bits;
1818
}
1919

20-
pub impl NumCast for i16 {
20+
impl NumCast for i16 {
2121
/**
2222
* Cast `n` to a `i16`
2323
*/

src/libcore/num/int-template/i32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod inst {
1717
pub const bits: uint = ::u32::bits;
1818
}
1919

20-
pub impl NumCast for i32 {
20+
impl NumCast for i32 {
2121
/**
2222
* Cast `n` to a `i32`
2323
*/

src/libcore/num/int-template/i64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod inst {
1717
pub const bits: uint = ::u64::bits;
1818
}
1919

20-
pub impl NumCast for i64 {
20+
impl NumCast for i64 {
2121
/**
2222
* Cast `n` to a `i64`
2323
*/

src/libcore/num/int-template/i8.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod inst {
1717
pub const bits: uint = ::u8::bits;
1818
}
1919

20-
pub impl NumCast for i8 {
20+
impl NumCast for i8 {
2121
/**
2222
* Cast `n` to a `i8`
2323
*/

src/libcore/num/int-template/int.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ mod inst {
5858
}
5959
}
6060

61-
pub impl NumCast for int {
61+
impl NumCast for int {
6262
/**
6363
* Cast `n` to a `int`
6464
*/

src/libcore/num/uint-template/u16.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod inst {
1919
pub const bits: uint = 16;
2020
}
2121

22-
pub impl NumCast for u16 {
22+
impl NumCast for u16 {
2323
/**
2424
* Cast `n` to a `u16`
2525
*/

src/libcore/num/uint-template/u32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod inst {
1919
pub const bits: uint = 32;
2020
}
2121

22-
pub impl NumCast for u32 {
22+
impl NumCast for u32 {
2323
/**
2424
* Cast `n` to a `u32`
2525
*/

src/libcore/num/uint-template/u64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod inst {
1919
pub const bits: uint = 64;
2020
}
2121

22-
pub impl NumCast for u64 {
22+
impl NumCast for u64 {
2323
/**
2424
* Cast `n` to a `u64`
2525
*/

src/libcore/num/uint-template/u8.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ mod inst {
2626
pub pure fn is_ascii(x: T) -> bool { return 0 as T == x & 128 as T; }
2727
}
2828

29-
pub impl NumCast for u8 {
29+
impl NumCast for u8 {
3030
/**
3131
* Cast `n` to a `u8`
3232
*/

src/libcore/num/uint-template/uint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub mod inst {
110110
return true;
111111
}
112112

113-
pub impl iter::Times for uint {
113+
impl iter::Times for uint {
114114
#[inline(always)]
115115
/**
116116
* A convenience form for basic iteration. Given a uint `x`,
@@ -209,7 +209,7 @@ pub mod inst {
209209
}
210210
}
211211

212-
pub impl NumCast for uint {
212+
impl NumCast for uint {
213213
/**
214214
* Cast `n` to a `uint`
215215
*/

src/libcore/option.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub enum Option<T> {
5656
Some(T),
5757
}
5858

59-
pub impl<T:Ord> Ord for Option<T> {
59+
impl<T:Ord> Ord for Option<T> {
6060
pure fn lt(&self, other: &Option<T>) -> bool {
6161
match (self, other) {
6262
(&None, &None) => false,

src/libcore/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,7 @@ pub trait OwnedStr {
23622362
fn push_char(&mut self, c: char);
23632363
}
23642364

2365-
pub impl OwnedStr for ~str {
2365+
impl OwnedStr for ~str {
23662366
fn push_str(&mut self, v: &str) {
23672367
push_str(self, v);
23682368
}

src/libcore/to_bytes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl IterBytes for char {
170170
pub mod x32 {
171171
use to_bytes::{Cb, IterBytes};
172172

173-
pub impl IterBytes for uint {
173+
impl IterBytes for uint {
174174
#[inline(always)]
175175
pure fn iter_bytes(&self, lsb0: bool, f: Cb) {
176176
(*self as u32).iter_bytes(lsb0, f)
@@ -182,7 +182,7 @@ pub mod x32 {
182182
pub mod x64 {
183183
use to_bytes::{Cb, IterBytes};
184184

185-
pub impl IterBytes for uint {
185+
impl IterBytes for uint {
186186
#[inline(always)]
187187
pure fn iter_bytes(&self, lsb0: bool, f: Cb) {
188188
(*self as u64).iter_bytes(lsb0, f)

src/librustc/middle/borrowck/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ impl LoanKind {
451451

452452
/// Creates and returns a new root_map
453453
454-
pub impl to_bytes::IterBytes for root_map_key {
454+
impl to_bytes::IterBytes for root_map_key {
455455
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
456456
to_bytes::iter_bytes_2(&self.id, &self.derefs, lsb0, f);
457457
}

src/librustc/middle/mem_categorization.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,12 @@ pub trait ast_node {
281281
fn span(&self) -> span;
282282
}
283283

284-
pub impl ast_node for @ast::expr {
284+
impl ast_node for @ast::expr {
285285
fn id(&self) -> ast::node_id { self.id }
286286
fn span(&self) -> span { self.span }
287287
}
288288

289-
pub impl ast_node for @ast::pat {
289+
impl ast_node for @ast::pat {
290290
fn id(&self) -> ast::node_id { self.id }
291291
fn span(&self) -> span { self.span }
292292
}
@@ -295,7 +295,7 @@ pub trait get_type_for_node {
295295
fn ty<N:ast_node>(&self, node: N) -> ty::t;
296296
}
297297

298-
pub impl get_type_for_node for ty::ctxt {
298+
impl get_type_for_node for ty::ctxt {
299299
fn ty<N:ast_node>(&self, node: N) -> ty::t {
300300
ty::node_id_to_type(*self, node.id())
301301
}

src/librustc/middle/trans/base.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub trait get_insn_ctxt {
107107
fn insn_ctxt(&self, s: &str) -> icx_popper;
108108
}
109109

110-
pub impl get_insn_ctxt for @CrateContext {
110+
impl get_insn_ctxt for @CrateContext {
111111
fn insn_ctxt(&self, s: &str) -> icx_popper {
112112
debug!("new insn_ctxt: %s", s);
113113
if self.sess.count_llvm_insns() {
@@ -117,13 +117,13 @@ pub impl get_insn_ctxt for @CrateContext {
117117
}
118118
}
119119

120-
pub impl get_insn_ctxt for block {
120+
impl get_insn_ctxt for block {
121121
fn insn_ctxt(&self, s: &str) -> icx_popper {
122122
self.ccx().insn_ctxt(s)
123123
}
124124
}
125125

126-
pub impl get_insn_ctxt for fn_ctxt {
126+
impl get_insn_ctxt for fn_ctxt {
127127
fn insn_ctxt(&self, s: &str) -> icx_popper {
128128
self.ccx.insn_ctxt(s)
129129
}

src/librustc/middle/trans/common.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -538,13 +538,13 @@ pub trait get_node_info {
538538
fn info(&self) -> Option<NodeInfo>;
539539
}
540540

541-
pub impl get_node_info for @ast::expr {
541+
impl get_node_info for @ast::expr {
542542
fn info(&self) -> Option<NodeInfo> {
543543
Some(NodeInfo { id: self.id, span: self.span })
544544
}
545545
}
546546

547-
pub impl get_node_info for ast::blk {
547+
impl get_node_info for ast::blk {
548548
fn info(&self) -> Option<NodeInfo> {
549549
Some(NodeInfo { id: self.node.id, span: self.span })
550550
}
@@ -553,7 +553,7 @@ pub impl get_node_info for ast::blk {
553553
// XXX: Work around a trait parsing bug. remove after snapshot
554554
pub type optional_boxed_ast_expr = Option<@ast::expr>;
555555

556-
pub impl get_node_info for optional_boxed_ast_expr {
556+
impl get_node_info for optional_boxed_ast_expr {
557557
fn info(&self) -> Option<NodeInfo> {
558558
self.chain_ref(|s| s.info())
559559
}
@@ -1275,7 +1275,7 @@ pub struct mono_id_ {
12751275
12761276
pub type mono_id = @mono_id_;
12771277
1278-
pub impl to_bytes::IterBytes for mono_param_id {
1278+
impl to_bytes::IterBytes for mono_param_id {
12791279
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
12801280
match /*bad*/copy *self {
12811281
mono_precise(t, mids) =>
@@ -1289,7 +1289,7 @@ pub impl to_bytes::IterBytes for mono_param_id {
12891289
}
12901290
}
12911291
1292-
pub impl to_bytes::IterBytes for mono_id_ {
1292+
impl to_bytes::IterBytes for mono_id_ {
12931293
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
12941294
to_bytes::iter_bytes_2(&self.def, &self.params, lsb0, f);
12951295
}

src/librustc/middle/trans/datum.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ pub impl DatumMode {
151151
}
152152
}
153153

154-
pub impl cmp::Eq for DatumMode {
154+
impl cmp::Eq for DatumMode {
155155
pure fn eq(&self, other: &DatumMode) -> bool {
156156
(*self) as uint == (*other as uint)
157157
}
158158
pure fn ne(&self, other: &DatumMode) -> bool { !(*self).eq(other) }
159159
}
160160

161-
pub impl to_bytes::IterBytes for DatumMode {
161+
impl to_bytes::IterBytes for DatumMode {
162162
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
163163
(*self as uint).iter_bytes(lsb0, f)
164164
}

src/librustc/middle/ty.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -660,46 +660,46 @@ pub trait Vid {
660660
pure fn to_uint(&self) -> uint;
661661
}
662662

663-
pub impl Vid for TyVid {
663+
impl Vid for TyVid {
664664
pure fn to_uint(&self) -> uint { **self }
665665
}
666666

667-
pub impl ToStr for TyVid {
667+
impl ToStr for TyVid {
668668
pure fn to_str(&self) -> ~str { fmt!("<V%u>", self.to_uint()) }
669669
}
670670

671-
pub impl Vid for IntVid {
671+
impl Vid for IntVid {
672672
pure fn to_uint(&self) -> uint { **self }
673673
}
674674

675-
pub impl ToStr for IntVid {
675+
impl ToStr for IntVid {
676676
pure fn to_str(&self) -> ~str { fmt!("<VI%u>", self.to_uint()) }
677677
}
678678

679-
pub impl Vid for FloatVid {
679+
impl Vid for FloatVid {
680680
pure fn to_uint(&self) -> uint { **self }
681681
}
682682

683-
pub impl ToStr for FloatVid {
683+
impl ToStr for FloatVid {
684684
pure fn to_str(&self) -> ~str { fmt!("<VF%u>", self.to_uint()) }
685685
}
686686

687-
pub impl Vid for RegionVid {
687+
impl Vid for RegionVid {
688688
pure fn to_uint(&self) -> uint { **self }
689689
}
690690

691-
pub impl ToStr for RegionVid {
691+
impl ToStr for RegionVid {
692692
pure fn to_str(&self) -> ~str { fmt!("%?", self) }
693693
}
694694

695-
pub impl ToStr for FnSig {
695+
impl ToStr for FnSig {
696696
pure fn to_str(&self) -> ~str {
697697
// grr, without tcx not much we can do.
698698
return ~"(...)";
699699
}
700700
}
701701

702-
pub impl ToStr for InferTy {
702+
impl ToStr for InferTy {
703703
pure fn to_str(&self) -> ~str {
704704
match *self {
705705
TyVar(ref v) => v.to_str(),
@@ -709,7 +709,7 @@ pub impl ToStr for InferTy {
709709
}
710710
}
711711

712-
pub impl ToStr for IntVarValue {
712+
impl ToStr for IntVarValue {
713713
pure fn to_str(&self) -> ~str {
714714
match *self {
715715
IntType(ref v) => v.to_str(),
@@ -718,25 +718,25 @@ pub impl ToStr for IntVarValue {
718718
}
719719
}
720720

721-
pub impl to_bytes::IterBytes for TyVid {
721+
impl to_bytes::IterBytes for TyVid {
722722
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
723723
self.to_uint().iter_bytes(lsb0, f)
724724
}
725725
}
726726

727-
pub impl to_bytes::IterBytes for IntVid {
727+
impl to_bytes::IterBytes for IntVid {
728728
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
729729
self.to_uint().iter_bytes(lsb0, f)
730730
}
731731
}
732732

733-
pub impl to_bytes::IterBytes for FloatVid {
733+
impl to_bytes::IterBytes for FloatVid {
734734
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
735735
self.to_uint().iter_bytes(lsb0, f)
736736
}
737737
}
738738

739-
pub impl to_bytes::IterBytes for RegionVid {
739+
impl to_bytes::IterBytes for RegionVid {
740740
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
741741
self.to_uint().iter_bytes(lsb0, f)
742742
}

0 commit comments

Comments
 (0)