rust/src/doc
bors 02b27f1e70 Auto merge of #86860 - fee1-dead:stabilize, r=LeSeulArtichaut
Stabilize `arbitrary_enum_discriminant`

Closes #60553.

----

## Stabilization Report

_copied from https://github.com/rust-lang/rust/issues/60553#issuecomment-865922311_

### Summary

Enables a user to specify *explicit* discriminants on arbitrary enums.

Previously, this was hard to achieve:

```rust
#[repr(u8)]
enum Foo {
    A(u8) = 0,
    B(i8) = 1,
    C(bool) = 42,
}
```

Someone would need to add 41 hidden variants in between as a workaround with implicit discriminants.

In conjunction with [RFC 2195](https://github.com/rust-lang/rfcs/blob/master/text/2195-really-tagged-unions.md), this feature would provide more flexibility for FFI and unsafe code involving enums.

### Test cases

Most tests are in [`src/test/ui/enum-discriminant`](https://github.com/rust-lang/rust/tree/master/src/test/ui/enum-discriminant), there are two [historical](https://github.com/rust-lang/rust/blob/master/src/test/ui/parser/tag-variant-disr-non-nullary.rs) [tests](https://github.com/rust-lang/rust/blob/master/src/test/ui/parser/issue-17383.rs) that are now covered by the feature (removed by this pr due to them being obsolete).

### Edge cases

The feature is well defined and does not have many edge cases.
One [edge case](https://github.com/rust-lang/rust/issues/70509) was related to another unstable feature named `repr128` and is resolved.

### Previous PRs

The [implementation PR](https://github.com/rust-lang/rust/pull/60732) added documentation to the Unstable Book, https://github.com/rust-lang/reference/pull/1055 was opened as a continuation of https://github.com/rust-lang/reference/pull/639.

### Resolution of unresolved questions

The questions are resolved in https://github.com/rust-lang/rust/issues/60553#issuecomment-511235271.

----

(someone please add `needs-fcp`)
2021-08-18 01:00:17 +00:00
..
book@7e49659102 Update books 2021-08-10 12:38:00 -07:00
edition-guide@3710b0cae7 Update books 2021-07-26 21:46:55 -07:00
embedded-book@4f9fcaa30d Update books 2021-08-10 12:38:00 -07:00
man Rollup merge of #59685 - lzutao:patch-1, r=GuillaumeGomez 2019-04-04 15:09:07 +02:00
nomicon@0c7e5bd142 Update books 2021-08-10 12:38:00 -07:00
reference@4884fe45c1 Update books 2021-08-10 12:38:00 -07:00
rust-by-example@0dc9cd4e89 Update books 2021-07-26 21:46:55 -07:00
rustc Rollup merge of #87677 - amalik18:issue-2788-fix, r=pietroalbini 2021-08-16 23:37:26 +02:00
rustc-dev-guide@c4644b427c Update books 2021-08-10 12:38:00 -07:00
rustdoc feature gate doc(primitive) 2021-08-16 05:41:16 +00:00
unstable-book Auto merge of #86860 - fee1-dead:stabilize, r=LeSeulArtichaut 2021-08-18 01:00:17 +00:00
complement-design-faq.md Remove the FAQs in favor of the website 2015-12-23 14:03:45 -08:00
complement-lang-faq.md Remove the FAQs in favor of the website 2015-12-23 14:03:45 -08:00
complement-project-faq.md Remove the FAQs in favor of the website 2015-12-23 14:03:45 -08:00
favicon.inc Use https URLs to refer to rust-lang.org where appropriate. 2015-08-09 14:28:46 -07:00
footer.inc rustdoc: Improve playground run buttons 2016-10-15 18:32:03 +01:00
full-toc.inc
grammar.md Remove legacy grammar 2019-09-30 07:46:10 +02:00
guide-crates.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide-error-handling.md Convert old doc links to current edition 2019-02-13 14:39:25 +00:00
guide-ffi.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide-macros.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide-ownership.md Convert old doc links to current edition 2019-02-13 14:39:25 +00:00
guide-plugins.md Add top level sections to the Unstable Book. 2017-04-18 21:26:09 -04:00
guide-pointers.md Convert old doc links to current edition 2019-02-13 14:39:25 +00:00
guide-strings.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide-tasks.md Fix broken link in old rust guide 2015-03-04 23:18:24 +00:00
guide-testing.md Convert old doc links to current edition 2019-02-13 14:39:25 +00:00
guide-unsafe.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
index.md Add link to rust website 2020-11-04 11:06:42 +01:00
intro.md Remove the 30 minute intro 2015-04-18 17:55:31 -04:00
not_found.md dro -> duckduckgo 2018-10-05 08:52:44 -07:00
redirect.inc Exclude old book redirect stubs from search engines 2019-03-14 22:56:38 +00:00
reference.md Update reference.md 2021-07-10 19:51:36 +02:00
robots.txt Block version-specific docs from search engines 2020-03-14 02:29:35 +00:00
rust.css override rustdoc.css {webkit,moz} box-sizing:unset 2021-06-29 13:05:00 +08:00
rust.md Avoid linking to a moved page in rust.html 2017-03-29 15:38:47 +02:00
rustdoc.md Move rustdoc.md into the book 2015-01-21 14:59:25 -05:00
tutorial.md Update tutorial.md 2018-05-17 12:25:24 -07:00
version_info.html.template Add alt tags for logos 2016-01-20 11:53:20 -05:00