Skip to content

Commit cfdd161

Browse files
committed
---
yaml --- r: 15616 b: refs/heads/try c: 71128e7 h: refs/heads/master v: v3
1 parent d916bbd commit cfdd161

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 7113a2c30b4ba5e7105879f6b5d683813eebc722
5+
refs/heads/try: 71128e75b083c9e5915d4fe1aa99f3abeee8f043
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/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)