Skip to content

Commit 71128e7

Browse files
committed
moderate comment, remove some dead regions code
1 parent 7113a2c commit 71128e7

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/rustc/middle/typeck.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,13 +2646,13 @@ impl methods for lookup {
26462646
tps: self_substs.tps + m_substs};
26472647
self.fcx.write_ty_substs(self.node_id, fty, all_substs);
26482648

2649-
// FIXME--this treatment of self and regions seems wrong. As a rule
2650-
// of thumb, one ought to substitute all type parameters at once, and
2651-
// we are not doing so here. The danger you open up has to do with
2652-
// the possibility that one of the substs in `all_substs` maps to a
2653-
// self type. Right now I think this is impossible but it may not be
2654-
// forever, and it's just sloppy to substitute in multiple steps.
2655-
// Probably the self parameter ought to be part of the all_substs.
2649+
// n.b. This treatment of self is risky but ok. As a rule of thumb,
2650+
// one ought to substitute all type parameters at once, and we are not
2651+
// doing so here. The danger you open up has to do with the
2652+
// possibility that one of the substs in `all_substs` maps to a self
2653+
// type. However, right now I think it is safe because the types in
2654+
// `all_substs` may not refer to self. This may not stay true
2655+
// forever, though.
26562656

26572657
if has_self && !option::is_none(self_ty_sub) {
26582658
let fty = self.fcx.node_ty(self.node_id);
@@ -2662,13 +2662,6 @@ impl methods for lookup {
26622662
self.fcx.write_ty(self.node_id, fty);
26632663
}
26642664

2665-
if ty::type_has_regions(ty::ty_fn_ret(fty)) {
2666-
let fty = self.fcx.node_ty(self.node_id);
2667-
let self_region = region_of(self.fcx, self.expr);
2668-
let fty = replace_self_region(self.tcx(), self_region, fty);
2669-
self.fcx.write_ty(self.node_id, fty);
2670-
}
2671-
26722665
ret origin;
26732666
}
26742667
}

0 commit comments

Comments
 (0)