Closed
Description
Summary
This happens since nightly-2023-04-14 maybe some rustc change regressed this?
// check-pass
// edition:2018
use std::future::Future;
async fn enter<'a, F, R>(_callback: F)
where
F: FnMut(&'a mut i32) -> R,
R: Future<Output = ()> + 'a,
{
unimplemented!()
}
fn main() {}
clippy-driver -Wclippy::future_not_send --edition=2018 src/main.rs
Version
rustc 1.70.0-nightly (a41fc00ea 2023-04-13)
binary: rustc
commit-hash: a41fc00eaf352541008965fec0dee811e44373b3
commit-date: 2023-04-13
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 16.0.2
Error output
Backtrace
warning: function `enter` is never used
--> src/main.rs:6:10
|
6 | async fn enter<'a, F, R>(_callback: F)
| ^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: future cannot be sent between threads safely
--> src/main.rs:7:1
|
7 | where
| ^ future returned by `enter` is not `Send`
|
note: captured value is not `Send`
--> src/main.rs:6:26
|
6 | async fn enter<'a, F, R>(_callback: F)
| ^^^^^^^^^ has type `F` which is not `Send`
= note: `F` doesn't implement `std::marker::Send`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
= note: requested on the command line with `-W clippy::future-not-send`
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: used a `TypeErrCtxt` without failing compilation
|
= note: delayed at 0: <rustc_errors::HandlerInner>::emit_diagnostic
1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
2: core::ptr::drop_in_place::<rustc_infer::infer::error_reporting::TypeErrCtxt>
3: <clippy_utils::diagnostics::span_lint_and_then<rustc_lint::context::LateContext, rustc_span::span_encoding::Span, <clippy_lints::future_not_send::FutureNotSend as rustc_lint::passes::LateLintPass>::check_fn::{closure#0}>::{closure#0} as core::ops::function::FnOnce<(&mut rustc_errors::diagnostic_builder::DiagnosticBuilder<()>,)>>::call_once::{shim:vtable#0}
4: rustc_middle::lint::struct_lint_level::struct_lint_level_impl::<&str>
5: rustc_middle::lint::struct_lint_level::<&str, clippy_utils::diagnostics::span_lint_and_then<rustc_lint::context::LateContext, rustc_span::span_encoding::Span, <clippy_lints::future_not_send::FutureNotSend as rustc_lint::passes::LateLintPass>::check_fn::{closure#0}>::{closure#0}>
6: <rustc_lint::context::LateContext as rustc_lint::context::LintContext>::struct_span_lint::<rustc_span::span_encoding::Span, &str, clippy_utils::diagnostics::span_lint_and_then<rustc_lint::context::LateContext, rustc_span::span_encoding::Span, <clippy_lints::future_not_send::FutureNotSend as rustc_lint::passes::LateLintPass>::check_fn::{closure#0}>::{closure#0}>
7: <clippy_lints::future_not_send::FutureNotSend as rustc_lint::passes::LateLintPass>::check_fn
8: <rustc_lint::late::RuntimeCombinedLateLintPass as rustc_lint::passes::LateLintPass>::check_fn
9: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_fn
10: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
11: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
12: rustc_hir::intravisit::walk_mod::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
13: rustc_lint::late::late_lint_crate::<rustc_lint::BuiltinCombinedLateLintPass>
14: <rustc_session::session::Session>::time::<(), rustc_lint::late::check_crate<rustc_lint::BuiltinCombinedLateLintPass, rustc_interface::passes::analysis::{closure#6}::{closure#1}::{closure#2}::{closure#0}::{closure#0}>::{closure#0}::{closure#0}>
15: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#6}::{closure#1}::{closure#2}::{closure#0}>
16: <core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::analysis::{closure#6}::{closure#1}> as core::ops::function::FnOnce<()>>::call_once
17: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#6}>
18: rustc_interface::passes::analysis
19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
20: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
21: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
22: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
23: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/a41fc00eaf352541008965fec0dee811e44373b3/library/alloc/src/boxed.rs:1976:9
28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/a41fc00eaf352541008965fec0dee811e44373b3/library/alloc/src/boxed.rs:1976:9
29: std::sys::unix::thread::Thread::new::thread_start
at /rustc/a41fc00eaf352541008965fec0dee811e44373b3/library/std/src/sys/unix/thread.rs:108:17
30: <unknown>
31: <unknown>
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1679:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new
note: Clippy version: clippy 0.1.70 (a41fc00 2023-04-13)
query stack during panic:
end of query stack
error: aborting due to 2 previous errors; 2 warnings emitted