Skip to content

Commit

Permalink
Limit scope of allow(coherence_leak_check) (#4339)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Dec 8, 2024
1 parent afea96e commit 54f97c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ macro_rules! doit {
($(
($($var:ident $arg1:ident $arg2:ident $arg3:ident $arg4:ident)*)
)*) => ($(
#[allow(coherence_leak_check)]
unsafe impl<$($var,)* R> WasmClosure for dyn Fn($($var),*) -> R + 'static
where $($var: FromWasmAbi + 'static,)*
R: ReturnWasmAbi + 'static,
Expand Down Expand Up @@ -620,6 +621,7 @@ macro_rules! doit {
}
}

#[allow(coherence_leak_check)]
unsafe impl<$($var,)* R> WasmClosure for dyn FnMut($($var),*) -> R + 'static
where $($var: FromWasmAbi + 'static,)*
R: ReturnWasmAbi + 'static,
Expand Down
12 changes: 8 additions & 4 deletions src/convert/closures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use crate::throw_str;

macro_rules! stack_closures {
($( ($cnt:tt $invoke:ident $invoke_mut:ident $($var:ident $arg1:ident $arg2:ident $arg3:ident $arg4:ident)*) )*) => ($(
impl<'a, 'b, $($var,)* R> IntoWasmAbi for &'a (dyn Fn($($var),*) -> R + 'b)
#[allow(coherence_leak_check)]
impl<$($var,)* R> IntoWasmAbi for &'_ (dyn Fn($($var),*) -> R + '_)
where $($var: FromWasmAbi,)*
R: ReturnWasmAbi
{
Expand Down Expand Up @@ -50,7 +51,8 @@ macro_rules! stack_closures {
ret.return_abi().into()
}

impl<'a, $($var,)* R> WasmDescribe for dyn Fn($($var),*) -> R + 'a
#[allow(coherence_leak_check)]
impl<$($var,)* R> WasmDescribe for dyn Fn($($var),*) -> R + '_
where $($var: FromWasmAbi,)*
R: ReturnWasmAbi
{
Expand All @@ -65,7 +67,8 @@ macro_rules! stack_closures {
}
}

impl<'a, 'b, $($var,)* R> IntoWasmAbi for &'a mut (dyn FnMut($($var),*) -> R + 'b)
#[allow(coherence_leak_check)]
impl<$($var,)* R> IntoWasmAbi for &'_ mut (dyn FnMut($($var),*) -> R + '_)
where $($var: FromWasmAbi,)*
R: ReturnWasmAbi
{
Expand Down Expand Up @@ -105,7 +108,8 @@ macro_rules! stack_closures {
ret.return_abi().into()
}

impl<'a, $($var,)* R> WasmDescribe for dyn FnMut($($var),*) -> R + 'a
#[allow(coherence_leak_check)]
impl<$($var,)* R> WasmDescribe for dyn FnMut($($var),*) -> R + '_
where $($var: FromWasmAbi,)*
R: ReturnWasmAbi
{
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
feature(allow_internal_unstable),
allow(internal_features)
)]
#![allow(coherence_leak_check)]
#![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")]

extern crate alloc;
Expand Down

0 comments on commit 54f97c9

Please sign in to comment.