Add more systematic tests

This commit is contained in:
Vadim Petrochenkov 2015-12-18 04:56:27 +03:00
parent 8f359d5912
commit cda7244a2a
11 changed files with 402 additions and 429 deletions

View file

@ -1,41 +0,0 @@
// 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.
pub struct PublicType;
struct PrivateType;
pub trait PublicTrait {
type Item;
}
trait PrivateTrait {
type Item;
}
impl PublicTrait for PublicType {
type Item = PrivateType; //~ ERROR private type in public interface
}
// OK
impl PublicTrait for PrivateType {
type Item = PrivateType;
}
// OK
impl PrivateTrait for PublicType {
type Item = PrivateType;
}
// OK
impl PrivateTrait for PrivateType {
type Item = PrivateType;
}
fn main() {}

View file

@ -1,43 +0,0 @@
// 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)]
#![allow(dead_code, unused_variables)]
mod y {
pub struct Foo { x: u32 }
struct Bar { x: u32 }
impl Foo {
pub fn foo(&self, x: Self, y: Bar) { } //~ WARN private type in public interface
}
}
mod x {
pub struct Foo { pub x: u32 }
struct Bar { _x: u32 }
impl Foo {
pub fn foo(&self, _x: Self, _y: Bar) { } //~ WARN private type in public interface
pub fn bar(&self) -> Bar { Bar { _x: self.x } }
//~^ WARN private type in public interface
}
}
#[rustc_error]
pub fn main() { //~ ERROR compilation successful
let f = x::Foo { x: 4 };
let b = f.bar();
f.foo(x::Foo { x: 5 }, b);
}

View file

@ -1,54 +0,0 @@
// 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();
}

View file

@ -1,47 +0,0 @@
// Copyright 2014 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.
#![feature(rustc_attrs)]
#![allow(dead_code)]
use std::marker;
struct Private<T>(marker::PhantomData<T>);
pub struct Public<T>(marker::PhantomData<T>);
pub trait PubTrait {
type Output;
}
type PrivAlias = Public<i8>;
trait PrivTrait2 {
type Alias;
}
impl PrivTrait2 for Private<isize> {
type Alias = Public<u8>;
}
impl PubTrait for PrivAlias {
type Output = Private<isize>; //~ WARN private type in public interface
}
impl PubTrait for <Private<isize> as PrivTrait2>::Alias {
type Output = Private<isize>; //~ WARN private type in public interface
}
type PrivAliasPubType = u8;
pub fn f1(_: PrivAliasPubType) {} // Ok, not an error
type PrivAliasGeneric<T = Private<isize>> = T;
pub fn f2(_: PrivAliasGeneric<u8>) {} // Ok, not an error
#[rustc_error]
fn main() {} //~ ERROR compilation successful

View file

@ -1,132 +0,0 @@
// Copyright 2014 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.
#![allow(dead_code)]
#![crate_type="lib"]
use std::marker;
struct Private<T>(marker::PhantomData<T>);
pub struct Public<T>(marker::PhantomData<T>);
impl Private<Public<isize>> {
pub fn a(&self) -> Private<isize> { panic!() }
fn b(&self) -> Private<isize> { panic!() }
pub fn c() -> Private<isize> { panic!() }
fn d() -> Private<isize> { panic!() }
}
impl Private<isize> {
pub fn e(&self) -> Private<isize> { panic!() }
fn f(&self) -> Private<isize> { panic!() }
}
impl Public<Private<isize>> {
pub fn a(&self) -> Private<isize> { panic!() }
fn b(&self) -> Private<isize> { panic!() }
pub fn c() -> Private<isize> { panic!() }
fn d() -> Private<isize> { panic!() }
}
impl Public<isize> {
pub fn e(&self) -> Private<isize> { panic!() } //~ ERROR private type in public interface
fn f(&self) -> Private<isize> { panic!() }
}
pub fn x(_: Private<isize>) {} //~ ERROR private type in public interface
fn y(_: Private<isize>) {}
pub struct Foo {
pub x: Private<isize>, //~ ERROR private type in public interface
y: Private<isize>
}
struct Bar {
x: Private<isize>,
}
pub enum Baz {
Baz1(Private<isize>), //~ ERROR private type in public interface
Baz2 {
y: Private<isize> //~ ERROR private type in public interface
},
}
enum Qux {
Qux1(Private<isize>),
Qux2 {
x: Private<isize>,
}
}
pub trait PubTrait {
fn foo(&self) -> Private<isize> { panic!( )} //~ ERROR private type in public interface
fn bar(&self) -> Private<isize>; //~ ERROR private type in public interface
fn baz() -> Private<isize>; //~ ERROR private type in public interface
}
impl PubTrait for Public<isize> {
fn bar(&self) -> Private<isize> { panic!() } // Warns in lint checking phase
fn baz() -> Private<isize> { panic!() } // Warns in lint checking phase
}
impl PubTrait for Public<Private<isize>> {
fn bar(&self) -> Private<isize> { panic!() }
fn baz() -> Private<isize> { panic!() }
}
impl PubTrait for Private<isize> {
fn bar(&self) -> Private<isize> { panic!() }
fn baz() -> Private<isize> { panic!() }
}
impl PubTrait for (Private<isize>,) {
fn bar(&self) -> Private<isize> { panic!() }
fn baz() -> Private<isize> { panic!() }
}
trait PrivTrait {
fn foo(&self) -> Private<isize> { panic!( )}
fn bar(&self) -> Private<isize>;
}
impl PrivTrait for Private<isize> {
fn bar(&self) -> Private<isize> { panic!() }
}
impl PrivTrait for (Private<isize>,) {
fn bar(&self) -> Private<isize> { panic!() }
}
pub trait ParamTrait<T> {
fn foo() -> T;
}
impl ParamTrait<Private<isize>>
for Public<isize> {
fn foo() -> Private<isize> { panic!() }
}
impl ParamTrait<Private<isize>> for Private<isize> {
fn foo() -> Private<isize> { panic!( )}
}
impl<T: ParamTrait<Private<isize>>> //~ ERROR private type in public interface
ParamTrait<T> for Public<i8> {
fn foo() -> T { panic!() }
}
type PrivAliasPrivType = Private<isize>;
pub fn f1(_: PrivAliasPrivType) {} //~ ERROR private type in public interface
type PrivAliasGeneric<T = Private<isize>> = T;
pub fn f2(_: PrivAliasGeneric) {} //~ ERROR private type in public interface
type Result<T> = std::result::Result<T, Private<isize>>;
pub fn f3(_: Result<u8>) {} //~ ERROR private type in public interface

View file

@ -1,28 +0,0 @@
// 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.
// Test that we properly check for private types in public signatures, even
// inside a private module (#22261).
mod a {
struct Priv;
pub fn expose_a() -> Priv { //~Error: private type in public interface
panic!();
}
mod b {
pub fn expose_b() -> super::Priv { //~Error: private type in public interface
panic!();
}
}
}
pub fn main() {}

View file

@ -0,0 +1,254 @@
// 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.
// Private types and traits are not allowed in public interfaces.
// This test also ensures that the checks are performed even inside private modules.
#![feature(rustc_attrs)]
#![feature(associated_consts)]
#![feature(associated_type_defaults)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(improper_ctypes)]
mod types {
struct Priv;
pub struct Pub;
pub trait PubTr {
type Alias;
}
pub type Alias = Priv; //~ WARN private type in public interface
pub enum E {
V1(Priv), //~ WARN private type in public interface
V2 { field: Priv }, //~ WARN private type in public interface
}
pub trait Tr {
const C: Priv = Priv; //~ WARN private type in public interface
type Alias = Priv; //~ WARN private type in public interface
fn f1(arg: Priv) {} //~ WARN private type in public interface
fn f2() -> Priv { panic!() } //~ WARN private type in public interface
}
extern {
pub static ES: Priv; //~ WARN private type in public interface
pub fn ef1(arg: Priv); //~ WARN private type in public interface
pub fn ef2() -> Priv; //~ WARN private type in public interface
}
impl PubTr for Pub {
type Alias = Priv; //~ WARN private type in public interface
}
}
mod traits {
trait PrivTr {}
pub struct Pub<T>(T);
pub trait PubTr {}
pub type Alias<T: PrivTr> = T; //~ WARN private trait in public interface
//~^ WARN trait bounds are not (yet) enforced in type definitions
pub trait Tr1: PrivTr {} //~ WARN private trait in public interface
pub trait Tr2<T: PrivTr> {} //~ WARN private trait in public interface
pub trait Tr3 {
type Alias: PrivTr; //~ WARN private trait in public interface
fn f<T: PrivTr>(arg: T) {} //~ WARN private trait in public interface
}
impl<T: PrivTr> Pub<T> {} //~ WARN private trait in public interface
impl<T: PrivTr> PubTr for Pub<T> {} //~ WARN private trait in public interface
}
mod traits_where {
trait PrivTr {}
pub struct Pub<T>(T);
pub trait PubTr {}
pub type Alias<T> where T: PrivTr = T; //~ WARN private trait in public interface
pub trait Tr2<T> where T: PrivTr {} //~ WARN private trait in public interface
pub trait Tr3 {
fn f<T>(arg: T) where T: PrivTr {} //~ WARN private trait in public interface
}
impl<T> Pub<T> where T: PrivTr {} //~ WARN private trait in public interface
impl<T> PubTr for Pub<T> where T: PrivTr {} //~ WARN private trait in public interface
}
mod generics {
struct Priv<T = u8>(T);
pub struct Pub<T = u8>(T);
trait PrivTr<T> {}
pub trait PubTr<T> {}
pub trait Tr1: PrivTr<Pub> {} //~ WARN private trait in public interface
pub trait Tr2: PubTr<Priv> {} //~ WARN private type in public interface
pub trait Tr3: PubTr<[Priv; 1]> {} //~ WARN private type in public interface
pub trait Tr4: PubTr<Pub<Priv>> {} //~ WARN private type in public interface
}
mod impls {
struct Priv;
pub struct Pub;
trait PrivTr {
type Alias;
}
pub trait PubTr {
type Alias;
}
impl Priv {
pub fn f(arg: Priv) {} // OK
}
impl PrivTr for Priv {
type Alias = Priv; // OK
}
impl PubTr for Priv {
type Alias = Priv; // OK
}
impl PrivTr for Pub {
type Alias = Priv; // OK
}
impl PubTr for Pub {
type Alias = Priv; //~ WARN private type in public interface
}
}
mod impls_generics {
struct Priv<T = u8>(T);
pub struct Pub<T = u8>(T);
trait PrivTr<T = u8> {
type Alias;
}
pub trait PubTr<T = u8> {
type Alias;
}
impl Priv<Pub> {
pub fn f(arg: Priv) {} // OK
}
impl Pub<Priv> {
pub fn f(arg: Priv) {} // OK
}
impl PrivTr<Pub> for Priv {
type Alias = Priv; // OK
}
impl PubTr<Priv> for Priv {
type Alias = Priv; // OK
}
impl PubTr for Priv<Pub> {
type Alias = Priv; // OK
}
impl PubTr for [Priv; 1] {
type Alias = Priv; // OK
}
impl PubTr for Pub<Priv> {
type Alias = Priv; // OK
}
impl PrivTr<Pub> for Pub {
type Alias = Priv; // OK
}
impl PubTr<Priv> for Pub {
type Alias = Priv; // OK
}
}
mod aliases_pub {
struct Priv;
mod m {
pub struct Pub1;
pub struct Pub2;
pub struct Pub3;
pub trait PubTr<T = u8> {
type Check = u8;
}
}
use self::m::Pub1 as PrivUseAlias;
use self::m::PubTr as PrivUseAliasTr;
type PrivAlias = m::Pub2;
trait PrivTr {
type AssocAlias = m::Pub3;
}
impl PrivTr for Priv {}
pub fn f1(arg: PrivUseAlias) {} // OK
pub fn f2(arg: PrivAlias) {} // OK
pub trait Tr1: PrivUseAliasTr {} // OK
pub trait Tr2: PrivUseAliasTr<PrivAlias> {} // OK
impl PrivAlias {
pub fn f(arg: Priv) {} //~ WARN private type in public interface
}
// This doesn't even parse
// impl <Priv as PrivTr>::AssocAlias {
// pub fn f(arg: Priv) {} // WARN private type in public interface
// }
impl PrivUseAliasTr for PrivUseAlias {
type Check = Priv; //~ WARN private type in public interface
}
impl PrivUseAliasTr for PrivAlias {
type Check = Priv; //~ WARN private type in public interface
}
impl PrivUseAliasTr for <Priv as PrivTr>::AssocAlias {
type Check = Priv; //~ WARN private type in public interface
}
}
mod aliases_priv {
struct Priv;
struct Priv1;
struct Priv2;
struct Priv3;
trait PrivTr1<T = u8> {
type Check = u8;
}
use self::Priv1 as PrivUseAlias;
use self::PrivTr1 as PrivUseAliasTr;
type PrivAlias = Priv2;
//~^ WARN private type in public interface
trait PrivTr {
type AssocAlias = Priv3;
}
impl PrivTr for Priv {}
pub trait Tr1: PrivUseAliasTr {} //~ WARN private trait in public interface
pub trait Tr2: PrivUseAliasTr<PrivAlias> {} //~ WARN private trait in public interface
//~^ WARN private type in public interface
impl PrivUseAlias {
pub fn f(arg: Priv) {} // OK
}
impl PrivAlias {
pub fn f(arg: Priv) {} // OK
}
// This doesn't even parse
// impl <Priv as PrivTr>::AssocAlias {
// pub fn f(arg: Priv) {} // OK
// }
impl PrivUseAliasTr for PrivUseAlias {
type Check = Priv; // OK
}
impl PrivUseAliasTr for PrivAlias {
type Check = Priv; // OK
}
impl PrivUseAliasTr for <Priv as PrivTr>::AssocAlias {
type Check = Priv; // OK
}
}
mod aliases_params {
struct Priv;
type PrivAliasGeneric<T = Priv> = T;
type Result<T> = ::std::result::Result<T, Priv>;
pub fn f1(arg: PrivAliasGeneric<u8>) {} // OK, not an error
}
#[rustc_error]
fn main() {} //~ ERROR compilation successful

View file

@ -0,0 +1,148 @@
// 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.
// Private types and traits are not allowed in public interfaces.
// This test also ensures that the checks are performed even inside private modules.
#![feature(associated_consts)]
#![feature(associated_type_defaults)]
mod types {
struct Priv;
pub struct Pub;
pub trait PubTr {
type Alias;
}
pub const C: Priv = Priv; //~ ERROR private type in public interface
pub static S: Priv = Priv; //~ ERROR private type in public interface
pub fn f1(arg: Priv) {} //~ ERROR private type in public interface
pub fn f2() -> Priv { panic!() } //~ ERROR private type in public interface
pub struct S1(pub Priv); //~ ERROR private type in public interface
pub struct S2 { pub field: Priv } //~ ERROR private type in public interface
impl Pub {
pub const C: Priv = Priv; //~ ERROR private type in public interface
pub fn f1(arg: Priv) {} //~ ERROR private type in public interface
pub fn f2() -> Priv { panic!() } //~ ERROR private type in public interface
}
}
mod traits {
trait PrivTr {}
pub struct Pub<T>(T);
pub trait PubTr {}
pub enum E<T: PrivTr> { V(T) } //~ ERROR private trait in public interface
pub fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait in public interface
pub struct S1<T: PrivTr>(T); //~ ERROR private trait in public interface
impl<T: PrivTr> Pub<T> {
pub fn f<U: PrivTr>(arg: U) {} //~ ERROR private trait in public interface
}
}
mod traits_where {
trait PrivTr {}
pub struct Pub<T>(T);
pub trait PubTr {}
pub enum E<T> where T: PrivTr { V(T) } //~ ERROR private trait in public interface
pub fn f<T>(arg: T) where T: PrivTr {} //~ ERROR private trait in public interface
pub struct S1<T>(T) where T: PrivTr; //~ ERROR private trait in public interface
impl<T> Pub<T> where T: PrivTr {
pub fn f<U>(arg: U) where U: PrivTr {} //~ ERROR private trait in public interface
}
}
mod generics {
struct Priv<T = u8>(T);
pub struct Pub<T = u8>(T);
trait PrivTr<T> {}
pub trait PubTr<T> {}
pub fn f1(arg: [Priv; 1]) {} //~ ERROR private type in public interface
pub fn f2(arg: Pub<Priv>) {} //~ ERROR private type in public interface
pub fn f3(arg: Priv<Pub>) {} //~ ERROR private type in public interface
}
mod impls {
struct Priv;
pub struct Pub;
trait PrivTr {
type Alias;
}
pub trait PubTr {
type Alias;
}
impl Pub {
pub fn f(arg: Priv) {} //~ ERROR private type in public interface
}
}
mod aliases_pub {
struct Priv;
mod m {
pub struct Pub1;
pub struct Pub2;
pub struct Pub3;
pub trait PubTr<T = u8> {
type Check = u8;
}
}
use self::m::Pub1 as PrivUseAlias;
use self::m::PubTr as PrivUseAliasTr;
type PrivAlias = m::Pub2;
trait PrivTr {
type AssocAlias = m::Pub3;
}
impl PrivTr for Priv {}
// This should be OK, but associated type aliases are not substituted yet
pub fn f3(arg: <Priv as PrivTr>::AssocAlias) {} //~ ERROR private type in public interface
impl PrivUseAlias {
pub fn f(arg: Priv) {} //~ ERROR private type in public interface
}
}
mod aliases_priv {
struct Priv;
struct Priv1;
struct Priv2;
struct Priv3;
trait PrivTr1<T = u8> {
type Check = u8;
}
use self::Priv1 as PrivUseAlias;
use self::PrivTr1 as PrivUseAliasTr;
type PrivAlias = Priv2;
trait PrivTr {
type AssocAlias = Priv3;
}
impl PrivTr for Priv {}
pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type in public interface
pub fn f2(arg: PrivAlias) {} //~ ERROR private type in public interface
pub fn f3(arg: <Priv as PrivTr>::AssocAlias) {} //~ ERROR private type in public interface
}
mod aliases_params {
struct Priv;
type PrivAliasGeneric<T = Priv> = T;
type Result<T> = ::std::result::Result<T, Priv>;
pub fn f2(arg: PrivAliasGeneric) {} //~ ERROR private type in public interface
pub fn f3(arg: Result<u8>) {} //~ ERROR private type in public interface
}
fn main() {}

View file

@ -1,67 +0,0 @@
// Copyright 2014 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.
trait Foo {
fn dummy(&self) { }
}
pub fn f<
T
: Foo //~ ERROR private trait in public interface
>() {}
pub fn g<T>() where
T
: Foo //~ ERROR private trait in public interface
{}
pub struct S;
impl S {
pub fn f<
T
: Foo //~ ERROR private trait in public interface
>() {}
pub fn g<T>() where
T
: Foo //~ ERROR private trait in public interface
{}
}
pub struct S1<
T
: Foo //~ ERROR private trait in public interface
> {
x: T
}
pub struct S2<T> where
T
: Foo //~ ERROR private trait in public interface
{
x: T
}
pub enum E1<
T
: Foo //~ ERROR private trait in public interface
> {
V1(T)
}
pub enum E2<T> where
T
: Foo //~ ERROR private trait in public interface
{
V2(T)
}
fn main() {}

View file

@ -1,17 +0,0 @@
// Copyright 2014 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.
trait Foo {
fn dummy(&self) { }
}
pub trait Bar : Foo {} //~ ERROR private trait in public interface
fn main() {}