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

::core::assert! in #![no_implicit_prelude] fails to compile because it calls panic! instead of ::core::panic! #84357

Closed
KSXGitHub opened this issue Apr 20, 2021 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@KSXGitHub
Copy link

I tried this code:

#![no_implicit_prelude]

fn main() {
    ::core::assert!(false, "wow");
}

playground.

I expected to see this happen: It panics at runtime.

Instead, this happened: It fails to compile.

error: cannot find macro `panic` in this scope
 --> src/main.rs:4:5
  |
4 |     ::core::assert!(false, "wow");
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: consider importing one of these items:
          core::panic
          pin_utils::core_reexport::panic
          std::panic
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

Meta

rustc --version --verbose:

rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1
@KSXGitHub KSXGitHub added the C-bug Category: This is a bug. label Apr 20, 2021
@syvb
Copy link
Contributor

syvb commented Apr 23, 2021

This is a known issue that will be fixed in Rust 2021: #78343 (comment)

@camelid
Copy link
Member

camelid commented Nov 12, 2021

Looks like it's fixed now that Rust 2021 is stable.

@camelid camelid closed this as completed Nov 12, 2021
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.
Projects
None yet
Development

No branches or pull requests

3 participants