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: expected item, found unknown node, caused by reexport. #68103

Closed
rodrimati1992 opened this issue Jan 10, 2020 · 2 comments · Fixed by #68106
Closed

ICE: expected item, found unknown node, caused by reexport. #68103

rodrimati1992 opened this issue Jan 10, 2020 · 2 comments · Fixed by #68106
Assignees
Labels
A-HIR Area: The high-level intermediate representation (HIR) 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

@rodrimati1992
Copy link
Contributor

rodrimati1992 commented Jan 10, 2020

Attempting to compile this code:

extern crate self as playground;

pub struct Hello;

pub use crate::playground::Hello as world;

Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9ee5284237231c2287488a22ec49230a

Causes this ICE in nightly 2019-12-29 ,and stable with a slightly different stack trace.

error: internal compiler error: src/librustc/hir/map/mod.rs:882: expected item, found unknown node (hir_id=HirId { owner: DefIndex(0), local_id: 0 })

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:889:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1057
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:195
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:215
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:476
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::bug
  14: rustc_errors::Handler::bug
  15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc::ty::context::tls::with_opt::{{closure}}
  17: rustc::ty::context::tls::with_opt
  18: rustc::util::bug::opt_span_bug_fmt
  19: rustc::util::bug::bug_fmt
  20: rustc::hir::map::Map::expect_item
  21: <rustc_privacy::EmbargoVisitor as rustc::hir::intravisit::Visitor>::visit_item
  22: <rustc_privacy::EmbargoVisitor as rustc::hir::intravisit::Visitor>::visit_mod
  23: rustc_privacy::privacy_access_levels
  24: rustc::ty::query::__query_compute::privacy_access_levels
  25: rustc::dep_graph::graph::DepGraph::with_task_impl
  26: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  27: rustc::util::common::time
  28: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  29: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:79
  30: rustc_interface::passes::analysis::{{closure}}
  31: rustc::util::common::time
  32: rustc_interface::passes::analysis
  33: rustc::ty::query::__query_compute::analysis
  34: rustc::dep_graph::graph::DepGraph::with_task_impl
  35: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  36: rustc::ty::context::tls::enter_global
  37: rustc_interface::interface::run_compiler_in_existing_thread_pool
  38: scoped_tls::ScopedKey<T>::set
  39: syntax::with_globals
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0-nightly (da3629b05 2019-12-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --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 `playground`.

@DutchGhost
Copy link
Contributor

reduced to 2 lines:

pub extern crate self as name;
pub use name::name as bug;

also, when the pub is removed from the use line, OR both pub's are removed, it compiles fine.

@jonas-schievink jonas-schievink added A-HIR Area: The high-level intermediate representation (HIR) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 10, 2020
@JohnTitor
Copy link
Member

@Centril yeah, I prepared the fix but @varkor has already submitted another fix so assignment is unnecessary?

@Centril Centril assigned varkor and unassigned JohnTitor Jan 11, 2020
Centril added a commit to Centril/rust that referenced this issue Jan 11, 2020
Fix issue with using `self` module via indirection

Fixes rust-lang#68103.
@bors bors closed this as completed in 04a340f Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-HIR Area: The high-level intermediate representation (HIR) 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.

5 participants