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 with RPITIT and lifetimes #103407

Closed
ivansanchez-oss opened this issue Oct 22, 2022 · 0 comments · Fixed by #103409
Closed

ICE with RPITIT and lifetimes #103407

ivansanchez-oss opened this issue Oct 22, 2022 · 0 comments · Fixed by #103409
Assignees
Labels
C-bug Category: This is a bug.

Comments

@ivansanchez-oss
Copy link

ivansanchez-oss commented Oct 22, 2022

the curious thing is that in my environment it produces a different error that I was not able to reproduce in the playground

Code

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

use std::future::Future;

pub trait AsyncTrait {
    fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
}

pub struct Struct;

impl AsyncTrait for Struct {
    fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
        async move { buff.to_vec() }
    }
}

Playground

Meta

rustc --version --verbose:

rustc 1.66.0-nightly (5c8bff74b 2022-10-21) running on x86_64-unknown-linux-gnu

Error output

thread 'rustc' panicked at 'no entry found for key', compiler/rustc_hir_analysis/src/check/compare_method.rs:601:47
Backtrace

 Compiling playground v0.0.1 (/playground)
thread 'rustc' panicked at 'no entry found for key', compiler/rustc_hir_analysis/src/check/compare_method.rs:601:47
stack backtrace:
   0:     0x7faa50285670 - std::backtrace_rs::backtrace::libunwind::trace::h7437781aa85dca60
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7faa50285670 - std::backtrace_rs::backtrace::trace_unsynchronized::hb84419b9fcbab27c
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7faa50285670 - std::sys_common::backtrace::_print_fmt::h9007eb4ce0fa4ee4
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7faa50285670 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h907649500d38afba
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7faa502e158e - core::fmt::write::hb8299136d300b292
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/core/src/fmt/mod.rs:1209:17
   5:     0x7faa502758e5 - std::io::Write::write_fmt::hebd34bdde63d754d
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/io/mod.rs:1682:15
   6:     0x7faa50285435 - std::sys_common::backtrace::_print::h840d14c241033cf4
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7faa50285435 - std::sys_common::backtrace::print::h20a48f724eef8553
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7faa5028823f - std::panicking::default_hook::{{closure}}::hcc5a4d7d2c9355d1
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/panicking.rs:267:22
   9:     0x7faa50287f7a - std::panicking::default_hook::haf4608272aae7458
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/panicking.rs:286:9
  10:     0x7faa52bd8eb4 - rustc_driver[7240838df62c6c6a]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7faa50288a69 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h583650acfaf68785
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/alloc/src/boxed.rs:2001:9
  12:     0x7faa50288a69 - std::panicking::rust_panic_with_hook::h3a705e9366d5a595
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/panicking.rs:692:13
  13:     0x7faa502887e7 - std::panicking::begin_panic_handler::{{closure}}::hcbadfa286450495e
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/panicking.rs:579:13
  14:     0x7faa50285b1c - std::sys_common::backtrace::__rust_end_short_backtrace::h8bb0eada007dcf6a
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/sys_common/backtrace.rs:137:18
  15:     0x7faa50288502 - rust_begin_unwind
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/panicking.rs:575:5
  16:     0x7faa502ddf73 - core::panicking::panic_fmt::h7b1097799bef8de0
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/core/src/panicking.rs:65:14
  17:     0x7faa502de0c1 - core::panicking::panic_display::ha954564600d863b5
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/core/src/panicking.rs:139:5
  18:     0x7faa502de06b - core::panicking::panic_str::h3e2be859b3d8d1f9
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/core/src/panicking.rs:123:5
  19:     0x7faa502ddce6 - core::option::expect_failed::h9ff5e77425bcb875
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/core/src/option.rs:1876:5
  20:     0x7faa52ed19a4 - rustc_hir_analysis[d96ae4c8b8da1cae]::check::compare_method::collect_trait_impl_trait_tys::{closure#2}
  21:     0x7faa527da5cb - <&rustc_middle[5bf93a4b064c7070]::ty::list::List<rustc_middle[5bf93a4b064c7070]::ty::subst::GenericArg> as rustc_middle[5bf93a4b064c7070]::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle[5bf93a4b064c7070]::ty::fold::RegionFolder>
  22:     0x7faa527da1a5 - <rustc_middle[5bf93a4b064c7070]::ty::Ty as rustc_middle[5bf93a4b064c7070]::ty::fold::TypeSuperFoldable>::super_fold_with::<rustc_middle[5bf93a4b064c7070]::ty::fold::RegionFolder>
  23:     0x7faa52ec9b5d - <rustc_middle[5bf93a4b064c7070]::ty::context::TyCtxt>::fold_regions::<rustc_middle[5bf93a4b064c7070]::ty::Ty, rustc_hir_analysis[d96ae4c8b8da1cae]::check::compare_method::collect_trait_impl_trait_tys::{closure#2}>
  24:     0x7faa52f09370 - rustc_hir_analysis[d96ae4c8b8da1cae]::check::compare_method::collect_trait_impl_trait_tys
  25:     0x7faa534ec93a - rustc_query_system[32363f7daffe92c]::query::plumbing::try_execute_query::<rustc_query_impl[42c2fa874da0ba3c]::plumbing::QueryCtxt, rustc_query_system[32363f7daffe92c]::query::caches::DefaultCache<rustc_span[9b0423c38f2996a]::def_id::DefId, core[4c69c3a2f73b376]::result::Result<&std[631fbe326a1fa8e7]::collections::hash::map::HashMap<rustc_span[9b0423c38f2996a]::def_id::DefId, rustc_middle[5bf93a4b064c7070]::ty::Ty, core[4c69c3a2f73b376]::hash::BuildHasherDefault<rustc_hash[b3e09f26190bbdc2]::FxHasher>>, rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>>>
  26:     0x7faa5351b38e - rustc_query_system[32363f7daffe92c]::query::plumbing::get_query::<rustc_query_impl[42c2fa874da0ba3c]::queries::collect_trait_impl_trait_tys, rustc_query_impl[42c2fa874da0ba3c]::plumbing::QueryCtxt>
  27:     0x7faa53c27e82 - <rustc_middle[5bf93a4b064c7070]::ty::context::TyCtxt>::bound_trait_impl_trait_tys
  28:     0x7faa5175bd98 - rustc_trait_selection[e0e2a1c7326f0e3e]::traits::project::opt_normalize_projection_type
  29:     0x7faa5174df86 - <rustc_trait_selection[e0e2a1c7326f0e3e]::traits::project::AssocTypeNormalizer as rustc_middle[5bf93a4b064c7070]::ty::fold::TypeFolder>::fold_ty
  30:     0x7faa51fd244a - rustc_middle[5bf93a4b064c7070]::ty::util::fold_list::<rustc_trait_selection[e0e2a1c7326f0e3e]::traits::project::AssocTypeNormalizer, rustc_middle[5bf93a4b064c7070]::ty::Ty, <&rustc_middle[5bf93a4b064c7070]::ty::list::List<rustc_middle[5bf93a4b064c7070]::ty::Ty> as rustc_middle[5bf93a4b064c7070]::ty::fold::TypeFoldable>::try_fold_with<rustc_trait_selection[e0e2a1c7326f0e3e]::traits::project::AssocTypeNormalizer>::{closure#0}>
  31:     0x7faa524730d8 - <rustc_infer[4c2e4843430f3deb]::infer::InferCtxt as rustc_trait_selection[e0e2a1c7326f0e3e]::infer::InferCtxtExt>::partially_normalize_associated_types_in::<rustc_middle[5bf93a4b064c7070]::ty::sty::FnSig>
  32:     0x7faa52471fed - <rustc_trait_selection[e0e2a1c7326f0e3e]::traits::engine::ObligationCtxt>::normalize::<rustc_middle[5bf93a4b064c7070]::ty::sty::FnSig>
  33:     0x7faa5246d223 - rustc_hir_analysis[d96ae4c8b8da1cae]::check::compare_method::compare_impl_method
  34:     0x7faa5245f5c2 - rustc_hir_analysis[d96ae4c8b8da1cae]::check::check::check_impl_items_against_trait
  35:     0x7faa5245494b - rustc_hir_analysis[d96ae4c8b8da1cae]::check::check::check_mod_item_types
  36:     0x7faa521bb6d5 - rustc_query_system[32363f7daffe92c]::query::plumbing::try_execute_query::<rustc_query_impl[42c2fa874da0ba3c]::plumbing::QueryCtxt, rustc_query_system[32363f7daffe92c]::query::caches::DefaultCache<rustc_span[9b0423c38f2996a]::def_id::LocalDefId, ()>>
  37:     0x7faa525e1629 - rustc_query_system[32363f7daffe92c]::query::plumbing::get_query::<rustc_query_impl[42c2fa874da0ba3c]::queries::check_mod_item_types, rustc_query_impl[42c2fa874da0ba3c]::plumbing::QueryCtxt>
  38:     0x7faa525afefc - <rustc_middle[5bf93a4b064c7070]::hir::map::Map>::for_each_module::<rustc_hir_analysis[d96ae4c8b8da1cae]::check_crate::{closure#6}::{closure#0}>
  39:     0x7faa525af9f5 - rustc_hir_analysis[d96ae4c8b8da1cae]::check_crate
  40:     0x7faa525af527 - rustc_interface[193c2632633c4bd2]::passes::analysis
  41:     0x7faa5296f154 - rustc_query_system[32363f7daffe92c]::query::plumbing::try_execute_query::<rustc_query_impl[42c2fa874da0ba3c]::plumbing::QueryCtxt, rustc_query_system[32363f7daffe92c]::query::caches::DefaultCache<(), core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>>>
  42:     0x7faa5296ee87 - rustc_query_system[32363f7daffe92c]::query::plumbing::get_query::<rustc_query_impl[42c2fa874da0ba3c]::queries::analysis, rustc_query_impl[42c2fa874da0ba3c]::plumbing::QueryCtxt>
  43:     0x7faa518c9204 - <rustc_interface[193c2632633c4bd2]::passes::QueryContext>::enter::<rustc_driver[7240838df62c6c6a]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>>
  44:     0x7faa518c5736 - <rustc_interface[193c2632633c4bd2]::interface::Compiler>::enter::<rustc_driver[7240838df62c6c6a]::run_compiler::{closure#1}::{closure#2}, core[4c69c3a2f73b376]::result::Result<core[4c69c3a2f73b376]::option::Option<rustc_interface[193c2632633c4bd2]::queries::Linker>, rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>>
  45:     0x7faa518bd0fc - rustc_span[9b0423c38f2996a]::with_source_map::<core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>, rustc_interface[193c2632633c4bd2]::interface::run_compiler<core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>, rustc_driver[7240838df62c6c6a]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  46:     0x7faa518bcac2 - <scoped_tls[ff9cb7d73db555fe]::ScopedKey<rustc_span[9b0423c38f2996a]::SessionGlobals>>::set::<rustc_interface[193c2632633c4bd2]::interface::run_compiler<core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>, rustc_driver[7240838df62c6c6a]::run_compiler::{closure#1}>::{closure#0}, core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>>
  47:     0x7faa518bb1ef - std[631fbe326a1fa8e7]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[193c2632633c4bd2]::util::run_in_thread_pool_with_globals<rustc_interface[193c2632633c4bd2]::interface::run_compiler<core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>, rustc_driver[7240838df62c6c6a]::run_compiler::{closure#1}>::{closure#0}, core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>>
  48:     0x7faa518bb05f - <<std[631fbe326a1fa8e7]::thread::Builder>::spawn_unchecked_<rustc_interface[193c2632633c4bd2]::util::run_in_thread_pool_with_globals<rustc_interface[193c2632633c4bd2]::interface::run_compiler<core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>, rustc_driver[7240838df62c6c6a]::run_compiler::{closure#1}>::{closure#0}, core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4c69c3a2f73b376]::result::Result<(), rustc_errors[79b484a79fe74c4b]::ErrorGuaranteed>>::{closure#1} as core[4c69c3a2f73b376]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7faa50292583 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcfc5d500cd06cbe0
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/alloc/src/boxed.rs:1987:9
  50:     0x7faa50292583 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h98c94487353f1fd4
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/alloc/src/boxed.rs:1987:9
  51:     0x7faa50292583 - std::sys::unix::thread::Thread::new::thread_start::h0b76d4916e03e8a3
                               at /rustc/5c8bff74bc1c52bef0c79f3689bb227f51f3e82d/library/std/src/sys/unix/thread.rs:108:17
  52:     0x7faa50164609 - start_thread
  53:     0x7faa50087133 - clone
  54:                0x0 - <unknown>

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.66.0-nightly (5c8bff74b 2022-10-21) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [collect_trait_impl_trait_tys] comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process
#1 [check_mod_item_types] checking item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `playground`

@ivansanchez-oss ivansanchez-oss added the C-bug Category: This is a bug. label Oct 22, 2022
@compiler-errors compiler-errors self-assigned this Oct 22, 2022
JohnTitor pushed a commit to JohnTitor/rust that referenced this issue Oct 24, 2022
…ismatch, r=lcnr

Delay span bug when we can't map lifetimes back in `collect_trait_impl_trait_tys`

When a lifetime is late-bound in a trait signature, but early-bound in an impl signature, we already emit an error -- however, we also ICE in `collect_trait_impl_trait_tys`, so just delay a bug here.

Fixes rust-lang#103407
@bors bors closed this as completed in 12babb6 Oct 25, 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants