Skip to content

Replace try! with ? #995

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
Dec 9, 2018
Merged

Replace try! with ? #995

merged 1 commit into from
Dec 9, 2018

Conversation

asomers
Copy link
Member

@asomers asomers commented Dec 8, 2018

try! is not available in Rust 2018. It would be premature to convert the entire project to Rust 2018, since that would bump the minimum compiler to 1.31.0. But his change will help us when we do convert it eventually.

try! is not available in Rust 2018
@asomers asomers requested a review from Susurrus December 8, 2018 20:55
@asomers
Copy link
Member Author

asomers commented Dec 9, 2018

bors r+

bors bot added a commit that referenced this pull request Dec 9, 2018
995: Replace try! with ? r=asomers a=asomers

try! is not available in Rust 2018.  It would be premature to convert the entire project to Rust 2018, since that would bump the minimum compiler to 1.31.0.  But his change will help us when we do convert it eventually.

Co-authored-by: Alan Somers <[email protected]>
@Susurrus
Copy link
Contributor

Susurrus commented Dec 9, 2018

LGTM. However, what's the point of doing this now without a test checking that new PRs don't reintroduce these? I'd think it'd be easier if we moved to rust2018 in a concerted effort once we're willing to bump our Rust requirement to 1.31.

@asomers
Copy link
Member Author

asomers commented Dec 9, 2018

New PRs could absolutely break it. But I had to do the work of building with Rust 2018 in order to make sure that Nix wouldn't cause any problems for dependent 2018 crates. For example, another crate of mine had a public try method, so it couldn't easily be used by a 2018 crate. I didn't find any problems, but since I had to make all of those changes anyway I figured I would push them.

@Susurrus
Copy link
Contributor

Susurrus commented Dec 9, 2018

I thought that there were no implications on other crates when setting the Rust edition? I guess that's not the case?

@asomers
Copy link
Member Author

asomers commented Dec 9, 2018

Technically there aren't. But if the consuming crate wants to use Rust 2018, then it would have an awkward time calling a Nix method called try or async. It would have to call them like foo.r#try(), or something like that. I wanted to make sure we would have no such pitfalls.

@bors
Copy link
Contributor

bors bot commented Dec 9, 2018

@bors bors bot merged commit ca03573 into nix-rust:master Dec 9, 2018
@asomers asomers deleted the 2018_readiness branch December 9, 2018 02:51
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.

2 participants