Stream: t-compiler/wg-nll

Topic: #54574 multi-segment paths


nikomatsakis (Sep 27 2018 at 17:47, on Zulip):

so @mikhail-m1

nikomatsakis (Sep 27 2018 at 17:47, on Zulip):

I'm actually a bit surprised that this fails

nikomatsakis (Sep 27 2018 at 17:48, on Zulip):

so maybe let's trace it a bit through the code first

mikhail-m1 (Sep 27 2018 at 17:50, on Zulip):

right now AscribeUserType added for local declaration with type provided by user

nikomatsakis (Sep 27 2018 at 17:51, on Zulip):

well

mikhail-m1 (Sep 27 2018 at 17:51, on Zulip):

in this case, we don't have user time, only initializer

nikomatsakis (Sep 27 2018 at 17:51, on Zulip):

so in the case of Foo::<T>::new...

nikomatsakis (Sep 27 2018 at 17:51, on Zulip):

that is a Path

nikomatsakis (Sep 27 2018 at 17:51, on Zulip):

which is being called

nikomatsakis (Sep 27 2018 at 17:52, on Zulip):

/me tries to remember

nikomatsakis (Sep 27 2018 at 17:52, on Zulip):

hmm

nikomatsakis (Sep 27 2018 at 17:52, on Zulip):

I know I annotated some of these paths

nikomatsakis (Sep 27 2018 at 17:53, on Zulip):

but not this one I guess

nikomatsakis (Sep 27 2018 at 17:53, on Zulip):

e.g., if you change it to <Foo<T>>::new it works, I think

nikomatsakis (Sep 27 2018 at 17:54, on Zulip):

or..not

nikomatsakis (Sep 27 2018 at 17:54, on Zulip):

ok, maybe just trait calls

nikomatsakis (Sep 27 2018 at 17:54, on Zulip):

in particular I'm lookinag at the tests in src/test/ui/nll/user-annotations

nikomatsakis (Sep 27 2018 at 17:55, on Zulip):

e.g., method-ufcs-1.rs, which contains stuff like

fn annot_reference_static_lifetime() {
    let a = 22;
    let b = 44;
    let c = 66;
    let x = <&'static u32 as Bazoom<_>>::method;
    x(&a, b, c); //~ ERROR
}
nikomatsakis (Sep 27 2018 at 17:55, on Zulip):

so "trait" paths work, but "inherent methods" like new do not

nikomatsakis (Sep 27 2018 at 17:56, on Zulip):

I think I am recording the substitutions in write_method_call

mikhail-m1 (Sep 27 2018 at 17:56, on Zulip):

ok, I will check how it works for trait paths

nikomatsakis (Sep 27 2018 at 17:58, on Zulip):

the basic idea is in librustc_typeck, we record the "user substitutions" for various things

nikomatsakis (Sep 27 2018 at 17:58, on Zulip):

ah, @mikhail-m1, I think the relevant pathway above is instantiate_value_path

nikomatsakis (Sep 27 2018 at 17:59, on Zulip):

this is where we compute the user_substs

nikomatsakis (Sep 27 2018 at 17:59, on Zulip):

if I were debugging this :) I'd run a small example with RUST_LOG=rustc_typeck::check and grep for user_substs

nikomatsakis (Sep 27 2018 at 17:59, on Zulip):

and try to see what data the base typeck is generating

nikomatsakis (Sep 27 2018 at 17:59, on Zulip):

it may be that we are generating the right data but not using it on the HAIR side

nikomatsakis (Sep 27 2018 at 17:59, on Zulip):

or it may be that we are not generating it

mikhail-m1 (Sep 27 2018 at 18:02, on Zulip):

okey, thanks for help

nikomatsakis (Oct 02 2018 at 14:56, on Zulip):

@mikhail-m1 have you had any more time to investigate this?

mikhail-m1 (Oct 02 2018 at 15:16, on Zulip):

@nikomatsakis not enough, for method case user's lifetime is ignored, but I haven't found how to fix it

mikhail-m1 (Oct 02 2018 at 15:34, on Zulip):

if someone else is ready to investigate it just reassign it, I may not have enough time or it

nikomatsakis (Oct 02 2018 at 15:43, on Zulip):

@mikhail-m1 ok, I'm digging into some related issues and may try to tackle it along the way

nikomatsakis (Oct 02 2018 at 18:45, on Zulip):

@mikhail-m1 https://github.com/rust-lang/rust/issues/54692 might be a good fit for you; gonna leave a few notes

mikhail-m1 (Oct 02 2018 at 20:48, on Zulip):

@nikomatsakis it's already assigned, I will try to find something else

nikomatsakis (Oct 02 2018 at 20:53, on Zulip):

I think if you are available to hack on it,we can unassign @blitzerr and assign you

nikomatsakis (Oct 02 2018 at 20:53, on Zulip):

since they have other things assigned to them

blitzerr (Oct 02 2018 at 21:02, on Zulip):

:+1:

nikomatsakis (Oct 11 2018 at 09:55, on Zulip):

Just wanted to report that I was wrestling with the user type annotation bugs assigned to me yesterday but I think I "see the light at the end of the tunnel" now. I've been doing some refactorings and I hope to have a PR for #54574 today. I think the same approach will let me tackle constants too and maybe some other thorny cases.

nikomatsakis (Oct 16 2018 at 14:50, on Zulip):

@pnkfelix think you'd have time to review https://github.com/rust-lang/rust/pull/55093? (@Matthew Jasper sounded like they'd prefer a second reviewer to take a look.)

pnkfelix (Oct 16 2018 at 14:51, on Zulip):

k

Last update: Nov 21 2019 at 23:25UTC