David Tolnay
d58307a1f0
Rename variants_from_header optin to "experimental-enum-variants-from-header"
...
In preparation for "experimental-async-fn" as a completely orthogonal
experimental feature.
2022-01-18 17:29:01 -08:00
David Tolnay
7fae55596e
Resolve dead code warnings uncovered by rustc_privacy/rustc_resolve refactor
...
warning: associated function is never used: `checked_succ`
--> gen/build/src/syntax/discriminant.rs:183:18
|
183 | pub const fn checked_succ(self) -> Option<Self> {
| ^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: associated function is never used: `ty`
--> gen/build/src/syntax/tokens.rs:305:12
|
305 | pub fn ty(&self) -> ReceiverType {
| ^^
warning: associated function is never used: `ty_self`
--> gen/build/src/syntax/tokens.rs:310:12
|
310 | pub fn ty_self(&self) -> ReceiverTypeSelf {
| ^^^^^^^
warning: variant is never constructed: `Foreign`
--> gen/build/src/syntax/mod.rs:122:5
|
122 | Foreign { rust_type: Path },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: associated function is never used: `checked_succ`
--> macro/src/syntax/discriminant.rs:183:18
|
183 | pub const fn checked_succ(self) -> Option<Self> {
| ^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: associated function is never used: `is_empty`
--> macro/src/syntax/doc.rs:22:12
|
22 | pub fn is_empty(&self) -> bool {
| ^^^^^^^^
warning: associated function is never used: `to_string`
--> macro/src/syntax/doc.rs:26:12
|
26 | pub fn to_string(&self) -> String {
| ^^^^^^^^^
warning: associated function is never used: `remove`
--> macro/src/syntax/map.rs:127:16
|
127 | pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
| ^^^^^^
warning: associated function is never used: `to_fully_qualified`
--> macro/src/syntax/names.rs:24:12
|
24 | pub fn to_fully_qualified(&self) -> String {
| ^^^^^^^^^^^^^^^^^^
warning: associated function is never used: `prefix_with`
--> macro/src/syntax/symbol.rs:44:12
|
44 | pub fn prefix_with(&self, prefix: &str) -> Symbol {
| ^^^^^^^^^^^
warning: variant is never constructed: `Foreign`
--> macro/src/syntax/mod.rs:122:5
|
122 | Foreign { rust_type: Path },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2022-01-10 18:50:49 -08:00
David Tolnay
c59a4022cd
Avoid inheriting formatter flags in some Display impls
...
The previous implementation would produce wrong unintentional output
when formatting with alignment or padding, such as {:<15}.
2021-07-29 13:34:55 -07:00
David Tolnay
e2250bca87
Parse discriminant values from clang AST
2021-04-22 20:04:02 -07:00
David Tolnay
a8abe460dc
Neg/Pos enum for discriminant sign
2020-11-20 20:33:08 -08:00
David Tolnay
ced2adc9c7
Remove check for duplicated discriminants
...
C++ enum and enum class are allowed to contain multiple enumerator
definitions with the same value. Our enum representation in Rust is
compatible with this too, so there is no need to error on such enums.
enum class Enum {
A = 5,
B = 4,
C = 4, // dup
D, // = 5 dup
};
2020-11-19 19:57:58 -08:00
David Tolnay
65bc8e6af8
Detect earlier untyped discriminants out of bounds of later suffix
2020-05-11 00:30:24 -07:00
David Tolnay
9f7c55acde
Rename discriminant Bounds to Limits
...
This is aligned with "limits" as used in std::numeric_limits in C++.
2020-05-11 00:19:02 -07:00
David Tolnay
17451dea34
Restore rust 1.42 compatibility
2020-05-10 23:49:12 -07:00
David Tolnay
f2d584101d
Expand maximum recognized discriminant to 64 bits
2020-05-10 23:23:37 -07:00
David Tolnay
94cce00fdd
Detect mismatched suffix on discriminant values
2020-05-10 23:19:39 -07:00
David Tolnay
5966f7b3f6
Detect out of bounds when inserting discriminant
2020-05-10 22:59:56 -07:00
David Tolnay
ddf69e291b
Parse repr attribute on enums
2020-05-10 22:57:33 -07:00
David Tolnay
e2e303f7f2
Infer enum repr based on discriminant range
2020-05-10 22:57:32 -07:00
David Tolnay
f1715fa994
Add const bound data for various discriminant reprs
2020-05-10 22:57:32 -07:00
David Tolnay
9bcb4c6d0b
Extract integer suffix of discriminants as the repr
2020-05-10 22:57:32 -07:00
David Tolnay
69c7960cb2
Parse negative discriminants
2020-05-10 22:57:32 -07:00
David Tolnay
17e137fbb3
Factor out a discriminant processing library
2020-05-10 22:57:32 -07:00