Skip to content

Adapted @BurntSushi's blog post to new error handling guide. #28301

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

Merged
merged 1 commit into from
Sep 10, 2015
Merged

Adapted @BurntSushi's blog post to new error handling guide. #28301

merged 1 commit into from
Sep 10, 2015

Conversation

alexispurslane
Copy link
Contributor

This was @steveklabnik's idea. Thanks @BurntSushi for the awesome blog post!
r? @steveklabnik

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@BurntSushi
Copy link
Member

Beat me to it! Part of what was taking me so long was fixing the doc tests. It looks like a lot of yours will fail if you run rustdoc --test on it (which I assume is part of the build process).

@alexispurslane
Copy link
Contributor Author

Oh.

@alexispurslane
Copy link
Contributor Author

Hmm. Yeah. 41 fail. That's strange.

@BurntSushi
Copy link
Member

@ChristopherDumas It's because of the way I setup the code. The code is itself defined in the article, but it is extracted and stitched together to generate full Rust programs, which collectively form a Cargo package. This alleviated me from having a bunch of # fn some_func_defined_earlier_but_used_again() { ... } everywhere. I was adding those in, but it looks like the task has fallen to you. :-)

@BurntSushi
Copy link
Member

@ChristopherDumas And you'll probably have to ignore a lot of the tests at the end in the case study since they use external crates.

@steveklabnik
Copy link
Member

Okay, so this is relevant, but this is why I said it shouldn't take too much editing: https://users.rust-lang.org/t/the-rust-programming-language-is-going-to-be-published-by-no-starch-press/2777

TL;DR: we're gonna get the book published, so I will have a Real Editor reading over it at some point, so we can take care of any problems then. 🎊

@alexispurslane
Copy link
Contributor Author

Ok. But I'll still be looking at it to see if theres an easier way to get the tests to run.

chapter will explore those stumbling blocks and demonstrate how to use the
standard library to make error handling concise and ergonomic.

## Table of Contents
Copy link
Member

Choose a reason for hiding this comment

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

One question is: do we leave this in?

Copy link
Member

Choose a reason for hiding this comment

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

The wording may not be appropriate, but I am a fan of delivering a key message somewhere early on: Rust does error handling with return values, not exceptions. However... When I wrote the blog post, I assumed some familiarity with Rust and at least one other programming language, so that message is useful is establishing context. I'm not exactly sure how to calibrate that to TRPL.

Copy link
Member

Choose a reason for hiding this comment

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

I'm more thinking that this chapter having its own TOC is unusual; it is helpful here, but also, more sub-headings in rustbook might be a good thing as well. I dunno :/

Copy link
Member

Choose a reason for hiding this comment

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

(I do think that that message should be delivered early too)

Copy link
Member

Choose a reason for hiding this comment

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

Oh! I misunderstood. I very much defer to your judgment on the ToC. :-)

@steveklabnik
Copy link
Member

steveklabnik commented Sep 10, 2015 via email

@alexispurslane
Copy link
Contributor Author

OK, I've added curly quotes.

@steveklabnik
Copy link
Member

Okay! I think this is good to go. We just need

  1. the llvm change still needs to go
  2. squash it down

r=me afterwards!

@alexispurslane
Copy link
Contributor Author

@steveklabnik What does r=me mean?

@BurntSushi
Copy link
Member

@ChristopherDumas For squashing, I think you want to rebase your branch against master. Usually what I do is (with your branch checked out and master up to date) git rebase -i master. Then squash all the commits into one. Then it should give you an opportunity to rewrite the commit message for one commit with all your changes.

@alexispurslane
Copy link
Contributor Author

@BurntSushi I tried to do this, but it couldn't apply one of the commits, (the one with the merge conflict). Any advice?

@alexispurslane
Copy link
Contributor Author

OK, I squashed all of the commits!

@alexispurslane
Copy link
Contributor Author

@BurntSushi @steveklabnik Were ready to merge this!

@alexispurslane
Copy link
Contributor Author

🎊

@alexispurslane
Copy link
Contributor Author

@bors r=@steveklabnik

@alexispurslane
Copy link
Contributor Author

@BurntSushi is this command correct? @bors=@steveklabnik

@BurntSushi
Copy link
Member

@ChristopherDumas Incidentally, I am not well versed in the language of bors. Best to wait for @steveklabnik to come and get it squared away. :-)

@alexispurslane
Copy link
Contributor Author

Is there a manual for bors? It seems like having one would be a good idea.

@alexispurslane
Copy link
Contributor Author

I think my command was correct, but because I'm not a collaborator or an owner, bors ignored me.

@BurntSushi
Copy link
Member

@ChristopherDumas Well, only people with access can wield the power of bors.

@alexispurslane
Copy link
Contributor Author

Can you try my command? You have access...

@pnkfelix
Copy link
Member

@bors r=steveklabnik

@bors
Copy link
Collaborator

bors commented Sep 10, 2015

📌 Commit e181226 has been approved by steveklabnik

@steveklabnik
Copy link
Member

@bors: r+

On Sep 10, 2015, at 12:49, Christopher Dumas [email protected] wrote:

@BurntSushi @steveklabnik Were ready to merge this!


Reply to this email directly or view it on GitHub.

@bors
Copy link
Collaborator

bors commented Sep 10, 2015

📌 Commit e181226 has been approved by steveklabnik

@steveklabnik
Copy link
Member

Yup! Bors only listens to people who have permissions. It's useful because if another committer came along, they could authorize it on my behalf.

On Sep 10, 2015, at 12:49, Christopher Dumas [email protected] wrote:

@BurntSushi @steveklabnik Were ready to merge this!


Reply to this email directly or view it on GitHub.

@alexispurslane
Copy link
Contributor Author

@steveklabnik is there a manual for bors yet?

bors added a commit that referenced this pull request Sep 10, 2015
…r=steveklabnik

This was @steveklabnik's idea. Thanks @BurntSushi for the awesome blog post!
r? @steveklabnik
@bors
Copy link
Collaborator

bors commented Sep 10, 2015

⌛ Testing commit e181226 with merge 98eeded...

@bors bors merged commit e181226 into rust-lang:master Sep 10, 2015
@BurntSushi
Copy link
Member

🎉 Nice work @ChristopherDumas! :D

@alexispurslane
Copy link
Contributor Author

Thanks! And thank you for the help, and the great blog post!

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.

6 participants