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

Derived traits in the standard library are missing stability information #40480

Open
jethrogb opened this issue Mar 13, 2017 · 14 comments
Open
Labels
A-stability Area: `#[stable]`, `#[unstable]` etc. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jethrogb
Copy link
Contributor

jethrogb commented Mar 13, 2017

impl Default for Duration was added in 1.15 but the current documentation doesn't indicate it wasn't available before that.

@jethrogb jethrogb changed the title Missing version number in std documentation Default::duration missing version number in std documentation Mar 13, 2017
@steveklabnik
Copy link
Member

We never talk about old versions for documentation; if you want to see that version's docs, check out the docs for that version.

Thanks, but this is something we just don't do.

@jethrogb
Copy link
Contributor Author

I'm not sure what you mean, there are version numbers all over the page I linked.

@steveklabnik
Copy link
Member

I don't see "version" anywhere there, could you send me a screenshot or something? It's possible I'm just misunderstanding you.

@steveklabnik steveklabnik reopened this Mar 13, 2017
@steveklabnik
Copy link
Member

steveklabnik commented Mar 13, 2017

Ohhhh I see now, you're not talking about in text, you're talking about the stability flags.

I believe that implementations are auto-stable, and therefore, don't have the flag, and therefore, don't have this. So this is more of a feature request.

Sorry for the misunderstanding here.

@steveklabnik steveklabnik added A-stability Area: `#[stable]`, `#[unstable]` etc. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 13, 2017
@jethrogb
Copy link
Contributor Author

screen shot 2017-03-13 at 11 40 14-fullpage

@jethrogb
Copy link
Contributor Author

The XyzAssign implementations have a version number though.

@codyps
Copy link
Contributor

codyps commented Mar 13, 2017

Likely because the trait itself was stabilized on that version number (trait XyzAssign was added in 1.9.0).

Agreed that having a marker on impls would be useful.

@jethrogb
Copy link
Contributor Author

Ok, looking at the source, it seems the cause is that you can't specify a stability attribute for a #[derive]. Related #29152

@Mark-Simulacrum Mark-Simulacrum added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 12, 2017
@steveklabnik
Copy link
Member

Triage: no changes I'm aware of.

@jyn514 jyn514 changed the title Default::duration missing version number in std documentation Derived traits in the standard library are missing stability information Dec 16, 2020
@jyn514
Copy link
Member

jyn514 commented Dec 16, 2020

I don't think this is really a rustdoc bug - the information just isn't available in the source code. I'm not sure who's in charge of #[stable] and #[unstable], maybe T-compiler?

That said, I think a syntax like #[derive(Clone(stable = "1.15.0"))] might be nice.

@jyn514 jyn514 added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 16, 2020
@petrochenkov
Copy link
Contributor

the information just isn't available in the source code

It should be available, starting from #29152 stability attributes are copied from the item to derived impls.
If they are not displayed in the doc, then something goes wrong along the way.

@petrochenkov petrochenkov added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. and removed T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Dec 16, 2020
@petrochenkov
Copy link
Contributor

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=9ef33271d10b380c800731eb31835323

#[stable(feature = "name", since = "version")]
#[derive(Clone)]
struct S;
#[stable(feature = "name", since = "version")]
struct S;
#[automatically_derived]
#[allow(unused_qualifications)]
#[stable(feature = "name", since = "version")]
impl ::core::clone::Clone for S {
    #[inline]
    fn clone(&self) -> S { match *self { S => S, } }
}

@jyn514
Copy link
Member

jyn514 commented Dec 16, 2020

Hmm, that seems like the wrong behavior though? Duration was stabilized in 1.3.0 but impl Default for Duration is only present since 1.15.0. I would rather not show the stability than show the wrong stability.

@petrochenkov
Copy link
Contributor

Ah, I see what is the issue now, the reported stabilization version for the impl is incorrect exactly because it's inherited from the item.

I don't think it's something important enough to extend derive syntax for (or do anything else really).

@ehuss ehuss removed the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stability Area: `#[stable]`, `#[unstable]` etc. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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

7 participants