Skip to content

Commit

Permalink
Simplified name mapping in auto trait handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
ibabushkin committed Apr 26, 2018
1 parent d101753 commit 388defa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/librustc/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<A> AutoTraitResult<A> {
pub struct AutoTraitInfo<'cx> {
pub full_user_env: ty::ParamEnv<'cx>,
pub region_data: RegionConstraintData<'cx>,
pub names_map: FxHashMap<String, String>,
pub names_map: FxHashSet<String>,
pub vid_to_region: FxHashMap<ty::RegionVid, ty::Region<'cx>>,
}

Expand Down Expand Up @@ -206,12 +206,10 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
)
});

let names_map: FxHashMap<String, String> = generics
let names_map: FxHashSet<String> = generics
.regions
.iter()
.map(|l| (l.name.to_string(), l.name.to_string()))
// TODO(twk): Lifetime branding and why is this map a set?!
// l.clean(self.cx) was present in the original code
.map(|l| l.name.to_string())
.collect();

let body_ids: FxHashSet<_> = infcx
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
let names_map =
info.names_map
.drain()
.map(|(name, lifetime)| (name, Lifetime(lifetime)))
.map(|name| (name.clone(), Lifetime(name)))
.collect();
let lifetime_predicates =
self.handle_lifetimes(&region_data, &names_map);
Expand Down

0 comments on commit 388defa

Please sign in to comment.