1
Fork 0

Simplified name mapping in auto trait handling.

This commit is contained in:
Inokentiy Babushkin 2018-04-15 15:47:56 +02:00
parent d101753cd8
commit 388defad2d
No known key found for this signature in database
GPG key ID: 7EFC8EC5224DE8EC
2 changed files with 4 additions and 6 deletions

View file

@ -55,7 +55,7 @@ impl<A> AutoTraitResult<A> {
pub struct AutoTraitInfo<'cx> { pub struct AutoTraitInfo<'cx> {
pub full_user_env: ty::ParamEnv<'cx>, pub full_user_env: ty::ParamEnv<'cx>,
pub region_data: RegionConstraintData<'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>>, pub vid_to_region: FxHashMap<ty::RegionVid, ty::Region<'cx>>,
} }
@ -206,12 +206,10 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
) )
}); });
let names_map: FxHashMap<String, String> = generics let names_map: FxHashSet<String> = generics
.regions .regions
.iter() .iter()
.map(|l| (l.name.to_string(), l.name.to_string())) .map(|l| 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
.collect(); .collect();
let body_ids: FxHashSet<_> = infcx let body_ids: FxHashSet<_> = infcx

View file

@ -290,7 +290,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
let names_map = let names_map =
info.names_map info.names_map
.drain() .drain()
.map(|(name, lifetime)| (name, Lifetime(lifetime))) .map(|name| (name.clone(), Lifetime(name)))
.collect(); .collect();
let lifetime_predicates = let lifetime_predicates =
self.handle_lifetimes(&region_data, &names_map); self.handle_lifetimes(&region_data, &names_map);