Stream: t-compiler/wg-rls-2.0

Topic: Type inference progress

Florian Diebold (Feb 23 2019 at 13:01, on Zulip):

We are now at just about 80% of expressions in RA itself having a complete type inferred :tada: :

Database loaded, 21 roots
Crates in this dir: 27
Total modules found: 230
Total declarations: 3760
Total functions: 2480
Total expressions: 49160
Expressions of unknown type: 8156 (16%)
Expressions of partially unknown type: 2432 (4%)

Of course there'll be some that are wrong (I can think of a few things), but I think it's nice progress :) For rustc, we're at 69%.

matklad (Feb 23 2019 at 13:03, on Zulip):


matklad (Feb 23 2019 at 13:03, on Zulip):

That means that one doesn't need traits 80% of the time, right? :)

Florian Diebold (Feb 23 2019 at 13:14, on Zulip):

Seems that way ;)

(Though there's quite a few things in the code model API that we should probably put into traits...)

matklad (Feb 23 2019 at 13:15, on Zulip):

oh yeah. We have like a dozen of fn module(&self) :D

matklad (Feb 23 2019 at 13:16, on Zulip):

We do use quite a bit of traits for ast though

vipentti (Feb 25 2019 at 07:13, on Zulip):

Hey! I'm currently working on rust-analyzer#887 to add Const / Static inference. I've gotten to a point where the inference works when the const is defined in the module scope (outside fn test()) but failing when the const is defined inside the function. I noticed that has TODO regarding consts etc. Can I attempt to add support for block defined consts together with rust-analyzer#887 or should that be done in a separate PR ?

Florian Diebold (Feb 25 2019 at 07:57, on Zulip):

I would keep that separate, it's almost completely independent of constants: Block-level items need to be handled during import resolution (in The TODO you're linking to is about handling the bodies of constants, i.e. what I wrote at the end of rust-analyzer#887 :)

vipentti (Feb 25 2019 at 08:00, on Zulip):

Ah yes, thanks!

Last update: Jan 21 2020 at 11:40UTC