Skip to content

Commit 388defa

Browse files
committed
Simplified name mapping in auto trait handling.
1 parent d101753 commit 388defa

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/librustc/traits/auto_trait.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<A> AutoTraitResult<A> {
5555
pub struct AutoTraitInfo<'cx> {
5656
pub full_user_env: ty::ParamEnv<'cx>,
5757
pub region_data: RegionConstraintData<'cx>,
58-
pub names_map: FxHashMap<String, String>,
58+
pub names_map: FxHashSet<String>,
5959
pub vid_to_region: FxHashMap<ty::RegionVid, ty::Region<'cx>>,
6060
}
6161

@@ -206,12 +206,10 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
206206
)
207207
});
208208

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

217215
let body_ids: FxHashSet<_> = infcx

src/librustdoc/clean/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
290290
let names_map =
291291
info.names_map
292292
.drain()
293-
.map(|(name, lifetime)| (name, Lifetime(lifetime)))
293+
.map(|name| (name.clone(), Lifetime(name)))
294294
.collect();
295295
let lifetime_predicates =
296296
self.handle_lifetimes(&region_data, &names_map);

0 commit comments

Comments
 (0)