Closed
Description
pub async fn foo() {}
produces:
"0:4:1568": {
"attrs": [],
"crate_id": 0,
"deprecation": null,
"docs": null,
"id": "0:4:1568",
"inner": {
"decl": {
"c_variadic": false,
"inputs": [],
"output": {
"inner": [
{
"trait_bound": {
"generic_params": [],
"modifier": "none",
"trait": {
"args": {
"angle_bracketed": {
"args": [],
"bindings": [
{
"args": {"angle_bracketed": {"args": [], "bindings": []}},
"binding": {"equality": {"type": {"inner": [], "kind": "tuple"}}},
"name": "Output"
}
]
}
},
"id": "1:14043:139",
"name": "Future"
}
}
}
],
"kind": "impl_trait"
}
},
"generics": {"params": [], "where_predicates": []},
"header": {"abi": "Rust", "async": true, "const": false, "unsafe": false}
},
"kind": "function",
"links": {},
"name": "foo",
"span": {"begin": [4, 0], "end": [4, 21], "filename": "/home/nixon/dev/rust/rust/src/test/rustdoc-json/async_orphan.rs"},
"visibility": "public"
}
But I think it should be.
"0:4:1568": {
"attrs": [],
"crate_id": 0,
"deprecation": null,
"docs": null,
"id": "0:4:1568",
"inner": {
"decl": {
"c_variadic": false,
"inputs": [],
"output": {
"inner": [],
"kind": "tuple"
}
},
"generics": {"params": [], "where_predicates": []},
"header": {"abi": "Rust", "async": true, "const": false, "unsafe": false}
},
"kind": "function",
"links": {},
"name": "foo",
"span": {"begin": [4, 0], "end": [4, 21], "filename": "/home/nixon/dev/rust/rust/src/test/rustdoc-json/async_orphan.rs"},
"visibility": "public"
}
For the HTML backend, rustdoc "resugars" the return type to get the T
from impl Future<Output=T
>
rust/src/librustdoc/html/format.rs
Lines 1394 to 1401 in 0631ea5
I think we should move this to a clean
pass.
cc @CraftSpider @GuillaumeGomez @Enselic, does this change seem like a good idea.
@rustbot modify labels: +T-rustdoc +A-rustdoc-json
Activity
GuillaumeGomez commentedon Aug 30, 2022
I'm not sure if it's worth adding a pass for this... Maybe handling this into a specific function shared between both formats could be a better idea?
aDotInTheVoid commentedon Aug 30, 2022
We could call
sugared_async_return_type
injson::conversions
. Or we could move this to when constructingclean
. I'm not sure which makes most sense.GuillaumeGomez commentedon Aug 30, 2022
In
clean
directly seems like a good approach.clean
, nothtml
#101204rustdoc: Resugar async fn return type in `clean`, not `html`
Rollup merge of rust-lang#101204 - aDotInTheVoid:async-resugar-in-cle…
Rollup merge of rust-lang#101204 - aDotInTheVoid:async-resugar-in-cle…
check_missing_items.py
withjsondoclint
#101809Rollup merge of rust-lang#101809 - aDotInTheVoid:jsondoclint, r=Guill…
2 remaining items