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

replace Void with Infallible + small fixes #100

Merged
merged 1 commit into from
Nov 8, 2019

Conversation

burrbull
Copy link
Member

@TheZoq2
Copy link
Member

TheZoq2 commented Aug 17, 2019

Ohh, that's a neat feature. The change looks good to me, but the dependency on the void crate should probably be removed from Cargo.toml

@burrbull
Copy link
Member Author

@TheZoq2
Copy link
Member

TheZoq2 commented Aug 17, 2019

Ah right, makes sense. I guess we might want to submit a PR to fix that in embedded-hal at some point.

@burrbull
Copy link
Member Author

Yes. But in any case it will be breaking change.

@burrbull
Copy link
Member Author

@TheZoq2
Copy link
Member

TheZoq2 commented Aug 24, 2019

Do we want to merge this now, or wait for the embedded-hal PR to land? If we do it now, we'll get another breaking change after the PR, right?

@burrbull
Copy link
Member Author

This part of changes shouldn't break user code (I hope).

@TheZoq2
Copy link
Member

TheZoq2 commented Aug 24, 2019

I think it will, we are changing public API after all.

For example, someone might have written wrapper functions around the GPIO pins like this

fn do_something_with_pins(...) -> Result<Something, Void> {
   pin.set_high()?; // ? Operator no longer works because return type changed from Void to Infallible
}

@burrbull
Copy link
Member Author

Looks like you are right.
Have you seen this somewhere is used.

@TheZoq2
Copy link
Member

TheZoq2 commented Aug 24, 2019

No, I don't think I have. It also seems like kind of a weird thing to do if you understand the point of the Void type.

It might not make a difference though. We already have breaking changes staged for the next release, so we might as well throw this in. When embedded-hal updates, that too will be a breaking change (probably).

@TeXitoi
Copy link
Contributor

TeXitoi commented Aug 24, 2019

@TheZoq2
Copy link
Member

TheZoq2 commented Sep 24, 2019

I'm pretty much fine with merging this, though the embedded-hal discussion brought up a good question. Do we have a minimum supported rust version?

I don't mind "latest stable" at all, but perhaps someone else has concerns about it. @therealprof What do you think?

@TheZoq2
Copy link
Member

TheZoq2 commented Oct 27, 2019

rust-lang/rust#65355

Looks like the never type will be included in 1.40 🎉. Do we still want to merge this, and then move to ! or go straight to !? My vote is on the latter, as both things will be breaking changes

@burrbull
Copy link
Member Author

By the way is there issue to disable #[must_use] check for Result<smth, !> to not write .unwrap() everywhere?

@TheZoq2
Copy link
Member

TheZoq2 commented Oct 27, 2019

That's a good question, it would certainly be nice

Also, I may have been too quick with my previous message. The comments on that rust-lang issue suggest that there is still some work to be done for it to stabilize.

@TheZoq2
Copy link
Member

TheZoq2 commented Oct 27, 2019

I submitted an issue here: rust-lang/rust#65861

@therealprof
Copy link
Member

I don't mind "latest stable" at all, but perhaps someone else has concerns about it. @therealprof What do you think?

I would prefer to stay a couple of versions behind the latest and the greatest. Infallible is AFAIK planned to automatically turn into the never type as soon as supported by the compiler so switching to Infallible now seems like the right approach to me.

@burrbull
Copy link
Member Author

burrbull commented Nov 4, 2019

Rebased

@TheZoq2
Copy link
Member

TheZoq2 commented Nov 8, 2019

Great! would you mind moving the changelog entry to the "Brekaing changes" section? Other than that, I think this is ready to be merged

@burrbull
Copy link
Member Author

burrbull commented Nov 8, 2019

Done.

@TheZoq2
Copy link
Member

TheZoq2 commented Nov 8, 2019

Lovely, thanks!

@TheZoq2 TheZoq2 merged commit 9ac0bb4 into stm32-rs:master Nov 8, 2019
@burrbull burrbull deleted the infallible branch December 3, 2019 15:53
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.

4 participants