Skip to content

assert! in edition 2018 has a non-hygienic use of panic! #56389

Closed
@Nemo157

Description

@Nemo157

This code runs fine on edition 2015, and has no warnings with #![warn(rust_2018_compatibility)], but fails to compile on edition 2018 (playground):

#![no_implicit_prelude]

fn main() {
    assert!(true);
}

error message:

error: cannot find macro `panic!` in this scope
 --> src/main.rs:4:5
  |
4 |     assert!(true);
  |     ^^^^^^^^^^^^^^
  |
  = help: have you added the `#[macro_use]` on the module/import?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions