Stream: t-compiler

Topic: Self type

Matthew Jasper (Jun 10 2019 at 21:00, on Zulip):

@eddyb regarding #50125, am I right in thinking that you would expect .has_self_ty() to be replaced with something like has_ty_param(0) and TypeFlags::HAS_SELF to be removed without direct replacement?

eddyb (Jun 11 2019 at 07:03, on Zulip):

huh, when was HAS_SELF added, that should be removed before has_self_ty

eddyb (Jun 11 2019 at 07:04, on Zulip):

@Matthew Jasper I think in my PR to change how parameters work (which wasn't merged because it was a perf hit to have DefId's in ty::Param) I changed uses to involve a TypeVisitor

eddyb (Jun 11 2019 at 07:05, on Zulip):

eddyb (Jun 11 2019 at 07:05, on Zulip):

yeah okay

eddyb (Jun 11 2019 at 07:06, on Zulip):

@Matthew Jasper so replace has_self_ty with .walk().any(|ty| ty == self_param_ty) where self_param_ty you obtain with mk_self_type or w/e

eddyb (Jun 11 2019 at 07:07, on Zulip):

the reason this is an improvement is because whatever is doing this and using mk_self_type should know already that parameter 0 is Self

eddyb (Jun 11 2019 at 07:07, on Zulip):

whereas has_self_ty could be expected to used more generally

Last update: May 24 2020 at 21:10UTC