diff --git a/src/item.rs b/src/item.rs
index 6383111..8254429 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -91,7 +91,11 @@ impl Printer {
self.outer_attrs(&item.attrs);
self.cbox(INDENT);
self.visibility(&item.vis);
- self.signature(&item.sig);
+ self.signature(
+ &item.sig,
+ #[cfg(feature = "verbatim")]
+ &verbatim::Safety::Disallowed,
+ );
self.where_clause_for_body(&item.sig.generics.where_clause);
self.word("{");
self.hardbreak_if_nonempty();
@@ -794,7 +798,11 @@ impl Printer {
self.outer_attrs(&foreign_item.attrs);
self.cbox(INDENT);
self.visibility(&foreign_item.vis);
- self.signature(&foreign_item.sig);
+ self.signature(
+ &foreign_item.sig,
+ #[cfg(feature = "verbatim")]
+ &verbatim::Safety::Disallowed,
+ );
self.where_clause_semi(&foreign_item.sig.generics.where_clause);
self.end();
self.hardbreak();
@@ -844,8 +852,10 @@ impl Printer {
#[cfg(feature = "verbatim")]
fn foreign_item_verbatim(&mut self, tokens: &TokenStream) {
use syn::parse::{Parse, ParseStream, Result};
- use syn::{Attribute, Token, Visibility};
- use verbatim::{FlexibleItemFn, FlexibleItemStatic, FlexibleItemType, WhereClauseLocation};
+ use syn::{Abi, Attribute, Token, Visibility};
+ use verbatim::{
+ kw, FlexibleItemFn, FlexibleItemStatic, FlexibleItemType, WhereClauseLocation,
+ };
enum ForeignItemVerbatim {
Empty,
@@ -855,6 +865,16 @@ impl Printer {
TypeFlexible(FlexibleItemType),
}
+ fn peek_signature(input: ParseStream) -> bool {
+ let fork = input.fork();
+ fork.parse::