-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustdoc renders re-exported async fn
s incorrectly
#63710
Comments
Check-in from the triage meeting: I'm going to mark this as "blocking" although it isn't really. It does seem like a good "polish" item to try and nail down before async-await hits beta, though it's ultimately a "nice to have". |
Should we also consider always documenting |
After some codereview I found that code. There seems to be a reset of the asyncness when the function gets duplicated. Unfortunately I don't know from where I can get the asyncness information for |
@rustbot claim |
Mentoring instructionsThanks, @hirschenberger, for the tip, I think that's exactly the right spot in the code. We basically want to copy the pathways in the code that we use for tracking (e.g.) whether a function is a For that case, you can see in the code that we invoke the tcx query rust/src/librustdoc/clean/inline.rs Lines 215 to 219 in 3287a65
so we're going to want something similar, like But first we need to add that
rust/src/librustc/query/mod.rs Lines 237 to 245 in 3287a65
The "provider" (function that gets called) for local functions is given in rust/src/librustc/ty/constness.rs Lines 71 to 84 in 3287a65
and installed into the provider struct down below: rust/src/librustc/ty/constness.rs Lines 110 to 115 in 3287a65
The tricky part comes when the function is loaded from metadata from another crate. That requires us to edit the rust/src/librustc_metadata/schema.rs Lines 296 to 301 in 3287a65
Here, we would add a field like rust/src/librustc_metadata/encoder.rs Lines 887 to 891 in 3287a65
Here we would just read it from the HIR. Finally, we have to modify the decoder and "crate store impl" files so that when you invoke the rust/src/librustc_metadata/decoder.rs Lines 1201 to 1209 in 3287a65
and then add an entry to the macro which invokes this function when the query is called, kind of like this: rust/src/librustc_metadata/cstore_impl.rs Line 135 in 3287a65
This macro basically says "when this tcx query is called on something from a foreign crate, invoke this method on the |
Oh, seems I was too late 😞 @nikomatsakis But thanks for the tried mentoring |
Relates to #58027, but this is the case where an async fn is re-exported by another crate. The docs for the original function shows
async fn
but the re-export showsfn -> impl Future
.Example:
The text was updated successfully, but these errors were encountered: