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

ICE: panic when resolving macros #55457

Closed
davidrusu opened this issue Oct 29, 2018 · 1 comment
Closed

ICE: panic when resolving macros #55457

davidrusu opened this issue Oct 29, 2018 · 1 comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Path resolution I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@davidrusu
Copy link

I've managed to reduce the exploding code to:

mod sub_mod {
    use serde_derive::serde;
    use serde::Serialize;

    #[serde(bound(deserialize = ""))]
    #[derive(Serialize)]
    struct Struct {}
}

fn main() {
}

link to proof in rust-playground

I get an ICE on stable, beta and nightly channels.

backtrace running stable 1.30.0

thread 'main' panicked at 'expected `Def::Macro` or `Def::NonMacroAttr`', librustc_resolve/macros.rs:476:18
stack backtrace:                                                                                  
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace                                   
   1: std::sys_common::backtrace::print                                                           
   2: std::panicking::default_hook::{{closure}}                                                   
   3: std::panicking::default_hook                                                                
   4: rustc::util::common::panic_hook                                                             
   5: std::panicking::rust_panic_with_hook                                                        
   6: std::panicking::begin_panic                                                                 
   7: rustc_resolve::macros::<impl rustc_resolve::Resolver<'a, 'cl>>::resolve_macro_to_def        
   8: rustc_resolve::macros::<impl rustc_resolve::Resolver<'a, 'cl>>::resolve_lexical_macro_path_segment
   9: rustc_resolve::macros::<impl rustc_resolve::Resolver<'a, 'cl>>::finalize_current_module_macro_resolutions
  10: rustc_resolve::Resolver::resolve_item                                                       
  11: rustc_resolve::Resolver::resolve_crate                                                      
  12: rustc::util::common::time                                                                   
  13: rustc_driver::driver::phase_2_configure_and_expand                                          
  14: rustc_driver::driver::compile_input                                                         
  15: rustc_driver::run_compiler_with_pool                                                        
  16: rustc_driver::driver::spawn_thread_pool                                                     
  17: rustc_driver::run_compiler                                                                  
  18: <scoped_tls::ScopedKey<T>>::set                                                             
  19: syntax::with_globals                                                                        
  20: __rust_maybe_catch_panic                                                                    
  21: rustc_driver::run                                                                           
  22: rustc_driver::main                                                                          
  23: std::rt::lang_start::{{closure}}                                                            
  24: std::panicking::try::do_call                                                                
  25: __rust_maybe_catch_panic                                                                    
  26: std::rt::lang_start_internal                                                                
  27: main                                                                                        
query stack during panic:                                                                         
end of query stack                             
error: aborting due to 3 previous errors                                                    
For more information about this error, try `rustc --explain E0432`.                            
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/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.30.0 (da5f414c2 2018-10-24) running on x86_64-apple-darwin          
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden 
@zackmdavis zackmdavis added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Oct 29, 2018
@petrochenkov petrochenkov added A-resolve Area: Path resolution A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Oct 29, 2018
@petrochenkov petrochenkov self-assigned this Oct 29, 2018
@petrochenkov
Copy link
Contributor

Fixed in #55490

@petrochenkov petrochenkov removed their assignment Oct 30, 2018
kennytm added a commit to kennytm/rust that referenced this issue Nov 6, 2018
resolve: Fix ICE in macro import error recovery

Fixes rust-lang#55457
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Path resolution I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants