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

cargo publish panics when running on a procedural macros crate which uses the build-std unstable feature #9828

Closed
GabrielMajeri opened this issue Aug 23, 2021 · 1 comment · Fixed by #9834
Labels
C-bug Category: bug

Comments

@GabrielMajeri
Copy link
Contributor

GabrielMajeri commented Aug 23, 2021

Problem
I was trying to publish a new version of the uefi-macros crate, and I encountered the following panic upon running cargo publish --target x86_64-unknown-uefi:

thread 'main' panicked at 'no entry found for key', src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs:340:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/af140757b4cb1a60d107c690720311ba8e06e7de/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/af140757b4cb1a60d107c690720311ba8e06e7de/library/core/src/panicking.rs:93:14
   2: core::option::expect_failed
             at /rustc/af140757b4cb1a60d107c690720311ba8e06e7de/library/core/src/option.rs:1618:5
   3: cargo::core::compiler::context::compilation_files::CompilationFiles::outputs
   4: cargo::core::compiler::context::Context::compile
   5: cargo::ops::cargo_compile::compile_ws
   6: cargo::ops::cargo_package::package_one
   7: cargo::ops::registry::publish
   8: cargo::commands::publish::exec
   9: cargo::cli::main
  10: cargo::main

The project is using the build-std unstable feature, and it seems to be the cause for this issue. If I comment out the build-std line in the cargo config file, I'm successfully able to publish the crate.

Additionally, I had no issue with publishing a new version of the uefi-rs crate, which is a regular library (not proc-macro).

Steps

  1. Check out the code from rust-osdev/uefi-rs@8832fbc
  2. Move into the uefi-macros subdirectory and run cargo publish --target x86_64-unknown-uefi
  3. Observe the cargo panic

Possible Solution(s)

The panic message is the same as the one in this issue, so the solution might be similar.

Notes

Output of rustc --version:

rustc 1.56.0-nightly (af140757b 2021-08-22)

Output of cargo --version:

cargo 1.56.0-nightly (e96bdb0c3 2021-08-17)

Contents of the project's .cargo/config:

[unstable]
build-std = ["core", "compiler_builtins", "alloc"]
@GabrielMajeri GabrielMajeri added the C-bug Category: bug label Aug 23, 2021
@GabrielMajeri GabrielMajeri changed the title cargo publish panics when running on a crate which uses the build-std unstable feature cargo publish panics when running on a procedural macros crate which uses the build-std unstable feature Aug 23, 2021
@ehuss
Copy link
Contributor

ehuss commented Aug 23, 2021

Thanks for the report! This doesn't seem to be specific to publishing, but running any build command in a proc-macro project with build-std activated would cause a panic.

I have posted #9834 with a fix.

@bors bors closed this as completed in 9b81660 Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants