Skip to content
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

Current implementation of #[doc(spotlight)] doesn't handle any type alises #76169

Open
WaffleLapkin opened this issue Aug 31, 2020 · 0 comments
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@WaffleLapkin
Copy link
Member

The current implementation of #[doc(spotlight)] (tracking issue #45040) doesn't work with any type aliases (Self inclided):

#![feature(doc_spotlight)]

impl Spotlighted {
    // doesn't work because of aliases
    pub fn a() -> Self { unimplemented!() }
    pub fn b() -> <Self as Trait>::Assoc { unimplemented!() }    
    pub fn c() -> Alias { unimplemented!() }

    // works 
    pub fn the_only_that_works() -> Spotlighted { unimplemented!() }	
}

pub trait Trait {
    type Assoc: Spotlight;

    // doesn't show spotlight although Assoc has bound
    fn test() -> Self::Assoc { unimplemented!() }
}

#[doc(spotlight)]
pub trait Spotlight {}

pub struct Spotlighted;

impl Spotlight for Spotlighted {}

impl Trait for Spotlighted {
    type Assoc = Self;
}

pub type Alias = Spotlighted;

image
image
(cargo 1.47.0-nightly (51b66125b 2020-08-19))

@WaffleLapkin WaffleLapkin added the C-bug Category: This is a bug. label Aug 31, 2020
@jonas-schievink jonas-schievink added requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants