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 from public Macro 2.0 + use crate as #77475

Closed
beepster4096 opened this issue Oct 3, 2020 · 6 comments · Fixed by #78264
Closed

ICE from public Macro 2.0 + use crate as #77475

beepster4096 opened this issue Oct 3, 2020 · 6 comments · Fixed by #78264
Labels
A-macros-2.0 Area: Declarative macros 2.0 (#39412) C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-decl_macro `#![feature(decl_macro)]` glacier ICE tracked in rust-lang/glacier. 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

@beepster4096
Copy link
Contributor

This does not happen if the macro is private or pub(crate).

Code

#![feature(decl_macro)]
use crate as _;
pub macro ice(){}

Meta

rustc --version --verbose:

rustc 1.48.0-nightly (154f1f544 2020-10-02)
binary: rustc
commit-hash: 154f1f544dd68f7b53ff8d9952811e855f4c2d7c
commit-date: 2020-10-02
host: x86_64-pc-windows-msvc
release: 1.48.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: compiler\rustc_middle\src\hir\map\mod.rs:477:41: couldn't find hir id HirId { owner: DefId(0:0 ~ icetest[63b0]), local_id: 0 } in the HIR map

thread 'rustc' panicked at 'Box<Any>', compiler\rustc_errors\src\lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.48.0-nightly (154f1f544 2020-10-02) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

error: aborting due to previous error

error: could not compile `icetest`
Backtrace

error: internal compiler error: compiler\rustc_middle\src\hir\map\mod.rs:477:41: couldn't find hir id HirId { owner: DefId(0:0 ~ icetest[63b0]), local_id: 0 } in the HIR map

thread 'rustc' panicked at 'Box<Any>', compiler\rustc_errors\src\lib.rs:945:9
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.48.0-nightly (154f1f544 2020-10-02) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [privacy_access_levels] privacy access levels
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

error: could not compile `icetest`

@beepster4096 beepster4096 added 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 Oct 3, 2020
@beepster4096 beepster4096 changed the title ICE from Macro 2.0 + use crate as ICE from public Macro 2.0 + use crate as Oct 3, 2020
@jyn514 jyn514 added A-macros-2.0 Area: Declarative macros 2.0 (#39412) F-decl_macro `#![feature(decl_macro)]` labels Oct 3, 2020
@beepster4096
Copy link
Contributor Author

The ice also occurs with extern crate self as _.

@JohnTitor
Copy link
Member

This is now compiled fine with the latest nightly, I think #78077 fixed it. Marking as E-needs-test.

@JohnTitor JohnTitor added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 22, 2020
@beepster4096
Copy link
Contributor Author

@JohnTitor
Copy link
Member

JohnTitor commented Oct 22, 2020

@drmeepster Note that its nightly isn't the latest (see godbolt for example).

@beepster4096
Copy link
Contributor Author

Latest nightly compiles it fine

@JohnTitor
Copy link
Member

This should be open until the test is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros-2.0 Area: Declarative macros 2.0 (#39412) C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-decl_macro `#![feature(decl_macro)]` glacier ICE tracked in rust-lang/glacier. 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