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

Improve TOML decoding error messages #3794

Merged
merged 1 commit into from
Mar 8, 2017

Conversation

alexcrichton
Copy link
Member

Unfortunately while #[serde(untagged)] is precisely what we want in terms of
semantics it leaves a little to be desired in terms of error messages. This
commit updates to remove the usage of that attribute in favor of implementing
Deserialize directly, which is quite simple in these few cases.

Closes #3790

@rust-highfive
Copy link

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

{
Ok(PathValue::String(String::deserialize(deserializer)?))
}
}
Copy link
Member

@matklad matklad Mar 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are writing custom deserialization anyway, maybe we can remove String variant from the enum?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed!

Unfortunately while `#[serde(untagged)]` is precisely what we want in terms of
semantics it leaves a little to be desired in terms of error messages. This
commit updates to remove the usage of that attribute in favor of implementing
`Deserialize` directly, which is quite simple in these few cases.

Closes rust-lang#3790
@matklad
Copy link
Member

matklad commented Mar 8, 2017

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 8, 2017

📌 Commit cb53e1b has been approved by matklad

@bors
Copy link
Contributor

bors commented Mar 8, 2017

⌛ Testing commit cb53e1b with merge 64339d8...

bors added a commit that referenced this pull request Mar 8, 2017
Improve TOML decoding error messages

Unfortunately while `#[serde(untagged)]` is precisely what we want in terms of
semantics it leaves a little to be desired in terms of error messages. This
commit updates to remove the usage of that attribute in favor of implementing
`Deserialize` directly, which is quite simple in these few cases.

Closes #3790
@bors
Copy link
Contributor

bors commented Mar 8, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: matklad
Pushing 64339d8 to master...

@bors bors merged commit cb53e1b into rust-lang:master Mar 8, 2017
@alexcrichton alexcrichton deleted the better-errors branch April 20, 2017 18:40
@ehuss ehuss added this to the 1.17.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in quality of TOML type mismatch error messages
6 participants