diff options
| author | Michael Woerister <michaelwoerister@gmail> | 2013-08-07 14:29:29 +0200 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@gmail> | 2013-08-07 14:30:00 +0200 |
| commit | 2c9922aa491f406d0a17631ef2f0bfc0bbf85346 (patch) | |
| tree | 67a8dd9e22edd3a57bcd5961e031ab6548605bd1 /src/test/auxiliary | |
| parent | 4da1cfe92369725b2e6bf34acb1fdebdbaff9339 (diff) | |
| download | rust-2c9922aa491f406d0a17631ef2f0bfc0bbf85346.tar.gz rust-2c9922aa491f406d0a17631ef2f0bfc0bbf85346.zip | |
Enable privacy check for enum methods.
Diffstat (limited to 'src/test/auxiliary')
| -rw-r--r-- | src/test/auxiliary/xc_private_method_lib.rs | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/test/auxiliary/xc_private_method_lib.rs b/src/test/auxiliary/xc_private_method_lib.rs index 05325c3b935..8290f62bada 100644 --- a/src/test/auxiliary/xc_private_method_lib.rs +++ b/src/test/auxiliary/xc_private_method_lib.rs @@ -1,9 +1,33 @@ #[crate_type="lib"]; -pub struct Foo { +pub struct Struct { x: int } -impl Foo { - fn new() -> Foo { Foo { x: 1 } } +impl Struct { + fn static_meth_struct() -> Struct { + Struct { x: 1 } + } + + fn meth_struct(&self) -> int { + self.x + } +} + +pub enum Enum { + Variant1(int), + Variant2(int) +} + +impl Enum { + fn static_meth_enum() -> Enum { + Variant2(10) + } + + fn meth_enum(&self) -> int { + match *self { + Variant1(x) | + Variant2(x) => x + } + } } |
