Skip to content

Make fail message more presentable #15239

@SiegeLord

Description

@SiegeLord
Contributor

Given this code,

fn main()
{
    fail!("This is why you fail.")
}

the failure message looks like this

task '<main>' failed at 'This is why you fail.', test.rs:3

This is problematic as the useful information (the message passed to fail!)is buried inside the sentence. It'd be better if the failure message was on its own line, something akin to:

task '<main>' failed at test.rs:3, saying:

This is why you fail.

This format also allows for space to mention other useful information (e.g. issue #11704).

Activity

jooert

jooert commented on Dec 15, 2015

@jooert
Contributor

Is this still something we want to do? I have a small patch that implements something like this and would also fix #11704, but I'm not sure how many people really want another format for panic messages. Changing the format might also break existing tools (for example, there are several run-tests in this repo that expect a panic).

SiegeLord

SiegeLord commented on Dec 15, 2015

@SiegeLord
ContributorAuthor

I'd be all for it, I still find those messages hard to read even after all these years.

steveklabnik

steveklabnik commented on Dec 15, 2015

@steveklabnik
Member

@jooert you should submit it

added a commit that references this issue on Jan 26, 2016
SiegeLord

SiegeLord commented on Jan 27, 2016

@SiegeLord
ContributorAuthor

The pull request didn't really fix this bug... should I make another bug like this, or is this a wontfix now?

jooert

jooert commented on Jan 27, 2016

@jooert
Contributor

Oh sorry, that's because I didn't change the original pull request message. Perhaps @alexcrichton can comment on this?

alexcrichton

alexcrichton commented on Jan 27, 2016

@alexcrichton
Member

This is somewhat of a wontfix for now, the discussion of #30402 concluded that we likely don't want to radically change the format for now due to the concurrency/verbosity reasons mentioned. If this becomes extra onerous in the future, however, we can consider reformatting these messages.

added a commit that references this issue on Aug 21, 2023
7ca45dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @steveklabnik@alexcrichton@SiegeLord@jooert

      Issue actions

        Make fail message more presentable · Issue #15239 · rust-lang/rust