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: cannot relate region: LUB(ReErased, ReErased) #102510

Closed
QuentinPerez opened this issue Sep 30, 2022 · 6 comments · Fixed by #103008
Closed

ICE: cannot relate region: LUB(ReErased, ReErased) #102510

QuentinPerez opened this issue Sep 30, 2022 · 6 comments · Fixed by #103008
Labels
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.

Comments

@QuentinPerez
Copy link

QuentinPerez commented Sep 30, 2022

👋 Since the nightly 2022-09-11, the following code doesn't compile anymore.

Code

#![feature(type_alias_impl_trait)]

use futures::Stream;

struct Output {}

#[async_trait::async_trait]
trait Service {
    type OutputStream;

    async fn stream(&self) -> Self::OutputStream;
}

#[async_trait::async_trait]
impl Service for () {
    type OutputStream = impl Stream<Item = Output>;

    async fn stream(&self) -> Self::OutputStream {
        futures::stream::iter(std::iter::from_fn(|| Some(Output {})))
        // futures::stream::iter(std::iter::repeat(Output {})) <- if we replace it with this line, it works
        // futures::stream::iter(std::iter::repeat(Output {}).map(|v| v)) <- doesn't work
    }
}

fn main() {}


// [dependencies]
// futures = "0.3"
// async-trait = "0.1"

Meta

rustc --version --verbose:

rustc 1.65.0-nightly (228710758 2022-09-10)
binary: rustc
commit-hash: 2287107588d92889d282e6cd3c1ca5df34cd34a5
commit-date: 2022-09-10
host: aarch64-apple-darwin
release: 1.65.0-nightly
LLVM version: 15.0.0

Error output

