💢 The truth about Rust + LLVM development hell
ChatGPT5 struggling for 34+ minutes with Rust lifetime/build errors...
This perfectly illustrates why we need Phase 22 (Nyash LLVM compiler)\!
Key insights:
- 'Rust is safe and beautiful' - Gemini (who never fought lifetime errors)
- Reality: 500-line error messages, 34min debug sessions, lifetime hell
- C would just work: void* compile(void* mir) { done; }
- Python would work: 100 lines with llvmlite
- ANY language with C ABI would work\!
The frustration is real:
- We're SO CLOSE to Nyash self-hosting paradise
- Once bootstrapped, EVERYTHING can be written in Nyash
- No more Rust complexity, no more 5-7min builds
- Just simple, beautiful Box-based code
Current status:
- PHI/SSA hardening in progress (ChatGPT5)
- 'phi incoming value missing' in Main.esc_json/1
- Sealed SSA approach being implemented
The dream is near: Everything is Box, even the compiler\! 🌟
This commit is contained in:
@ -16,15 +16,13 @@ pub(super) fn try_handle_string_method<'ctx>(
|
||||
args: &[ValueId],
|
||||
recv_v: BVE<'ctx>,
|
||||
) -> Result<bool, String> {
|
||||
// Only act if receiver is annotated as String or StringBox
|
||||
// Act if receiver is annotated as String/StringBox, or if the actual value is an i8* (string literal path)
|
||||
let is_string_recv = match func.metadata.value_types.get(box_val) {
|
||||
Some(crate::mir::MirType::String) => true,
|
||||
Some(crate::mir::MirType::Box(b)) if b == "StringBox" => true,
|
||||
_ => false,
|
||||
_ => matches!(recv_v, BVE::PointerValue(_)),
|
||||
};
|
||||
if !is_string_recv {
|
||||
return Ok(false);
|
||||
}
|
||||
// Do not early-return; allow method-specific checks below to validate types
|
||||
|
||||
// concat fast-paths
|
||||
if method == "concat" {
|
||||
@ -153,9 +151,13 @@ pub(super) fn try_handle_string_method<'ctx>(
|
||||
}
|
||||
let i64t = codegen.context.i64_type();
|
||||
let i8p = codegen.context.ptr_type(AddressSpace::from(0));
|
||||
// receiver must be i8* for this fast path
|
||||
// receiver preferably i8*; if it's a handle (i64), conservatively cast to i8*
|
||||
let recv_p = match recv_v {
|
||||
BVE::PointerValue(p) => p,
|
||||
BVE::IntValue(iv) => codegen
|
||||
.builder
|
||||
.build_int_to_ptr(iv, codegen.context.ptr_type(AddressSpace::from(0)), "str_h2p_sub")
|
||||
.map_err(|e| e.to_string())?,
|
||||
_ => return Ok(false),
|
||||
};
|
||||
let a0 = *vmap.get(&args[0]).ok_or("substring start arg missing")?;
|
||||
|
||||
Reference in New Issue
Block a user