Closed
Description
Code
use futures::future::{self, BoxFuture};
fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box<dyn FnOnce(&'a Env) -> BoxFuture<'a, A>> {
let fut: BoxFuture<'a, A> = Box::pin(future::ready(v));
Box::new(move |_| fut)
}
fn main() {}
Meta
The bug does not appear on beta or nightly.
rustc --version --verbose
:
rustc 1.45.2 (d3fb005a3 2020-07-31)
binary: rustc
commit-hash: d3fb005a39e62501b8b0b356166e515ae24e2e54
commit-date: 2020-07-31
host: x86_64-unknown-linux-gnu
release: 1.45.2
LLVM version: 10.0
Error output
error: internal compiler error: the following error was constructed but not emitted
error: cannot infer an appropriate lifetime
--> src/main.rs:5:14
|
5 | Box::new(move |_| fut)
| ^^^^^^^^^^^^
thread 'rustc' panicked at 'explicit panic', src/librustc_errors/diagnostic_builder.rs:416: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/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.45.2 (d3fb005a3 2020-07-31) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden