45f0ce71c1
This PR allows using methods from traits that are visible but are defined in an inaccessible module (fixes #18241). For example, ```rust mod foo { pub use foo::bar::Tr; mod bar { // This module is inaccessible from `g` pub trait Tr { fn f(&self) {} } } } fn g<T: foo::Tr>(t: T) { t.f(); // Currently, this is a privacy error even though `foo::Tr` is visible } ``` After this PR, it will continue to be a privacy error to use a method from a trait that is not visible. This can happen when a public trait inherits from a private trait (in violation of the `public_in_private` lint) -- see @petrochenkov's example in #28504. r? @nikomatsakis