Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> - bad error messages (even though that was a focus for the rust team!)

I would love to hear more! (If you have the time.)



Not the fault of Rust compiler per se but in my case the errors that mismatching trait impls from async libraries yield can be downright suicide-inducing.

I recognize this is not entirely on rustc though.


esteban of course gave you an excellent response already, but just another bit of like, context here: while it may not be on rustc, the developers want to go beyond the norm here. rustc understands if you write async/await syntax like JavaScript, and then directly proposes that you switch to the Rust syntax:

    pub async fn foo() -> i32 {
       unimplemented(); 
    }
    
    pub async fn bar() {
        let f = await foo();
    }
gives

    error: incorrect use of `await`
     --> src/lib.rs:6:13
      |
    6 |     let f = await foo();
      |             ^^^^^^^^^ help: `await` is a postfix operation: `foo().await`
It isn't on rustc to understand this either, but it helps a bunch of people, so the team does it anyway.


Check sibling reply. Sadly I never wrote those down. :(

I'll definitely do so going forward.

The problem is with that is the impostor syndrome: I legitimately can't tell if I am an idiot and skipped some basic Rust training, or the error messages are truly confusing and unproductive.

But your messages help. I'll just write those down and send them to GitHub's issue list.


I’m not working on Rust anymore, but the previous stated position on this, which as far as I know is still the case, is that if it’s confusing, you should file. Worst case scenario is “sort we can’t fix that” but it’s not an imposition to file issues. More is better. Because exactly as Esteban said, information is valuable. Even duplicates are valuable: they indicate that more than one person has run into this, and therefore it’s more valuable than an obscure issue only one person sees.


I can confirm all of this is still the case.

> I legitimately can't tell if I am an idiot and skipped some basic Rust training, or the error messages are truly confusing and unproductive.

It doesn't make a difference. The compiler can't assume any level of proficiency. If a topic requires you to read the docs, it should tell you so. There are some "basic" things it relies on, but for anyone with any level of experience programming should be able to read a diagnostic and either understand it outright or have enough clues about what to search for. So "this error is confusing because I didn't read chapter N of The Book" can be simplified to "this error is confusing."


Excellent. Keep up the good work, I (and others) appreciate it.


Having examples of these is useful to see what we could get rustc to do. The general case might be impossible to deal with in a generic way, but we can target specific patterns libraries use and emit custom errors for them. The problem with these is we have to be reactive: if we don't see a problematic patter ourselves (or it isn't reported to us), we can't do anything about them.


Unfortunately last I tried these code snippets was months ago, was rushing like mad because it was a startup and I couldn't afford to just stop and write everything down and... yeah, priceless info was lost.

Just recently I am making a comeback to rewriting a tokio 0.1 library to the latest version so I'll likely have a few examples that I can post... where? In GitHub issues?


GitHub works great for it, for diagnostic tickets in particular you can file them at https://github.com/rust-lang/rust/issues/new?assignees=&labe...

Even if it is an "it hurts when I do this" without more context it can be useful to bring the problem to our attention (but the more context you provide the higher the change we'll fix the problem).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: