librustc: Make methods private if the impl is private
This commit is contained in:
parent
107bf96ff0
commit
09a2b4e599
3 changed files with 63 additions and 13 deletions
15
src/test/compile-fail/private-method-inherited.rs
Normal file
15
src/test/compile-fail/private-method-inherited.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Tests that inherited visibility applies to methods.
|
||||
|
||||
mod a {
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
fn f(self) {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = a::Foo;
|
||||
x.f(); //~ ERROR method `f` is private
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue