File: gate-tests.patch

package info (click to toggle)
rust-wast 239.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,552 kB
  • sloc: makefile: 2
file content (151 lines) | stat: -rw-r--r-- 4,203 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
diff --git a/src/lib.rs b/src/lib.rs
index f861136..7ebf457 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -138,6 +138,8 @@ macro_rules! custom_keyword {
 /// instead of keywords (`Token::Keyword`).
 ///
 /// ```
+/// #[cfg(feature = "wasm-module")]
+/// {
 /// use wast::parser::{Parser, Result, Parse};
 ///
 /// // Define a custom reserved symbol, the "spaceship" operator: `<=>`.
@@ -158,6 +160,7 @@ macro_rules! custom_keyword {
 ///         Ok(ThreeWayComparison { lhs, rhs })
 ///     }
 /// }
+/// }
 /// ```
 #[macro_export]
 macro_rules! custom_reserved {
diff --git a/src/parser.rs b/src/parser.rs
index 54305b2..60cb680 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -8,6 +8,8 @@
 //! The top-level [`parse`] function can be used to fully parse AST fragments:
 //!
 //! ```
+//! #[cfg(feature = "wasm-module")]
+//! {
 //! use wast::Wat;
 //! use wast::parser::{self, ParseBuffer};
 //!
@@ -17,11 +19,14 @@
 //! let module = parser::parse::<Wat>(&buf)?;
 //! # Ok(())
 //! # }
+//! }
 //! ```
 //!
 //! and you can also define your own new syntax with the [`Parse`] trait:
 //!
 //! ```
+//! #[cfg(feature = "wasm-module")]
+//! {
 //! use wast::kw;
 //! use wast::core::{Import, Func};
 //! use wast::parser::{Parser, Parse, Result};
@@ -57,6 +62,7 @@
 //!         Ok(OnlyImportsAndFunctions { imports, functions })
 //!     }
 //! }
+//! }
 //! ```
 //!
 //! This module is heavily inspired by [`syn`](https://docs.rs/syn) so you can
@@ -94,6 +100,8 @@ pub(crate) const MAX_PARENS_DEPTH: usize = 100;
 /// # Examples
 ///
 /// ```
+/// #[cfg(feature = "wasm-module")]
+/// {
 /// use wast::Wat;
 /// use wast::parser::{self, ParseBuffer};
 ///
@@ -103,6 +111,7 @@ pub(crate) const MAX_PARENS_DEPTH: usize = 100;
 /// let module = parser::parse::<Wat>(&buf)?;
 /// # Ok(())
 /// # }
+/// }
 /// ```
 ///
 /// or parsing simply a fragment
@@ -185,6 +194,8 @@ pub fn parse<'a, T: Parse<'a>>(buf: &'a ParseBuffer<'a>) -> Result<T> {
 /// before all functions. An example [`Parse`] implementation might look like:
 ///
 /// ```
+/// #[cfg(feature = "wasm-module")]
+/// {
 /// use wast::core::{Import, Func};
 /// use wast::kw;
 /// use wast::parser::{Parser, Parse, Result};
@@ -220,6 +231,7 @@ pub fn parse<'a, T: Parse<'a>>(buf: &'a ParseBuffer<'a>) -> Result<T> {
 ///         Ok(OnlyImportsAndFunctions { imports, functions })
 ///     }
 /// }
+/// }
 /// ```
 pub trait Parse<'a>: Sized {
     /// Attempts to parse `Self` from `parser`, returning an error if it could
@@ -538,6 +550,8 @@ impl<'a> Parser<'a> {
     /// and a [`RefType`]
     ///
     /// ```
+    /// #[cfg(feature = "wasm-module")]
+    /// {
     /// # use wast::core::*;
     /// # use wast::parser::*;
     /// struct TableType<'a> {
@@ -554,6 +568,7 @@ impl<'a> Parser<'a> {
     ///         })
     ///     }
     /// }
+    /// }
     /// ```
     ///
     /// [`Limits`]: crate::core::Limits
@@ -719,6 +734,8 @@ impl<'a> Parser<'a> {
     /// the exact definition, but it's close enough!
     ///
     /// ```
+    /// #[cfg(feature = "wasm-module")]
+    /// {
     /// # use wast::kw;
     /// # use wast::core::*;
     /// # use wast::parser::*;
@@ -740,6 +757,7 @@ impl<'a> Parser<'a> {
     ///         Ok(Module { fields })
     ///     }
     /// }
+    /// }
     /// ```
     pub fn parens<T>(self, f: impl FnOnce(Parser<'a>) -> Result<T>) -> Result<T> {
         self.buf.depth.set(self.buf.depth.get() + 1);
@@ -917,6 +935,8 @@ impl<'a> Parser<'a> {
     /// registered *before* we parse the parentheses of the annotation.
     ///
     /// ```
+    /// #[cfg(feature = "wasm-module")]
+    /// {
     /// # use wast::{kw, annotation};
     /// # use wast::core::Custom;
     /// # use wast::parser::*;
@@ -963,6 +983,7 @@ impl<'a> Parser<'a> {
     ///         Err(parser.error("unknown module field"))
     ///     }
     /// }
+    /// }
     /// ```
     ///
     /// [annotation]: https://github.com/WebAssembly/annotations
diff --git a/tests/comments.rs b/tests/comments.rs
index 54b649c..577e244 100644
--- a/tests/comments.rs
+++ b/tests/comments.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "wasm-module")]
 use wast::parser::{self, Parse, ParseBuffer, Parser, Result};
 
 pub struct Comments<'a> {