Stream: t-compiler/help

Topic: `!` fallback lint


nikomatsakis (Nov 06 2019 at 23:01, on Zulip):

Hey @llogiq (cc @centril) -- so about the lint

nikomatsakis (Nov 06 2019 at 23:02, on Zulip):

actually i'm not sure if this is the best stream but .. why not

nikomatsakis (Nov 06 2019 at 23:02, on Zulip):

I don't have a ton of time just now but if we create an issue I could also leave notes there, is there one?

centril (Nov 06 2019 at 23:02, on Zulip):

Heh; just woke up -- Haven't had a chance to review the developments in the thread

centril (Nov 06 2019 at 23:02, on Zulip):

@nikomatsakis I made a tracking issue when changing the PR: https://github.com/rust-lang/rust/issues/65992

nikomatsakis (Nov 06 2019 at 23:02, on Zulip):

Ah, great

nikomatsakis (Nov 06 2019 at 23:02, on Zulip):

thanks

centril (Nov 06 2019 at 23:03, on Zulip):

(it is also used in the code in the PR to activate the fallback)

llogiq (Nov 06 2019 at 23:08, on Zulip):

Ok, so I understand you want the lint to reach into inference to see if ! gets inferred because of fallback and then see if there would be a different outcome without the fallback.

nikomatsakis (Nov 06 2019 at 23:10, on Zulip):

I created https://github.com/rust-lang/rust/issues/66173 to track the lint specifically

nikomatsakis (Nov 06 2019 at 23:12, on Zulip):

Ok, so I understand you want the lint to reach into inference to see if ! gets inferred because of fallback and then see if there would be a different outcome without the fallback.

well

nikomatsakis (Nov 06 2019 at 23:12, on Zulip):

so what I had in mind was

nikomatsakis (Nov 06 2019 at 23:12, on Zulip):

the simplest version would be

nikomatsakis (Nov 06 2019 at 23:12, on Zulip):

at the point where we decide to apply fallback to some type variable ?T

nikomatsakis (Nov 06 2019 at 23:12, on Zulip):

we can inspect the pending obligations and things to get a list of all the type variables that are related to ?T

nikomatsakis (Nov 06 2019 at 23:13, on Zulip):

that is effectively the set that are now falling back to () and which will fallback to !

nikomatsakis (Nov 06 2019 at 23:13, on Zulip):

we can then see where those type variables appear -- e.g., do they appear in the types of variables and things?

nikomatsakis (Nov 06 2019 at 23:13, on Zulip):

we could also see if there are pending obligations like ?T: Debug or something that are true for () but not for !, or where it might change behavior

nikomatsakis (Nov 06 2019 at 23:13, on Zulip):

I'm not sure exactly when we want to lint, that is an interesting question

nikomatsakis (Nov 06 2019 at 23:14, on Zulip):

but I guess the first step would be to get this "tainted" set

nikomatsakis (Nov 06 2019 at 23:14, on Zulip):

honestly I sort of suspect that anytime this fallback affects live code, something...fishy may be going on worth linting about, even if we don't change the fallback...

centril (Nov 06 2019 at 23:16, on Zulip):

I wonder how big the fallout would be if we removed the fallback altogether in a crater run

nikomatsakis (Nov 06 2019 at 23:18, on Zulip):

worth an experiment

nikomatsakis (Nov 06 2019 at 23:18, on Zulip):

except that I feel like I tried it once and it was a problem..?

nikomatsakis (Nov 06 2019 at 23:18, on Zulip):

can't remember

nikomatsakis (Nov 06 2019 at 23:18, on Zulip):

I know we tried removing i32 fallback and it was glorious...except for testing code :) we had to put it back eventually

centril (Nov 06 2019 at 23:18, on Zulip):

too long ago :slight_smile: crater queue is reasonably sized for it to be worth it I recon

nikomatsakis (Nov 06 2019 at 23:19, on Zulip):

yeah this was all like back in 2012 or something :)

llogiq (Nov 06 2019 at 23:24, on Zulip):

Ok will be looking into obligations.

Last update: Nov 11 2019 at 22:45UTC