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

ICE: unexpected concrete region in borrowck: ReStatic #87455

Closed
Tracked by #87749
ehuss opened this issue Jul 25, 2021 · 7 comments · Fixed by #87483 or #88190
Closed
Tracked by #87749

ICE: unexpected concrete region in borrowck: ReStatic #87455

ehuss opened this issue Jul 25, 2021 · 7 comments · Fixed by #87483 or #88190
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@ehuss
Copy link
Contributor

ehuss commented Jul 25, 2021

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

@ehuss ehuss 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. C-bug Category: This is a bug. labels Jul 25, 2021
@oli-obk oli-obk added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Jul 25, 2021
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 25, 2021
@oli-obk oli-obk self-assigned this Jul 25, 2021
@hellow554

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Jul 26, 2021

Seems like a duplicate of #79590

I don't think that is related, neither the error matches nor is it a recent regression. Did you link the wrong issue?

#87483 fixes this ICE

@apiraino
Copy link
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 29, 2021
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 29, 2021
Mir borrowck does not generate lifetime variables for 'static lifetimes during opaque type resolution

Fixes rust-lang#87455

This situation was unreachable before rust-lang#87287 as we used to just grab the resolved opaque type from typeck and replaced all regions with new inference vars. After rust-lang#87287 we let the `InferCx` in mir borrowck figure out the opaque type all by itself (which it already did before, but it only used the result to sanity check with the typeck result).
fee1-dead added a commit to fee1-dead-contrib/rust that referenced this issue Jul 29, 2021
Mir borrowck does not generate lifetime variables for 'static lifetimes during opaque type resolution

Fixes rust-lang#87455

This situation was unreachable before rust-lang#87287 as we used to just grab the resolved opaque type from typeck and replaced all regions with new inference vars. After rust-lang#87287 we let the `InferCx` in mir borrowck figure out the opaque type all by itself (which it already did before, but it only used the result to sanity check with the typeck result).
@bors bors closed this as completed in f739552 Jul 30, 2021
@oli-obk oli-obk added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jul 30, 2021
@oli-obk
Copy link
Contributor

oli-obk commented Jul 30, 2021

Still needs a backport

@oli-obk oli-obk reopened this Jul 30, 2021
@pnkfelix pnkfelix self-assigned this Aug 12, 2021
@pnkfelix
Copy link
Member

(assigning self to ensure backport happens.)

bors added a commit to rust-lang-ci/rust that referenced this issue Aug 21, 2021
…acrum

Backport PR 87483

Backport of PR rust-lang#87483: "Mir borrowck does not generate lifetime variables for 'static lifetimes during opaque type resolution"

Fix rust-lang#87455: "ICE: unexpected concrete region in borrowck: ReStatic"
@Mark-Simulacrum Mark-Simulacrum added this to the 1.55.0 milestone Aug 27, 2021
@wesleywiser
Copy link
Member

Backport (#88190) was merged.

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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
9 participants