Skip to content

error: cannot find macro panic in this scope #78333

Closed
@phlopsi

Description

@phlopsi

I tried this code:

#![no_implicit_prelude]

fn main() {
    ::std::todo!();
    ::std::unimplemented!();
}

(Playground)

I expected to see this happen:
Successful compilation

Instead, this happened:

   Compiling playground v0.0.1 (/playground)
error: cannot find macro `panic` in this scope
 --> src/main.rs:4:5
  |
4 |     ::std::todo!();
  |     ^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: cannot find macro `panic` in this scope
 --> src/main.rs:5:5
  |
5 |     ::std::unimplemented!();
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors

error: could not compile `playground`.

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

Meta

rustc --version --verbose Playground Stable Version:

1.47.0

The macros should be using $crate::panic!, instead of panic!.

Metadata

Metadata

Assignees

Labels

A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions