This commit is contained in:
2026-05-19 06:55:58 +02:00
parent bcefabe2d2
commit 69e5ab2a5e
4 changed files with 9 additions and 1 deletions
+1
View File
@@ -26,6 +26,7 @@ pub enum TypePostfix {
RefMut, RefMut,
RefLifetime(Identifier), RefLifetime(Identifier),
RefMutLifetime(Identifier), RefMutLifetime(Identifier),
Dyn,
} }
#[derive(Debug, Clone, Serialize)] #[derive(Debug, Clone, Serialize)]
+5 -1
View File
@@ -85,8 +85,12 @@ ref_type = {
mutable? ~ lifetime? ~ "*" mutable? ~ lifetime? ~ "*"
} }
dyn_type = {
"dyn"
}
type_expr = { type_expr = {
(path_type | tuple_type) ~ ref_type* (path_type | tuple_type) ~ (ref_type | dyn_type)*
} }
lifetime = { lifetime = {
+2
View File
@@ -36,6 +36,8 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for TypePostfix {
}) })
} }
Rule::dyn_type => Ok(TypePostfix::Dyn),
_ => AstError::bug_unimplemented(pair), _ => AstError::bug_unimplemented(pair),
} }
} }
+1
View File
@@ -828,6 +828,7 @@ impl GetRust for TypePostfix {
TypePostfix::RefMut => format!("&mut "), TypePostfix::RefMut => format!("&mut "),
TypePostfix::RefLifetime(lifetime) => format!("&'{} ", lifetime.get_rust()), TypePostfix::RefLifetime(lifetime) => format!("&'{} ", lifetime.get_rust()),
TypePostfix::RefMutLifetime(lifetime) => format!("&'{} mut ", lifetime.get_rust()), TypePostfix::RefMutLifetime(lifetime) => format!("&'{} mut ", lifetime.get_rust()),
TypePostfix::Dyn => format!("dyn "),
} }
} }
} }