Unsafe lifetime

This commit is contained in:
2026-06-16 03:59:28 +02:00
parent d7e5e72bbb
commit f07bde8d3f
5 changed files with 48 additions and 10 deletions
+18 -4
View File
@@ -236,12 +236,26 @@ impl GetRust for TypeExpr {
mutable,
ty,
} => {
let mutable = if *mutable { "mut " } else { "" };
if let Some(lifetime) = lifetime {
format!("&'{} {mutable}{}", lifetime.get_rust(), ty.get_rust())
match lifetime {
Lifetime::Lifetime(v) => {
format!(
"&{} {}{}",
v.get_rust(),
if *mutable { "mut " } else { "" },
ty.get_rust()
)
}
Lifetime::Unsafe => {
format!(
"*{} {}",
if *mutable { "mut" } else { "const" },
ty.get_rust()
)
}
}
} else {
format!("&{mutable}{}", ty.get_rust())
format!("&{}{}", if *mutable { "mut " } else { "" }, ty.get_rust())
}
}