Skip to content

Commit 9b04fe9

Browse files
authored
Merge pull request #1545 from infinity0/master
Work around rust-lang/rust#58516
2 parents bc5f73e + 81fb2d9 commit 9b04fe9

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

crates/macro-support/src/parser.rs

+19-2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ macro_rules! methods {
6060
($(($name:ident $(($other:tt))*, $variant:ident($($contents:tt)*)),)*) => {
6161
$(methods!(@method $name, $variant($($contents)*));)*
6262

63+
#[cfg(feature = "strict-macro")]
6364
fn check_used(self) -> Result<(), Diagnostic> {
6465
// Account for the fact this method was called
6566
ATTRS.with(|state| state.checks.set(state.checks.get() + 1));
@@ -69,16 +70,32 @@ macro_rules! methods {
6970
if used.get() {
7071
continue
7172
}
72-
if !cfg!(feature = "strict-macro") {
73+
// The check below causes rustc to crash on powerpc64 platforms
74+
// with an LLVM error. To avoid this, we instead use #[cfg()]
75+
// and duplicate the function below. See #58516 for details.
76+
/*if !cfg!(feature = "strict-macro") {
7377
continue
74-
}
78+
}*/
7579
let span = match attr {
7680
$(BindgenAttr::$variant(span, ..) => span,)*
7781
};
7882
errors.push(Diagnostic::span_error(*span, "unused #[wasm_bindgen] attribute"));
7983
}
8084
Diagnostic::from_vec(errors)
8185
}
86+
87+
#[cfg(not(feature = "strict-macro"))]
88+
fn check_used(self) -> Result<(), Diagnostic> {
89+
// Account for the fact this method was called
90+
ATTRS.with(|state| state.checks.set(state.checks.get() + 1));
91+
let mut errors = Vec::new();
92+
for (used, attr) in self.attrs.iter() {
93+
if used.get() {
94+
continue
95+
}
96+
}
97+
Diagnostic::from_vec(errors)
98+
}
8299
};
83100

84101
(@method $name:ident, $variant:ident(Span, String, Span)) => {

0 commit comments

Comments
 (0)