Skip to content

ICE: Impossible case reached #52421

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
dpc opened this issue Jul 16, 2018 · 6 comments
Closed

ICE: Impossible case reached #52421

dpc opened this issue Jul 16, 2018 · 6 comments
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

@dpc
Copy link
Contributor

dpc commented Jul 16, 2018

error: internal compiler error: librustc/traits/structural_impls.rs:178: impossible case reached                                                                                   
                                                                                                                                                                                   
thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:554:9                                                                                                                 
stack backtrace:                                                                                                                                                                   
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace                                                                                                                    
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49                                                                                                                      
   1: std::sys_common::backtrace::print  
             at libstd/sys_common/backtrace.rs:71                                                                                                                         [87/8490]
             at libstd/sys_common/backtrace.rs:59                                                                                                                                  
   2: std::panicking::default_hook::{{closure}}                                                                                                                                    
             at libstd/panicking.rs:211                                                                                                                                            
   3: std::panicking::default_hook                                                                                                                                                 
             at libstd/panicking.rs:227                                                                                                                                            
   4: rustc::util::common::panic_hook                                                                                                                                              
   5: std::panicking::rust_panic_with_hook                                                                                                                                         
             at libstd/panicking.rs:479                                                                                                                                            
   6: std::panicking::begin_panic                                                                                                                                                  
   7: rustc_errors::Handler::bug                                                                                                                                                   
   8: rustc::session::opt_span_bug_fmt::{{closure}}                                                                                                                                
   9: rustc::ty::context::tls::with_opt::{{closure}}                                                                                                                               
  10: rustc::ty::context::tls::with_context_opt                                                                                                                                    
  11: rustc::ty::context::tls::with_opt                                                                                                                                            
  12: rustc::session::opt_span_bug_fmt                                                                                                                                             
  13: rustc::session::bug_fmt                                                                                                                                                      
  14: rustc::traits::structural_impls::<impl rustc::ty::context::Lift<'tcx> for rustc::traits::SelectionError<'a>>::lift_to_tcx                                                    
  15: rustc::ty::context::TyCtxt::lift_to_global                                                                                                                                   
  16: rustc::traits::select::SelectionContext::candidate_from_obligation                                                                                                           
  17: rustc::traits::select::SelectionContext::evaluate_stack                                                                                                                      
  18: rustc::ty::context::tls::with_context  
  19: rustc::dep_graph::graph::DepGraph::with_anon_task                                                                                                                   [65/8490]
  20: rustc::traits::select::SelectionContext::evaluate_predicate_recursively                                                                                                      
  21: rustc::infer::InferCtxt::probe                                                                                                                                               
  22: <&'a mut I as core::iter::iterator::Iterator>::next                                                                                                                          
  23: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter                                                                                                              
  24: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache                                                                                                  
  25: rustc::ty::context::tls::with_context                                                                                                                                        
  26: rustc::dep_graph::graph::DepGraph::with_anon_task                                                                                                                            
  27: rustc::traits::select::SelectionContext::candidate_from_obligation                                                                                                           
  28: rustc::traits::select::SelectionContext::evaluate_stack                                                                                                                      
  29: rustc::ty::context::tls::with_context                                                                                                                                        
  30: rustc::dep_graph::graph::DepGraph::with_anon_task                                                                                                                            
  31: rustc::traits::select::SelectionContext::evaluate_predicate_recursively                                                                                                      
  32: rustc::infer::InferCtxt::probe                                                                                                                                               
  33: <&'a mut I as core::iter::iterator::Iterator>::next                                                                                                                          
  34: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter                                                                                                              
  35: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache                                                                                                  
  36: rustc::ty::context::tls::with_context                                                                                                                                        
  37: rustc::dep_graph::graph::DepGraph::with_anon_task                                                                                                                            
  38: rustc::traits::select::SelectionContext::candidate_from_obligation                                                                                                           
  39: rustc::traits::select::SelectionContext::evaluate_stack                                                                                                                      
  40: rustc::ty::context::tls::with_context                                                                                                                                        
  41: rustc::dep_graph::graph::DepGraph::with_anon_task
  42: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  43: rustc::infer::InferCtxt::probe
  44: <&'a mut I as core::iter::iterator::Iterator>::next
  45: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  46: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
  47: rustc::ty::context::tls::with_context
  48: rustc::dep_graph::graph::DepGraph::with_anon_task
  49: rustc::traits::select::SelectionContext::candidate_from_obligation
  50: rustc::traits::select::SelectionContext::evaluate_stack
  51: rustc::ty::context::tls::with_context
  52: rustc::dep_graph::graph::DepGraph::with_anon_task
  53: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  54: rustc::infer::InferCtxt::probe
  55: <&'a mut I as core::iter::iterator::Iterator>::next
  56: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  57: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache    
  58: rustc::ty::context::tls::with_context                                   
  59: rustc::dep_graph::graph::DepGraph::with_anon_task
  60: rustc::traits::select::SelectionContext::candidate_from_obligation
  61: rustc::traits::select::SelectionContext::evaluate_stack
  62: rustc::ty::context::tls::with_context                                                                                                                               [22/8490]
  63: rustc::dep_graph::graph::DepGraph::with_anon_task
  64: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  65: rustc::infer::InferCtxt::probe
  66: <&'a mut I as core::iter::iterator::Iterator>::next
  67: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  68: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
  69: rustc::ty::context::tls::with_context
  70: rustc::dep_graph::graph::DepGraph::with_anon_task
  71: rustc::traits::select::SelectionContext::candidate_from_obligation
  72: rustc::traits::select::SelectionContext::evaluate_stack
  73: rustc::ty::context::tls::with_context
  74: rustc::dep_graph::graph::DepGraph::with_anon_task
  75: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  76: rustc::infer::InferCtxt::probe
  77: <&'a mut I as core::iter::iterator::Iterator>::next
  78: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  79: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache    
  80: rustc::ty::context::tls::with_context                                   
  81: rustc::dep_graph::graph::DepGraph::with_anon_task
  82: rustc::traits::select::SelectionContext::candidate_from_obligation
  83: rustc::traits::select::SelectionContext::evaluate_stack
  84: rustc::ty::context::tls::with_context
  85: rustc::dep_graph::graph::DepGraph::with_anon_task
  86: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  87: rustc::infer::InferCtxt::probe
  88: <&'a mut I as core::iter::iterator::Iterator>::next                                                        
  89: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  90: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache    
  91: rustc::ty::context::tls::with_context
  92: rustc::dep_graph::graph::DepGraph::with_anon_task             
  93: rustc::traits::select::SelectionContext::candidate_from_obligation
  94: rustc::traits::select::SelectionContext::evaluate_stack
  95: rustc::ty::context::tls::with_context
  96: rustc::dep_graph::graph::DepGraph::with_anon_task
  97: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  98: rustc::infer::InferCtxt::probe                
  99: <&'a mut I as core::iter::iterator::Iterator>::next                                                                                
query stack during panic:                              
#0 [evaluate_obligation] evaluating trait selection obligation `&'_ _: std::io::Read`
#1 [typeck_tables_of] pr  62: rustc::ty::context::tls::with_context                                                                                                                               [22/8490]
  63: rustc::dep_graph::graph::DepGraph::with_anon_task
  64: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  65: rustc::infer::InferCtxt::probe
  66: <&'a mut I as core::iter::iterator::Iterator>::next
  67: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  68: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
  69: rustc::ty::context::tls::with_context
  70: rustc::dep_graph::graph::DepGraph::with_anon_task
  71: rustc::traits::select::SelectionContext::candidate_from_obligation
  72: rustc::traits::select::SelectionContext::evaluate_stack
  73: rustc::ty::context::tls::with_context
  74: rustc::dep_graph::graph::DepGraph::with_anon_task
  75: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  76: rustc::infer::InferCtxt::probe
  77: <&'a mut I as core::iter::iterator::Iterator>::next
  78: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  79: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache    
  80: rustc::ty::context::tls::with_context                                   
  81: rustc::dep_graph::graph::DepGraph::with_anon_task
  82: rustc::traits::select::SelectionContext::candidate_from_obligation
  83: rustc::traits::select::SelectionContext::evaluate_stack
  84: rustc::ty::context::tls::with_context
  85: rustc::dep_graph::graph::DepGraph::with_anon_task
  86: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  87: rustc::infer::InferCtxt::probe
  88: <&'a mut I as core::iter::iterator::Iterator>::next                                                        
  89: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  90: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache    
  91: rustc::ty::context::tls::with_context
  92: rustc::dep_graph::graph::DepGraph::with_anon_task             
  93: rustc::traits::select::SelectionContext::candidate_from_obligation
  94: rustc::traits::select::SelectionContext::evaluate_stack
  95: rustc::ty::context::tls::with_context
  96: rustc::dep_graph::graph::DepGraph::with_anon_task
  97: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  98: rustc::infer::InferCtxt::probe                
  99: <&'a mut I as core::iter::iterator::Iterator>::next                                                                                
query stack during panic:                              
#0 [evaluate_obligation] evaluating trait selection obligation `&'_ _: std::io::Read`
#1 [typeck_tables_of] processing `child::mongod::Mongod::lookup_block_by_hash`
#2 [typeck_item_bodies] type-checking all item bodies
end of query stack                         
error: aborting due to previous error ocessing `child::mongod::Mongod::lookup_block_by_hash`
#2 [typeck_item_bodies] type-checking all item bodies
end of query stack                         
error: aborting due to previous error 

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.29.0-nightly (31f1bc7b4 2018-07-15) running on x86_64-unknown-linux-gnu

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

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



I'm sorry for no more info. I'll try to provide when I can.

@ishitatsuyuki ishitatsuyuki added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-trait-system Area: Trait system C-bug Category: This is a bug. labels Jul 16, 2018
@dpc dpc changed the title Nightly crash: Impossible case reached ICE: Impossible case reached Jul 16, 2018
@dpc
Copy link
Contributor Author

dpc commented Jul 16, 2018

Same issue on stable

@dpc
Copy link
Contributor Author

dpc commented Jul 16, 2018

I couldn't really minimize, and I can't publish the code verbatim, but more or less it had something to do with


if let Some(ref block_record) = cursor
            .map(|document| {
                let document = document.unwrap();
                bson::from_bson(bson::Bson::Document(document)).unwrap()
            })
            .next() {
    let block_record: BlocksRecord = block_record;
    Ok(block_record)
} else {
/...
}

BlocksRecord ia a simple struct that holds bunch of fields of the record fetched from mongodb.

cursor was https://docs.rs/mongo_driver/0.12.1/mongo_driver/cursor/struct.Cursor.html (note it has a <'a> . Adding that ref that triggered the problem.

@ljedrz
Copy link
Contributor

ljedrz commented Aug 2, 2018

Looks like a trait evaluation overflow error. Is this actually a bug or is this evaluation just impossible? In case of the latter, wouldn't it just be better to report that with a regular error?

@ljedrz
Copy link
Contributor

ljedrz commented Aug 2, 2018

The trace looks quite similar to #52356.

@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 5, 2019
@Centril Centril added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Mar 10, 2020
@Centril
Copy link
Contributor

Centril commented Mar 10, 2020

@dpc Were you able to produce a minimal example?

@dpc
Copy link
Contributor Author

dpc commented Mar 10, 2020

@Centril I have failed. And that's almost 2 years old now. I don't remember which project or code that was. I think we can close.

@dpc dpc closed this as completed Mar 10, 2020
@fmease fmease added A-trait-system Area: Trait system and removed A-trait-system Area: Trait system labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

6 participants