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.
16 struct Private<T>(marker::PhantomData<T>);
17 pub struct Public<T>(marker::PhantomData<T>);
19 impl Private<Public<isize>> {
20 pub fn a(&self) -> Private<isize> { panic!() }
21 fn b(&self) -> Private<isize> { panic!() }
23 pub fn c() -> Private<isize> { panic!() }
24 fn d() -> Private<isize> { panic!() }
27 pub fn e(&self) -> Private<isize> { panic!() }
28 fn f(&self) -> Private<isize> { panic!() }
31 impl Public<Private<isize>> {
32 pub fn a(&self) -> Private<isize> { panic!() }
33 fn b(&self) -> Private<isize> { panic!() }
35 pub fn c() -> Private<isize> { panic!() }
36 fn d() -> Private<isize> { panic!() }
39 pub fn e(&self) -> Private<isize> { panic!() } //~ ERROR private type in exported type signature
40 fn f(&self) -> Private<isize> { panic!() }
43 pub fn x(_: Private<isize>) {} //~ ERROR private type in exported type signature
45 fn y(_: Private<isize>) {}
49 pub x: Private<isize>, //~ ERROR private type in exported type signature
58 Baz1(Private<isize>), //~ ERROR private type in exported type signature
60 y: Private<isize> //~ ERROR private type in exported type signature
72 fn foo(&self) -> Private<isize> { panic!( )} //~ ERROR private type in exported type signature
73 fn bar(&self) -> Private<isize>; //~ ERROR private type in exported type signature
74 fn baz() -> Private<isize>; //~ ERROR private type in exported type signature
77 impl PubTrait for Public<isize> {
78 fn bar(&self) -> Private<isize> { panic!() } //~ ERROR private type in exported type signature
79 fn baz() -> Private<isize> { panic!() } //~ ERROR private type in exported type signature
81 impl PubTrait for Public<Private<isize>> {
82 fn bar(&self) -> Private<isize> { panic!() }
83 fn baz() -> Private<isize> { panic!() }
86 impl PubTrait for Private<isize> {
87 fn bar(&self) -> Private<isize> { panic!() }
88 fn baz() -> Private<isize> { panic!() }
90 impl PubTrait for (Private<isize>,) {
91 fn bar(&self) -> Private<isize> { panic!() }
92 fn baz() -> Private<isize> { panic!() }
97 fn foo(&self) -> Private<isize> { panic!( )}
98 fn bar(&self) -> Private<isize>;
100 impl PrivTrait for Private<isize> {
101 fn bar(&self) -> Private<isize> { panic!() }
103 impl PrivTrait for (Private<isize>,) {
104 fn bar(&self) -> Private<isize> { panic!() }
107 pub trait ParamTrait<T> {
111 impl ParamTrait<Private<isize>>
113 fn foo() -> Private<isize> { panic!() }
116 impl ParamTrait<Private<isize>> for Private<isize> {
117 fn foo() -> Private<isize> { panic!( )}
120 impl<T: ParamTrait<Private<isize>>> //~ ERROR private type in exported type signature
121 ParamTrait<T> for Public<i8> {
122 fn foo() -> T { panic!() }