forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#118715 - davidtwco:issue-117997-privacy-vis…
…it-trait-ref-and-args, r=TaKO8Ki privacy: visit trait def id of projections Fixes rust-lang#117997. A refactoring in rust-lang#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. Eventually this influences the reachability set and whether a function is encoded into the metadata.
- Loading branch information
Showing
5 changed files
with
89 additions
and
19 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(); | ||
} |
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