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

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

Closed
scullionw opened this issue Sep 26, 2019 · 3 comments · Fixed by #65140
Closed
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name resolution 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) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@scullionw
Copy link

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.
@csmoe csmoe added A-resolve Area: Name resolution I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Sep 26, 2019
@Centril Centril added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 26, 2019
@pnkfelix pnkfelix added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Sep 26, 2019
@pnkfelix
Copy link
Member

triage: tagging as P-high for initial investigation as to severity. Doesn't seem like it warrants discussion at T-compiler meeting. Removing nomination tag.

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Sep 26, 2019
@petrochenkov petrochenkov self-assigned this Sep 26, 2019
@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label Sep 26, 2019
@petrochenkov
Copy link
Contributor

I'll try to look at this during the weekend.
This is not a regression, so the priority is probably not especially high.

@petrochenkov
Copy link
Contributor

Fixed in #65140.

@petrochenkov petrochenkov removed their assignment Oct 5, 2019
@bors bors closed this as completed in 9c588c1 Oct 10, 2019
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: Name resolution 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) ❄️ P-high High priority 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.

6 participants