Repository: shepmaster/snafu (rust)

Issue:
snafu-derive 0.4.2 broke `#[doc(hidden)]`
Hi - big fan of snafu! I have a crate that depends on it, and it looks like I'm getting bit by a backwards-incompatible change in a patch release in snafu (jgallagher/amiquip#12). Specifically, [this code](https://github.com/jgallagher/amiquip/blob/c81c49a5c6ded91c3a8e2816a85c0e2c138b4614/src/errors.rs#L250-L252) compiles if I download snafu 0.4.1 and change its snafu-derive dependency to `"=0.4.1"`, but breaks if it's `"0.4.1"` (the published value) or `"=0.4.2"`.

I looked at the issues and didn't see anyone else mention this, so maybe I'm the only one that got bit by it. I'm about to publish a patch release that just removes the `#[doc(hidden)]` attribute for now, but I am curious if it's still possible to include it somehow with 0.4.3.

Pull request description:
Do not report errors if we fail to parse a `#[doc]` attribute
Fixes #139

Patch:
diff --git a/snafu-derive/src/lib.rs b/snafu-derive/src/lib.rs
index 4830fbd..1533c89 100644
--- a/snafu-derive/src/lib.rs
+++ b/snafu-derive/src/lib.rs
@@ -617,7 +617,12 @@ fn attributes_from_syn(attrs: Vec<syn::Attribute>) -> MultiSynResult<Vec<SnafuAt
         if attr.path.is_ident("snafu") {
             Some(parse2::<SnafuAttributeBody>(attr.tts).map(|body| body.0))
         } else if attr.path.is_ident("doc") {
-            Some(parse2::<DocComment>(attr.tts).map(|comment| vec![comment.0]))
+            // Ignore any errors that occur while parsing the doc
+            // comment. This isn't our attribute so we shouldn't
+            // assume that we know what values are acceptable.
+            parse2::<DocComment>(attr.tts)
+                .ok()
+                .map(|comment| Ok(vec![comment.0]))
         } else {
             None
         }


Test patch:
diff --git a/tests/doc_comment.rs b/tests/doc_comment.rs
index 38a9623..c36e44d 100644
--- a/tests/doc_comment.rs
+++ b/tests/doc_comment.rs
@@ -9,9 +9,13 @@ enum Error {
     ///
     /// Here is a more detailed description.
     MissingUser,
+
     /// This is just a doc comment.
     #[snafu(display("This is {}", stronger))]
     Stronger { stronger: &'static str },
+
+    #[doc(hidden)]
+    Hidden,
 }
 
 #[test]