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

internal error: entered unreachable code #63164

Closed
cazgp opened this issue Jul 31, 2019 · 15 comments · Fixed by #63624
Closed

internal error: entered unreachable code #63164

cazgp opened this issue Jul 31, 2019 · 15 comments · Fixed by #63624
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-macros-2.0 Area: Declarative macros 2.0 (#39412) A-visibility Area: Visibility / privacy C-bug Category: This is a bug. 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

@cazgp
Copy link

cazgp commented Jul 31, 2019

Seems to be something to do with Rocket. Having a get on the internal function is causing the compiler to blow up.

fn moo() {
    #[get("/moo")]
    fn get() -> String {
        "moo".to_string()
    }
}

Version:

rustc 1.38.0-nightly (dddb7fca0 2019-07-30)
binary: rustc
commit-hash: dddb7fca09dc817ba275602b950bb81a9032fb6d
commit-date: 2019-07-30
host: x86_64-unknown-linux-gnu
release: 1.38.0-nightly
LLVM version: 9.0

Stack trace:

thread 'rustc' panicked at 'internal error: entered unreachable code', src/librustc_privacy/lib.rs:767:17
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:481
   8: std::panicking::begin_panic
   9: <rustc_privacy::EmbargoVisitor as rustc::hir::intravisit::Visitor>::visit_macro_def
  10: rustc_privacy::privacy_access_levels
  11: rustc::ty::query::__query_compute::privacy_access_levels
  12: rustc::dep_graph::graph::DepGraph::with_task_impl
  13: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  14: rustc::util::common::time
  15: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  16: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  17: rustc_interface::passes::analysis::{{closure}}
  18: rustc::util::common::time
  19: rustc_interface::passes::analysis
  20: rustc::ty::query::__query_compute::analysis
  21: rustc::dep_graph::graph::DepGraph::with_task_impl
  22: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  23: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  24: rustc_interface::passes::create_global_ctxt::{{closure}}
  25: rustc_interface::interface::run_compiler_in_existing_thread_pool
  26: std::thread::local::LocalKey<T>::with
  27: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [privacy_access_levels] privacy access levels
#1 [analysis] running analysis passes on this crate
end of query stack
@maxdeviant

This comment has been minimized.

@cazgp

This comment has been minimized.

@Mark-Simulacrum
Copy link
Member

Hm, this bug probably originates with interesting codegen in Rocket, but is likely a bug in rustc in the end. I would keep it here, though letting Rocket know about it might not be a bad idea.

@Mark-Simulacrum Mark-Simulacrum added 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 Jul 31, 2019
@Centril Centril added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) I-nominated P-high High priority A-visibility Area: Visibility / privacy labels Jul 31, 2019
@Centril
Copy link
Contributor

Centril commented Jul 31, 2019

I'm going to label this as P-high for now since it affects Rocket.

cc @petrochenkov re. macros & privacy.

@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label Jul 31, 2019
@estebank
Copy link
Contributor

Without looking too deeply I would wager that we're getting a ForeignMod here, although it could be any other ItemKind which would be worrisome:

let module = if module_id == hir::CRATE_HIR_ID {
&self.tcx.hir().krate().module
} else if let hir::ItemKind::Mod(ref module) =
self.tcx.hir().expect_item(module_id).node {
module
} else {
unreachable!()
};

@nagisa
Copy link
Member

nagisa commented Aug 1, 2019

Would be great to have a reproducer that did not depend on Rocket and codegen, if it is possible.

@nagisa nagisa removed the I-nominated label Aug 1, 2019
@cazgp
Copy link
Author

cazgp commented Aug 2, 2019

Trying to get a simple reproducible example and am unable to :( It got a little time-consuming and I really need to get work done so have worked around it for now. I could possibly publish everything in a repo, but it would still be rocket + codegen and not a very simple example!

@estebank estebank added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Aug 2, 2019
@hellow554
Copy link
Contributor

Latest nightly (2019-08-11) still panics, but with different error message:

thread 'rustc' panicked at 'not a module', src/librustc/hir/map/mod.rs:528:18
stack backtrace:
   0:     0x7f0ad7d6c61b - backtrace::backtrace::libunwind::trace::ha0c5be6d84ff3577
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1:     0x7f0ad7d6c61b - backtrace::backtrace::trace_unsynchronized::h0140f1905fe5df01
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2:     0x7f0ad7d6c61b - std::sys_common::backtrace::_print::h71c90b55c1552895
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x7f0ad7d6c61b - std::sys_common::backtrace::print::h0d9ae497e80a66d3
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x7f0ad7d6c61b - std::panicking::default_hook::{{closure}}::h0f874d2b67342285
                               at src/libstd/panicking.rs:200
   5:     0x7f0ad7d6c2f6 - std::panicking::default_hook::hb16f7323e318d7e4
                               at src/libstd/panicking.rs:214
   6:     0x7f0ad9a864a1 - rustc::util::common::panic_hook::h429013132a47c4fc
   7:     0x7f0ad7d6ce76 - std::panicking::rust_panic_with_hook::h399c25a83b2171e5
                               at src/libstd/panicking.rs:481
   8:     0x7f0ad9aec655 - std::panicking::begin_panic::he315ffb87476d743
   9:     0x7f0ad97341e9 - rustc::hir::map::Map::get_module::h1210e98f2c905b81
  10:     0x7f0ad8796c55 - rustc_privacy::EmbargoVisitor::update_macro_reachable::h03ea7b13a3744e67
  11:     0x7f0ad8798b18 - <rustc_privacy::EmbargoVisitor as rustc::hir::intravisit::Visitor>::visit_macro_def::hacc66c1d53288339
  12:     0x7f0ad879dcd9 - rustc_privacy::privacy_access_levels::h2f299a855f11d2ea
  13:     0x7f0ad83f4995 - rustc::ty::query::__query_compute::privacy_access_levels::h0a7b4c7f05bc2167
  14:     0x7f0ad83f719c - rustc::dep_graph::graph::DepGraph::with_task_impl::h4453007938f8cfe3
  15:     0x7f0ad83e61c7 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hc392c801ffb5ed4c
  16:     0x7f0ad838d59e - rustc::util::common::time::h15d9e7ce0076925b
  17:     0x7f0ad82fa5db - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h12546751fd40c726
  18:     0x7f0ad7d7d70a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  19:     0x7f0ad8392f62 - rustc_interface::passes::analysis::{{closure}}::h8734b7d05d191413
  20:     0x7f0ad838c820 - rustc::util::common::time::h02a48a90970b1bac
  21:     0x7f0ad8349b14 - rustc_interface::passes::analysis::h57ebb0969e450b3d
  22:     0x7f0ad8233f31 - rustc::ty::query::__query_compute::analysis::h6c096f0d36ed86f6
  23:     0x7f0ad82353b9 - rustc::dep_graph::graph::DepGraph::with_task_impl::h2550ad6665d41399
  24:     0x7f0ad824795e - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hc5055ce71170472f
  25:     0x7f0ad825509a - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::h4786e32a4ca81311
  26:     0x7f0ad83c351a - rustc_interface::passes::create_global_ctxt::{{closure}}::h597429a0e6926f58
  27:     0x7f0ad8257aaf - rustc_interface::interface::run_compiler_in_existing_thread_pool::hff30cd26e49be082
  28:     0x7f0ad82904f2 - std::thread::local::LocalKey<T>::with::hd8d9ab6c3632b928
  29:     0x7f0ad82a6a00 - syntax::with_globals::hab02661e6f94b740
  30:     0x7f0ad8228a62 - std::sys_common::backtrace::__rust_begin_short_backtrace::h142cd21c5b6016af
  31:     0x7f0ad7d7d70a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  32:     0x7f0ad8259029 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc6e3bc11b5dabea5
  33:     0x7f0ad7d502ff - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hc06a52252b8da4d8
                               at /rustc/00ee1b47f42129a0a6e33510578fbcf07c1e5382/src/liballoc/boxed.rs:787
  34:     0x7f0ad7d7c390 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::ha593cf28b5c6f358
                               at /rustc/00ee1b47f42129a0a6e33510578fbcf07c1e5382/src/liballoc/boxed.rs:787
  35:     0x7f0ad7d7c390 - std::sys_common::thread::start_thread::h0e1c86ca3f5e2a0a
                               at src/libstd/sys_common/thread.rs:13
  36:     0x7f0ad7d7c390 - std::sys::unix::thread::Thread::new::thread_start::h2c0daa2b9405abac
                               at src/libstd/sys/unix/thread.rs:79
  37:     0x7f0ad7cbb75a - start_thread
  38:     0x7f0ad7bd09f3 - __clone
  39:                0x0 - <unknown>
query stack during panic:
#0 [privacy_access_levels] privacy access levels
#1 [analysis] running analysis passes on this crate
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.38.0-nightly (00ee1b47f 2019-08-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

@hellow554
Copy link
Contributor

hellow554 commented Aug 12, 2019

Also as a sidenote: Rocket master does not ICE anymore. The ICE "was fixed" by rwf2/Rocket@2f458b5 so it may be a problem with decl_macro ?

@estebank
Copy link
Contributor

@hellow554 I would still wan't rustc not to ICE on the face of malformed input.

@estebank
Copy link
Contributor

pub fn get_module(&self, module: DefId) -> (&'hir Mod, Span, HirId)
{
let hir_id = self.as_local_hir_id(module).unwrap();
self.read(hir_id);
match self.find_entry(hir_id).unwrap().node {
Node::Item(&Item {
span,
node: ItemKind::Mod(ref m),
..
}) => (m, span, hir_id),
Node::Crate => (&self.forest.krate.module, self.forest.krate.span, hir_id),
_ => panic!("not a module")
}
}

For future reference, when panicking or using bug for not finding what you expect it is a good idea to include in the message what the found value was. :)

@hellow554
Copy link
Contributor

@hellow554 I would still wan't rustc not to ICE on the face of malformed input.

I think you got me wrong. I haven't said, that this should be closed because upstream code has changed, but I said, that upstream does not ICE anymore, so I looked into it, what caused it to not ICE anymore.

For future reference, when panicking or using bug for not finding what you expect it is a good idea to include in the message what the found value was. :)

I try to go that ;)


Confirmed, that it is related to decl maros

@rustbot modify labels: +A-macros-2.0

@rustbot rustbot removed A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-visibility Area: Visibility / privacy 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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 13, 2019
@hellow554

This comment has been minimized.

@estebank estebank added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-macros-2.0 Area: Declarative macros 2.0 (#39412) labels Aug 13, 2019
@estebank estebank added A-visibility Area: Visibility / privacy 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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 13, 2019
@hellow554
Copy link
Contributor

#![feature(decl_macro)]

pub fn moo() {
    pub macro ABC() {{}}
}

fn main() {}
Backtraces
60960a2
thread 'rustc' panicked at 'not a module', src/librustc/hir/map/mod.rs:528:18
stack backtrace:
   0:     0x7f99dcf3868b - backtrace::backtrace::libunwind::trace::h2577eef7cb82271e
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1:     0x7f99dcf3868b - backtrace::backtrace::trace_unsynchronized::ha9b72a77aa6c4ce9
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2:     0x7f99dcf3868b - std::sys_common::backtrace::_print::h8e2c1c5cda6e4e6e
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x7f99dcf3868b - std::sys_common::backtrace::print::h7e0f8aad0d8a6f3b
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x7f99dcf3868b - std::panicking::default_hook::{{closure}}::haae4327ede06a559
                               at src/libstd/panicking.rs:200
   5:     0x7f99dcf38366 - std::panicking::default_hook::hbf5f36093f15fccc
                               at src/libstd/panicking.rs:214
   6:     0x7f99deddf6c1 - rustc::util::common::panic_hook::h186d7378210995d5
   7:     0x7f99dcf38ee6 - std::panicking::rust_panic_with_hook::hf385e0a05e771036
                               at src/libstd/panicking.rs:481
   8:     0x7f99ded60535 - std::panicking::begin_panic::h98efcde0b33861fd
   9:     0x7f99dea1e8e9 - rustc::hir::map::Map::get_module::h8459c30767a59634
  10:     0x7f99dd976bd5 - rustc_privacy::EmbargoVisitor::update_macro_reachable::h6a3b276385f70843
  11:     0x7f99dd978ae5 - <rustc_privacy::EmbargoVisitor as rustc::hir::intravisit::Visitor>::visit_macro_def::hcbafa5fdfe7ec278
  12:     0x7f99dd97da19 - rustc_privacy::privacy_access_levels::hab5fb8ebf6879a00
  13:     0x7f99dd5c9875 - rustc::ty::query::__query_compute::privacy_access_levels::h997d37146502020c
  14:     0x7f99dd5ce5cc - rustc::dep_graph::graph::DepGraph::with_task_impl::h5b324a86c2bc7b54
  15:     0x7f99dd5baad7 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hb10373db1d5669d1
  16:     0x7f99dd55d12e - rustc::util::common::time::h48c99f483b081dea
  17:     0x7f99dd4c5edb - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h9e5808ec22ae1930
  18:     0x7f99dcf497da - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  19:     0x7f99dd562182 - rustc_interface::passes::analysis::{{closure}}::h054b9f0f0c77f34b
  20:     0x7f99dd55d8e0 - rustc::util::common::time::h8409e1576e8c0d89
  21:     0x7f99dd518954 - rustc_interface::passes::analysis::heb3974148e32c83a
  22:     0x7f99dd3fe941 - rustc::ty::query::__query_compute::analysis::h83791fe1f4d00f5f
  23:     0x7f99dd3ffe99 - rustc::dep_graph::graph::DepGraph::with_task_impl::h28a3f59ca4aea2c5
  24:     0x7f99dd40e09e - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h598f4a5ef7d98b4a
  25:     0x7f99dd41f97a - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::h7aa52f166037c173
  26:     0x7f99dd59888a - rustc_interface::passes::create_global_ctxt::{{closure}}::h970097f89991677c
  27:     0x7f99dd42142f - rustc_interface::interface::run_compiler_in_existing_thread_pool::h2009c7257c3c167e
  28:     0x7f99dd45b302 - std::thread::local::LocalKey<T>::with::h5f3bc545c05a19af
  29:     0x7f99dd471ae0 - syntax::with_globals::h55d1d6dcdd17adef
  30:     0x7f99dd3f37c2 - std::sys_common::backtrace::__rust_begin_short_backtrace::hfa7060075d41bdcb
  31:     0x7f99dcf497da - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  32:     0x7f99dd423c09 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc822505d1ebef265
  33:     0x7f99dcf1c34f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hcb726170bbd77169
                               at /rustc/60960a260f7b5c695fd0717311d72ce62dd4eb43/src/liballoc/boxed.rs:787
  34:     0x7f99dcf48460 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h8f9a27f02cc198cd
                               at /rustc/60960a260f7b5c695fd0717311d72ce62dd4eb43/src/liballoc/boxed.rs:787
  35:     0x7f99dcf48460 - std::sys_common::thread::start_thread::h7b733f0fbf8d0251
                               at src/libstd/sys_common/thread.rs:13
  36:     0x7f99dcf48460 - std::sys::unix::thread::Thread::new::thread_start::h69a20ebd2130c891
                               at src/libstd/sys/unix/thread.rs:79
  37:     0x7f99dce8775a - start_thread
  38:     0x7f99dcd9c9f3 - __clone
  39:                0x0 - <unknown>
query stack during panic:
#0 [privacy_access_levels] privacy access levels
#1 [analysis] running analysis passes on this crate
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.38.0-nightly (60960a260 2019-08-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
dddb7fc
thread 'rustc' panicked at 'internal error: entered unreachable code', src/librustc_privacy/lib.rs:767:17
stack backtrace:
   0:     0x7fe45d04600b - backtrace::backtrace::libunwind::trace::h52f24a95439ef578
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1:     0x7fe45d04600b - backtrace::backtrace::trace_unsynchronized::h95d5121d267c42e7
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2:     0x7fe45d04600b - std::sys_common::backtrace::_print::hb84c1e80b3c39e3b
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x7fe45d04600b - std::sys_common::backtrace::print::hf6f56322692db8bf
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x7fe45d04600b - std::panicking::default_hook::{{closure}}::h19298f991e34e518
                               at src/libstd/panicking.rs:200
   5:     0x7fe45d045ce6 - std::panicking::default_hook::h24d4b216d9b958a7
                               at src/libstd/panicking.rs:214
   6:     0x7fe45ed242e1 - rustc::util::common::panic_hook::h1dd7f28a1964c2cb
   7:     0x7fe45d046866 - std::panicking::rust_panic_with_hook::hec63884fa234b28d
                               at src/libstd/panicking.rs:481
   8:     0x7fe45da20d45 - std::panicking::begin_panic::h57aa041734b11738
   9:     0x7fe45da4e1b0 - <rustc_privacy::EmbargoVisitor as rustc::hir::intravisit::Visitor>::visit_macro_def::hc1da9eff917bcabe
  10:     0x7fe45da53229 - rustc_privacy::privacy_access_levels::h783d64b1d818203b
  11:     0x7fe45d6b5f95 - rustc::ty::query::__query_compute::privacy_access_levels::hd8b8fec48aa4f30a
  12:     0x7fe45d6ba6ec - rustc::dep_graph::graph::DepGraph::with_task_impl::ha23193b852ec19e8
  13:     0x7fe45d68f787 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h062ebe411627cf5a
  14:     0x7fe45d6637be - rustc::util::common::time::hce9d9246aef66790
  15:     0x7fe45d5bbb1b - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h89d28534075d9ced
  16:     0x7fe45d0570fa - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  17:     0x7fe45d667ab2 - rustc_interface::passes::analysis::{{closure}}::h984f4e19f4d1fe61
  18:     0x7fe45d661330 - rustc::util::common::time::h0a2f2eb1d7acc77d
  19:     0x7fe45d60d484 - rustc_interface::passes::analysis::h33ebf750c675f89b
  20:     0x7fe45d4f68e1 - rustc::ty::query::__query_compute::analysis::h63934db633e843ec
  21:     0x7fe45d4f8399 - rustc::dep_graph::graph::DepGraph::with_task_impl::ha5757adb20b9ea3b
  22:     0x7fe45d505e0e - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h2d5f2f2a098a1b29
  23:     0x7fe45d51808a - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::hb6313b20433cdbc4
  24:     0x7fe45d66696a - rustc_interface::passes::create_global_ctxt::{{closure}}::hccd7c77555c50c54
  25:     0x7fe45d519434 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h02ba1ec2154be072
  26:     0x7fe45d552152 - std::thread::local::LocalKey<T>::with::he42ca5b61e1e7359
  27:     0x7fe45d5682c0 - syntax::with_globals::h287fa2caf2b24706
  28:     0x7fe45d4ebe22 - std::sys_common::backtrace::__rust_begin_short_backtrace::h113d82c9ba2144b4
  29:     0x7fe45d0570fa - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  30:     0x7fe45d51b939 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hcddb7194ffd10ee0
  31:     0x7fe45d029d8f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h82a57145aa4239a7
                               at /rustc/dddb7fca09dc817ba275602b950bb81a9032fb6d/src/liballoc/boxed.rs:770
  32:     0x7fe45d055d80 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h167c1ef971e93086
                               at /rustc/dddb7fca09dc817ba275602b950bb81a9032fb6d/src/liballoc/boxed.rs:770
  33:     0x7fe45d055d80 - std::sys_common::thread::start_thread::h739b9b99c7f25b24
                               at src/libstd/sys_common/thread.rs:13
  34:     0x7fe45d055d80 - std::sys::unix::thread::Thread::new::thread_start::h79a2f27ba62f96ae
                               at src/libstd/sys/unix/thread.rs:79
  35:     0x7fe45cf9575a - start_thread
  36:     0x7fe45ceaa9f3 - __clone
  37:                0x0 - <unknown>
query stack during panic:
#0 [privacy_access_levels] privacy access levels
#1 [analysis] running analysis passes on this crate
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.38.0-nightly (dddb7fca0 2019-07-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

@rustbot modify labels: -E-needs-mcve

@rustbot rustbot removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Aug 13, 2019
@estebank
Copy link
Contributor

estebank commented Aug 16, 2019

What is the appropriate visibility scope for macro ABC? get_module is failing because we get the following instead:

Item(Item {
    ident: moo#0,
    hir_id: HirId {
        owner: DefIndex(12),
        local_id: 0
    },
    attrs: [],
    node: Fn(
        FnDecl { inputs: [], output: DefaultReturn(file7.rs:3:14: 3:14), c_variadic: false, implicit_self: None },
        FnHeader { unsafety: Normal, constness: NotConst, asyncness: NotAsync, abi: Rust },
        Generics { params: [], where_clause: WhereClause { predicates: [], span: file7.rs:3:12: 3:13 }, span: file7.rs:3:11: 3:11 },
        BodyId { hir_id: HirId { owner: DefIndex(12), local_id: 2 } }
    ),
    vis: Spanned { node: Public, span: file7.rs:3:1: 3:4 },
    span: file7.rs:3:1: 5:2
})

In my mind the expected semantics of this could would be to scope ABC to inside moo, but currently with a macro by example it would be scoped to the current module.

I can implement either semantic. @petrochenkov?


Edit: I'm talking out of my ass, the scoping rules of macro_rules! inside of methods matches my intuition. Don't know why I thought otherwise.

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-macros-2.0 Area: Declarative macros 2.0 (#39412) A-visibility Area: Visibility / privacy C-bug Category: This is a bug. 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.

9 participants