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 parameter Type(Repr) when substituting in region #112510

Closed
matthiaskrgr opened this issue Jun 10, 2023 · 5 comments
Closed

ICE: Unexpected parameter Type(Repr) when substituting in region #112510

matthiaskrgr opened this issue Jun 10, 2023 · 5 comments
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

@matthiaskrgr
Copy link
Member

Code

use std::future::Future;

trait Stream {}

trait X {
    type LineStream<'a, Repr>
    where
        Self: 'a;
    type LineStreamFut<'a, Repr>
    where
        Self: 'a;
}

struct Y;

impl X for Y {
    type LineStream<'a, 'b, T, U> = impl Stream;
    type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>;
    fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (43062c43d 2023-06-09)
binary: rustc
commit-hash: 43062c43d2a63cf4e261c6eddc417575c4f3062f
commit-date: 2023-06-09
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

error[E0407]: method `line_stream` is not a member of trait `X`
  --> treereduce.out:19:5
   |
19 |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `X`

error[E0658]: `impl Trait` in associated types is unstable
  --> treereduce.out:17:37
   |
17 |     type LineStream<'a, 'b, T, U> = impl Stream;
   |                                     ^^^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable

error[E0658]: `impl Trait` in associated types is unstable
  --> treereduce.out:18:36
   |
18 |     type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>;
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `treereduce`
  --> treereduce.out:20:2
   |
20 | }
   |  ^ consider adding a `main` function to `treereduce.out`

error[E0049]: type `LineStream` has 2 type parameters but its trait declaration has 1 type parameter
  --> treereduce.out:17:21
   |
6  |     type LineStream<'a, Repr>
   |                     --  ----
   |                     |
   |                     expected 1 type parameter
...
17 |     type LineStream<'a, 'b, T, U> = impl Stream;
   |                     ^^  ^^  ^  ^
   |                     |
   |                     found 2 type parameters
Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:817:13: Unexpected parameter Type(Repr) when substituting in region 'b (index=1)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/compiler/rustc_errors/src/lib.rs:1650:9
stack backtrace:
   0:     0x7ffbd8968c41 - trace
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ffbd8968c41 - trace_unsynchronized<std::sys_common::backtrace::_print_fmt::{closure_env#1}>
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ffbd8968c41 - _print_fmt
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7ffbd8968c41 - fmt
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ffbd89c95ff - fmt
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/core/src/fmt/rt.rs:138:9
   5:     0x7ffbd89c95ff - write
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/core/src/fmt/mod.rs:1094:21
   6:     0x7ffbd895bee1 - write_fmt<std::sys::unix::stdio::Stderr>
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/io/mod.rs:1713:15
   7:     0x7ffbd8968a55 - _print
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ffbd8968a55 - print
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ffbd896b737 - {closure#1}
  10:     0x7ffbd896b524 - default_hook
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/panicking.rs:288:9
  11:     0x7ffbdbbe4ceb - rustc_driver_impl[d0821492cae6a3a8]::install_ice_hook::{closure#0}
  12:     0x7ffbd896be7d - call<(&core::panic::panic_info::PanicInfo), (dyn core::ops::function::Fn<(&core::panic::panic_info::PanicInfo), Output=()> + core::marker::Send + core::marker::Sync), alloc::alloc::Global>
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/alloc/src/boxed.rs:1999:9
  13:     0x7ffbd896be7d - rust_panic_with_hook
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/panicking.rs:709:13
  14:     0x7ffbdc101191 - std[30357d997d387a25]::panicking::begin_panic::<rustc_errors[69e647fa84a8242c]::ExplicitBug>::{closure#0}
  15:     0x7ffbdc0fc916 - std[30357d997d387a25]::sys_common::backtrace::__rust_end_short_backtrace::<std[30357d997d387a25]::panicking::begin_panic<rustc_errors[69e647fa84a8242c]::ExplicitBug>::{closure#0}, !>
  16:     0x7ffbdc177ec6 - std[30357d997d387a25]::panicking::begin_panic::<rustc_errors[69e647fa84a8242c]::ExplicitBug>
  17:     0x7ffbdc0f7434 - <rustc_errors[69e647fa84a8242c]::HandlerInner>::bug::<alloc[25a23451e3897904]::string::String>
  18:     0x7ffbdc0f71d6 - <rustc_errors[69e647fa84a8242c]::Handler>::bug::<alloc[25a23451e3897904]::string::String>
  19:     0x7ffbdc186235 - rustc_middle[5f3e0edc8316c59d]::util::bug::opt_span_bug_fmt::<rustc_span[8dceba2d8f32b518]::span_encoding::Span>::{closure#0}
  20:     0x7ffbdc182e4a - rustc_middle[5f3e0edc8316c59d]::ty::context::tls::with_opt::<rustc_middle[5f3e0edc8316c59d]::util::bug::opt_span_bug_fmt<rustc_span[8dceba2d8f32b518]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7ffbdc182e1a - rustc_middle[5f3e0edc8316c59d]::ty::context::tls::with_context_opt::<rustc_middle[5f3e0edc8316c59d]::ty::context::tls::with_opt<rustc_middle[5f3e0edc8316c59d]::util::bug::opt_span_bug_fmt<rustc_span[8dceba2d8f32b518]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7ffbd9e5694d - rustc_middle[5f3e0edc8316c59d]::util::bug::bug_fmt
  23:     0x7ffbdc1210b1 - <rustc_middle[5f3e0edc8316c59d]::ty::subst::SubstFolder as rustc_type_ir[dd14b209ae9cb3b9]::fold::TypeFolder<rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt>>::fold_region::region_param_invalid
  24:     0x7ffbd9bfcfd6 - <rustc_middle[5f3e0edc8316c59d]::ty::Ty as rustc_type_ir[dd14b209ae9cb3b9]::fold::TypeSuperFoldable<rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_middle[5f3e0edc8316c59d]::ty::subst::SubstFolder>
  25:     0x7ffbdc8e6509 - <rustc_ty_utils[fe7930032cf6a2dd]::opaque_types::OpaqueTypeCollector as rustc_type_ir[dd14b209ae9cb3b9]::visit::TypeVisitor<rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt>>::visit_ty
  26:     0x7ffbdc8f7b43 - <rustc_middle[5f3e0edc8316c59d]::ty::Term as rustc_type_ir[dd14b209ae9cb3b9]::visit::TypeVisitable<rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt>>::visit_with::<rustc_ty_utils[fe7930032cf6a2dd]::opaque_types::OpaqueTypeCollector>
  27:     0x7ffbdc8f74ee - <rustc_middle[5f3e0edc8316c59d]::ty::PredicateKind as rustc_type_ir[dd14b209ae9cb3b9]::visit::TypeVisitable<rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt>>::visit_with::<rustc_ty_utils[fe7930032cf6a2dd]::opaque_types::OpaqueTypeCollector>
  28:     0x7ffbdc8e6367 - <rustc_ty_utils[fe7930032cf6a2dd]::opaque_types::OpaqueTypeCollector as rustc_type_ir[dd14b209ae9cb3b9]::visit::TypeVisitor<rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt>>::visit_ty
  29:     0x7ffbdc8e6515 - <rustc_ty_utils[fe7930032cf6a2dd]::opaque_types::OpaqueTypeCollector as rustc_type_ir[dd14b209ae9cb3b9]::visit::TypeVisitor<rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt>>::visit_ty
  30:     0x7ffbdc9029c3 - <rustc_middle[5f3e0edc8316c59d]::ty::sty::Binder<&rustc_middle[5f3e0edc8316c59d]::ty::list::List<rustc_middle[5f3e0edc8316c59d]::ty::Ty>> as rustc_type_ir[dd14b209ae9cb3b9]::visit::TypeSuperVisitable<rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt>>::super_visit_with::<rustc_ty_utils[fe7930032cf6a2dd]::opaque_types::OpaqueTypeCollector>
  31:     0x7ffbdc8e5ccb - <rustc_ty_utils[fe7930032cf6a2dd]::opaque_types::OpaqueTypeCollector>::collect::<rustc_middle[5f3e0edc8316c59d]::ty::sty::FnSig>
  32:     0x7ffbdc8e5e3e - rustc_ty_utils[fe7930032cf6a2dd]::opaque_types::opaque_types_defined_by
  33:     0x7ffbdc51c9bf - rustc_query_impl[ead61cf3be1d21dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ead61cf3be1d21dc]::query_impl::opaque_types_defined_by::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 16usize]>>
  34:     0x7ffbdc4ff2e2 - <rustc_query_impl[ead61cf3be1d21dc]::query_impl::opaque_types_defined_by::dynamic_query::{closure#2} as core[d3915b1385eeee84]::ops::function::FnOnce<(rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt, rustc_span[8dceba2d8f32b518]::def_id::LocalDefId)>>::call_once
  35:     0x7ffbda4e1455 - rustc_query_system[b1cad9b13541f961]::query::plumbing::try_execute_query::<rustc_query_impl[ead61cf3be1d21dc]::DynamicConfig<rustc_query_system[b1cad9b13541f961]::query::caches::VecCache<rustc_span[8dceba2d8f32b518]::def_id::LocalDefId, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[ead61cf3be1d21dc]::plumbing::QueryCtxt, false>
  36:     0x7ffbdc4d281c - rustc_query_impl[ead61cf3be1d21dc]::query_impl::opaque_types_defined_by::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7ffbdabcbd87 - <rustc_infer[266f3098d907b771]::infer::InferCtxt>::opaque_type_origin
  38:     0x7ffbdb2d6741 - <rustc_middle[5f3e0edc8316c59d]::ty::fold::BottomUpFolder<<rustc_infer[266f3098d907b771]::infer::InferCtxt>::replace_opaque_types_with_inference_vars<rustc_middle[5f3e0edc8316c59d]::ty::Ty>::{closure#3}, <rustc_infer[266f3098d907b771]::infer::InferCtxt>::replace_opaque_types_with_inference_vars<rustc_middle[5f3e0edc8316c59d]::ty::Ty>::{closure#1}, <rustc_infer[266f3098d907b771]::infer::InferCtxt>::replace_opaque_types_with_inference_vars<rustc_middle[5f3e0edc8316c59d]::ty::Ty>::{closure#2}> as rustc_type_ir[dd14b209ae9cb3b9]::fold::FallibleTypeFolder<rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt>>::try_fold_ty
  39:     0x7ffbda6ab73e - rustc_hir_typeck[540acb189a8d256b]::check::check_fn
  40:     0x7ffbda6912ee - rustc_hir_typeck[540acb189a8d256b]::typeck
  41:     0x7ffbd9c26d0e - rustc_query_impl[ead61cf3be1d21dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ead61cf3be1d21dc]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 8usize]>>
  42:     0x7ffbd9c26cde - <rustc_query_impl[ead61cf3be1d21dc]::query_impl::typeck::dynamic_query::{closure#2} as core[d3915b1385eeee84]::ops::function::FnOnce<(rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt, rustc_span[8dceba2d8f32b518]::def_id::LocalDefId)>>::call_once
  43:     0x7ffbd9cef70d - rustc_query_system[b1cad9b13541f961]::query::plumbing::try_execute_query::<rustc_query_impl[ead61cf3be1d21dc]::DynamicConfig<rustc_query_system[b1cad9b13541f961]::query::caches::VecCache<rustc_span[8dceba2d8f32b518]::def_id::LocalDefId, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ead61cf3be1d21dc]::plumbing::QueryCtxt, false>
  44:     0x7ffbdb564eb1 - rustc_query_impl[ead61cf3be1d21dc]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7ffbdbcc52fb - rustc_middle[5f3e0edc8316c59d]::query::plumbing::query_get_at::<rustc_query_system[b1cad9b13541f961]::query::caches::VecCache<rustc_span[8dceba2d8f32b518]::def_id::LocalDefId, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 8usize]>>>
  46:     0x7ffbdbccdc0d - <rustc_hir_analysis[893db6da0ea67cd6]::collect::type_of::opaque::TaitConstraintLocator>::check
  47:     0x7ffbdbcca381 - <rustc_hir_analysis[893db6da0ea67cd6]::collect::type_of::opaque::TaitConstraintLocator as rustc_hir[5036ef232420606e]::intravisit::Visitor>::visit_nested_impl_item
  48:     0x7ffbdbd21a05 - rustc_hir[5036ef232420606e]::intravisit::walk_item::<rustc_hir_analysis[893db6da0ea67cd6]::collect::type_of::opaque::TaitConstraintLocator>
  49:     0x7ffbdbccdac0 - rustc_hir_analysis[893db6da0ea67cd6]::collect::type_of::opaque::find_opaque_ty_constraints_for_tait
  50:     0x7ffbdafee796 - rustc_hir_analysis[893db6da0ea67cd6]::collect::type_of::type_of
  51:     0x7ffbd9d1da67 - rustc_query_impl[ead61cf3be1d21dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ead61cf3be1d21dc]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 8usize]>>
  52:     0x7ffbd9d1d7a0 - <rustc_query_impl[ead61cf3be1d21dc]::query_impl::type_of::dynamic_query::{closure#2} as core[d3915b1385eeee84]::ops::function::FnOnce<(rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt, rustc_span[8dceba2d8f32b518]::def_id::DefId)>>::call_once
  53:     0x7ffbd9c277c5 - rustc_query_system[b1cad9b13541f961]::query::plumbing::try_execute_query::<rustc_query_impl[ead61cf3be1d21dc]::DynamicConfig<rustc_query_system[b1cad9b13541f961]::query::caches::DefaultCache<rustc_span[8dceba2d8f32b518]::def_id::DefId, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ead61cf3be1d21dc]::plumbing::QueryCtxt, false>
  54:     0x7ffbdb561d53 - rustc_query_impl[ead61cf3be1d21dc]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  55:     0x7ffbda9f69c0 - rustc_middle[5f3e0edc8316c59d]::query::plumbing::query_get_at::<rustc_query_system[b1cad9b13541f961]::query::caches::DefaultCache<rustc_span[8dceba2d8f32b518]::def_id::DefId, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 8usize]>>>
  56:     0x7ffbda9f0937 - rustc_hir_analysis[893db6da0ea67cd6]::check::check::check_mod_item_types
  57:     0x7ffbda86325c - rustc_query_impl[ead61cf3be1d21dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ead61cf3be1d21dc]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 0usize]>>
  58:     0x7ffbda86323e - <rustc_query_impl[ead61cf3be1d21dc]::query_impl::check_mod_item_types::dynamic_query::{closure#2} as core[d3915b1385eeee84]::ops::function::FnOnce<(rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt, rustc_span[8dceba2d8f32b518]::def_id::LocalDefId)>>::call_once
  59:     0x7ffbda2ce34f - rustc_query_system[b1cad9b13541f961]::query::plumbing::try_execute_query::<rustc_query_impl[ead61cf3be1d21dc]::DynamicConfig<rustc_query_system[b1cad9b13541f961]::query::caches::VecCache<rustc_span[8dceba2d8f32b518]::def_id::LocalDefId, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[ead61cf3be1d21dc]::plumbing::QueryCtxt, false>
  60:     0x7ffbdb5649f4 - rustc_query_impl[ead61cf3be1d21dc]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  61:     0x7ffbdb080a87 - <rustc_middle[5f3e0edc8316c59d]::hir::map::Map>::for_each_module::<rustc_hir_analysis[893db6da0ea67cd6]::check_crate::{closure#6}::{closure#0}>
  62:     0x7ffbdb07febd - <rustc_session[f84aa7fe032fd862]::session::Session>::time::<(), rustc_hir_analysis[893db6da0ea67cd6]::check_crate::{closure#6}>
  63:     0x7ffbdb07e077 - rustc_hir_analysis[893db6da0ea67cd6]::check_crate
  64:     0x7ffbdb078d2d - rustc_interface[5db37c687d653f71]::passes::analysis
  65:     0x7ffbdb10130a - rustc_query_impl[ead61cf3be1d21dc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ead61cf3be1d21dc]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 1usize]>>
  66:     0x7ffbdb1012f9 - <rustc_query_impl[ead61cf3be1d21dc]::query_impl::analysis::dynamic_query::{closure#2} as core[d3915b1385eeee84]::ops::function::FnOnce<(rustc_middle[5f3e0edc8316c59d]::ty::context::TyCtxt, ())>>::call_once
  67:     0x7ffbdb27f728 - rustc_query_system[b1cad9b13541f961]::query::plumbing::try_execute_query::<rustc_query_impl[ead61cf3be1d21dc]::DynamicConfig<rustc_query_system[b1cad9b13541f961]::query::caches::SingleCache<rustc_middle[5f3e0edc8316c59d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ead61cf3be1d21dc]::plumbing::QueryCtxt, false>
  68:     0x7ffbdb27f4f9 - rustc_query_impl[ead61cf3be1d21dc]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  69:     0x7ffbdb2583b5 - <rustc_middle[5f3e0edc8316c59d]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[d0821492cae6a3a8]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[d3915b1385eeee84]::result::Result<(), rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>>
  70:     0x7ffbdaea83bf - <rustc_interface[5db37c687d653f71]::interface::Compiler>::enter::<rustc_driver_impl[d0821492cae6a3a8]::run_compiler::{closure#1}::{closure#2}, core[d3915b1385eeee84]::result::Result<core[d3915b1385eeee84]::option::Option<rustc_interface[5db37c687d653f71]::queries::Linker>, rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>>
  71:     0x7ffbdaea5f59 - <scoped_tls[db132b8948264e24]::ScopedKey<rustc_span[8dceba2d8f32b518]::SessionGlobals>>::set::<rustc_interface[5db37c687d653f71]::interface::run_compiler<core[d3915b1385eeee84]::result::Result<(), rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>, rustc_driver_impl[d0821492cae6a3a8]::run_compiler::{closure#1}>::{closure#0}, core[d3915b1385eeee84]::result::Result<(), rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>>
  72:     0x7ffbdaea53c6 - std[30357d997d387a25]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5db37c687d653f71]::util::run_in_thread_pool_with_globals<rustc_interface[5db37c687d653f71]::interface::run_compiler<core[d3915b1385eeee84]::result::Result<(), rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>, rustc_driver_impl[d0821492cae6a3a8]::run_compiler::{closure#1}>::{closure#0}, core[d3915b1385eeee84]::result::Result<(), rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d3915b1385eeee84]::result::Result<(), rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>>
  73:     0x7ffbdaea5175 - <<std[30357d997d387a25]::thread::Builder>::spawn_unchecked_<rustc_interface[5db37c687d653f71]::util::run_in_thread_pool_with_globals<rustc_interface[5db37c687d653f71]::interface::run_compiler<core[d3915b1385eeee84]::result::Result<(), rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>, rustc_driver_impl[d0821492cae6a3a8]::run_compiler::{closure#1}>::{closure#0}, core[d3915b1385eeee84]::result::Result<(), rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d3915b1385eeee84]::result::Result<(), rustc_span[8dceba2d8f32b518]::ErrorGuaranteed>>::{closure#1} as core[d3915b1385eeee84]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  74:     0x7ffbd89763a5 - call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/alloc/src/boxed.rs:1985:9
  75:     0x7ffbd89763a5 - call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global>
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/alloc/src/boxed.rs:1985:9
  76:     0x7ffbd89763a5 - thread_start
                               at /rustc/43062c43d2a63cf4e261c6eddc417575c4f3062f/library/std/src/sys/unix/thread.rs:108:17
  77:     0x7ffbd870f44b - <unknown>
  78:     0x7ffbd8792e40 - <unknown>
  79:                0x0 - <unknown>

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.72.0-nightly (43062c43d 2023-06-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [opaque_types_defined_by] computing the opaque types defined by `<impl at treereduce.out:16:1: 16:13>::line_stream`
#1 [typeck] type-checking `<impl at treereduce.out:16:1: 16:13>::line_stream`
#2 [type_of] computing type of `<impl at treereduce.out:16:1: 16:13>::LineStream::{opaque#0}`
#3 [check_mod_item_types] checking item types in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors

Some errors have detailed explanations: E0049, E0407, E0601, E0658.
For more information about an error, try `rustc --explain E0049`.

@matthiaskrgr matthiaskrgr 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 Jun 10, 2023
@matthiaskrgr
Copy link
Member Author

Regression in #110454 cc @oli-obk

@compiler-errors
Copy link
Member

This is conceptually a dupe of #111828, even if the code differs a bit.

@compiler-errors
Copy link
Member

Wait no it's literally a duplicate, the code looks identical to me haha

@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Jun 10, 2023

code isn't identical

@@ -1,6 +1,3 @@
-#![feature(impl_trait_in_assoc_type)]
-#![crate_type="lib"]
-
 use std::future::Future;

 trait Stream {}
@@ -17,7 +14,7 @@
 struct Y;

 impl X for Y {
-    type LineStream<T> = impl Stream;
+    type LineStream<'a, 'b, T, U> = impl Stream;
     type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>;
     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
 }

the old one still crashes with

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:885:9: expected type for `T/#0` (T/0) but found Lifetime(ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:21 ~ old[ced2]::{impl#0}::line_stream::'a), 'a) })) when substituting, substs=[ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:21 ~ old[ced2]::{impl#0}::line_stream::'a), 'a) }), Repr]

though, do they have the same cause?

@compiler-errors
Copy link
Member

Yes they do have the same cause.

The crate_type attr doesn't change the behavior meaningfully in this case, nor does the feature branch since it's just used to emit error messages (doesn't affect lowering).

The choice of generics in that LineStream TAIT doesn't matter really -- the problem is just that the code that was written in the blame PR isn't handling generic args correctly in general. I expect any PR to fix that to fix both of these examples, and don't think they both need tests 😸

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 22, 2023
…-in-OpaqueTypeCollector, r=oli-obk

Don't substitute a GAT that has mismatched generics in `OpaqueTypeCollector`

Fixes rust-lang#111828

I didn't put up minimized UI tests for rust-lang#112510 or rust-lang#112873 because they'd minimize to literally the same code, but with different substs on the trait/impl. I don't think that warrants duplicate tests given the nature of the fix.

r? `@oli-obk`

----

Side-note: I checked, and this isn't fixed by rust-lang#112652 -- I think we discussed whether or not that PR fixed it either intentionally or by accident. The code here isn't really touched by that PR either as far as I can tell?

Also, sorry, did some other drive-bys. Hope it doesn't make rebasing rust-lang#112652 too difficult 😅
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
Development

No branches or pull requests

2 participants