1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![deny(visible_private_types)]
17 struct Private<T>(marker::PhantomData<T>);
18 pub struct Public<T>(marker::PhantomData<T>);
20 impl Private<Public<isize>> {
21 pub fn a(&self) -> Private<isize> { panic!() }
22 fn b(&self) -> Private<isize> { panic!() }
24 pub fn c() -> Private<isize> { panic!() }
25 fn d() -> Private<isize> { panic!() }
28 pub fn e(&self) -> Private<isize> { panic!() }
29 fn f(&self) -> Private<isize> { panic!() }
32 impl Public<Private<isize>> {
33 pub fn a(&self) -> Private<isize> { panic!() }
34 fn b(&self) -> Private<isize> { panic!() }
36 pub fn c() -> Private<isize> { panic!() } //~ ERROR private type in exported type signature
37 fn d() -> Private<isize> { panic!() }
40 pub fn e(&self) -> Private<isize> { panic!() } //~ ERROR private type in exported type signature
41 fn f(&self) -> Private<isize> { panic!() }
44 pub fn x(_: Private<isize>) {} //~ ERROR private type in exported type signature
46 fn y(_: Private<isize>) {}
50 pub x: Private<isize>, //~ ERROR private type in exported type signature
59 Baz1(Private<isize>), //~ ERROR private type in exported type signature
61 y: Private<isize> //~ ERROR private type in exported type signature
73 fn foo(&self) -> Private<isize> { panic!( )} //~ ERROR private type in exported type signature
74 fn bar(&self) -> Private<isize>; //~ ERROR private type in exported type signature
75 fn baz() -> Private<isize>; //~ ERROR private type in exported type signature
78 impl PubTrait for Public<isize> {
79 fn bar(&self) -> Private<isize> { panic!() }
80 fn baz() -> Private<isize> { panic!() }
82 impl PubTrait for Public<Private<isize>> {
83 fn bar(&self) -> Private<isize> { panic!() }
84 fn baz() -> Private<isize> { panic!() }
87 impl PubTrait for Private<isize> {
88 fn bar(&self) -> Private<isize> { panic!() }
89 fn baz() -> Private<isize> { panic!() }
91 impl PubTrait for (Private<isize>,) {
92 fn bar(&self) -> Private<isize> { panic!() }
93 fn baz() -> Private<isize> { panic!() }
98 fn foo(&self) -> Private<isize> { panic!( )}
99 fn bar(&self) -> Private<isize>;
101 impl PrivTrait for Private<isize> {
102 fn bar(&self) -> Private<isize> { panic!() }
104 impl PrivTrait for (Private<isize>,) {
105 fn bar(&self) -> Private<isize> { panic!() }
108 pub trait ParamTrait<T> : marker::MarkerTrait {
112 impl ParamTrait<Private<isize>> //~ ERROR private type in exported type signature
114 fn foo() -> Private<isize> { panic!() }
117 impl ParamTrait<Private<isize>> for Private<isize> {
118 fn foo() -> Private<isize> { panic!( )}
121 impl<T: ParamTrait<Private<isize>>> //~ ERROR private type in exported type signature
122 ParamTrait<T> for Public<i8> {
123 fn foo() -> T { panic!() }