mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-05-15 15:21:20 +00:00
Work around rust-lang/rust#58516
This commit is contained in:
parent
0cbdea5fa9
commit
81fb2d97d3
@ -60,6 +60,7 @@ macro_rules! methods {
|
|||||||
($(($name:ident $(($other:tt))*, $variant:ident($($contents:tt)*)),)*) => {
|
($(($name:ident $(($other:tt))*, $variant:ident($($contents:tt)*)),)*) => {
|
||||||
$(methods!(@method $name, $variant($($contents)*));)*
|
$(methods!(@method $name, $variant($($contents)*));)*
|
||||||
|
|
||||||
|
#[cfg(feature = "strict-macro")]
|
||||||
fn check_used(self) -> Result<(), Diagnostic> {
|
fn check_used(self) -> Result<(), Diagnostic> {
|
||||||
// Account for the fact this method was called
|
// Account for the fact this method was called
|
||||||
ATTRS.with(|state| state.checks.set(state.checks.get() + 1));
|
ATTRS.with(|state| state.checks.set(state.checks.get() + 1));
|
||||||
@ -69,9 +70,12 @@ macro_rules! methods {
|
|||||||
if used.get() {
|
if used.get() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !cfg!(feature = "strict-macro") {
|
// The check below causes rustc to crash on powerpc64 platforms
|
||||||
|
// with an LLVM error. To avoid this, we instead use #[cfg()]
|
||||||
|
// and duplicate the function below. See #58516 for details.
|
||||||
|
/*if !cfg!(feature = "strict-macro") {
|
||||||
continue
|
continue
|
||||||
}
|
}*/
|
||||||
let span = match attr {
|
let span = match attr {
|
||||||
$(BindgenAttr::$variant(span, ..) => span,)*
|
$(BindgenAttr::$variant(span, ..) => span,)*
|
||||||
};
|
};
|
||||||
@ -79,6 +83,19 @@ macro_rules! methods {
|
|||||||
}
|
}
|
||||||
Diagnostic::from_vec(errors)
|
Diagnostic::from_vec(errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "strict-macro"))]
|
||||||
|
fn check_used(self) -> Result<(), Diagnostic> {
|
||||||
|
// Account for the fact this method was called
|
||||||
|
ATTRS.with(|state| state.checks.set(state.checks.get() + 1));
|
||||||
|
let mut errors = Vec::new();
|
||||||
|
for (used, attr) in self.attrs.iter() {
|
||||||
|
if used.get() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Diagnostic::from_vec(errors)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
(@method $name:ident, $variant:ident(Span, String, Span)) => {
|
(@method $name:ident, $variant:ident(Span, String, Span)) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user