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 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>>,
}
@ -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

View File

@ -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);