717c481739
When implementing a public trait with a private super-trait, we now emit a note that the missing bound is not going to be able to be satisfied, and we explain the concept of a sealed trait.
20 lines
355 B
Rust
20 lines
355 B
Rust
// provide custom privacy error for sealed traits
|
|
pub mod a {
|
|
pub trait Sealed: self::b::Hidden {
|
|
fn foo() {}
|
|
}
|
|
|
|
struct X;
|
|
impl Sealed for X {}
|
|
impl self::b::Hidden for X {}
|
|
|
|
mod b {
|
|
pub trait Hidden {}
|
|
}
|
|
}
|
|
|
|
struct S;
|
|
impl a::Sealed for S {} //~ ERROR the trait bound `S: Hidden` is not satisfied
|
|
|
|
fn main() {}
|