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

Internal Compiler Error #93690

Closed
ccqpein opened this issue Feb 6, 2022 · 8 comments
Closed

Internal Compiler Error #93690

ccqpein opened this issue Feb 6, 2022 · 8 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium 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

@ccqpein
Copy link
Contributor

ccqpein commented Feb 6, 2022

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

@ccqpein ccqpein 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 Feb 6, 2022
@gimbling-away
Copy link
Contributor

image
Just to point it out, This doesn't ICE on stable.

@pnkfelix pnkfelix added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Feb 10, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Feb 10, 2022
@steffahn
Copy link
Member

@rustbot label E-needs-bisection

@rustbot rustbot added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Feb 23, 2022
@apiraino
Copy link
Contributor

bisection points to commit e0e70c0

searched nightlies: from nightly-2021-12-01 to nightly-2022-02-23
regressed nightly: nightly-2022-01-29
searched commit range: 21b4a9c...e0a55f4
regressed commit: e0e70c0

bisected with cargo-bisect-rustc v0.6.1

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

cargo bisect-rustc --start=2021-12-01 --script=./test.sh --regress non-error 
$ cat test.sh
#!/usr/bin/env bash
cargo build 2>&1 | grep "internal compiler error"

@rustbot label -E-needs-bisection

@rustbot rustbot removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Feb 23, 2022
@steffahn
Copy link
Member

cc @bobrippling @camelid

@apiraino
Copy link
Contributor

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

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Feb 24, 2022
@bobrippling
Copy link
Contributor

At a guess, the original code has a compile error (self.channel.send((X::new(xx.S)), 1) should be self.channel.send((X::new(xx.S), 1))) and this is now detected and throwing out this adjustment code - I'm not familiar with this but I believe it's adding the autoref expressions?

So it seems that the suggestion is auto-applied and then we attempt to autoref based upon that, but there's no existing reference so we ICE?

@ouz-a
Copy link
Contributor

ouz-a commented Mar 1, 2022

I think this is fixed by #94438 (great work @compiler-errors) I can't reproduce on the latest nightly

@camelid camelid 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 Mar 2, 2022
@camelid camelid added this to the 1.60.0 milestone Mar 2, 2022
@camelid
Copy link
Member

camelid commented Mar 2, 2022

The issue is fixed on nightly but still present on beta, and I beta-nominated the PR that fixed it. I'm going to close this issue now.

@camelid camelid closed this as completed Mar 2, 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) ❄️ P-medium Medium 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
Development

No branches or pull requests

9 participants