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):

https://github.com/rust-lang/rust/pull/53661

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

yeah okay https://github.com/rust-lang/rust/pull/53661/files#diff-1b4d50b82a87f1031cd5f99b64123de7R594

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: Nov 22 2019 at 04:25UTC