]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/issue-28514.rs
New upstream version 1.15.0+dfsg1
[rustc.git] / src / test / compile-fail / issue-28514.rs
CommitLineData
5bcae85e
SL
1// Copyright 2016 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.
4//
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.
10
11#![deny(private_in_public)]
12
13pub use inner::C;
14
15mod inner {
16 trait A {
17 fn a(&self) { }
18 }
19
20 pub trait B {
21 fn b(&self) { }
22 }
23
476ff2be 24 pub trait C: A + B { //~ ERROR private trait `inner::A` in public interface
5bcae85e
SL
25 //~^ WARN will become a hard error
26 fn c(&self) { }
27 }
28
29 impl A for i32 {}
30 impl B for i32 {}
31 impl C for i32 {}
32
33}
34
35fn main() {
36 // A is private
37 // B is pub, not reexported
38 // C : A + B is pub, reexported
39
40 // 0.a(); // can't call
41 // 0.b(); // can't call
42 0.c(); // ok
43
44 C::a(&0); // can call
45 C::b(&0); // can call
46 C::c(&0); // ok
47}