Skip to content

compile error using fail! is confusing #11382

Closed
@metajack

Description

@metajack

This program:

pub fn main() {
    let s: &str = "foo";
    fail!(s);
}

generates this error:

<std-macros>:37:13: 37:36 error: instantiating a type parameter with an incompatible type `&str`, which does not fulfill `Send`
<std-macros>:37             ::std::rt::begin_unwind($msg, file!(), line!())
                            ^~~~~~~~~~~~~~~~~~~~~~~
<std-macros>:32:5: 42:6 note: in expansion of fail!
badfail.rs:3:5: 3:14 note: expansion site
error: aborting due to previous error

It does point you to the right place if you read it close, but I missed it myself the first few times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions