Skip to content

Compiler error #110062

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

Closed
hughdbrown opened this issue Apr 7, 2023 · 1 comment
Closed

Compiler error #110062

hughdbrown opened this issue Apr 7, 2023 · 1 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.

Comments

@hughdbrown
Copy link

Code

/// Given a list of poker hands, return a list of those hands which win.
///
/// Note the type signature: this function should return _the same_ reference to
/// the winning hand(s) as were passed in, not reconstructed strings which happen to be equal.
///
use std::collections::HashMap;
use std::hash::Hash;

#[derive(Debug, PartialEq, PartialOrd, Ord, Eq)]
pub enum HandType {
    HighCard(u32),
    Pair(u32),
    TwoPair(u32, u32, u32),
    ThreeOfAKind(u32),
    Straight(u32),
    Flush(u32),
    FullHouse(u32, u32),
    FourOfAKind(u32),
    StraightFlush(u32),
    RoyalFlush,
}

struct Card {
    rank: u32,
    suit: char,
}

pub fn counter<T>(iterable: &Vec<T>) -> HashMap<&T, u32> 
    where T: Eq + Hash
{
    let mut item_counts = HashMap::new();
    for v in iterable.iter() {
        *item_counts.entry(v).or_insert(0u32) += 1;
    }
    item_counts 
}

pub fn score(hand: &str) -> HandType {
    let mut cards = Vec::new();
    
    for card in hand.split_whitespace() {
        let x = card.len() - 1;
        let number = card[0..x].to_string();
        let rank = match number.as_ref() {
            "A" => 14,
            "K" => 13,
            "Q" => 12,
            "J" => 11,
            _ => number.parse::<i32>().unwrap() as u32
        };
        let suit: char = card.chars().nth(x).unwrap();
        cards.push(Card{rank, suit});
    }
    let suits: Vec<char> = cards.iter().map(|card| card.suit).collect();
    let ranks: Vec<u32> = cards.iter().map(|card| card.rank).collect();
    let suit_counts = counter(&suits);
    let rank_counts = counter(&ranks);
    let min_rank = *ranks.iter().min().unwrap();
    let max_rank = *ranks.iter().max().unwrap();
    let flush: bool = suit_counts.keys().len() == 1;
    let straight: bool = max_rank - min_rank == 4u32;

    let mut pairing_count = vec![0u32, 0u32, 0u32, 0u32, 0u32];
    for (_k, v) in &rank_counts {
        pairing_count[*v as usize] += 1;
    }

    if pairing_count[1] == 5u32 {
        if flush {
            if straight {
                if max_rank == 14u32 {
                    return HandType::RoyalFlush;
                }
                else {
                    return HandType::StraightFlush(max_rank);
                }
            }
            else {
                return HandType::Flush(max_rank);
            }
        }
        else if straight {
            return HandType::Straight(max_rank);
        }
        else {
            return HandType::HighCard(max_rank);
        }
    }
    else {
        if pairing_count[4] == 1u32 {
            for (k, v) in rank_counts.iter() {
                if *v == 4u32  {
                    return HandType::FourOfAKind(**k);
                }
            }
            return HandType::FourOfAKind(2); // Unreachable
        }
        else if pairing_count[3] == 1 {
            let mut two = 0u32;
            let mut three = 0u32; 
            for (k, v) in rank_counts.into_iter() {
                if v == 3u32 {
                    three = *k;
                }
                else if v == 2u32 {
                    two = *k;
                }
            }
            if pairing_count[2] == 1u32 {
                return HandType::FullHouse(three, two);
            }
            else {
                return HandType::ThreeOfAKind(three);
            }
        }
        else if pairing_count[2] == 2u32 {
            let mut two: Vec<u32> = vec![];
            let mut one = 0u32;
            for (k, v) in rank_counts.into_iter() {
                if v == 2u32 {
                    two.push(*k);
                }
                else if v == 1u32 {
                    one = *k;
                }
            }
            let max_two = *two.iter().max().unwrap();
            let min_two = *two.iter().min().unwrap();
            return HandType::TwoPair(max_two, min_two, one);
        }
        else if pairing_count[2] == 1u32 {
            return HandType::Pair(2);
        }
        else {
            return HandType::HighCard(3); // Unreachable?
        }
    }
}


//pub fn pos_mapper<T>(elems: &[&T]) -> HashMap<&T, u32> {
//    let mut h = HashMap::<&T, u32>::new();
//    for (i, aa) in a.iter().enumerate() {
//        h.insert(aa, i as u32);
//    }
//    h
//}

pub fn winning_hands<'a>(hands: &[&'a str]) -> Vec<&'a str> {
    // Score the hands, put them into vector
    let scored_hands: Vec<(HandType, &str)> = hands
        .iter()
        .map(|hand| (score(hand), *hand))
        .collect();
    println!("{:?}", scored_hands);

    // Sort the hands, put them into vector
    let sorted_hands: Vec<(HandType, &str)> = scored_hands
        .sort_by(|a: (HandType, &str), b: (HandType, &str)| {
            (b.0).partial_cmp(&a.0).unwrap()
        })
        .collect();
    println!("{:?}", sorted_hands);

    // Extract all the best hands together
    let best_hand = scored_hands[0];
    let mut best_hands = vec![];
    for hand in scored_hands {
        if hand.0 == best_hand.0 {
            best_hands.push(hand.1);
        }
    }
    best_hands
}

Meta

rustc --version --verbose:

<version>

Error output

<output>
Backtrace

   Compiling poker v1.1.0 (/Users/hughbrown/Exercism/rust/poker)
error[E0599]: `()` is not an iterator
   --> src/lib.rs:162:10
    |
162 |         .collect();
    |          ^^^^^^^ `()` is not an iterator
    |
    = note: the following trait bounds were not satisfied:
            `(): Iterator`
            which is required by `&mut (): Iterator`

error: internal compiler error: compiler/rustc_infer/src/infer/region_constraints/mod.rs:568:17: cannot relate bound region: ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:66 ~ poker[e494]::winning_hands::'_), '_) }) <= '_#0r

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/compiler/rustc_errors/src/lib.rs:987:33
stack backtrace:
   0:        0x10ed7d6e6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47bed05ceb7970ee
   1:        0x10eddafca - core::fmt::write::hefd823d99333384a
   2:        0x10ed6feac - std::io::Write::write_fmt::hb978956bb1b85e2b
   3:        0x10ed7d4ca - std::sys_common::backtrace::print::hc9e298c4664da113
   4:        0x10ed808c3 - std::panicking::default_hook::{{closure}}::hb97411d6e916e1d2
   5:        0x10ed80618 - std::panicking::default_hook::hc3ac81176817192f
   6:        0x11899dd8a - rustc_driver[38920cb2344860e2]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x10ed810b9 - std::panicking::rust_panic_with_hook::hc11209fa2686218a
   8:        0x11902baf7 - std[963c226d0575182f]::panicking::begin_panic::<rustc_errors[112d18aeec5719f8]::ExplicitBug>::{closure#0}
   9:        0x119021619 - std[963c226d0575182f]::sys_common::backtrace::__rust_end_short_backtrace::<std[963c226d0575182f]::panicking::begin_panic<rustc_errors[112d18aeec5719f8]::ExplicitBug>::{closure#0}, !>
  10:        0x11ce2c209 - std[963c226d0575182f]::panicking::begin_panic::<rustc_errors[112d18aeec5719f8]::ExplicitBug>
  11:        0x119106a29 - std[963c226d0575182f]::panic::panic_any::<rustc_errors[112d18aeec5719f8]::ExplicitBug>
  12:        0x119103f48 - <rustc_errors[112d18aeec5719f8]::HandlerInner>::span_bug::<rustc_span[abe350e59e28df37]::span_encoding::Span, &alloc[622432b1fc1d0ab9]::string::String>
  13:        0x119103d5e - <rustc_errors[112d18aeec5719f8]::Handler>::span_bug::<rustc_span[abe350e59e28df37]::span_encoding::Span, &alloc[622432b1fc1d0ab9]::string::String>
  14:        0x1190850eb - rustc_middle[7044477369b49eec]::util::bug::opt_span_bug_fmt::<rustc_span[abe350e59e28df37]::span_encoding::Span>::{closure#0}
  15:        0x119085147 - rustc_middle[7044477369b49eec]::ty::context::tls::with_opt::<rustc_middle[7044477369b49eec]::util::bug::opt_span_bug_fmt<rustc_span[abe350e59e28df37]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  16:        0x1190844ef - rustc_middle[7044477369b49eec]::ty::context::tls::with_context_opt::<rustc_middle[7044477369b49eec]::ty::context::tls::with_opt<rustc_middle[7044477369b49eec]::util::bug::opt_span_bug_fmt<rustc_span[abe350e59e28df37]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  17:        0x119084491 - rustc_middle[7044477369b49eec]::util::bug::opt_span_bug_fmt::<rustc_span[abe350e59e28df37]::span_encoding::Span>
  18:        0x11ce2c1ff - rustc_middle[7044477369b49eec]::util::bug::span_bug_fmt::<rustc_span[abe350e59e28df37]::span_encoding::Span>
  19:        0x11907dfa0 - <rustc_infer[6cab06927fa701c3]::infer::region_constraints::RegionConstraintCollector>::make_subregion
  20:        0x119076f82 - <rustc_infer[6cab06927fa701c3]::infer::region_constraints::RegionConstraintCollector>::make_eqregion
  21:        0x11908afda - <rustc_infer[6cab06927fa701c3]::infer::equate::Equate as rustc_middle[7044477369b49eec]::ty::relate::TypeRelation>::regions
  22:        0x119093470 - rustc_middle[7044477369b49eec]::ty::relate::super_relate_tys::<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>
  23:        0x1190106e0 - <rustc_infer[6cab06927fa701c3]::infer::InferCtxt>::super_combine_tys::<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>
  24:        0x11908f289 - <rustc_infer[6cab06927fa701c3]::infer::equate::Equate as rustc_middle[7044477369b49eec]::ty::relate::TypeRelation>::tys
  25:        0x11905cc77 - <core[fd5e363bb4760a86]::result::Result<rustc_middle[7044477369b49eec]::ty::Ty, rustc_middle[7044477369b49eec]::ty::error::TypeError> as rustc_type_ir[12a6d7d457ec9c1a]::InternIteratorElement<rustc_middle[7044477369b49eec]::ty::Ty, rustc_middle[7044477369b49eec]::ty::Ty>>::intern_with::<core[fd5e363bb4760a86]::iter::adapters::map::Map<core[fd5e363bb4760a86]::iter::adapters::zip::Zip<core[fd5e363bb4760a86]::iter::adapters::copied::Copied<core[fd5e363bb4760a86]::slice::iter::Iter<rustc_middle[7044477369b49eec]::ty::Ty>>, core[fd5e363bb4760a86]::iter::adapters::copied::Copied<core[fd5e363bb4760a86]::slice::iter::Iter<rustc_middle[7044477369b49eec]::ty::Ty>>>, rustc_middle[7044477369b49eec]::ty::relate::super_relate_tys<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>::{closure#2}>, <rustc_middle[7044477369b49eec]::ty::context::TyCtxt>::mk_tup<core[fd5e363bb4760a86]::iter::adapters::map::Map<core[fd5e363bb4760a86]::iter::adapters::zip::Zip<core[fd5e363bb4760a86]::iter::adapters::copied::Copied<core[fd5e363bb4760a86]::slice::iter::Iter<rustc_middle[7044477369b49eec]::ty::Ty>>, core[fd5e363bb4760a86]::iter::adapters::copied::Copied<core[fd5e363bb4760a86]::slice::iter::Iter<rustc_middle[7044477369b49eec]::ty::Ty>>>, rustc_middle[7044477369b49eec]::ty::relate::super_relate_tys<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>::{closure#2}>>::{closure#0}>
  26:        0x119093509 - rustc_middle[7044477369b49eec]::ty::relate::super_relate_tys::<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>
  27:        0x1190106e0 - <rustc_infer[6cab06927fa701c3]::infer::InferCtxt>::super_combine_tys::<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>
  28:        0x11908f289 - <rustc_infer[6cab06927fa701c3]::infer::equate::Equate as rustc_middle[7044477369b49eec]::ty::relate::TypeRelation>::tys
  29:        0x11a4d1363 - <rustc_infer[6cab06927fa701c3]::infer::InferCtxt>::commit_if_ok::<rustc_infer[6cab06927fa701c3]::infer::InferOk<()>, rustc_middle[7044477369b49eec]::ty::error::TypeError, <rustc_infer[6cab06927fa701c3]::infer::at::Trace>::eq<rustc_middle[7044477369b49eec]::ty::Ty>::{closure#0}>
  30:        0x11a4dfc70 - <rustc_infer[6cab06927fa701c3]::infer::InferCtxt>::can_eq::<rustc_middle[7044477369b49eec]::ty::Ty>
  31:        0x11a4ad84c - rustc_trait_selection[957489648007299]::traits::error_reporting::suggestions::hint_missing_borrow
  32:        0x11a5b91aa - <rustc_infer[6cab06927fa701c3]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[957489648007299]::traits::error_reporting::suggestions::TypeErrCtxtExt>::report_closure_arg_mismatch
  33:        0x11a5cc6f1 - <rustc_infer[6cab06927fa701c3]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[957489648007299]::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
  34:        0x11a5dcb2f - <rustc_infer[6cab06927fa701c3]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[957489648007299]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
  35:        0x11a5c644b - <rustc_infer[6cab06927fa701c3]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[957489648007299]::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
  36:        0x118dd7743 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_argument_types
  37:        0x118dd65f1 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_method_argument_types
  38:        0x118e2ffd8 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_expr_kind
  39:        0x118dc66b5 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  40:        0x118ddf73c - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_decl
  41:        0x118ddfc24 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_stmt
  42:        0x118de04df - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_block_with_expected
  43:        0x118e28faf - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_expr_kind
  44:        0x118dc66b5 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  45:        0x118dc80e0 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_return_expr
  46:        0x118ea3afc - rustc_hir_typeck[6efceea4454c75c9]::check::check_fn
  47:        0x118ede670 - rustc_hir_typeck[6efceea4454c75c9]::typeck
  48:        0x119f94a54 - <rustc_query_system[3d399bab0eaade7f]::dep_graph::graph::DepGraph<rustc_middle[7044477369b49eec]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[7044477369b49eec]::ty::context::TyCtxt, rustc_span[abe350e59e28df37]::def_id::LocalDefId, &rustc_middle[7044477369b49eec]::ty::typeck_results::TypeckResults>
  49:        0x119d9f286 - rustc_query_system[3d399bab0eaade7f]::query::plumbing::try_execute_query::<rustc_query_impl[469a71c953212c97]::queries::typeck, rustc_query_impl[469a71c953212c97]::plumbing::QueryCtxt>
  50:        0x119ec3b4e - <rustc_query_impl[469a71c953212c97]::Queries as rustc_middle[7044477369b49eec]::ty::query::QueryEngine>::typeck
  51:        0x118e69fab - rustc_data_structures[a3be787722aab228]::sync::par_for_each_in::<&[rustc_span[abe350e59e28df37]::def_id::LocalDefId], <rustc_middle[7044477369b49eec]::hir::map::Map>::par_body_owners<rustc_hir_typeck[6efceea4454c75c9]::typeck_item_bodies::{closure#0}>::{closure#0}>
  52:        0x118edc0a4 - rustc_hir_typeck[6efceea4454c75c9]::typeck_item_bodies
  53:        0x119fd0e59 - <rustc_query_system[3d399bab0eaade7f]::dep_graph::graph::DepGraph<rustc_middle[7044477369b49eec]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[7044477369b49eec]::ty::context::TyCtxt, (), ()>
  54:        0x119d049df - rustc_query_system[3d399bab0eaade7f]::query::plumbing::try_execute_query::<rustc_query_impl[469a71c953212c97]::queries::typeck_item_bodies, rustc_query_impl[469a71c953212c97]::plumbing::QueryCtxt>
  55:        0x119ec3a6f - <rustc_query_impl[469a71c953212c97]::Queries as rustc_middle[7044477369b49eec]::ty::query::QueryEngine>::typeck_item_bodies
  56:        0x118c540f7 - <rustc_session[d7fa5f284918d396]::session::Session>::time::<(), rustc_hir_analysis[27a8f7e0703a01ee]::check_crate::{closure#7}>
  57:        0x118bf0cb3 - rustc_hir_analysis[27a8f7e0703a01ee]::check_crate
  58:        0x11914c079 - rustc_interface[d2d1d1fbee7644ce]::passes::analysis
  59:        0x119fc6e99 - <rustc_query_system[3d399bab0eaade7f]::dep_graph::graph::DepGraph<rustc_middle[7044477369b49eec]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[7044477369b49eec]::ty::context::TyCtxt, (), core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>
  60:        0x119da213b - rustc_query_system[3d399bab0eaade7f]::query::plumbing::try_execute_query::<rustc_query_impl[469a71c953212c97]::queries::analysis, rustc_query_impl[469a71c953212c97]::plumbing::QueryCtxt>
  61:        0x119ebf5a8 - <rustc_query_impl[469a71c953212c97]::Queries as rustc_middle[7044477369b49eec]::ty::query::QueryEngine>::analysis
  62:        0x11892f96a - <rustc_interface[d2d1d1fbee7644ce]::passes::QueryContext>::enter::<rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>
  63:        0x118910f5d - <rustc_interface[d2d1d1fbee7644ce]::queries::QueryResult<rustc_interface[d2d1d1fbee7644ce]::passes::QueryContext>>::enter::<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}::{closure#2}::{closure#2}>
  64:        0x11896eda3 - <rustc_interface[d2d1d1fbee7644ce]::interface::Compiler>::enter::<rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}::{closure#2}, core[fd5e363bb4760a86]::result::Result<core[fd5e363bb4760a86]::option::Option<rustc_interface[d2d1d1fbee7644ce]::queries::Linker>, rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>
  65:        0x11898ba86 - rustc_span[abe350e59e28df37]::with_source_map::<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_interface[d2d1d1fbee7644ce]::interface::run_compiler<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  66:        0x1189363e5 - std[963c226d0575182f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d2d1d1fbee7644ce]::util::run_in_thread_pool_with_globals<rustc_interface[d2d1d1fbee7644ce]::interface::run_compiler<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}>::{closure#0}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>
  67:        0x118915385 - <<std[963c226d0575182f]::thread::Builder>::spawn_unchecked_<rustc_interface[d2d1d1fbee7644ce]::util::run_in_thread_pool_with_globals<rustc_interface[d2d1d1fbee7644ce]::interface::run_compiler<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}>::{closure#0}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>::{closure#1} as core[fd5e363bb4760a86]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  68:        0x10ed8a5a7 - std::sys::unix::thread::Thread::new::thread_start::had0599fead9033cd
  69:     0x7ff80fbdc1d3 - __pthread_start

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.68.2 (9eb3afe9e 2023-03-27) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [typeck] type-checking `winning_hands`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: compiler/rustc_infer/src/infer/region_constraints/mod.rs:568:17: cannot relate bound region: ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:64 ~ poker[f908]::winning_hands::'_), '_) }) <= '_#0r

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/compiler/rustc_errors/src/lib.rs:987:33
stack backtrace:
   0:        0x10a3e96e6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47bed05ceb7970ee
For more information about this error, try `rustc --explain E0599`.
   1:        0x10a446fca - core::fmt::write::hefd823d99333384a
   2:        0x10a3dbeac - std::io::Write::write_fmt::hb978956bb1b85e2b
   3:        0x10a3e94ca - std::sys_common::backtrace::print::hc9e298c4664da113
   4:        0x10a3ec8c3 - std::panicking::default_hook::{{closure}}::hb97411d6e916e1d2
   5:        0x10a3ec618 - std::panicking::default_hook::hc3ac81176817192f
   6:        0x114009d8a - rustc_driver[38920cb2344860e2]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x10a3ed0b9 - std::panicking::rust_panic_with_hook::hc11209fa2686218a
   8:        0x114697af7 - std[963c226d0575182f]::panicking::begin_panic::<rustc_errors[112d18aeec5719f8]::ExplicitBug>::{closure#0}
   9:        0x11468d619 - std[963c226d0575182f]::sys_common::backtrace::__rust_end_short_backtrace::<std[963c226d0575182f]::panicking::begin_panic<rustc_errors[112d18aeec5719f8]::ExplicitBug>::{closure#0}, !>
  10:        0x118498209 - std[963c226d0575182f]::panicking::begin_panic::<rustc_errors[112d18aeec5719f8]::ExplicitBug>
error: could not compile `poker` due to previous error
warning: build failed, waiting for other jobs to finish...
  11:        0x114772a29 - std[963c226d0575182f]::panic::panic_any::<rustc_errors[112d18aeec5719f8]::ExplicitBug>
  12:        0x11476ff48 - <rustc_errors[112d18aeec5719f8]::HandlerInner>::span_bug::<rustc_span[abe350e59e28df37]::span_encoding::Span, &alloc[622432b1fc1d0ab9]::string::String>
  13:        0x11476fd5e - <rustc_errors[112d18aeec5719f8]::Handler>::span_bug::<rustc_span[abe350e59e28df37]::span_encoding::Span, &alloc[622432b1fc1d0ab9]::string::String>
  14:        0x1146f10eb - rustc_middle[7044477369b49eec]::util::bug::opt_span_bug_fmt::<rustc_span[abe350e59e28df37]::span_encoding::Span>::{closure#0}
  15:        0x1146f1147 - rustc_middle[7044477369b49eec]::ty::context::tls::with_opt::<rustc_middle[7044477369b49eec]::util::bug::opt_span_bug_fmt<rustc_span[abe350e59e28df37]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  16:        0x1146f04ef - rustc_middle[7044477369b49eec]::ty::context::tls::with_context_opt::<rustc_middle[7044477369b49eec]::ty::context::tls::with_opt<rustc_middle[7044477369b49eec]::util::bug::opt_span_bug_fmt<rustc_span[abe350e59e28df37]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  17:        0x1146f0491 - rustc_middle[7044477369b49eec]::util::bug::opt_span_bug_fmt::<rustc_span[abe350e59e28df37]::span_encoding::Span>
  18:        0x1184981ff - rustc_middle[7044477369b49eec]::util::bug::span_bug_fmt::<rustc_span[abe350e59e28df37]::span_encoding::Span>
  19:        0x1146e9fa0 - <rustc_infer[6cab06927fa701c3]::infer::region_constraints::RegionConstraintCollector>::make_subregion
  20:        0x1146e2f82 - <rustc_infer[6cab06927fa701c3]::infer::region_constraints::RegionConstraintCollector>::make_eqregion
  21:        0x1146f6fda - <rustc_infer[6cab06927fa701c3]::infer::equate::Equate as rustc_middle[7044477369b49eec]::ty::relate::TypeRelation>::regions
  22:        0x1146ff470 - rustc_middle[7044477369b49eec]::ty::relate::super_relate_tys::<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>
  23:        0x11467c6e0 - <rustc_infer[6cab06927fa701c3]::infer::InferCtxt>::super_combine_tys::<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>
  24:        0x1146fb289 - <rustc_infer[6cab06927fa701c3]::infer::equate::Equate as rustc_middle[7044477369b49eec]::ty::relate::TypeRelation>::tys
  25:        0x1146c8c77 - <core[fd5e363bb4760a86]::result::Result<rustc_middle[7044477369b49eec]::ty::Ty, rustc_middle[7044477369b49eec]::ty::error::TypeError> as rustc_type_ir[12a6d7d457ec9c1a]::InternIteratorElement<rustc_middle[7044477369b49eec]::ty::Ty, rustc_middle[7044477369b49eec]::ty::Ty>>::intern_with::<core[fd5e363bb4760a86]::iter::adapters::map::Map<core[fd5e363bb4760a86]::iter::adapters::zip::Zip<core[fd5e363bb4760a86]::iter::adapters::copied::Copied<core[fd5e363bb4760a86]::slice::iter::Iter<rustc_middle[7044477369b49eec]::ty::Ty>>, core[fd5e363bb4760a86]::iter::adapters::copied::Copied<core[fd5e363bb4760a86]::slice::iter::Iter<rustc_middle[7044477369b49eec]::ty::Ty>>>, rustc_middle[7044477369b49eec]::ty::relate::super_relate_tys<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>::{closure#2}>, <rustc_middle[7044477369b49eec]::ty::context::TyCtxt>::mk_tup<core[fd5e363bb4760a86]::iter::adapters::map::Map<core[fd5e363bb4760a86]::iter::adapters::zip::Zip<core[fd5e363bb4760a86]::iter::adapters::copied::Copied<core[fd5e363bb4760a86]::slice::iter::Iter<rustc_middle[7044477369b49eec]::ty::Ty>>, core[fd5e363bb4760a86]::iter::adapters::copied::Copied<core[fd5e363bb4760a86]::slice::iter::Iter<rustc_middle[7044477369b49eec]::ty::Ty>>>, rustc_middle[7044477369b49eec]::ty::relate::super_relate_tys<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>::{closure#2}>>::{closure#0}>
  26:        0x1146ff509 - rustc_middle[7044477369b49eec]::ty::relate::super_relate_tys::<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>
  27:        0x11467c6e0 - <rustc_infer[6cab06927fa701c3]::infer::InferCtxt>::super_combine_tys::<rustc_infer[6cab06927fa701c3]::infer::equate::Equate>
  28:        0x1146fb289 - <rustc_infer[6cab06927fa701c3]::infer::equate::Equate as rustc_middle[7044477369b49eec]::ty::relate::TypeRelation>::tys
  29:        0x115b3d363 - <rustc_infer[6cab06927fa701c3]::infer::InferCtxt>::commit_if_ok::<rustc_infer[6cab06927fa701c3]::infer::InferOk<()>, rustc_middle[7044477369b49eec]::ty::error::TypeError, <rustc_infer[6cab06927fa701c3]::infer::at::Trace>::eq<rustc_middle[7044477369b49eec]::ty::Ty>::{closure#0}>
  30:        0x115b4bc70 - <rustc_infer[6cab06927fa701c3]::infer::InferCtxt>::can_eq::<rustc_middle[7044477369b49eec]::ty::Ty>
  31:        0x115b1984c - rustc_trait_selection[957489648007299]::traits::error_reporting::suggestions::hint_missing_borrow
  32:        0x115c251aa - <rustc_infer[6cab06927fa701c3]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[957489648007299]::traits::error_reporting::suggestions::TypeErrCtxtExt>::report_closure_arg_mismatch
  33:        0x115c386f1 - <rustc_infer[6cab06927fa701c3]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[957489648007299]::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
  34:        0x115c48b2f - <rustc_infer[6cab06927fa701c3]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[957489648007299]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
  35:        0x115c3244b - <rustc_infer[6cab06927fa701c3]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[957489648007299]::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
  36:        0x114443743 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_argument_types
  37:        0x1144425f1 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_method_argument_types
  38:        0x11449bfd8 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_expr_kind
  39:        0x1144326b5 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  40:        0x11444b73c - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_decl
  41:        0x11444bc24 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_stmt
  42:        0x11444c4df - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_block_with_expected
  43:        0x114494faf - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_expr_kind
  44:        0x1144326b5 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  45:        0x1144340e0 - <rustc_hir_typeck[6efceea4454c75c9]::fn_ctxt::FnCtxt>::check_return_expr
  46:        0x11450fafc - rustc_hir_typeck[6efceea4454c75c9]::check::check_fn
  47:        0x11454a670 - rustc_hir_typeck[6efceea4454c75c9]::typeck
  48:        0x115600a54 - <rustc_query_system[3d399bab0eaade7f]::dep_graph::graph::DepGraph<rustc_middle[7044477369b49eec]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[7044477369b49eec]::ty::context::TyCtxt, rustc_span[abe350e59e28df37]::def_id::LocalDefId, &rustc_middle[7044477369b49eec]::ty::typeck_results::TypeckResults>
  49:        0x11540b286 - rustc_query_system[3d399bab0eaade7f]::query::plumbing::try_execute_query::<rustc_query_impl[469a71c953212c97]::queries::typeck, rustc_query_impl[469a71c953212c97]::plumbing::QueryCtxt>
  50:        0x11552fb4e - <rustc_query_impl[469a71c953212c97]::Queries as rustc_middle[7044477369b49eec]::ty::query::QueryEngine>::typeck
  51:        0x1144d5fab - rustc_data_structures[a3be787722aab228]::sync::par_for_each_in::<&[rustc_span[abe350e59e28df37]::def_id::LocalDefId], <rustc_middle[7044477369b49eec]::hir::map::Map>::par_body_owners<rustc_hir_typeck[6efceea4454c75c9]::typeck_item_bodies::{closure#0}>::{closure#0}>
  52:        0x1145480a4 - rustc_hir_typeck[6efceea4454c75c9]::typeck_item_bodies
  53:        0x11563ce59 - <rustc_query_system[3d399bab0eaade7f]::dep_graph::graph::DepGraph<rustc_middle[7044477369b49eec]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[7044477369b49eec]::ty::context::TyCtxt, (), ()>
  54:        0x1153709df - rustc_query_system[3d399bab0eaade7f]::query::plumbing::try_execute_query::<rustc_query_impl[469a71c953212c97]::queries::typeck_item_bodies, rustc_query_impl[469a71c953212c97]::plumbing::QueryCtxt>
  55:        0x11552fa6f - <rustc_query_impl[469a71c953212c97]::Queries as rustc_middle[7044477369b49eec]::ty::query::QueryEngine>::typeck_item_bodies
  56:        0x1142c00f7 - <rustc_session[d7fa5f284918d396]::session::Session>::time::<(), rustc_hir_analysis[27a8f7e0703a01ee]::check_crate::{closure#7}>
  57:        0x11425ccb3 - rustc_hir_analysis[27a8f7e0703a01ee]::check_crate
  58:        0x1147b8079 - rustc_interface[d2d1d1fbee7644ce]::passes::analysis
  59:        0x115632e99 - <rustc_query_system[3d399bab0eaade7f]::dep_graph::graph::DepGraph<rustc_middle[7044477369b49eec]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[7044477369b49eec]::ty::context::TyCtxt, (), core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>
  60:        0x11540e13b - rustc_query_system[3d399bab0eaade7f]::query::plumbing::try_execute_query::<rustc_query_impl[469a71c953212c97]::queries::analysis, rustc_query_impl[469a71c953212c97]::plumbing::QueryCtxt>
  61:        0x11552b5a8 - <rustc_query_impl[469a71c953212c97]::Queries as rustc_middle[7044477369b49eec]::ty::query::QueryEngine>::analysis
  62:        0x113f9b96a - <rustc_interface[d2d1d1fbee7644ce]::passes::QueryContext>::enter::<rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>
  63:        0x113f7cf5d - <rustc_interface[d2d1d1fbee7644ce]::queries::QueryResult<rustc_interface[d2d1d1fbee7644ce]::passes::QueryContext>>::enter::<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}::{closure#2}::{closure#2}>
  64:        0x113fdada3 - <rustc_interface[d2d1d1fbee7644ce]::interface::Compiler>::enter::<rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}::{closure#2}, core[fd5e363bb4760a86]::result::Result<core[fd5e363bb4760a86]::option::Option<rustc_interface[d2d1d1fbee7644ce]::queries::Linker>, rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>
  65:        0x113ff7a86 - rustc_span[abe350e59e28df37]::with_source_map::<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_interface[d2d1d1fbee7644ce]::interface::run_compiler<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  66:        0x113fa23e5 - std[963c226d0575182f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d2d1d1fbee7644ce]::util::run_in_thread_pool_with_globals<rustc_interface[d2d1d1fbee7644ce]::interface::run_compiler<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}>::{closure#0}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>
  67:        0x113f81385 - <<std[963c226d0575182f]::thread::Builder>::spawn_unchecked_<rustc_interface[d2d1d1fbee7644ce]::util::run_in_thread_pool_with_globals<rustc_interface[d2d1d1fbee7644ce]::interface::run_compiler<core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>, rustc_driver[38920cb2344860e2]::run_compiler::{closure#1}>::{closure#0}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[fd5e363bb4760a86]::result::Result<(), rustc_errors[112d18aeec5719f8]::ErrorGuaranteed>>::{closure#1} as core[fd5e363bb4760a86]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  68:        0x10a3f65a7 - std::sys::unix::thread::Thread::new::thread_start::had0599fead9033cd
  69:     0x7ff80fbdc1d3 - __pthread_start

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.68.2 (9eb3afe9e 2023-03-27) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [typeck] type-checking `winning_hands`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `poker` due to previous error

@hughdbrown hughdbrown 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 Apr 7, 2023
@jyn514
Copy link
Member

jyn514 commented Apr 8, 2023

Duplicate of #109361

@jyn514 jyn514 marked this as a duplicate of #109361 Apr 8, 2023
@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2023
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

No branches or pull requests

2 participants