/
issue-28450.rs
54 lines (42 loc) · 1.38 KB
/
issue-28450.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Checks for private types in public interfaces
#![feature(rustc_attrs)]
struct Priv;
pub use self::private::public;
mod private {
pub type Priv = super::Priv; //~ WARN private type in public interface
pub fn public(_x: Priv) {
}
}
struct __CFArray;
pub type CFArrayRef = *const __CFArray; //~ WARN private type in public interface
trait Pointer { type Pointee; }
impl<T> Pointer for *const T { type Pointee = T; }
pub type __CFArrayRevealed = <CFArrayRef as Pointer>::Pointee;
//~^ WARN private type in public interface
pub trait Exporter {
type Output;
}
pub struct Helper;
pub fn block() -> <Helper as Exporter>::Output {
struct Inner;
impl Inner {
fn poke(&self) { println!("Hello!"); }
}
impl Exporter for Helper {
type Output = Inner; //~ WARN private type in public interface
}
Inner
}
#[rustc_error]
fn main() { //~ ERROR compilation successful
block().poke();
}