error: internal compiler error: compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:536:17: cannot relate region: LUB(ReErased, ReErased)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/2287107588d92889d282e6cd3c1ca5df34cd34a5/compiler/rustc_errors/src/lib.rs:1460:9
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/2287107588d92889d282e6cd3c1ca5df34cd34a5/compiler/rustc_errors/src/lib.rs:1460:9

Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/2287107588d92889d282e6cd3c1ca5df34cd34a5/compiler/rustc_errors/src/lib.rs:1460:9
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/2287107588d92889d282e6cd3c1ca5df34cd34a5/compiler/rustc_errors/src/lib.rs:1460:9
stack backtrace:
stack backtrace:
   0:        0x10515f334 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2fe0ddafe7e5c3a3
   0:        0x1058bf334 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2fe0ddafe7e5c3a3
   1:        0x105909b14 - core::fmt::write::h8eaf3b4948b7ff36
   1:        0x1051a9b14 - core::fmt::write::h8eaf3b4948b7ff36
   2:        0x1058b1ff0 - std::io::Write::write_fmt::h4bc2d969eec13592
   2:        0x105151ff0 - std::io::Write::write_fmt::h4bc2d969eec13592
   3:        0x1058c1bb0 - std::panicking::default_hook::{{closure}}::h282893686f869ced
   3:        0x105161bb0 - std::panicking::default_hook::{{closure}}::h282893686f869ced
   4:        0x1058c18d4 - std::panicking::default_hook::h3986eac7ff8396ca
   4:        0x1051618d4 - std::panicking::default_hook::h3986eac7ff8396ca
   5:        0x10cfb0664 - rustc_driver[2308dbc839f5c469]::DEFAULT_HOOK::{closure#0}::{closure#0}
   5:        0x10d710664 - rustc_driver[2308dbc839f5c469]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x1058c2274 - std::panicking::rust_panic_with_hook::h5a4b03a0872ff49e
   6:        0x105162274 - std::panicking::rust_panic_with_hook::h5a4b03a0872ff49e
   7:        0x111403000 - std[953e50f2bf2d6c99]::panicking::begin_panic::<rustc_errors[64d67c4b807721a5]::ExplicitBug>::{closure#0}
   7:        0x110ca3000 - std[953e50f2bf2d6c99]::panicking::begin_panic::<rustc_errors[64d67c4b807721a5]::ExplicitBug>::{closure#0}
   8:        0x110ca1b30 - std[953e50f2bf2d6c99]::sys_common::backtrace::__rust_end_short_backtrace::<std[953e50f2bf2d6c99]::panicking::begin_panic<rustc_errors[64d67c4b807721a5]::ExplicitBug>::{closure#0}, !>
   8:        0x111401b30 - std[953e50f2bf2d6c99]::sys_common::backtrace::__rust_end_short_backtrace::<std[953e50f2bf2d6c99]::panicking::begin_panic<rustc_errors[64d67c4b807721a5]::ExplicitBug>::{closure#0}, !>
   9:        0x1111a5094 - std[953e50f2bf2d6c99]::panicking::begin_panic::<rustc_errors[64d67c4b807721a5]::ExplicitBug>
   9:        0x111905094 - std[953e50f2bf2d6c99]::panicking::begin_panic::<rustc_errors[64d67c4b807721a5]::ExplicitBug>
  10:        0x1113fb0e0 - std[953e50f2bf2d6c99]::panic::panic_any::<rustc_errors[64d67c4b807721a5]::ExplicitBug>
  10:        0x110c9b0e0 - std[953e50f2bf2d6c99]::panic::panic_any::<rustc_errors[64d67c4b807721a5]::ExplicitBug>
  11:        0x110c9affc - <rustc_errors[64d67c4b807721a5]::HandlerInner>::bug::<&alloc[6b0ef6687e6c6d93]::string::String>
  12:        0x110c9a900 - <rustc_errors[64d67c4b807721a5]::Handler>::bug::<&alloc[6b0ef6687e6c6d93]::string::String>
  13:        0x110d5a110 - rustc_middle[6e96b350aa2bce63]::ty::context::tls::with_context_opt::<rustc_middle[6e96b350aa2bce63]::ty::context::tls::with_opt<rustc_middle[6e96b350aa2bce63]::util::bug::opt_span_bug_fmt<rustc_span[139c8615ac80492e]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  14:        0x110d5aa10 - rustc_middle[6e96b350aa2bce63]::util::bug::opt_span_bug_fmt::<rustc_span[139c8615ac80492e]::span_encoding::Span>
  15:        0x1111acaa4 - rustc_middle[6e96b350aa2bce63]::util::bug::bug_fmt
  11:        0x1113faffc - <rustc_errors[64d67c4b807721a5]::HandlerInner>::bug::<&alloc[6b0ef6687e6c6d93]::string::String>
  16:        0x110bc2c30 - <rustc_infer[2c5a0a049a29947e]::infer::lexical_region_resolve::LexicalResolver>::lub_concrete_regions
  17:        0x110bc14e4 - rustc_infer[2c5a0a049a29947e]::infer::lexical_region_resolve::resolve
  12:        0x1113fa900 - <rustc_errors[64d67c4b807721a5]::Handler>::bug::<&alloc[6b0ef6687e6c6d93]::string::String>
  18:        0x110b1a73c - <rustc_infer[2c5a0a049a29947e]::infer::InferCtxt>::resolve_regions
  13:        0x1114ba110 - rustc_middle[6e96b350aa2bce63]::ty::context::tls::with_context_opt::<rustc_middle[6e96b350aa2bce63]::ty::context::tls::with_opt<rustc_middle[6e96b350aa2bce63]::util::bug::opt_span_bug_fmt<rustc_span[139c8615ac80492e]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  19:        0x110b1a94c - <rustc_infer[2c5a0a049a29947e]::infer::InferCtxt>::resolve_regions_and_report_errors
  14:        0x1114baa10 - rustc_middle[6e96b350aa2bce63]::util::bug::opt_span_bug_fmt::<rustc_span[139c8615ac80492e]::span_encoding::Span>
  15:        0x11190caa4 - rustc_middle[6e96b350aa2bce63]::util::bug::bug_fmt
  16:        0x111322c30 - <rustc_infer[2c5a0a049a29947e]::infer::lexical_region_resolve::LexicalResolver>::lub_concrete_regions
  20:        0x10f73cd30 - <rustc_infer[2c5a0a049a29947e]::infer::InferCtxtBuilder>::enter::<(), rustc_typeck[15cb74585e045bd3]::check::check::check_opaque_meets_bounds::{closure#0}>
  17:        0x1113214e4 - rustc_infer[2c5a0a049a29947e]::infer::lexical_region_resolve::resolve
  21:        0x10f70dac0 - rustc_typeck[15cb74585e045bd3]::check::check::check_opaque
  18:        0x11127a73c - <rustc_infer[2c5a0a049a29947e]::infer::InferCtxt>::resolve_regions
  22:        0x10f70f510 - rustc_typeck[15cb74585e045bd3]::check::check::check_item_type
  19:        0x11127a94c - <rustc_infer[2c5a0a049a29947e]::infer::InferCtxt>::resolve_regions_and_report_errors
  23:        0x10f715d7c - rustc_typeck[15cb74585e045bd3]::check::check::check_mod_item_types
  20:        0x10fe9cd30 - <rustc_infer[2c5a0a049a29947e]::infer::InferCtxtBuilder>::enter::<(), rustc_typeck[15cb74585e045bd3]::check::check::check_opaque_meets_bounds::{closure#0}>
  24:        0x1101aee88 - <rustc_query_system[44980da0ed33a065]::dep_graph::graph::DepGraph<rustc_middle[6e96b350aa2bce63]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6e96b350aa2bce63]::ty::context::TyCtxt, rustc_span[139c8615ac80492e]::def_id::LocalDefId, ()>
  21:        0x10fe6dac0 - rustc_typeck[15cb74585e045bd3]::check::check::check_opaque
  25:        0x10ff7a024 - rustc_query_system[44980da0ed33a065]::query::plumbing::try_execute_query::<rustc_query_impl[7656fa6fd748bddf]::plumbing::QueryCtxt, rustc_query_system[44980da0ed33a065]::query::caches::DefaultCache<rustc_span[139c8615ac80492e]::def_id::LocalDefId, ()>>
  26:        0x1100249d8 - rustc_query_system[44980da0ed33a065]::query::plumbing::get_query::<rustc_query_impl[7656fa6fd748bddf]::queries::check_mod_item_types, rustc_query_impl[7656fa6fd748bddf]::plumbing::QueryCtxt>
  22:        0x10fe6f510 - rustc_typeck[15cb74585e045bd3]::check::check::check_item_type
  27:        0x10f66c71c - <rustc_middle[6e96b350aa2bce63]::hir::map::Map>::for_each_module::<rustc_typeck[15cb74585e045bd3]::check_crate::{closure#6}::{closure#0}>
  23:        0x10fe75d7c - rustc_typeck[15cb74585e045bd3]::check::check::check_mod_item_types
  28:        0x10f68ccd0 - <rustc_session[fffe365febf7b6e3]::session::Session>::time::<(), rustc_typeck[15cb74585e045bd3]::check_crate::{closure#6}>
  24:        0x11090ee88 - <rustc_query_system[44980da0ed33a065]::dep_graph::graph::DepGraph<rustc_middle[6e96b350aa2bce63]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6e96b350aa2bce63]::ty::context::TyCtxt, rustc_span[139c8615ac80492e]::def_id::LocalDefId, ()>
  29:        0x10f7c1fbc - rustc_typeck[15cb74585e045bd3]::check_crate
  25:        0x1106da024 - rustc_query_system[44980da0ed33a065]::query::plumbing::try_execute_query::<rustc_query_impl[7656fa6fd748bddf]::plumbing::QueryCtxt, rustc_query_system[44980da0ed33a065]::query::caches::DefaultCache<rustc_span[139c8615ac80492e]::def_id::LocalDefId, ()>>
  30:        0x10d0bee3c - rustc_interface[d4aa11f9707af7ae]::passes::analysis
  26:        0x1107849d8 - rustc_query_system[44980da0ed33a065]::query::plumbing::get_query::<rustc_query_impl[7656fa6fd748bddf]::queries::check_mod_item_types, rustc_query_impl[7656fa6fd748bddf]::plumbing::QueryCtxt>
  31:        0x1101d179c - <rustc_query_system[44980da0ed33a065]::dep_graph::graph::DepGraph<rustc_middle[6e96b350aa2bce63]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6e96b350aa2bce63]::ty::context::TyCtxt, (), core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>
  32:        0x10ffc37ac - rustc_query_system[44980da0ed33a065]::query::plumbing::try_execute_query::<rustc_query_impl[7656fa6fd748bddf]::plumbing::QueryCtxt, rustc_query_system[44980da0ed33a065]::query::caches::DefaultCache<(), core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>>
  27:        0x10fdcc71c - <rustc_middle[6e96b350aa2bce63]::hir::map::Map>::for_each_module::<rustc_typeck[15cb74585e045bd3]::check_crate::{closure#6}::{closure#0}>
  33:        0x11003ea10 - rustc_query_system[44980da0ed33a065]::query::plumbing::get_query::<rustc_query_impl[7656fa6fd748bddf]::queries::analysis, rustc_query_impl[7656fa6fd748bddf]::plumbing::QueryCtxt>
  28:        0x10fdeccd0 - <rustc_session[fffe365febf7b6e3]::session::Session>::time::<(), rustc_typeck[15cb74585e045bd3]::check_crate::{closure#6}>
  34:        0x10cfe13d4 - <rustc_interface[d4aa11f9707af7ae]::passes::QueryContext>::enter::<rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>
  29:        0x10ff21fbc - rustc_typeck[15cb74585e045bd3]::check_crate
  35:        0x10cfcca40 - rustc_interface[d4aa11f9707af7ae]::interface::create_compiler_and_run::<core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>, rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}>
  30:        0x10d81ee3c - rustc_interface[d4aa11f9707af7ae]::passes::analysis
  36:        0x10d01929c - <scoped_tls[19da6ae19371f74a]::ScopedKey<rustc_span[139c8615ac80492e]::SessionGlobals>>::set::<rustc_interface[d4aa11f9707af7ae]::interface::run_compiler<core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>, rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>
  31:        0x11093179c - <rustc_query_system[44980da0ed33a065]::dep_graph::graph::DepGraph<rustc_middle[6e96b350aa2bce63]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6e96b350aa2bce63]::ty::context::TyCtxt, (), core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>
  37:        0x10cfe4cac - std[953e50f2bf2d6c99]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d4aa11f9707af7ae]::util::run_in_thread_pool_with_globals<rustc_interface[d4aa11f9707af7ae]::interface::run_compiler<core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>, rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>
  32:        0x1107237ac - rustc_query_system[44980da0ed33a065]::query::plumbing::try_execute_query::<rustc_query_impl[7656fa6fd748bddf]::plumbing::QueryCtxt, rustc_query_system[44980da0ed33a065]::query::caches::DefaultCache<(), core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>>
  38:        0x10cfe7b30 - <<std[953e50f2bf2d6c99]::thread::Builder>::spawn_unchecked_<rustc_interface[d4aa11f9707af7ae]::util::run_in_thread_pool_with_globals<rustc_interface[d4aa11f9707af7ae]::interface::run_compiler<core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>, rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>::{closure#1} as core[c703795cca38ec11]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:        0x11079ea10 - rustc_query_system[44980da0ed33a065]::query::plumbing::get_query::<rustc_query_impl[7656fa6fd748bddf]::queries::analysis, rustc_query_impl[7656fa6fd748bddf]::plumbing::QueryCtxt>
  39:        0x10516a110 - std::sys::unix::thread::Thread::new::thread_start::h7099863dbc9fa449
  34:        0x10d7413d4 - <rustc_interface[d4aa11f9707af7ae]::passes::QueryContext>::enter::<rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>
  35:        0x10d72ca40 - rustc_interface[d4aa11f9707af7ae]::interface::create_compiler_and_run::<core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>, rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}>
  36:        0x10d77929c - <scoped_tls[19da6ae19371f74a]::ScopedKey<rustc_span[139c8615ac80492e]::SessionGlobals>>::set::<rustc_interface[d4aa11f9707af7ae]::interface::run_compiler<core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>, rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>
  40:        0x1a98a826c - __pthread_deallocate
  37:        0x10d744cac - std[953e50f2bf2d6c99]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d4aa11f9707af7ae]::util::run_in_thread_pool_with_globals<rustc_interface[d4aa11f9707af7ae]::interface::run_compiler<core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>, rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>

  38:        0x10d747b30 - <<std[953e50f2bf2d6c99]::thread::Builder>::spawn_unchecked_<rustc_interface[d4aa11f9707af7ae]::util::run_in_thread_pool_with_globals<rustc_interface[d4aa11f9707af7ae]::interface::run_compiler<core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>, rustc_driver[2308dbc839f5c469]::run_compiler::{closure#1}>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>::{closure#0}, core[c703795cca38ec11]::result::Result<(), rustc_errors[64d67c4b807721a5]::ErrorGuaranteed>>::{closure#1} as core[c703795cca38ec11]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
note: the compiler unexpectedly panicked. this is a bug.

  39:        0x1058ca110 - std::sys::unix::thread::Thread::new::thread_start::h7099863dbc9fa449
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
  40:        0x1a98a826c - __pthread_deallocate

note: rustc 1.65.0-nightly (228710758 2022-09-10) running on aarch64-apple-darwin

note: the compiler unexpectedly panicked. this is a bug.

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

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: some of the compiler flags provided by cargo are hidden
note: rustc 1.65.0-nightly (228710758 2022-09-10) running on aarch64-apple-darwin


query stack during panic:
note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]
#0 [check_mod_item_types] checking item types in top-level module

#1 [analysis] running analysis passes on this crate
note: some of the compiler flags provided by cargo are hidden

end of query stack
query stack during panic:
#0 [check_mod_item_types] checking item types in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack

@QuentinPerez QuentinPerez 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 Sep 30, 2022
@Nilstrieb
Copy link
Member

Minimized it a little

#![feature(type_alias_impl_trait)]

use std::future::Future;

type X<T> = Box<dyn Future<Output = T>>;

trait Service {
    type Something;

    fn stream<'a, 'b>(&self) -> X<Self::Something>
    where
        'a: 'b;
}

impl Service for () {
    type Something = impl Sized;

    fn stream<'a, 'b>(&self) -> X<Self::Something>
    where
        'a: 'b,
    {
        Box::new(async move { std::iter::from_fn(|| Some(())) })
    }
}
fn main() {}

@Nilstrieb
Copy link
Member

searched nightlies: from nightly-2022-01-01 to nightly-2022-09-30
regressed nightly: nightly-2022-09-11
searched commit range: 1d37ed6...2287107
regressed commit: 2287107

bisected with cargo-bisect-rustc v0.6.4

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --access github --timeout 30 --start 2022-01-01 

@QuentinPerez
Copy link
Author

cc #98559

@Nilstrieb
Copy link
Member

cc @jackh726

@FlyingRatBull
Copy link

I get the same ICE when using the current nightly in a complex Codebase.
The nightly-2022-09-09 works fine.

@compiler-errors
Copy link
Member

I think I minimized this to:

#![feature(type_alias_impl_trait)]

struct Output;

trait Service {
    type OutputStream;

    fn stream<'l, 'a>(&'l self) -> Self::OutputStream
    where
        Self: 'a,
        'l: 'a;
}

trait Stream {
    type Item;
}

struct ImplStream<F: Fn()>(F);

impl<F: Fn()> Stream for ImplStream<F> {
    type Item = Output;
}

impl Service for () {
    type OutputStream = impl Stream<Item = Output>;

    fn stream<'l, 'a>(&'l self) -> Self::OutputStream
    where
        Self: 'a,
        'l: 'a,
    {
        ImplStream(|| ())
    }
}

fn main() {}

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 13, 2022
…li-obk

replace ReErased with fresh region vars in opaque types

See inline comments.

Prior art rust-lang#102943. cc `@compiler-errors` `@oli-obk`

Fixes rust-lang#100267
Fixes rust-lang#101940
Fixes rust-lang#102649
Fixes rust-lang#102510
@bors bors closed this as completed in 059bbf7 Oct 14, 2022
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
4 participants