Impl parsing
diff --git a/tests/cases/impl.rs b/tests/cases/impl.rs
new file mode 100644
index 0000000..6d4d30c
--- /dev/null
+++ b/tests/cases/impl.rs
@@ -0,0 +1,16 @@
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<T> FromIterator<T> for Vec<T> {
+ #[inline]
+ fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Vec<T> {}
+}
+
+impl<T> IntoIterator for Vec<T> {
+ type Item = T;
+ type IntoIter = IntoIter<T>;
+}
+
+impl<T: ?Sized> !Sync for *mut T {}
+
+impl [T; 8] {
+ const LEN: usize = 8;
+}
diff --git a/tests/test_round_trip.rs b/tests/test_round_trip.rs
index 9350c32..e197172 100644
--- a/tests/test_round_trip.rs
+++ b/tests/test_round_trip.rs
@@ -80,8 +80,9 @@
fn respan_crate(krate: ast::Crate) -> ast::Crate {
use std::rc::Rc;
- use syntex_syntax::ast::{Attribute, Expr, ExprKind, Field, FnDecl, FunctionRetTy, ItemKind,
- Mac, MethodSig, TraitItem, TraitItemKind, TyParam};
+ use syntex_syntax::ast::{Attribute, Expr, ExprKind, Field, FnDecl, FunctionRetTy, ImplItem,
+ ImplItemKind, ItemKind, Mac, MethodSig, TraitItem, TraitItemKind,
+ TyParam};
use syntex_syntax::codemap::{self, Spanned};
use syntex_syntax::fold::{self, Folder};
use syntex_syntax::ptr::P;
@@ -187,6 +188,23 @@
})
}
+ fn fold_impl_item(&mut self, i: ImplItem) -> SmallVector<ImplItem> {
+ let noop = fold::noop_fold_impl_item(i, self).expect_one("");
+ SmallVector::one(ImplItem {
+ node: match noop.node {
+ ImplItemKind::Method(sig, body) => {
+ ImplItemKind::Method(MethodSig {
+ constness: self.fold_spanned(sig.constness),
+ .. sig
+ },
+ body)
+ }
+ node => node,
+ },
+ .. noop
+ })
+ }
+
fn fold_attribute(&mut self, mut at: Attribute) -> Option<Attribute> {
at.node.id.0 = 0;
fold::noop_fold_attribute(at, self)