Skip to content

Internal Compiler Error #93690

Closed
Closed
@ccqpein

Description

@ccqpein

Code

/// tokio = { version = "1", features = ["full"] }
use tokio::sync::mpsc::{Receiver, Sender};

struct X {
    S: String,
}

impl X {
    fn new(sss: String) -> Self {
        Self { S: sss }
    }
}

struct A {
    receiver: Receiver<X>,
    channel: Sender<(X, i32)>,
}

impl A {
    pub async fn run(&mut self) {
        while let Some(ref xx) = self.receiver.recv().await {
            tokio::spawn(async move {
                self.channel.send((X::new(xx.S)), 1).await;
            });
        }
    }
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (88fb06a1f 2022-02-05)
binary: rustc
commit-hash: 88fb06a1f331926bccb448acdb52966fd1ec8a92
commit-date: 2022-02-05
host: x86_64-apple-darwin
release: 1.60.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:318:26: while adjusting Expr { hir_id: HirId { owner: DefId(0:18 ~ temp[29dd]::{impl#1}::run), local_id: 70 }, kind: Path(Resolved(None, Path { span: src/main.rs:22:43: 22:45 (#0), res: Local(HirId { owner: DefId(0:18 ~ temp[29dd]::{impl#1}::run), local_id: 12 }), segments: [PathSegment { ident: xx#0, hir_id: Some(HirId { owner: DefId(0:18 ~ temp[29dd]::{impl#1}::run), local_id: 69 }), res: Some(Local(HirId { owner: DefId(0:18 ~ temp[29dd]::{impl#1}::run), local_id: 12 })), args: None, infer_args: true }] })), span: src/main.rs:22:43: 22:45 (#0) }, can't compose [Deref(None) -> X] and [Deref(None) -> X]
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1160:9
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner>::bug
   3: <rustc_errors::Handler>::bug
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, ()>
   5: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_typeck::check::fn_ctxt::FnCtxt>::apply_adjustments
   8: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_field
   9: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  10: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  11: <rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  12: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  13: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  14: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  15: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  16: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_method_argument_types
  17: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  18: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  19: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  20: <rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  21: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  22: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  23: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24: <rustc_typeck::check::fn_ctxt::FnCtxt>::demand_scrutinee_type
  25: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
  26: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  27: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  29: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  30: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  31: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  32: rustc_typeck::check::check::check_fn
  33: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_closure
  34: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  35: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  36: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  37: <rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  38: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  39: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  40: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  41: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  42: <rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  43: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  44: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  45: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  46: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  47: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  48: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  49: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  50: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  51: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  52: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  53: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  54: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  55: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  56: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  57: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  58: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  59: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  60: rustc_typeck::check::check::check_fn
  61: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_closure
  62: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  63: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  64: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  65: <rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  66: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  67: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  68: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  69: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  70: rustc_typeck::check::check::check_fn
  71: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
  72: rustc_typeck::check::typeck
  73: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>
  74: rustc_data_structures::stack::ensure_sufficient_stack::<(&rustc_middle::ty::context::TypeckResults, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#3}>
  75: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
  76: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
  77: <rustc_middle::ty::context::TyCtxt>::typeck_opt_const_arg
  78: rustc_mir_build::build::mir_built
  79: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>
  80: rustc_data_structures::stack::ensure_sufficient_stack::<(&rustc_data_structures::steal::Steal<rustc_middle::mir::Body>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>::{closure#3}>
  81: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>>
  82: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::mir_built, rustc_query_impl::plumbing::QueryCtxt>
  83: rustc_mir_transform::check_unsafety::unsafety_check_result
  84: <rustc_mir_transform::check_unsafety::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  85: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>
  86: rustc_data_structures::stack::ensure_sufficient_stack::<(&rustc_middle::mir::query::UnsafetyCheckResult, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>::{closure#3}>
  87: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>>
  88: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::unsafety_check_result, rustc_query_impl::plumbing::QueryCtxt>
  89: rustc_mir_transform::mir_const
  90: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>
  91: rustc_data_structures::stack::ensure_sufficient_stack::<(&rustc_data_structures::steal::Steal<rustc_middle::mir::Body>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>::{closure#3}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.60.0-nightly (88fb06a1f 2022-02-05) running on x86_64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [typeck] type-checking `<impl at src/main.rs:18:1: 26:2>::run`
#1 [mir_built] building MIR for `<impl at src/main.rs:18:1: 26:2>::run`
#2 [unsafety_check_result] unsafety-checking `<impl at src/main.rs:18:1: 26:2>::run`
#3 [mir_const] processing MIR for `<impl at src/main.rs:18:1: 26:2>::run`
#4 [mir_promoted] processing `<impl at src/main.rs:18:1: 26:2>::run`
#5 [mir_borrowck] borrow-checking `<impl at src/main.rs:18:1: 26:2>::run`
#6 [type_of] computing type of `<impl at src/main.rs:18:1: 26:2>::run::{opaque#0}`
#7 [check_mod_item_types] checking item types in top-level module
#8 [analysis] running analysis passes on this crate
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions