Skip to content

ICE while adjusting Expr {...}, can't compose [...] and [...] #77596

Closed
@90-008

Description

@90-008

Code

Cargo.toml:

[dependencies]
uuid = "0.8.1"

main.rs:

use uuid::Uuid;
use std::str::FromStr;

fn main() {
    if let Some(id) = Some("aasdf") {
        if Ok(id) = Uuid::from_str(&id) {
        }
    }
}

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (beb5ae474 2020-10-04)
binary: rustc
commit-hash: beb5ae474d2835962ebdf7416bd1c9ad864fe101
commit-date: 2020-10-04
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: compiler/rustc_typeck/src/check/fn_ctxt.rs:459:25: while adjusting Expr { hir_id: HirId { owner: DefId(0:5 ~ uuid_ice[56f1]::main), local_id: 24 }, kind: AddrOf(Ref, Not, Expr { hir_id: HirId { owner: DefId(0:5 ~ uuid_ice[56f1]::main), local_id: 23 }, kind: Path(Resolved(None, Path { span: src/main.rs:6:37: 6:39 (#0), res: Local(HirId { owner: DefId(0:5 ~ uuid_ice[56f1]::main), local_id: 2 }), segments: [PathSegment { ident: id#0, hir_id: Some(HirId { owner: DefId(0:5 ~ uuid_ice[56f1]::main), local_id: 22 }), res: Some(Local(HirId { owner: DefId(0:5 ~ uuid_ice[56f1]::main), local_id: 2 })), args: None, infer_args: true }] })), attrs: ThinVec(None), span: src/main.rs:6:37: 6:39 (#0) }), attrs: ThinVec(None), span: src/main.rs:6:36: 6:39 (#0) }, can't compose [Deref(None) -> &str, Deref(None) -> str, Borrow(Ref('_#4r, Not)) -> &str] and [Deref(None) -> &str, Deref(None) -> str, Borrow(Ref('_#8r, Not)) -> &str]

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.49.0-nightly (beb5ae474 2020-10-04) running on x86_64-unknown-linux-gnu

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

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

stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::bug
   2: rustc_errors::Handler::bug
   3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   4: rustc_middle::ty::context::tls::with_opt::{{closure}}
   5: rustc_middle::ty::context::tls::with_opt
   6: rustc_middle::util::bug::opt_span_bug_fmt
   7: rustc_middle::util::bug::bug_fmt
   8: rustc_typeck::check::fn_ctxt::FnCtxt::apply_adjustments
   9: rustc_typeck::check::coercion::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::try_coerce
  10: rustc_typeck::check::demand::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::demand_coerce_diag
  11: rustc_typeck::check::fn_ctxt::FnCtxt::check_argument_types
  12: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  13: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  14: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  15: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  16: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_coercable_to_type
  17: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  18: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  19: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  20: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  21: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
  22: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  23: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  24: rustc_typeck::check::fn_ctxt::FnCtxt::check_block_with_expected
  25: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  26: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  27: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
  28: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  29: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  30: rustc_typeck::check::fn_ctxt::FnCtxt::check_block_with_expected
  31: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  32: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  33: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  34: rustc_typeck::check::check::check_fn
  35: rustc_infer::infer::InferCtxtBuilder::enter
  36: rustc_typeck::check::typeck
  37: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
  38: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  40: rustc_data_structures::stack::ensure_sufficient_stack
  41: rustc_query_system::query::plumbing::get_query_impl
  42: rustc_query_system::query::plumbing::ensure_query_impl
  43: rustc_typeck::check::typeck_item_bodies
  44: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute
  45: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  46: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  47: rustc_data_structures::stack::ensure_sufficient_stack
  48: rustc_query_system::query::plumbing::get_query_impl
  49: rustc_typeck::check_crate
  50: rustc_interface::passes::analysis
  51: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  52: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  53: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  54: rustc_data_structures::stack::ensure_sufficient_stack
  55: rustc_query_system::query::plumbing::get_query_impl
  56: rustc_interface::passes::QueryContext::enter
  57: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  58: rustc_span::with_source_map
  59: rustc_interface::interface::create_compiler_and_run
  60: scoped_tls::ScopedKey<T>::set

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [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) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions