Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

make error description consistent with display #172

Merged
merged 4 commits into from May 24, 2017

Conversation

Projects
None yet
3 participants
@nivkner
Copy link
Contributor

nivkner commented May 24, 2017

Fixes #166

@budziq

This comment has been minimized.

Copy link
Contributor

budziq commented May 24, 2017

Hi @nivkner
Your PR fails due to tests::test_error_trait not being updated with the new description

@nivkner

This comment has been minimized.

Copy link
Contributor Author

nivkner commented May 24, 2017

Fixed, thanks.

@dtolnay
Copy link
Member

dtolnay left a comment

Could you refactor this to make sure the messages stay in sync? Maybe something like this:

fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
    formatter.write_str(self.description())
}
@nivkner

This comment has been minimized.

Copy link
Contributor Author

nivkner commented May 24, 2017

nightly only problem with use statements. Is that a change I should know about?

@dtolnay

This comment has been minimized.

Copy link
Member

dtolnay commented May 24, 2017

Oh 🦊 this is failing in the no_std build because Display is implemented but the #[cfg(feature = "use_std")] line means Error is not implemented, so Display cannot get the description from Error.

How about private statics instead? Used by both Display and Error.

static SET_LOGGER_ERROR: &'static str = "...";
@dtolnay
Copy link
Member

dtolnay left a comment

Nice, thank you!

@dtolnay dtolnay merged commit 502c712 into rust-lang-nursery:master May 24, 2017

1 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@nivkner nivkner deleted the nivkner:error-msg branch Jun 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.