Stream: wg-async-foundations

Topic: rustdoc and async fn #63710


nikomatsakis (Sep 18 2019 at 21:46, on Zulip):

Hey @csmoe I left some mentoring instructions here -- let me know if they make sense to you. I was basically just pointing out the bits of code that you'll want to copy so that you can thread this info through to rustdoc.

csmoe (Sep 19 2019 at 17:02, on Zulip):

@nikomatsakis while tring to invoke is_async_fn query here, rustc ICEs:

`tcx.is_async_fn(DefId(0:3094 ~ alloc[8787]::borrow[0]::{{impl}}[1]::to_owned[0]))` unsupported by its crate

what does it mean?

nikomatsakis (Sep 19 2019 at 17:06, on Zulip):

good question :)

nikomatsakis (Sep 19 2019 at 17:07, on Zulip):

ah hmm

nikomatsakis (Sep 19 2019 at 17:07, on Zulip):

I think it means maybe you forgot to register a provider

nikomatsakis (Sep 19 2019 at 17:07, on Zulip):

is that your WIP PR? I can take a look

simulacrum (Sep 19 2019 at 17:10, on Zulip):

hm, no I think that's more likely that it needs to be added to cstore

simulacrum (Sep 19 2019 at 17:10, on Zulip):

for metadata loading

csmoe (Sep 19 2019 at 17:11, on Zulip):

is that your WIP PR? I can take a look

yes

csmoe (Sep 19 2019 at 17:13, on Zulip):

hm, no I think that's more likely that it needs to be added to cstore

"installed" here https://github.com/rust-lang/rust/pull/64599/files#diff-f682599ab8df719f4fa313038a5d2f72R136

csmoe (Sep 19 2019 at 17:15, on Zulip):

more precisely, it failed when doc'ing alloc crate
pasted image

simulacrum (Sep 19 2019 at 17:19, on Zulip):

ah, yes, so you'll also need to install it for the "local" crate

simulacrum (Sep 19 2019 at 17:21, on Zulip):

@csmoe I'm not sure if there's a good place to do it -- you can probably add it to ty/mod.rs and put the provider in here: https://github.com/rust-lang/rust/blob/master/src/librustc/ty/mod.rs#L3352-L3357

csmoe (Sep 19 2019 at 17:24, on Zulip):

csmoe I'm not sure if there's a good place to do it -- you can probably add it to ty/mod.rs and put the provider in here: https://github.com/rust-lang/rust/blob/master/src/librustc/ty/mod.rs#L3352-L3357

thanks :heart:

simulacrum (Sep 19 2019 at 17:25, on Zulip):

Ah, I see Niko said much the same :)

nikomatsakis (Sep 19 2019 at 17:26, on Zulip):

yep I left @csmoe some notes on the PR, too, but I hadn't gotten around to looking for a good place though

nikomatsakis (Sep 19 2019 at 17:26, on Zulip):

I think @simulacrum's suggestion sounds fine

csmoe (Sep 20 2019 at 15:07, on Zulip):

@nikomatsakis PR is ready for your review
pasted image

csmoe (Sep 20 2019 at 15:19, on Zulip):

and I found another case(not related to this bug)
https://docs.rs/tokio-sync/0.2.0-alpha.2/tokio_sync/mpsc/struct.Receiver.html#method.recv
rustdoc inserted a `_ lifetime into the fn_sig, but elided in the source code, is this intended?

csmoe (Sep 20 2019 at 16:26, on Zulip):
struct A;
impl A {
    async fn foo(&self) {}
}

rustc +nightly --edtion 2018 --Z unpretty=hir prints:

struct A;
impl A {
    async fn foo<'_>(self: &'_ Self)
     ->  ::std::future::from_generator(move || { let self = self; })
}

hir seems the one to blame for such `_ insertion, and it breaks the anonymous lifetime(impl Foo<`_> { ... })

nikomatsakis (Sep 20 2019 at 17:23, on Zulip):

@csmoe kind of looks like a bug, yeah

nikomatsakis (Sep 20 2019 at 17:23, on Zulip):

though I think it's more a rustdoc bug

nikomatsakis (Sep 20 2019 at 17:24, on Zulip):

that is, the HIR has to insert those lifetimes, but they have a special designator ("fresh" or something?) that indicates they were added automatically, we are probably ignoring that distinction in rustdoc

nikomatsakis (Sep 20 2019 at 17:24, on Zulip):

also, nice job!

nikomatsakis (Sep 20 2019 at 17:26, on Zulip):

Hey @QuietMisdreavus -- are there any docs for how to add new rustdoc tests?

QuietMisdreavus (Sep 20 2019 at 17:45, on Zulip):

@nikomatsakis not in the rustc guide, but the syntax for the rustdoc tests is best explained in the top comment in src/etc/htmldocck.py

QuietMisdreavus (Sep 20 2019 at 17:46, on Zulip):

i think i’ve seen that issue before

Last update: Nov 18 2019 at 02:00UTC