rpass/cfail: Update field privacy where necessary
This commit is contained in:
parent
0b36e9d913
commit
d0a80cca6c
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
pub struct Foo {
|
||||
x: int
|
||||
pub x: int
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
pub mod kitties {
|
||||
pub struct cat {
|
||||
priv meows : uint,
|
||||
meows : uint,
|
||||
|
||||
how_hungry : int,
|
||||
pub how_hungry : int,
|
||||
}
|
||||
|
||||
pub fn cat(in_x : uint, in_y : int) -> cat {
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
pub mod kitties {
|
||||
pub struct cat {
|
||||
priv meows : uint,
|
||||
meows : uint,
|
||||
|
||||
how_hungry : int,
|
||||
pub how_hungry : int,
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
pub mod kitties {
|
||||
pub struct cat {
|
||||
priv meows : uint,
|
||||
meows : uint,
|
||||
|
||||
how_hungry : int,
|
||||
pub how_hungry : int,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
pub mod kitties {
|
||||
pub struct cat {
|
||||
priv meows : uint,
|
||||
meows : uint,
|
||||
|
||||
how_hungry : int,
|
||||
name : ~str,
|
||||
pub how_hungry : int,
|
||||
pub name : ~str,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
pub mod kitties {
|
||||
pub struct cat {
|
||||
priv meows : uint,
|
||||
how_hungry : int,
|
||||
meows : uint,
|
||||
pub how_hungry : int,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
|
@ -11,10 +11,10 @@
|
||||
pub mod kitties {
|
||||
|
||||
pub struct cat<U> {
|
||||
priv info : Vec<U> ,
|
||||
priv meows : uint,
|
||||
info : Vec<U> ,
|
||||
meows : uint,
|
||||
|
||||
how_hungry : int,
|
||||
pub how_hungry : int,
|
||||
}
|
||||
|
||||
impl<U> cat<U> {
|
||||
|
@ -12,9 +12,9 @@ pub mod kitty {
|
||||
use std::fmt;
|
||||
|
||||
pub struct cat {
|
||||
priv meows : uint,
|
||||
how_hungry : int,
|
||||
name : ~str,
|
||||
meows : uint,
|
||||
pub how_hungry : int,
|
||||
pub name : ~str,
|
||||
}
|
||||
|
||||
impl fmt::Show for cat {
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#[crate_type = "lib"];
|
||||
|
||||
pub struct NameVal { name: ~str, val: int }
|
||||
pub struct NameVal { pub name: ~str, pub val: int }
|
||||
|
||||
pub fn struct_nameval() -> NameVal {
|
||||
NameVal { name: ~"crateresolve5", val: 10 }
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#[crate_type = "lib"];
|
||||
|
||||
pub struct NameVal { name: ~str, val: int }
|
||||
pub struct NameVal { pub name: ~str, pub val: int }
|
||||
pub fn struct_nameval() -> NameVal {
|
||||
NameVal { name: ~"crateresolve5", val: 10 }
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ pub trait Foo {
|
||||
}
|
||||
|
||||
pub struct Bar {
|
||||
x: ~str
|
||||
pub x: ~str
|
||||
}
|
||||
|
||||
impl Foo for Bar {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#[crate_type = "lib"];
|
||||
|
||||
pub struct Fish {
|
||||
x: int
|
||||
pub x: int
|
||||
}
|
||||
|
||||
impl Fish {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#[crate_type = "lib"];
|
||||
|
||||
pub struct Fish {
|
||||
x: int
|
||||
pub x: int
|
||||
}
|
||||
|
||||
mod unexported {
|
||||
|
@ -11,11 +11,11 @@
|
||||
#[feature(struct_variant)];
|
||||
|
||||
pub struct BTree<V> {
|
||||
node: TreeItem<V>,
|
||||
pub node: TreeItem<V>,
|
||||
}
|
||||
|
||||
pub enum TreeItem<V> {
|
||||
TreeLeaf { value: V },
|
||||
TreeLeaf { pub value: V },
|
||||
}
|
||||
|
||||
pub fn leaf<V>(value: V) -> TreeItem<V> {
|
||||
|
@ -14,7 +14,7 @@ extern crate issue2378a;
|
||||
|
||||
use issue2378a::maybe;
|
||||
|
||||
pub struct two_maybes<T> {a: maybe<T>, b: maybe<T>}
|
||||
pub struct two_maybes<T> {pub a: maybe<T>, pub b: maybe<T>}
|
||||
|
||||
impl<T:Clone> Index<uint,(T,T)> for two_maybes<T> {
|
||||
fn index(&self, idx: &uint) -> (T, T) {
|
||||
|
@ -116,18 +116,18 @@ pub trait Trait {
|
||||
impl Trait for MethodTester {}
|
||||
|
||||
#[deprecated]
|
||||
pub struct DeprecatedStruct { i: int }
|
||||
pub struct DeprecatedStruct { pub i: int }
|
||||
#[experimental]
|
||||
pub struct ExperimentalStruct { i: int }
|
||||
pub struct ExperimentalStruct { pub i: int }
|
||||
#[unstable]
|
||||
pub struct UnstableStruct { i: int }
|
||||
pub struct UnmarkedStruct { i: int }
|
||||
pub struct UnstableStruct { pub i: int }
|
||||
pub struct UnmarkedStruct { pub i: int }
|
||||
#[stable]
|
||||
pub struct StableStruct { i: int }
|
||||
pub struct StableStruct { pub i: int }
|
||||
#[frozen]
|
||||
pub struct FrozenStruct { i: int }
|
||||
pub struct FrozenStruct { pub i: int }
|
||||
#[locked]
|
||||
pub struct LockedStruct { i: int }
|
||||
pub struct LockedStruct { pub i: int }
|
||||
|
||||
#[deprecated]
|
||||
pub struct DeprecatedUnitStruct;
|
||||
|
@ -11,7 +11,7 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
struct DerefWithHelper<H, T> {
|
||||
helper: H
|
||||
pub helper: H
|
||||
}
|
||||
|
||||
trait Helper<T> {
|
||||
|
@ -9,5 +9,5 @@
|
||||
// except according to those terms.
|
||||
|
||||
pub struct Foo {
|
||||
name: int
|
||||
pub name: int
|
||||
}
|
||||
|
@ -14,6 +14,6 @@ struct A {
|
||||
}
|
||||
|
||||
pub struct B {
|
||||
a: int,
|
||||
priv b: int,
|
||||
pub a: int,
|
||||
b: int,
|
||||
}
|
||||
|
@ -11,6 +11,6 @@
|
||||
#[crate_type="lib"];
|
||||
|
||||
pub struct S {
|
||||
x: int,
|
||||
y: int
|
||||
pub x: int,
|
||||
pub y: int,
|
||||
}
|
||||
|
@ -14,5 +14,5 @@
|
||||
#![feature(struct_variant)]
|
||||
|
||||
pub enum Enum {
|
||||
Variant { arg: u8 }
|
||||
Variant { pub arg: u8 }
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#[crate_id="trait_default_method_xc_aux"];
|
||||
|
||||
pub struct Something { x: int }
|
||||
pub struct Something { pub x: int }
|
||||
|
||||
pub trait A {
|
||||
fn f(&self) -> int;
|
||||
|
@ -13,7 +13,7 @@
|
||||
extern crate aux = "trait_default_method_xc_aux";
|
||||
use aux::A;
|
||||
|
||||
pub struct a_struct { x: int }
|
||||
pub struct a_struct { pub x: int }
|
||||
|
||||
impl A for a_struct {
|
||||
fn f(&self) -> int { 10 }
|
||||
|
@ -12,7 +12,7 @@ pub trait Foo { fn f(&self) -> int; }
|
||||
pub trait Bar { fn g(&self) -> int; }
|
||||
pub trait Baz { fn h(&self) -> int; }
|
||||
|
||||
pub struct A { x: int }
|
||||
pub struct A { pub x: int }
|
||||
|
||||
impl Foo for A { fn f(&self) -> int { 10 } }
|
||||
impl Bar for A { fn g(&self) -> int { 20 } }
|
||||
|
@ -14,7 +14,7 @@ pub trait Foo {
|
||||
}
|
||||
|
||||
pub struct A {
|
||||
x: int
|
||||
pub x: int
|
||||
}
|
||||
|
||||
impl Foo for A {
|
||||
|
@ -15,7 +15,7 @@ pub trait MyNum : Add<Self,Self> + Sub<Self,Self> + Mul<Self,Self> + Eq {
|
||||
|
||||
#[deriving(Show)]
|
||||
pub struct MyInt {
|
||||
val: int
|
||||
pub val: int
|
||||
}
|
||||
|
||||
impl Add<MyInt, MyInt> for MyInt {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#[crate_type="lib"];
|
||||
|
||||
pub struct Struct {
|
||||
x: int
|
||||
pub x: int
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
mod my_mod {
|
||||
pub struct MyStruct {
|
||||
priv priv_field: int
|
||||
priv_field: int
|
||||
}
|
||||
pub fn MyStruct () -> MyStruct {
|
||||
MyStruct {priv_field: 4}
|
||||
|
@ -24,14 +24,14 @@ struct Foo {
|
||||
}
|
||||
|
||||
pub struct PubFoo { //~ ERROR: missing documentation
|
||||
a: int, //~ ERROR: missing documentation
|
||||
priv b: int,
|
||||
pub a: int, //~ ERROR: missing documentation
|
||||
b: int,
|
||||
}
|
||||
|
||||
#[allow(missing_doc)]
|
||||
pub struct PubFoo2 {
|
||||
a: int,
|
||||
c: int,
|
||||
pub a: int,
|
||||
pub c: int,
|
||||
}
|
||||
|
||||
mod module_no_dox {}
|
||||
@ -106,8 +106,8 @@ enum Baz {
|
||||
|
||||
pub enum PubBaz { //~ ERROR: missing documentation
|
||||
PubBazA { //~ ERROR: missing documentation
|
||||
a: int, //~ ERROR: missing documentation
|
||||
priv b: int
|
||||
pub a: int, //~ ERROR: missing documentation
|
||||
b: int
|
||||
},
|
||||
|
||||
priv PubBazB
|
||||
@ -118,8 +118,8 @@ pub enum PubBaz2 {
|
||||
/// dox
|
||||
PubBaz2A {
|
||||
/// dox
|
||||
a: int,
|
||||
priv b: int
|
||||
pub a: int,
|
||||
b: int
|
||||
},
|
||||
priv PubBaz2B
|
||||
}
|
||||
@ -127,8 +127,8 @@ pub enum PubBaz2 {
|
||||
#[allow(missing_doc)]
|
||||
pub enum PubBaz3 {
|
||||
PubBaz3A {
|
||||
a: int,
|
||||
priv b: int
|
||||
pub a: int,
|
||||
b: int
|
||||
},
|
||||
priv PubBaz3B
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ mod test {
|
||||
}
|
||||
|
||||
mod foo {
|
||||
pub struct Point{x: int, y: int}
|
||||
pub struct Square{p: Point, h: uint, w: uint}
|
||||
pub struct Point{pub x: int, pub y: int}
|
||||
pub struct Square{pub p: Point, pub h: uint, pub w: uint}
|
||||
}
|
||||
|
||||
mod bar {
|
||||
|
@ -46,8 +46,8 @@ fn y(_: Private<int>) {}
|
||||
|
||||
|
||||
pub struct Foo {
|
||||
x: Private<int>, //~ ERROR private type in exported type signature
|
||||
priv y: Private<int>
|
||||
pub x: Private<int>, //~ ERROR private type in exported type signature
|
||||
y: Private<int>
|
||||
}
|
||||
|
||||
struct Bar {
|
||||
@ -57,8 +57,8 @@ struct Bar {
|
||||
pub enum Baz {
|
||||
Baz1(Private<int>), //~ ERROR private type in exported type signature
|
||||
Baz2 {
|
||||
x: Private<int>, //~ ERROR private type in exported type signature
|
||||
priv y: Private<int>
|
||||
pub x: Private<int>, //~ ERROR private type in exported type signature
|
||||
y: Private<int>
|
||||
},
|
||||
|
||||
priv Baz3(Private<int>),
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
mod a {
|
||||
pub struct Foo {
|
||||
x: int
|
||||
pub x: int
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
mod a {
|
||||
pub struct Foo {
|
||||
priv x: int
|
||||
x: int
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ use a::Foo;
|
||||
|
||||
mod a {
|
||||
pub struct Foo {
|
||||
priv x: int
|
||||
x: int
|
||||
}
|
||||
|
||||
pub fn make() -> Foo {
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
mod cat {
|
||||
pub struct Cat {
|
||||
priv meows: uint
|
||||
meows: uint
|
||||
}
|
||||
|
||||
pub fn new_cat() -> Cat {
|
||||
|
@ -20,12 +20,10 @@ mod inner {
|
||||
struct A {
|
||||
a: int,
|
||||
pub b: int,
|
||||
priv c: int, //~ ERROR: unnecessary `priv` visibility
|
||||
}
|
||||
pub struct B {
|
||||
a: int,
|
||||
priv b: int,
|
||||
pub c: int,
|
||||
pub a: int,
|
||||
b: int,
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,10 +34,8 @@ fn test(a: A, b: inner::A, c: inner::B, d: xc::A, e: xc::B) {
|
||||
a.a;
|
||||
b.a; //~ ERROR: field `a` is private
|
||||
b.b;
|
||||
b.c; //~ ERROR: field `c` is private
|
||||
c.a;
|
||||
c.b; //~ ERROR: field `b` is private
|
||||
c.c;
|
||||
|
||||
d.a; //~ ERROR: field `a` is private
|
||||
d.b;
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
mod buildings {
|
||||
pub struct Tower { height: uint }
|
||||
pub struct Tower { pub height: uint }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
pub struct Scheduler {
|
||||
/// The event loop used to drive the scheduler and perform I/O
|
||||
priv event_loop: ~int
|
||||
event_loop: ~int
|
||||
}
|
||||
|
||||
pub fn main() { }
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
mod m {
|
||||
pub struct S {
|
||||
x: int,
|
||||
y: int
|
||||
pub x: int,
|
||||
pub y: int
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@ impl<X, Y> Deref<Y> for DerefWrapper<X, Y> {
|
||||
|
||||
mod priv_test {
|
||||
pub struct DerefWrapperHideX<X, Y> {
|
||||
priv x: X,
|
||||
y: Y
|
||||
x: X,
|
||||
pub y: Y
|
||||
}
|
||||
|
||||
impl<X, Y> DerefWrapperHideX<X, Y> {
|
||||
|
@ -24,7 +24,7 @@ fn welp<T>(i: int, _x: &T) -> int {
|
||||
}
|
||||
|
||||
mod stuff {
|
||||
pub struct thing { x: int }
|
||||
pub struct thing { pub x: int }
|
||||
}
|
||||
|
||||
impl A for stuff::thing {
|
||||
|
Loading…
x
Reference in New Issue
Block a user