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

trimmed_def_paths constructed when indirect_structural_match allowed #89088

Closed
ryanolf opened this issue Sep 19, 2021 · 1 comment · Fixed by #89126
Closed

trimmed_def_paths constructed when indirect_structural_match allowed #89088

ryanolf opened this issue Sep 19, 2021 · 1 comment · Fixed by #89126
Labels
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.

Comments

@ryanolf
Copy link

ryanolf commented Sep 19, 2021

Code

#![allow(indirect_structural_match)]
use std::borrow::Cow;

const FOO: &A = &A::Field(Cow::Borrowed("foo"));

#[derive(PartialEq, Eq)]
enum A {
    Field(Cow<'static, str>)
}

fn main() {
    let var = A::Field(Cow::Borrowed("bar"));

    match &var {
        FOO => todo!(),
        _ => todo!()
    }
}

Meta

rustc --version --verbose:

rustc 1.57.0-nightly (aa8f2d432 2021-09-18)
binary: rustc
commit-hash: aa8f2d432b23575929a48f87b8746f41ba723318
commit-date: 2021-09-18
host: aarch64-apple-darwin
release: 1.57.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: trimmed_def_paths constructed
  |
  = note: delayed at    0: std::backtrace::Backtrace::create
             1: rustc_errors::Handler::delay_good_path_bug
             2: rustc_middle::ty::print::pretty::trimmed_def_paths
             3: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
             4: rustc_data_structures::stack::ensure_sufficient_stack
             5: rustc_query_system::query::plumbing::try_execute_query
             6: rustc_query_system::query::plumbing::force_query_impl
             7: rustc_query_impl::query_callbacks::trimmed_def_paths::force_from_dep_node
             8: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
             9: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_green
            10: rustc_query_system::query::plumbing::ensure_must_run
            11: rustc_query_system::query::plumbing::get_query
            12: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
            13: rustc_session::utils::<impl rustc_session::session::Session>::time
            14: rustc_interface::passes::analysis
            15: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
            16: rustc_data_structures::stack::ensure_sufficient_stack
            17: rustc_query_system::query::plumbing::try_execute_query
            18: rustc_query_system::query::plumbing::get_query
            19: rustc_interface::passes::QueryContext::enter
            20: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
            21: rustc_span::with_source_map
            22: scoped_tls::ScopedKey<T>::set
            23: std::sys_common::backtrace::__rust_begin_short_backtrace
            24: core::ops::function::FnOnce::call_once{{vtable.shim}}
            25: std::sys::unix::thread::Thread::new::thread_start
            26: _pthread_jit_write_protect_np
          

thread 'rustc' panicked at 'no warnings or errors encountered even though `delayed_good_path_bugs` issued', compiler/rustc_errors/src/lib.rs:1165:13
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.57.0-nightly (e4828d5b7 2021-09-16) running on aarch64-apple-darwin

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

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

query stack during panic:
end of query stack
Backtrace

error: internal compiler error: trimmed_def_paths constructed
  |
  = note: delayed at    0: std::backtrace::Backtrace::create
             1: rustc_errors::Handler::delay_good_path_bug
             2: rustc_middle::ty::print::pretty::trimmed_def_paths
             3: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
             4: rustc_data_structures::stack::ensure_sufficient_stack
             5: rustc_query_system::query::plumbing::try_execute_query
             6: rustc_query_system::query::plumbing::get_query
             7: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_def_path
             8: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_def_path
             9: rustc_middle::ty::print::pretty::PrettyPrinter::pretty_print_type
            10: rustc_middle::ty::print::pretty::<impl core::fmt::Display for &rustc_middle::ty::TyS>::fmt
            11: core::fmt::write
            12: alloc::fmt::format
            13: rustc_mir_build::thir::pattern::const_to_pat::ConstToPat::recur
            14: <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold
            15: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
            16: core::iter::adapters::process_results
            17: rustc_mir_build::thir::pattern::const_to_pat::ConstToPat::recur
            18: rustc_mir_build::thir::pattern::const_to_pat::ConstToPat::recur
            19: rustc_mir_build::thir::pattern::const_to_pat::ConstToPat::to_pat
            20: rustc_infer::infer::InferCtxtBuilder::enter
            21: rustc_mir_build::thir::pattern::const_to_pat::<impl rustc_mir_build::thir::pattern::PatCtxt>::const_to_pat
            22: rustc_mir_build::thir::pattern::PatCtxt::lower_path
            23: rustc_mir_build::thir::pattern::PatCtxt::lower_pattern
            24: rustc_mir_build::thir::pattern::check_match::MatchVisitor::lower_pattern
            25: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
            26: <rustc_mir_build::thir::pattern::check_match::MatchVisitor as rustc_hir::intravisit::Visitor>::visit_expr
            27: <rustc_mir_build::thir::pattern::check_match::MatchVisitor as rustc_hir::intravisit::Visitor>::visit_expr
            28: rustc_mir_build::thir::pattern::check_match::check_match
            29: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
            30: rustc_data_structures::stack::ensure_sufficient_stack
            31: rustc_query_system::query::plumbing::try_execute_query
            32: rustc_query_system::query::plumbing::get_query
            33: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
            34: rustc_session::utils::<impl rustc_session::session::Session>::time
            35: rustc_interface::passes::analysis
            36: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
            37: rustc_data_structures::stack::ensure_sufficient_stack
            38: rustc_query_system::query::plumbing::try_execute_query
            39: rustc_query_system::query::plumbing::get_query
            40: rustc_interface::passes::QueryContext::enter
            41: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
            42: rustc_span::with_source_map
            43: scoped_tls::ScopedKey<T>::set
            44: std::sys_common::backtrace::__rust_begin_short_backtrace
            45: core::ops::function::FnOnce::call_once{{vtable.shim}}
            46: std::sys::unix::thread::Thread::new::thread_start
            47: _pthread_jit_write_protect_np
          

thread 'rustc' panicked at 'no warnings or errors encountered even though `delayed_good_path_bugs` issued', compiler/rustc_errors/src/lib.rs:1165:13
stack backtrace:
   0: _rust_begin_unwind
   1: std::panicking::begin_panic_fmt
   2: rustc_errors::HandlerInner::flush_delayed
   3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   4: core::ptr::drop_in_place<rustc_session::parse::ParseSess>
   5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
   6: core::ptr::drop_in_place<rustc_interface::interface::Compiler>
   7: rustc_span::with_source_map
   8: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.57.0-nightly (e4828d5b7 2021-09-16) running on aarch64-apple-darwin

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

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

query stack during panic:
end of query stack

@ryanolf ryanolf 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 Sep 19, 2021
@ryanolf
Copy link
Author

ryanolf commented Sep 19, 2021

The same error is present in the stable toolchain.

@ryanolf ryanolf changed the title trimmed_def_paths constructed when indirect_structural_match warnings allowed trimmed_def_paths constructed when indirect_structural_match allowed Sep 19, 2021
@bors bors closed this as completed in 8d95bb2 Sep 22, 2021
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant