makepad/libs/relax/compiler/tests/n01_round31_discriminants.rs
Admin b22a714840 makepad run: the Rust JIT (libs/relax) and makepad-remote
The JIT that runs makepad apps from source: lexer, front end, type checker,
lazy borrow checker (Gandalf; `--check-first` opts in), codegen, session and
warm/cold caches keyed by compiler stamp, provided crates bound late,
startup images, live patching. User-facing name is `makepad run` (binary
`makepad`, MAKEPAD_RUN_* env, ~/.makepad-run); libs/relax stays the internal
library name. `makepad check` reports rustc-style diagnostics with rustc
error codes and checks a whole workspace (`--workspace`). Runs on macOS,
Linux, Windows and Android. makepad-remote: one tool schema for apps and the
WM (app/1): grabs, captures, traces, frame profiles and tweaks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 12:26:21 +02:00

17 lines
556 B
Rust

#![allow(dead_code)]
const fn tag() -> i16 { -17 }
#[repr(i16)]
enum Signed { A = tag(), B, C = 126, D }
#[repr(u64)]
enum Unsigned { A = 0xffff_ffff_ffff_fffe, B }
#[repr(i16)]
enum Data { A(u8) = -2, B(u16), C = 300 }
#[test]
fn queried_discriminants() {
assert_eq!(Signed::A as i16, -17);
assert_eq!(Signed::B as i64, -16);
assert_eq!(Signed::D as i16, 127);
assert_eq!(Unsigned::B as u64, u64::MAX);
assert_eq!(match Data::A(7) { Data::A(n) => n, _ => 0 }, 7);
assert_eq!(match Data::B(300) { Data::B(n) => n, _ => 0 }, 300);
}