diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs index 7dcb03b4c78..6fed0b660e8 100644 --- a/compiler/rustc_ast/src/mut_visit.rs +++ b/compiler/rustc_ast/src/mut_visit.rs @@ -12,7 +12,7 @@ use crate::ptr::P; use crate::token::{self, Token}; use crate::tokenstream::*; -use rustc_data_structures::map_in_place::MapInPlace; +use rustc_data_structures::flat_map_in_place::FlatMapInPlace; use rustc_data_structures::sync::Lrc; use rustc_span::source_map::Spanned; use rustc_span::symbol::Ident; diff --git a/compiler/rustc_data_structures/src/map_in_place.rs b/compiler/rustc_data_structures/src/flat_map_in_place.rs similarity index 87% rename from compiler/rustc_data_structures/src/map_in_place.rs rename to compiler/rustc_data_structures/src/flat_map_in_place.rs index a0d4b7ade1f..f58844f2817 100644 --- a/compiler/rustc_data_structures/src/map_in_place.rs +++ b/compiler/rustc_data_structures/src/flat_map_in_place.rs @@ -2,14 +2,7 @@ use smallvec::{Array, SmallVec}; use std::ptr; use thin_vec::ThinVec; -pub trait MapInPlace: Sized { - fn map_in_place(&mut self, mut f: F) - where - F: FnMut(T) -> T, - { - self.flat_map_in_place(|e| Some(f(e))) - } - +pub trait FlatMapInPlace: Sized { fn flat_map_in_place(&mut self, f: F) where F: FnMut(T) -> I, @@ -66,14 +59,14 @@ macro_rules! flat_map_in_place { }; } -impl MapInPlace for Vec { +impl FlatMapInPlace for Vec { flat_map_in_place!(); } -impl> MapInPlace for SmallVec { +impl> FlatMapInPlace for SmallVec { flat_map_in_place!(); } -impl MapInPlace for ThinVec { +impl FlatMapInPlace for ThinVec { flat_map_in_place!(); } diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index a94e52fdfe6..c595bf830a3 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -50,6 +50,7 @@ pub fn cold_path R, R>(f: F) -> R { pub mod base_n; pub mod binary_search_util; pub mod captures; +pub mod flat_map_in_place; pub mod flock; pub mod functor; pub mod fx; @@ -57,7 +58,6 @@ pub mod graph; pub mod intern; pub mod jobserver; pub mod macros; -pub mod map_in_place; pub mod obligation_forest; pub mod owning_ref; pub mod sip128; diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs index 01500c2c77c..d6cb173ba9b 100644 --- a/compiler/rustc_expand/src/config.rs +++ b/compiler/rustc_expand/src/config.rs @@ -12,8 +12,8 @@ use rustc_ast::tokenstream::{LazyAttrTokenStream, TokenTree}; use rustc_ast::NodeId; use rustc_ast::{self as ast, AttrStyle, Attribute, HasAttrs, HasTokens, MetaItem}; use rustc_attr as attr; +use rustc_data_structures::flat_map_in_place::FlatMapInPlace; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::map_in_place::MapInPlace; use rustc_feature::{Feature, Features, State as FeatureState}; use rustc_feature::{ ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES, diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index 79d058d9c97..4092a192e0c 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -20,7 +20,7 @@ use rustc_ast::{ForeignItemKind, HasAttrs, HasNodeId}; use rustc_ast::{Inline, ItemKind, MacStmtStyle, MetaItemKind, ModKind}; use rustc_ast::{NestedMetaItem, NodeId, PatKind, StmtKind, TyKind}; use rustc_ast_pretty::pprust; -use rustc_data_structures::map_in_place::MapInPlace; +use rustc_data_structures::flat_map_in_place::FlatMapInPlace; use rustc_data_structures::sync::Lrc; use rustc_errors::PResult; use rustc_feature::Features;