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

Panic when trying to use macro #53269

Closed
jD91mZM2 opened this issue Aug 11, 2018 · 2 comments · Fixed by #53471
Closed

Panic when trying to use macro #53269

jD91mZM2 opened this issue Aug 11, 2018 · 2 comments · Fixed by #53471
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@jD91mZM2
Copy link
Contributor

The compiler panicked

I tried this code:
compiler-crash tag on rust-nix.
cargo test

I expected to see this happen: A normal compilation error
Instead, this happened: The rust compiler panicked

Meta

rustc --version --verbose:

rustc 1.30.0-nightly (7e8ca9f8b 2018-08-03)
binary: rustc
commit-hash: 7e8ca9f8bd8325398e76bc30ac09aab138bbb127
commit-date: 2018-08-03
host: x86_64-unknown-linux-gnu
release: 1.30.0-nightly
LLVM version: 7.0

2018 edition of rust

Backtrace: https://gist.github.com/0bf4ae25ef77940633fda40257b16cab

@petrochenkov petrochenkov added A-resolve Area: Name/path resolution done by `rustc_resolve` specifically 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, ..) regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Aug 11, 2018
@jD91mZM2
Copy link
Contributor Author

jD91mZM2 commented Aug 11, 2018

Minimal reproduction example:

#![feature(rust_2018_preview)]

macro_rules! m {
    () => {}
}

mod m {
    use crate::nonexistent_module::m;

    fn f() {
        m!();
    }
}

@jD91mZM2 jD91mZM2 changed the title Panic when trying to use macro that doesn't exist Panic when trying to use macro Aug 11, 2018
@petrochenkov petrochenkov self-assigned this Aug 14, 2018
@petrochenkov
Copy link
Contributor

Fixed locally as a part of larger refactoring, will submit a PR soon.

bors added a commit that referenced this issue Aug 21, 2018
resolve: Some macro resolution refactoring

Work towards completing #50911 (comment)

The last commit also fixes #53269 by not using `def_id()` on `Def::Err` and also fixes #53512.
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/path resolution done by `rustc_resolve` specifically I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants