rust/tests/ui/privacy/auxiliary/issue-117997.rs
David Wood 5d97724002
privacy: visit trait def id of projections
A refactoring in #117076 changed the `DefIdVisitorSkeleton` to avoid
calling `visit_projection_ty` for `ty::Projection` aliases, and instead
just iterate over the args - this makes sense, as `visit_projection_ty`
will indirectly visit all of the same args, but in doing so, will also
create a `TraitRef` containing the trait's `DefId`, which also gets
visited. The trait's `DefId` isn't visited when we only visit the
arguments without separating them into `TraitRef` and own args first.

Signed-off-by: David Wood <david@davidtw.co>
2023-12-08 14:26:03 +00:00

36 lines
693 B
Rust

// no-prefer-dynamic
// compile-flags: --crate-type=rlib
pub use impl_mod::TraitImplementer as Implementer;
pub use trait_mod::get_assoc;
mod impl_mod {
use crate::trait_mod::TraitWithAssocType;
pub struct TraitImplementer {}
pub struct AssociatedType {}
impl AssociatedType {
pub fn method_on_assoc(&self) -> i32 {
todo!()
}
}
impl TraitWithAssocType for TraitImplementer {
type AssocType = AssociatedType;
}
}
mod trait_mod {
use crate::Implementer;
pub fn get_assoc() -> <Implementer as TraitWithAssocType>::AssocType {
todo!()
}
pub trait TraitWithAssocType {
type AssocType;
}
}