-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
3 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// aux-build:issue-117997.rs | ||
// build-pass | ||
|
||
extern crate issue_117997; | ||
|
||
pub fn main() { | ||
issue_117997::get_assoc().method_on_assoc(); | ||
} |