Skip to content

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

@WaffleLapkin

Description

@WaffleLapkin

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions