Skip to content

ICE: 'assertion failed: !bounds.has_escaping_bound_vars()', compiler/rustc_typeck/src/check/method/mod.rs:388:9 #77910

Closed
@chengniansun

Description

@chengniansun

Code

fn foo(s: &i32) -> &i32 {
    let xs;
    xs
}
fn main() {
    let y;
    assert_eq!(foo, y);
}

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (3525087ad 2020-10-08)

binary: rustc

commit-hash: 3525087ada7018ef227b10846648660b7f07b6d1

commit-date: 2020-10-08

host: x86_64-unknown-linux-gnu

release: 1.49.0-nightly

LLVM version: 11.0

Error output

thread 'rustc' panicked at 'assertion failed: !bounds.has_escaping_bound_vars()', compiler/rustc_typeck/src/check/method/mod.rs:388:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.49.0-nightly (8dae8cdcc 2020-10-12) running on x86_64-unknown-linux-gnu

error: internal compiler error: trimmed_def_paths constructed
  |
  = note: delayed at    0: rustc_errors::Handler::delay_good_path_bug
             1: rustc_middle::ty::print::pretty::trimmed_def_paths
             2: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::trimmed_def_paths>::compute
             3: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
             4: rustc_data_structures::stack::ensure_sufficient_stack
             5: rustc_query_system::query::plumbing::get_query_impl
             6: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_def_path
             7: rustc_middle::ty::print::pretty::PrettyPrinter::pretty_print_type
             8: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_type
             9: rustc_middle::ty::print::pretty::<impl core::fmt::Display for &rustc_middle::ty::TyS>::fmt
            10: core::fmt::write
                       at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/core/src/fmt/mod.rs:1076
            11: core::fmt::Write::write_fmt
                       at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/core/src/fmt/mod.rs:182
                alloc::fmt::format
                       at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/alloc/src/fmt.rs:577
            12: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_overloaded_binop
            13: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_binop
            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_kind
            17: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
            18: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
            19: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
            20: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
            21: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
            22: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
            23: rustc_typeck::check::fn_ctxt::FnCtxt::check_block_with_expected
            24: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
            25: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
            26: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
            27: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
            28: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
            29: rustc_typeck::check::fn_ctxt::FnCtxt::check_block_with_expected
            30: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
            31: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
            32: rustc_typeck::check::fn_ctxt::FnCtxt::check_stmt
            33: rustc_typeck::check::fn_ctxt::FnCtxt::check_block_with_expected
            34: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
            35: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
            36: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
            37: rustc_typeck::check::check::check_fn
            38: rustc_infer::infer::InferCtxtBuilder::enter
            39: rustc_typeck::check::typeck
            40: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
            41: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
            42: rustc_data_structures::stack::ensure_sufficient_stack
            43: rustc_query_system::query::plumbing::get_query_impl
            44: rustc_query_system::query::plumbing::ensure_query_impl
            45: rustc_typeck::check::typeck_item_bodies
            46: 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
            47: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
            48: rustc_data_structures::stack::ensure_sufficient_stack
            49: rustc_query_system::query::plumbing::get_query_impl
            50: rustc_typeck::check_crate
            51: rustc_interface::passes::analysis
            52: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
            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: scoped_tls::ScopedKey<T>::set
            60: std::sys_common::backtrace::__rust_begin_short_backtrace
            61: core::ops::function::FnOnce::call_once{{vtable.shim}}
            62: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
                       at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/alloc/src/boxed.rs:1042
                <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
                       at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/alloc/src/boxed.rs:1042
                std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/sys/unix/thread.rs:87
            63: start_thread
            64: clone


thread 'rustc' panicked at 'no warnings or errors encountered even though `delayed_good_path_bugs` issued', compiler/rustc_errors/src/lib.rs:961:13
stack backtrace:
   0:     0x7fe8fb9e0410 - std::backtrace_rs::backtrace::libunwind::trace::h622bab51c72c4e69
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
   1:     0x7fe8fb9e0410 - std::backtrace_rs::backtrace::trace_unsynchronized::h7e820b882ebd41ee
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe8fb9e0410 - std::sys_common::backtrace::_print_fmt::h64d46258114db92f
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/sys_common/backtrace.rs:79:5
   3:     0x7fe8fb9e0410 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47111d0c1b5f0da5
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/sys_common/backtrace.rs:58:22
   4:     0x7fe8fba4edfc - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/core/src/fmt/mod.rs:1076:17
   5:     0x7fe8fb9d2222 - std::io::Write::write_fmt::h4604516fed3e5731
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/io/mod.rs:1516:15
   6:     0x7fe8fb9e520d - std::sys_common::backtrace::_print::h785e7a78d5ef272c
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/sys_common/backtrace.rs:61:5
   7:     0x7fe8fb9e520d - std::sys_common::backtrace::print::h108047ac5c4555d5
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/sys_common/backtrace.rs:48:9
   8:     0x7fe8fb9e520d - std::panicking::default_hook::{{closure}}::h1d0c271f0d087ebf
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/panicking.rs:208:50
   9:     0x7fe8fb9e4eb8 - std::panicking::default_hook::h692753e26f11b7b7
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/panicking.rs:227:9
  10:     0x7fe8fc2a02c8 - rustc_driver::report_ice::h94e1b9f0f92bafae
  11:     0x7fe8fb9e5a56 - std::panicking::rust_panic_with_hook::h74ddc20305301cd9
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/panicking.rs:581:17
  12:     0x7fe8fb9e55d9 - std::panicking::begin_panic_handler::{{closure}}::h1a9ca6427ceee1d0
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/panicking.rs:484:9
  13:     0x7fe8fb9e08cc - std::sys_common::backtrace::__rust_end_short_backtrace::h97e27b7ab754adde
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/sys_common/backtrace.rs:153:18
  14:     0x7fe8fb9e5599 - rust_begin_unwind
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/panicking.rs:483:5
  15:     0x7fe8fb9e554b - std::panicking::begin_panic_fmt::h45d0f154d1dd3395
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/panicking.rs:437:5
  16:     0x7fe8ff34af41 - rustc_errors::HandlerInner::flush_delayed::h7bddafb93bd8de90
  17:     0x7fe8ff3478fc - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::hd958c71a259d81a2
  18:     0x7fe8fc2d4b46 - core::ptr::drop_in_place::h40d5276e772edf19
  19:     0x7fe8fc2e7d26 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h6e883ca9dd0b7542
  20:     0x7fe8fc2b1f4d - core::ptr::drop_in_place::h0bc6a6c8123fa286
  21:     0x7fe8fc2a50fd - rustc_span::with_source_map::h62a26cc1f538b576
  22:     0x7fe8fc2bd221 - scoped_tls::ScopedKey<T>::set::h851e47b28a99a947
  23:     0x7fe8fc2c5e91 - std::sys_common::backtrace::__rust_begin_short_backtrace::hcc10758615a842a8
  24:     0x7fe8fc24a3de - core::ops::function::FnOnce::call_once{{vtable.shim}}::hdee37546948bd4b7
  25:     0x7fe8fb9f486a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h588ce842808b3fd0
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/alloc/src/boxed.rs:1042:9
  26:     0x7fe8fb9f486a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h46bc655f05471a92
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/alloc/src/boxed.rs:1042:9
  27:     0x7fe8fb9f486a - std::sys::unix::thread::Thread::new::thread_start::hb4b79d379b730058
                               at /rustc/8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306/library/std/src/sys/unix/thread.rs:87:17
  28:     0x7fe8fb925609 - start_thread
  29:     0x7fe8fb839293 - clone
  30:                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.49.0-nightly (8dae8cdcc 2020-10-12) running on x86_64-unknown-linux-gnu

thread panicked while panicking. aborting.
Illegal instruction (core dumped)
Backtrace

<backtrace>

NOTE: The bug is found by our work-in-progress compiler testing tool Kira, and the test program is reduced/minimized by Perses

Metadata

Metadata

Assignees

Labels

A-lifetimesArea: Lifetimes / regionsA-type-systemArea: Type systemC-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcI-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.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions