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

50 lines
1.5 KiB
Rust

// boot b17 (frontend, imports): in an edition-2015 crate `use name;` / `use name::{self, X};` /
// `use {A, B};` are crate-root relative. objc-sys (edition 2015): `use runtime::{self, Class, ..}`,
// `use {Encode, EncodeArguments, ..}`, `use encode;` -> 14 unresolved imports.
// Booted by run.sh (edition-2015 lib + 2021 bin); rustc --edition 2015: ok.
pub mod runtime {
pub struct Class;
pub fn k() -> u32 {
4
}
}
pub mod encode {
pub trait Encode {}
}
pub use encode::Encode;
mod user {
use runtime::{self, Class};
use {Encode};
use encode;
pub fn f() -> u32 {
let _c = Class;
runtime::k()
}
}
// expr/scope.rs, binding/pat-ranges.rs: `::f()` and `::NUM` (values and range-pattern ends) are
// crate-root paths in 2015
pub const NUM: u32 = 3;
fn root_f() -> u32 {
1
}
mod inner {
pub fn g(x: u32) -> u32 {
match x {
::NUM...10 => ::root_f() + ::NUM,
_ => 0,
}
}
}
pub fn f() -> u32 {
user::f() + inner::g(5) - 4
}
// the injected `extern crate std;` is a crate-root item in 2015 (`::std::..`, `super::std`), and
// a root `extern crate x as y;` puts `y` in the extern prelude for every module (brotli:
// `extern crate alloc_no_stdlib as alloc;` then `alloc::Allocator<u32>` in submodules)
extern crate core as kore;
pub mod prelude_paths {
use super::std as s;
pub fn sizes() -> usize {
kore::mem::size_of::<u64>() + ::std::mem::size_of::<u16>() + s::mem::size_of::<u8>() + ::kore::mem::size_of::<u32>()
}
}