rust/crates
bors 817a6a8609 Auto merge of #12966 - OleStrohm:master, r=Veykril
feat: Display the value of enum variant on hover

fixes #12955

This PR adds const eval support for enums, as well as showing their value on hover, just as consts currently have.

I developed these two things at the same time, but I've realized now that they are separate. However since the hover is just a 10 line change (not including tests), I figured I may as well put them in the same PR. Though if you want them split up into "enum const eval support"  and "show enum variant value on hover", I think that's reasonable too.

Since this adds const eval support for enums this also allows consts that reference enums to have their values computed now too.

The const evaluation itself is quite rudimentary, it doesn't keep track of the actual type of the enum, but it turns out that Rust doesn't actually either, and `E::A as u8` is valid regardless of the `repr` on `E`.

It also doesn't really care about what expression the enum variant contains, it could for example be a string, despite that not being allowed, but I guess it's up to the `cargo check` diagnostics to inform of such issues anyway?
2022-09-20 14:01:16 +00:00
..
base-db Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
cfg Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
flycheck Add cargo.extraEnv setting 2022-09-13 11:29:14 -07:00
hir Auto merge of #12966 - OleStrohm:master, r=Veykril 2022-09-20 14:01:16 +00:00
hir-def Auto merge of #12966 - OleStrohm:master, r=Veykril 2022-09-20 14:01:16 +00:00
hir-expand Auto merge of #13167 - iDawer:exhaustive_patterns, r=Veykril 2022-09-02 12:32:36 +00:00
hir-ty Auto merge of #12966 - OleStrohm:master, r=Veykril 2022-09-20 14:01:16 +00:00
ide Auto merge of #12966 - OleStrohm:master, r=Veykril 2022-09-20 14:01:16 +00:00
ide-assists Auto merge of #13227 - Veykril:core-pref, r=Veykril 2022-09-13 13:16:57 +00:00
ide-completion Complete variants and assoc items in path pattern through type aliases 2022-09-16 16:11:58 +02:00
ide-db Auto merge of #12966 - OleStrohm:master, r=Veykril 2022-09-20 14:01:16 +00:00
ide-diagnostics Fix tests by using primitive rather than String. 2022-09-16 16:56:19 -05:00
ide-ssr Add config to unconditionally prefer core imports over std 2022-09-09 20:04:56 +02:00
limit Properly cfg the max field of Limit 2022-07-31 19:27:20 +02:00
mbe mbe: Remove unneeded unwrap 2022-09-14 23:49:08 +02:00
parser Auto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon, r=jonas-schievink 2022-09-01 21:00:14 +00:00
paths Auto merge of #12808 - Veykril:check-workspace, r=Veykril 2022-08-04 12:57:04 +00:00
proc-macro-api remove imports that are also in edition 2021's prelude 2022-08-09 01:16:32 +02:00
proc-macro-srv Replace crossbeam with std's scoped threads 2022-08-22 14:55:13 +02:00
proc-macro-srv-cli Gate and rename binary, use it if it's in the sysroot 2022-07-25 16:22:39 +02:00
proc-macro-test revert nightly rustfmt formatting that accidentally slipped in 2022-07-25 14:18:30 +02:00
profile Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
project-model Simplify 2022-09-20 14:33:18 +02:00
rust-analyzer Simplify 2022-09-19 17:31:08 +02:00
sourcegen run stable fmt through rustup 2022-08-06 17:25:02 +03:00
stdx Update test fixtures 2022-08-25 21:07:24 +02:00
syntax Fmt 2022-09-02 21:18:36 +00:00
test-utils Implement IntoFuture type inference 2022-08-08 21:05:56 -04:00
text-edit Enable extra warnings required by rust-lang/rust 2022-07-20 15:00:17 +02:00
toolchain Enable extra warnings required by rust-lang/rust 2022-07-20 15:00:17 +02:00
tt Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
vfs Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
vfs-notify Bump notify 2022-08-19 21:37:05 +03:00