Remove Type::Slice from syntax tree
Slices were considered illegal in most positions except as the target of
a reference, which led to confusing code in the code generators. This
commit replaces their syntax tree representation from
Type::Ref(Type::Slice(...)) to Type::SliceRef(...).
diff --git a/syntax/mod.rs b/syntax/mod.rs
index e61e384..c3c24ff 100644
--- a/syntax/mod.rs
+++ b/syntax/mod.rs
@@ -164,8 +164,7 @@
CxxVector(Box<Ty1>),
Fn(Box<Signature>),
Void(Span),
- Slice(Box<Slice>),
- SliceRefU8(Box<Ref>),
+ SliceRefU8(Box<SliceRef>),
Array(Box<Array>),
}
@@ -186,9 +185,13 @@
pub mutability: Option<Token![mut]>,
}
-pub struct Slice {
+pub struct SliceRef {
+ pub ampersand: Token![&],
+ pub lifetime: Option<Lifetime>,
+ pub mutable: bool,
pub bracket: Bracket,
pub inner: Type,
+ pub mutability: Option<Token![mut]>,
}
pub struct Array {