Skip to content

cargo doc: shows different return types for re-exported methods #115760

Closed
@bheesham

Description

@bheesham

Running cargo doc for the async-net and smol repositories show different return types for async fn methods.

(Links to docs.rs provided below as a quick preview of the issue.)

git clone https://github.com/smol-rs/async-net.git && cd async-net && cargo doc --open && cd ..
git clone https://github.com/smol-rs/smol.git && cd smol && cargo doc --open && cd ..

Then browsing to the documentation for UdpSocket::bind in each, we see (using links from docs.rs):

async_net::UdpSocket::bind:

pub async fn bind<A: AsyncToSocketAddrs>(addr: A) -> Result<UdpSocket>

smol::UdpSocket::bind:

pub async fn bind<A>(addr: A) -> impl Future<Output = Result<UdpSocket, Error>> where
    A: AsyncToSocketAddrs,

I expected to see this happen: the same types should have been displayed.

Instead, this happened: smol's type is an async fn which returns a Future, which seems to conflict with async-net's definition.

Meta

rustc --version --verbose:

rustc 1.74.0-nightly (030e4d382 2023-09-10)
binary: rustc
commit-hash: 030e4d382f1df30240408540f25cd1ccc8dbbf50
commit-date: 2023-09-10
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Some discussion: https://users.rust-lang.org/t/cargo-doc-shows-different-return-for-re-exported-methods/99687

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitA-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateC-bugCategory: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions