Stream: t-compiler/rust-analyzer

Topic: Add "add reference" code action/diagnostics


ivan770 (Dec 12 2020 at 11:09, on Zulip):

Hi. What are the shortcomings of current type system implementation in https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics/expr.rs#L156-L160? I think that's a blocking FIXME for https://github.com/rust-analyzer/rust-analyzer/issues/6814

Laurențiu (Dec 12 2020 at 13:11, on Zulip):

Pretty much everything under https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AA-ty

Laurențiu (Dec 12 2020 at 13:12, on Zulip):

Type inference works mostly fine if you're not doing anything too fancy trait-wise, but it's annoying to have false positives for warning/error diagnostics, so the idea is to avoid that

Florian Diebold (Dec 12 2020 at 13:53, on Zulip):

you can run rust-analyzer analysis-stats -v . in some project (that presumably type-checks) to see examples

Florian Diebold (Dec 12 2020 at 13:55, on Zulip):

I don't think that blocks 6814 though, we just should only emit the diagnostic if we have a quickfix. If we have a type mismatch and adding the reference seems to fix the type mismatch, I'd say it's pretty unlikely to be a false positive

Florian Diebold (Dec 12 2020 at 13:57, on Zulip):

hmm looking at the type mismatches in RA right now, it seems our main problem is some kind of problem with coercion to dyn Trait... I wonder if I looked into that before :thinking:

ivan770 (Dec 15 2020 at 10:31, on Zulip):

Is it ok to promote once-cell from dev-dependencies to dependencies? Since iter method of ArenaMap doesn't have ExactSizeIterator I can't find any way to get if we have type mismatches without calling iter twice

ivan770 (Dec 15 2020 at 10:31, on Zulip):

Related: https://github.com/rust-analyzer/rust-analyzer/pull/6853#discussion_r543212866

matklad (Dec 15 2020 at 10:31, on Zulip):

yup, it should be fine

ivan770 (Dec 15 2020 at 10:32, on Zulip):

Ok, thanks!

Florian Diebold (Dec 15 2020 at 10:58, on Zulip):

hmm, is there some borrow checking issue there? otherwise it should be completely fine to call body_with_source_map inside the filter_map, it'll be very fast and presumably there won't be many calls anyway

ivan770 (Dec 15 2020 at 10:59, on Zulip):

If you are asking about those 3 references above whole iterator logic - yep, borrowck is angry about borrowing self instead of it's fields

ivan770 (Dec 15 2020 at 11:00, on Zulip):

Moving body_with_source_map to filter_map would only remove owner, while leaving infer and sink intact

Florian Diebold (Dec 15 2020 at 11:12, on Zulip):

I'm asking about the use of Lazy

ivan770 (Dec 15 2020 at 11:44, on Zulip):

Hmm. Removing Lazy still leaves us with owner because of borrowck, but I can return once-cell back to dev-dependencies

Last update: Jul 26 2021 at 12:00UTC