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

47 lines
1.3 KiB
Rust

use std::marker::PhantomData;
use std::pin::pin;
struct CachePadded<T> { value: T }
impl<T> CachePadded<T> {
fn new(value: T) -> Self { CachePadded::<T> { value } }
}
struct QueueHandle<State> { state: PhantomData<State> }
struct QueueProxyData<I, U, State> {
handle: QueueHandle<State>,
udata: U,
interface: PhantomData<I>,
}
impl<State> QueueHandle<State> {
fn make_data<I, U>(&self, user_data: U) -> QueueProxyData<I, U, State> {
QueueProxyData::<I, U, State> {
handle: QueueHandle { state: PhantomData },
udata: user_data,
interface: PhantomData,
}
}
}
// std/sync/mpmc/utils.rs:79: explicit arguments on a struct initializer.
#[test]
fn cache_padded_explicit_argument() {
assert_eq!(CachePadded::new(13u32).value, 13);
}
// wayland-client/event_queue.rs:619: mixed inferred and explicit generic inputs.
#[test]
fn queue_proxy_data_explicit_arguments() {
let queue: QueueHandle<u8> = QueueHandle { state: PhantomData };
let data = queue.make_data::<u16, _>(17u32);
assert_eq!(data.udata, 17);
}
// async_closures.rs:26: pin! expands to a qualified struct initializer.
#[test]
fn pin_macro_in_generic_body() {
fn pinned<T>(value: T) -> T where T: Copy {
let value = pin!(value);
*value
}
assert_eq!(pinned(19u32), 19);
}