Description
Trying to build warp
0.2.5 with latest nightly results in an ICE.
Bisected the regression to #87287, cc @oli-obk.
I have tried to minimize it. This still requires futures
0.3, I'm not sure how to minimize if further.
use futures::{Stream, TryStream};
use std::error::Error as StdError;
use std::pin::Pin;
use std::task::{Context, Poll};
pub trait ServerSentEvent: Sized + Send + Sync + 'static {}
impl<T: Send + Sync + 'static> ServerSentEvent for T {}
struct SseKeepAlive<S> {
event_stream: S,
}
struct SseComment<T>(T);
impl<S> Stream for SseKeepAlive<S>
where
S: TryStream + Send + 'static,
S::Ok: ServerSentEvent,
S::Error: StdError + Send + Sync + 'static,
{
type Item = Result<SseComment<&'static str>, ()>;
fn poll_next(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Option<Self::Item>> {
unimplemented!()
}
}
pub fn keep<S>(
event_stream: S,
) -> impl TryStream<Ok = impl ServerSentEvent + Send + 'static, Error = ()> + Send + 'static
where
S: TryStream + Send + 'static,
S::Ok: ServerSentEvent + Send,
S::Error: StdError + Send + Sync + 'static,
{
SseKeepAlive { event_stream }
}
Meta
rustc --version --verbose
:
rustc 1.56.0-nightly (d9aa28767 2021-07-24)
binary: rustc
commit-hash: d9aa28767287670df6cf823b94629122e04442c0
commit-date: 2021-07-24
host: x86_64-apple-darwin
release: 1.56.0-nightly
LLVM version: 12.0.1
Error output
warning: field is never read: `event_stream`
--> src/lib.rs:11:5
|
11 | event_stream: S,
| ^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: Error finalizing incremental compilation session directory `/Users/eric/Temp/z50/warp-0.2.5/eric/target/debug/incremental/eric-3a2ytbduf2rnx/s-g0sxn41dw4-19a86sm-working`: No such file or directory (os error 2)
error: internal compiler error: unexpected concrete region in borrowck: ReStatic
--> src/lib.rs:28:1
|
28 | / pub fn keep<S>(
29 | | event_stream: S,
30 | | ) -> impl TryStream<Ok = impl ServerSentEvent + Send + 'static, Error = ()> + Send + 'static
31 | | where
... |
36 | | SseKeepAlive { event_stream }
37 | | }
| |_^
|
= note: delayed at compiler/rustc_mir/src/borrow_check/region_infer/opaque_types.rs:87:44
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1050: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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.56.0-nightly (d9aa28767 2021-07-24) running on x86_64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
warning: `eric` (lib) generated 2 warnings
error: could not compile `eric`; 2 warnings emitted
Backtrace
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1050:13
stack backtrace:
0: _rust_begin_unwind
1: std::panicking::begin_panic_fmt
2: rustc_errors::HandlerInner::flush_delayed
3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
4: core::ptr::drop_in_place<rustc_session::parse::ParseSess>
5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
6: core::ptr::drop_in_place<rustc_interface::interface::Compiler>
7: rustc_span::with_source_map
8: rustc_interface::interface::create_compiler_and_run
9: scoped_tls::ScopedKey<T>::set