diff options
| author | Eljay <lee@leejeffery.co.uk> | 2015-09-19 00:58:36 +0100 |
|---|---|---|
| committer | Eljay <lee@leejeffery.co.uk> | 2015-09-19 00:58:36 +0100 |
| commit | f4f95eb3a9f2c3c38679db84aabbb7cdb46d2641 (patch) | |
| tree | bd28b50dbe6271a91907bb004754cf71f4019703 /src | |
| parent | fb5de8ce57a36e504af2dd6626365d94b5f4262d (diff) | |
| download | rust-f4f95eb3a9f2c3c38679db84aabbb7cdb46d2641.tar.gz rust-f4f95eb3a9f2c3c38679db84aabbb7cdb46d2641.zip | |
Remove unnecessary trait accessibility check.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_privacy/lib.rs | 8 | ||||
| -rw-r--r-- | src/test/run-pass/issue-16264.rs | 27 |
2 files changed, 29 insertions, 6 deletions
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 0384e7b6932..45104e4a964 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -847,12 +847,8 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> { ty::ImplContainer(_) => { self.check_static_method(span, method_def_id, name) } - // Trait methods are always all public. The only controlling factor - // is whether the trait itself is accessible or not. - ty::TraitContainer(trait_def_id) => { - self.report_error(self.ensure_public(span, trait_def_id, - None, "source trait")); - } + // Trait methods are always accessible if the trait is in scope. + ty::TraitContainer(_) => {} } } } diff --git a/src/test/run-pass/issue-16264.rs b/src/test/run-pass/issue-16264.rs new file mode 100644 index 00000000000..67701de6386 --- /dev/null +++ b/src/test/run-pass/issue-16264.rs @@ -0,0 +1,27 @@ +// 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. + +use outer::Foo; + +mod outer { + pub use self::inner::Foo; + + mod inner { + pub trait Foo { + fn bar(&self) {} + } + impl Foo for i32 {} + } +} + +fn main() { + let x: i32 = 0; + x.bar(); +} |
