rust-lang / reference

The Rust Reference
https://doc.rust-lang.org/nightly/reference/
Apache License 2.0
1.23k stars 479 forks source link

Undocumented Attributes #532

Closed ehuss closed 4 years ago

ehuss commented 5 years ago

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.

These are just waiting to be finished:

petrochenkov commented 5 years ago

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

Centril commented 5 years ago

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 commented 5 years ago

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 https://github.com/rust-lang/rust/pull/34105. Just grepping through the code shows a few uses:

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

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 commented 5 years ago

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 commented 5 years ago

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 (https://github.com/rust-lang/rust/pull/44884). SAFE_PACKED_BORROWS says it will become a hard error in the future.

Havvy commented 4 years ago

This can be closed, yes?

ehuss commented 4 years ago

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