makepad/libs/relax/compiler/tests/n01_round34_mcg.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

16 lines
713 B
Rust

#![allow(dead_code, unused_braces)]
struct A<const N: usize>;
struct Defaults<const N: usize = 2, const M: usize = N>;
fn bare<const N: usize>(x: A<{ N }>) -> A<N> { x }
fn repeat_type<T>() -> usize { [0u8; std::mem::size_of::<*const T>()].len() }
fn inline<const N: usize>() -> usize { const { N + 1 } }
fn shadow<const N: usize>() -> usize { let a = [0u8; { const N: usize = 3; N + 1 }]; a.len() }
struct S;
impl S { const N: usize = 4; fn self_alias() -> [u8; Self::N] { [0; Self::N] } }
#[test] fn accepted_const_scopes() {
let _: A<3> = bare(A::<3>);
assert_eq!(repeat_type::<u32>(), 8);
assert_eq!(inline::<3>(), 4);
assert_eq!(shadow::<2>(), 4);
assert_eq!(S::self_alias().len(), 4);
}