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

resolve_macro_to_def panics #43860

Closed
debris opened this issue Aug 14, 2017 · 2 comments · Fixed by #77271
Closed

resolve_macro_to_def panics #43860

debris opened this issue Aug 14, 2017 · 2 comments · Fixed by #77271
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-proc-macros Area: Procedural macros 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

@debris
Copy link
Contributor

debris commented Aug 14, 2017

rustc 1.19.0 (0ade33941 2017-07-17)

I have 3 crates

crate a:

#[proc_macro_derive(EthabiContract, attributes(ethabi_contract_options))]
pub fn ethabi_derive(input: TokenStream) -> TokenStream {
// do something
}

crate b:

#[macro_export]
macro_rules! use_contract {
	($name: ident, $path: expr) => {
		#[derive(EthabiContract)]
		#[ethabi_contract_options(path = $path)]
		pub struct $name<T, C> {
			api: T,
			contract: C,
		}
	}
}

crate c:

use_contract!(ContractName, file!());

building crate c results in compiler panic

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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'no entry found for key', src/libcore/option.rs:823
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::option::expect_failed
   9: rustc_resolve::macros::<impl rustc_resolve::Resolver<'a>>::resolve_macro_to_def
  10: rustc_resolve::macros::<impl syntax::ext::base::Resolver for rustc_resolve::Resolver<'a>>::resolve_invoc
  11: syntax::ext::expand::MacroExpander::expand
  12: syntax::ext::expand::MacroExpander::expand_crate
  13: rustc_driver::driver::phase_2_configure_and_expand::{{closure}}
  14: rustc_driver::driver::phase_2_configure_and_expand
  15: rustc_driver::driver::compile_input
  16: rustc_driver::run_compiler

error: Could not compile `ethabi_contract`.
@carols10cents
Copy link
Member

To my untrained eye, this looks similar to #42164 but I'm not confident in definitively proclaiming these issues duplicates...

@carols10cents carols10cents added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) 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 Aug 14, 2017
@Aaron1011 Aaron1011 added the A-proc-macros Area: Procedural macros label May 24, 2020
@petrochenkov
Copy link
Contributor

Fixed in #77271.

@bors bors closed this as completed in 4c0c5e0 Nov 3, 2020
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-proc-macros Area: Procedural macros 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

Successfully merging a pull request may close this issue.

4 participants