Skip to content

compile error using fail! is confusing #11382

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
metajack opened this issue Jan 7, 2014 · 1 comment · Fixed by #18555
Closed

compile error using fail! is confusing #11382

metajack opened this issue Jan 7, 2014 · 1 comment · Fixed by #18555
Labels
A-syntaxext Area: Syntax extensions E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@metajack
Copy link
Contributor

metajack commented Jan 7, 2014

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.

@treeman
Copy link
Contributor

treeman commented Sep 15, 2014

Triage bump. Example from op now compiles correctly, this is still relevant:

fn main() { fail!(1.2); }

Gives

<std macros>:8:9: 8:32 error: cannot determine a type for this bounded type parameter: cannot determine the type of this number; add a suffix to specify the type explicitly
<std macros>:8         ::std::rt::begin_unwind($msg, &_FILE_LINE)
                       ^~~~~~~~~~~~~~~~~~~~~~~
<std macros>:1:1: 34:2 note: in expansion of fail!
tst.rs:1:13: 1:24 note: expansion site
<std macros>:8:9: 8:32 error: cannot determine a type for this bounded type parameter: cannot determine the type of this number; add a suffix to specify the type explicitly
<std macros>:8         ::std::rt::begin_unwind($msg, &_FILE_LINE)
                       ^~~~~~~~~~~~~~~~~~~~~~~
<std macros>:1:1: 34:2 note: in expansion of fail!
tst.rs:1:13: 1:24 note: expansion site
error: aborting due to 2 previous errors

For the duplicate errors see #16966.

@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 30, 2014
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-syntaxext Area: Syntax extensions E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants