Skip to content

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

Description

@KSXGitHub

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

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions