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 #![allow(non_snake_case)]
13 register_long_diagnostics! {
16 A private trait was used on a public type parameter bound. Erroneous code
24 pub trait Bar : Foo {} // error: private trait in exported type parameter bound
27 To solve this error, please ensure that the trait is also public and accessible
28 at the same level of the public functions or types which are bound on it.
32 pub trait Foo { // we set the Foo trait public
36 pub trait Bar : Foo {} // ok!
41 A private type was used in an exported type signature. Erroneous code example:
47 pub fn bar() -> Bar { // error: private type in exported type signature
53 To solve this error, please ensure that the type is also public and accessible
54 at the same level of the public functions or types which use it. Example:
58 pub struct Bar(u32); // we set the Bar type public
60 pub fn bar() -> Bar { // ok!
68 The `pub` keyword was used inside a function. Erroneous code example:
72 pub struct Bar; // error: visibility has no effect inside functions
76 Since we cannot access inside function's elements, the visibility of its
77 elements does not impact outer code. So using the `pub` keyword in this context