Skip to content

Commit e786235

Browse files
committed
add IntoIterator impl for self-contained linking components
1 parent 4d70750 commit e786235

File tree

1 file changed

+13
-0
lines changed
  • compiler/rustc_target/src/spec

1 file changed

+13
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,19 @@ impl LinkSelfContainedComponents {
695695
}
696696
}
697697

698+
impl IntoIterator for LinkSelfContainedComponents {
699+
type Item = LinkSelfContainedComponents;
700+
type IntoIter = std::vec::IntoIter<LinkSelfContainedComponents>;
701+
702+
fn into_iter(self) -> Self::IntoIter {
703+
LinkSelfContainedComponents::all_components()
704+
.into_iter()
705+
.filter(|&s| self.contains(s))
706+
.collect::<Vec<_>>()
707+
.into_iter()
708+
}
709+
}
710+
698711
impl ToJson for LinkSelfContainedComponents {
699712
fn to_json(&self) -> Json {
700713
let components: Vec<_> = Self::all_components()

0 commit comments

Comments
 (0)