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

Undocumented Attributes #532

Closed
6 tasks done
ehuss opened this issue Mar 8, 2019 · 7 comments
Closed
6 tasks done

Undocumented Attributes #532

ehuss opened this issue Mar 8, 2019 · 7 comments
Labels
A-attributes Area: Attributes Enhancement Improvement in a non-prose section of the book

Comments

@ehuss
Copy link
Contributor

ehuss commented Mar 8, 2019

There are a few attributes that are currently not documented. I wanted to get feedback if these should be documented. I've included my inclination, but I'd like to hear what others think.

  • automatically_derived — I vote "probably"? It has some use in the wild. I think the only reason to use it is for rustdoc. Are there other reasons to use it?
  • feature — I vote "maybe" 🤔? Although this is a nightly-oriented attribute, it is very widely used.
  • type_length_limit — I vote "yes". I think it is analogous to recursion_limit, and I suspect it just fell through the cracks.
  • bench — I vote "no". It requires the unstable Bencher to be used. (Now destabilized via Remove derives Encodable/Decodable and unstabilize attribute #[bench] rust#62507)
  • reexport_test_harness_main — I vote "no". Even though it is usable on stable, I think it is an internal implementation detail, and I do not see anyone using it.

These are just waiting to be finished:

@Centril Centril added the Enhancement Improvement in a non-prose section of the book label Mar 8, 2019
@petrochenkov
Copy link
Contributor

automatically_derived is also an implementation detail, I don't know why it's not feature gated.

@Centril
Copy link
Contributor

Centril commented Mar 8, 2019

automatically_derived — I vote "probably"? It has some use in the wild. I think the only reason to use it is for rustdoc. Are there other reasons to use it?

What does the attribute do?

@petrochenkov Could you try a PR + crater to "destabilization"?

bench — I vote "no". It requires the unstable Bencher to be used.

👍

feature — I vote "maybe" 🤔? Although this is a nightly-oriented attribute, it is very widely used.

👍 + note that it is unstable.

reexport_test_harness_main — I vote "no". Even though it is usable on stable, I think it is an internal implementation detail, and I do not see anyone using it.

What... @petrochenkov I'd also attempt destabilization for this...

type_length_limit — I vote "yes". I think it is analogous to recursion_limit, and I suspect it just fell through the cracks.

Sounds good.

These are just waiting to be finished:

@ehuss I think these PRs haven't received any attention for some time, if you would like to take over them that'd be nice.

@ehuss
Copy link
Contributor Author

ehuss commented Mar 8, 2019

What does the attribute do?

Hm, looking closer, I'm not sure. rustdoc used to use it to separate automatically derived traits, but it was removed in rust-lang/rust#34105. Just grepping through the code shows a few uses:

  • Avoids unused warnings.
  • Something about unsafety checks.
  • Clippy uses it for some lints.

Here's a sampling of crates that use it in the wild:

  • alga_derive
  • aster
  • bart_derive
  • bit_manager_derive
  • clippy_lints
  • drop-take-derive
  • enum-kinds
  • enum-kinds-macros
  • enum-map-derive
  • enum_traits_macros
  • eosio_macros
  • gluon_codegen
  • log4rs-rolling-file
  • nue-codegen
  • palette_derive
  • runtime-fmt-derive
  • serde_codegen
  • serde_derive
  • serde_derive_state
  • serde_yaml_incomplete

if you would like to take over them that'd be nice.

Yea, I'll try to take a look. I think Jorge said he's busy with thesis work.

@Centril
Copy link
Contributor

Centril commented Mar 8, 2019

Something about unsafety checks.

That sounds concerning...

Here's a sampling of crates that use it in the wild:

Oh... wow; That seems quite unfortunate... Might be unfeasible to destabilize, maybe we should try to clarify semantics instead then...

@ehuss
Copy link
Contributor Author

ehuss commented Mar 8, 2019

That sounds concerning...

Here it is used to display a warning diagnostic if #[derive] is used on something that uses #[repr(packed)] that doesn't implement Copy. Seems a bit presumptuous that all derives will do something unsafe, but I'm not going to read the long discussion where it was introduced (rust-lang/rust#44884). SAFE_PACKED_BORROWS says it will become a hard error in the future.

@Havvy
Copy link
Contributor

Havvy commented Aug 19, 2020

This can be closed, yes?

@ehuss
Copy link
Contributor Author

ehuss commented Aug 19, 2020

Yea. I seem to recall leaving it open for some reason, but now I can't remember.

@ehuss ehuss closed this as completed Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes Enhancement Improvement in a non-prose section of the book
Projects
None yet
Development

No branches or pull requests

4 participants