Skip to content

Commit

Permalink
Disable the 1-s!-macro-per-file style rule
Browse files Browse the repository at this point in the history
Rust 1.14.0 and earlier don't correctly expand #[cfg()] attributes
within the macro, sometimes necessitating multiple s! macros per file.
  • Loading branch information
asomers committed Jul 10, 2022
1 parent 15869f7 commit b80bf4b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ci/style.rs
Expand Up @@ -171,7 +171,15 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
}
if s_macros == 2 {
s_macros += 1;
err.error(path, i, "multiple s! macros in one module");
// Can't enforce this rule until after raising the MSRV to 1.19.0 or
// later. It seems that earlier Rust versions ignore #[cfg()]
// attributes within the macro. As a result, it's sometimes
// necessary to have multiple s!{} macros in a single file. It's
// hard to debug, because cargo-expand doesn't work with such
// old versions.
// See also https://github.com/rust-lang/libc/pull/2813

// err.error(path, i, "multiple s! macros in one module");
}

state = line_state;
Expand Down

0 comments on commit b80bf4b

Please sign in to comment.