Stream: t-compiler/wg-rls-2.0/chalk

Topic: associated types?


Laurențiu Nicola (May 21 2019 at 18:43, on Zulip):

Should this work?

struct I;

impl Iterator for I {
    type Item = i32;

    fn next(&mut self) -> Option<Self::Item> {
        None
    }
}

fn foo() -> I {
    I
}

fn bar() {
    for s in foo() {
        let x = s;
    }
}

foo is resolved properly, but not s

Laurențiu Nicola (May 21 2019 at 18:43, on Zulip):

also, Self::Item isn't handled properly

Florian Diebold (May 21 2019 at 18:50, on Zulip):

No, projecting associated types isn't implemented yet. I'm working on it at the moment :)

Laurențiu Nicola (May 21 2019 at 18:51, on Zulip):

nor does it work with -> Option<i32>, FWIW

Florian Diebold (May 21 2019 at 18:51, on Zulip):

also, just defining Iterator doesn't work of course... rust actually seems to hardcode a desugaring using ::std::iter::IntoIterator::into_iter
I misread your code ;)

Florian Diebold (May 21 2019 at 18:52, on Zulip):

but yeah, for loops aren't implemented yet at all

Laurențiu Nicola (May 21 2019 at 18:53, on Zulip):

:grimacing:

Laurențiu Nicola (May 21 2019 at 18:53, on Zulip):
struct S;

impl S {
    fn foo(self) {
        Self::bar()
    }

    fn bar() {}
}
Laurențiu Nicola (May 21 2019 at 18:53, on Zulip):

This doesn't work either

Laurențiu Nicola (May 21 2019 at 18:53, on Zulip):

Thought it was implemented in https://github.com/rust-analyzer/rust-analyzer/pull/912/

Laurențiu Nicola (May 21 2019 at 18:55, on Zulip):

At least that's not related to Chalk

Florian Diebold (May 21 2019 at 19:20, on Zulip):

yeah, that's https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_hir/src/ty/infer.rs#L499

Laurențiu Nicola (May 21 2019 at 19:36, on Zulip):

Ah

Florian Diebold (Jun 13 2019 at 14:33, on Zulip):

I'll probably get the associated types / Deref support done this weekend, btw... Currently investigating why we don't find the impl<T> Deref for Arc<T> for some reason :( or rather we find it, but ignore it because we can't resolve Deref there.

Last update: Nov 15 2019 at 09:45UTC