Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.
This repository was archived by the owner on Mar 3, 2020. It is now read-only.

almost useless error messages #110

@estokes

Description

@estokes

I realize this crate is legacy, but at the moment it's the best way to write async software if you depend on anything from crates.io, which is basically every useful program one might want to write. Also, this could be a much bigger issue with proc macros that surely needs reporting, so, sometimes when developing a new program the compiler spits out error messages like this,

This happens on rustc 1.30.0-nightly (73c78734b 2018-08-05) and ever other version of nightly I tried (which believe me is quite a few more than I want to list)

error[E0507]: cannot move out of borrowed content

error[E0597]: borrowed value does not live long enough
   --> src/protocol.rs:339:5
    |
339 |     #[async]
    |     ^^^^^^^-
    |     |      |
    |     |      temporary value only lives until here
    |     temporary value does not live long enough
    |     borrow later used here

error: aborting due to 2 previous errors

This is almost completely useless, and I have to say, intensely frustrating. The horrible thing about this problem is that sometimes the error message is completely reasonable, and I have yet to identify a small example that triggers the behaviour, it doesn't seem to happen in small projects, but once a project crosses some complexity threshold the error context is getting totally clobbered by either async await, or proc macro. Another example, even more frustrating,

error[E0308]: match arms have incompatible types
  |
  = note: expected type `std::result::Result<protocol::Client, _>`
             found type `std::result::Result<(), _>`

error[E0308]: mismatched types

error: aborting due to 2 previous errors

That was the entire error message. It could be anywhere in the crate. Or even worse,

error[E0308]: mismatched types

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.

This one happened to be a u64 vs i64 type mismatch in a function call. The function expected i64 and was being passed a u64. The function being called wasn't async, but the caller was.

Barring a simple example, I can make the code available, it's only about 400 lines, just let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions