Skip to content

error: internal compiler error: unexpected panic: inconsistent resolution for a macro #64803

Closed
@scullionw

Description

@scullionw

Compiling this:

https://github.com/scullionw/eseabuddy/tree/compiler_bug

#[macro_use]
extern crate pypack;

use pypack::{rust_embed, RustEmbed, RustEmbedExt};

#[derive(RustEmbed)]
#[folder = "dist/"]
struct Python;

fn main() {
    Python::dump_and_exec();
}

Results in an ICE:

λ cargo +stable build --release                                                                                               
   Compiling pypack v0.1.0 (C:\Users\LUNA\Desktop\Projects\pypack)                                                            
   Compiling eseabuddy v0.1.0 (C:\Users\LUNA\Desktop\Projects\eseabuddy)                                                      
thread 'rustc' panicked at 'src\librustc_resolve\macros.rs:928: inconsistent resolution for a macro', src\librustc\util\bug.rs
:37:26                                                                                                                        
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/blob/master/CONTRIBUTING.md#bug-reports             
                                                                                                                              
note: rustc 1.37.0 (eae3437df 2019-08-13) running on x86_64-pc-windows-msvc                                                   
                                                                                                                              
note: compiler flags: -C opt-level=3 --crate-type bin                                                                         
                                                                                                                              
note: some of the compiler flags provided by cargo are hidden                                                                 
                                                                                                                              
error: Could not compile `eseabuddy`.                                                                                         
                                                                                                                              
To learn more, run the command again with --verbose.     

Different error on nightly:

C:\Users\LUNA\Desktop\Projects\eseabuddy (master -> origin)                                                                   
λ cargo build --release                                                                                                       
   Compiling eseabuddy v0.1.0 (C:\Users\LUNA\Desktop\Projects\eseabuddy)                                                      
thread 'rustc' panicked at 'assertion failed: initial_binding.is_none()', src\librustc_resolve\macros.rs:775:21               
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/blob/master/CONTRIBUTING.md#bug-reports             
                                                                                                                              
note: rustc 1.39.0-nightly (eb48d6bde 2019-09-12) running on x86_64-pc-windows-msvc                                           
                                                                                                                              
note: compiler flags: -C opt-level=3 --crate-type bin                                                                         
                                                                                                                              
note: some of the compiler flags provided by cargo are hidden                                                                 
                                                                                                                              
error: Could not compile `eseabuddy`.

Backtrace for stable:

C:\Users\LUNA\Desktop\New folder\eseabuddy (compiler_bug -> origin)
λ set RUST_BACKTRACE=1 && cargo +stable build --release
   Compiling eseabuddy v0.1.0 (C:\Users\LUNA\Desktop\New folder\eseabuddy)
thread 'rustc' panicked at 'src\librustc_resolve\macros.rs:928: inconsistent resolution for a macro', src\librustc\util\bug.rs:37:26
stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: <(rustc::hir::def_id::DefId, rustc::hir::def_id::DefId) as rustc::ty::query::keys::Key>::default_span
   4: std::panicking::rust_panic_with_hook
   5: <rustc_resolve::check_unused::UnusedImportCheckVisitor as syntax::visit::Visitor>::visit_use_tree
   6: <rustc_resolve::resolve_imports::UnresolvedImportError as core::fmt::Debug>::fmt
   7: <rustc_resolve::resolve_imports::UnresolvedImportError as core::fmt::Debug>::fmt
   8: <rustc_resolve::resolve_imports::UnresolvedImportError as core::fmt::Debug>::fmt
   9: <rustc_resolve::resolve_imports::UnresolvedImportError as core::fmt::Debug>::fmt
  10: <rustc_resolve::resolve_imports::UnresolvedImportError as core::fmt::Debug>::fmt
  11: <rustc_resolve::resolve_imports::UnresolvedImportError as core::fmt::Debug>::fmt
  12: rustc_resolve::macros::<impl rustc_resolve::Resolver>::finalize_current_module_macro_resolutions
  13: rustc_resolve::macros::<impl rustc_resolve::Resolver>::finalize_current_module_macro_resolutions
  14: rustc_resolve::Resolver::resolve_crate
  15: rustc_interface::passes::BoxedResolver::to_expansion_result
  16: <rustc_interface::util::ReplaceBodyWithLoop as syntax::mut_visit::MutVisitor>::visit_mac
  17: <rustc_interface::util::ReplaceBodyWithLoop as syntax::mut_visit::MutVisitor>::visit_mac
  18: <rustc_interface::proc_macro_decls::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_trait_item
  19: <rustc_interface::proc_macro_decls::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_trait_item
  20: <rustc_interface::proc_macro_decls::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_trait_item
  21: <rustc_interface::proc_macro_decls::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_trait_item
  22: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::prepare_outputs
  23: rustc_driver::set_sigpipe_handler
  24: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  25: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  26: <rustc_driver::Compilation as core::fmt::Debug>::fmt
  27: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
  28: _rust_maybe_catch_panic
  29: rustc_driver::set_sigpipe_handler
  30: ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error..Error$u2b$core..marker..Send$u2b$core..marker..Sync$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17
  31: std::sys::windows::thread::Thread::new
  32: BaseThreadInitThunk
  33: RtlUserThreadStart
query stack during panic:
end of query stack

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.37.0 (eae3437df 2019-08-13) running on x86_64-pc-windows-msvc

note: compiler flags: -C opt-level=3 --crate-type bin

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

error: Could not compile `eseabuddy`.

To learn more, run the command again with --verbose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions