Skip to content
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

The following error was constructed but not emitted: cannot infer an appropriate lifetime #75777

Closed
Darksonn opened this issue Aug 21, 2020 · 1 comment · Fixed by #76257
Closed
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Darksonn
Copy link
Contributor

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() {}

playground

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
@Darksonn Darksonn added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 21, 2020
@jonas-schievink jonas-schievink added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 21, 2020
@tesuji
Copy link
Contributor

tesuji commented Aug 22, 2020

Fixed in beta and nightly.

matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Add regression test

This adds a regression test for rust-lang#75777, effectively closing it since it is solved on nightly and beta.
matklad added a commit to matklad/rust that referenced this issue Sep 4, 2020
Add regression test

This adds a regression test for rust-lang#75777, effectively closing it since it is solved on nightly and beta.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Sep 30, 2020
Add regression test

This adds a regression test for rust-lang#75777, effectively closing it since it is solved on nightly and beta.
@bors bors closed this as completed in 3478d7c Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants