Repository: pyrossh/rust-embed (language: rust)

Issue:
`include` and `exclude` should at least warn if their feature isn't enabled
I just spent half an hour getting very confused before I realized that the example of using the `include` and `exclude` attributes was in a section describing a `feature`.

I could easily see that kind of oversight resulting in someone exposing sensitive files for public access that they didn't intend to, so it'd probably be a good idea to at *least* have the build process print a warning if those attributes are used without the `include-exclude` feature being enabled, if not a full-blown build-failing error, same as if you try to reference an identifier that's only defined when some feature is enabled.


Discussion / hints:

Fix patch:
diff --git a/impl/src/lib.rs b/impl/src/lib.rs
index dd1ff14..3345d93 100644
--- a/impl/src/lib.rs
+++ b/impl/src/lib.rs
@@ -231,6 +231,11 @@ fn impl_rust_embed(ast: &syn::DeriveInput) -> TokenStream2 {
   let includes = find_attribute_values(ast, "include");
   let excludes = find_attribute_values(ast, "exclude");
 
+  #[cfg(not(feature = "include-exclude"))]
+  if !includes.is_empty() || !excludes.is_empty() {
+    panic!("Please turn on the `include-exclude` feature to use the `include` and `exclude` attributes")
+  }
+
   #[cfg(feature = "interpolate-folder-path")]
   let folder_path = shellexpand::full(&folder_path).unwrap().to_string();
 


Test patch: