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 on safer_ffi's ffi_export #78287

Closed
jacg opened this issue Oct 23, 2020 · 1 comment
Closed

Panic on safer_ffi's ffi_export #78287

jacg opened this issue Oct 23, 2020 · 1 comment
Labels
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

@jacg
Copy link

jacg commented Oct 23, 2020

Code

src/lib.rs

use ::safer_ffi::prelude::ffi_export;

#[ffi_export]
pub fn foo() {}

Cargo.toml

[package]
name = "panic"
version = "0.1.0"
authors = ["panic"]
edition = "2018"

[dependencies]
safer-ffi = { version = "0.0.5" }

Meta

rustc --version --verbose:

rustc --version --verbose
rustc 1.47.0 (18bf6b4f0 2020-10-07)
binary: rustc
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
commit-date: 2020-10-07
host: x86_64-unknown-linux-gnu
release: 1.47.0
LLVM version: 11.0

The errors shown below were generated by the stable compiler version shown above, but essentially the same error is also generated by the following nightly:

rustc 1.49.0-nightly (a9cd294cf 2020-10-22)
binary: rustc
commit-hash: a9cd294cf2775441e713c7ee2918b728733b99f5
commit-date: 2020-10-22
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

   Compiling panic v0.1.0 (/home/jacek/rust/deleteme-ffi)
thread 'rustc' panicked at 'Expected module, found DefId(18:196)', src/librustc_metadata/rmeta/decoder.rs:1178:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0 (18bf6b4f0 2020-10-07) running on x86_64-unknown-linux-gnu

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: could not compile `panic`.

To learn more, run the command again with --verbose.
Backtrace

   Compiling panic v0.1.0 (/home/jacek/rust/deleteme-ffi)
thread 'rustc' panicked at 'Expected module, found DefId(18:196)', src/librustc_metadata/rmeta/decoder.rs:1178:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:475
   1: std::panicking::begin_panic_fmt
             at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:429
   2: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_metadata::creader::CStore>::module_expansion_untracked
   3: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::get_module
   4: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::get_module
   5: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::macro_def_scope
   6: rustc_resolve::macros::<impl rustc_expand::base::ResolverExpand for rustc_resolve::Resolver>::resolve_macro_invocation
   7: rustc_expand::expand::MacroExpander::fully_expand_fragment
   8: rustc_expand::expand::MacroExpander::expand_crate
   9: rustc_session::utils::<impl rustc_session::session::Session>::time
  10: rustc_interface::passes::configure_and_expand_inner
  11: rustc_interface::passes::configure_and_expand::{{closure}}
  12: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  13: rustc_interface::passes::configure_and_expand
  14: rustc_interface::queries::Queries::expansion
  15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  16: rustc_span::with_source_map
  17: rustc_interface::interface::create_compiler_and_run
  18: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0 (18bf6b4f0 2020-10-07) running on x86_64-unknown-linux-gnu

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:
end of query stack
error: could not compile `panic`.

@jacg jacg 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 23, 2020
@jyn514
Copy link
Member

jyn514 commented Oct 23, 2020

Duplicate of #75982

@jyn514 jyn514 marked this as a duplicate of #75982 Oct 23, 2020
@jyn514 jyn514 closed this as completed Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

No branches or pull requests

2 participants