Skip to content

Limit scope of allow(coherence_leak_check) #4339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -16,7 +16,6 @@
feature(thread_local, 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
Loading