Skip to content

rustdoc: Clone's implementations on CString is considered foreign #97610

Closed
@jsha

Description

@jsha

On https://doc.rust-lang.org/nightly/std/clone/trait.Clone.html#foreign-impls, CString, FromBytesUntilNulError, FromBytesWithNulError, FromVecWithNulError, IntoStringError, and NulError are considered "Implementations on Foreign Types", even though each of those types exists in std.

On stable (https://doc.rust-lang.org/stable/std/clone/trait.Clone.html#foreign-impls), those types are not considered "Implementations on Foreign Types."

I believe this is caused indirectly by 7f3cc2f (/cc @petrochenkov). That commit changed the export style for CString etc from pub use to pub type CString = alloc::ffi::CString.

However, this could also be considered a rustdoc bug. MCVE:

yarble.rs

pub struct Yarb;
pub struct Proust;
pub struct Dsug;

foo.rs

extern crate yarble;

pub trait Bar {}

impl Bar for yarble::Yarb{}
impl Bar for yarble::Proust{}

pub use yarble::Yarb;

pub type Proust = yarble::Proust;
pub type Dsug = yarble::Dsug;

impl Bar for Dsug{}

run:

rustc --crate-type lib yarble.rs && rm -r doc ; rustdoc -L . foo.rs && open doc/foo/trait.Bar.html

Expected result:

All three of Yarble, Dsug, and Proust are considered plain "Implementations".

Actual result:

Proust is considered an "Implementation on Foreign Type" (screenshot below).

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateC-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions