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

mismatched types with from_le_bytes #56902

Closed
Mark-Simulacrum opened this issue Dec 17, 2018 · 4 comments
Closed

mismatched types with from_le_bytes #56902

Mark-Simulacrum opened this issue Dec 17, 2018 · 4 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Mark-Simulacrum
Copy link
Member

https://crater-reports.s3.amazonaws.com/beta-1.32-1/beta-2018-12-05/reg/tinkerforge-2.0.5/log.txt

Dec 10 00:57:00.056 INFO [stderr] error[E0308]: mismatched types
Dec 10 00:57:00.056 INFO [stderr]   --> src/bindings/accelerometer_bricklet.rs:92:48
Dec 10 00:57:00.056 INFO [stderr]    |
Dec 10 00:57:00.056 INFO [stderr] 92 |         Acceleration { x: <i16>::from_le_bytes(&bytes[0..2]), y: <i16>::from_le_bytes(&bytes[2..4]), z: <i16>::from_le_bytes(&bytes[4..6]) }
Dec 10 00:57:00.056 INFO [stderr]    |                                                ^^^^^^^^^^^^ expected array of 2 elements, found &[u8]
Dec 10 00:57:00.056 INFO [stderr]    |
Dec 10 00:57:00.056 INFO [stderr]    = note: expected type `[u8; 2]`
Dec 10 00:57:00.056 INFO [stderr]               found type `&[u8]`
Dec 10 00:57:00.056 INFO [stderr] 
Dec 10 00:57:00.096 INFO [stderr] error[E0308]: mismatched types
Dec 10 00:57:00.096 INFO [stderr]   --> src/bindings/accelerometer_bricklet.rs:92:87
Dec 10 00:57:00.096 INFO [stderr]    |
Dec 10 00:57:00.096 INFO [stderr] 92 |         Acceleration { x: <i16>::from_le_bytes(&bytes[0..2]), y: <i16>::from_le_bytes(&bytes[2..4]), z: <i16>::from_le_bytes(&bytes[4..6]) }
Dec 10 00:57:00.096 INFO [stderr]    |                                                                                       ^^^^^^^^^^^^ expected array of 2 elements, found &[u8]
Dec 10 00:57:00.096 INFO [stderr]    |
Dec 10 00:57:00.096 INFO [stderr]    = note: expected type `[u8; 2]`
Dec 10 00:57:00.096 INFO [stderr]               found type `&[u8]`
Dec 10 00:57:00.096 INFO [stderr] 
Dec 10 00:57:00.140 INFO [stderr] error[E0308]: mismatched types
Dec 10 00:57:00.140 INFO [stderr]   --> src/bindings/accelerometer_bricklet.rs:92:126
Dec 10 00:57:00.140 INFO [stderr]    |
Dec 10 00:57:00.140 INFO [stderr] 92 |         Acceleration { x: <i16>::from_le_bytes(&bytes[0..2]), y: <i16>::from_le_bytes(&bytes[2..4]), z: <i16>::from_le_bytes(&bytes[4..6]) }
Dec 10 00:57:00.140 INFO [stderr]    |                                                                                                                              ^^^^^^^^^^^^ expected array of 2 elements, found &[u8]
Dec 10 00:57:00.140 INFO [stderr]    |
Dec 10 00:57:00.140 INFO [stderr]    = note: expected type `[u8; 2]`
Dec 10 00:57:00.140 INFO [stderr]               found type `&[u8]`
@Mark-Simulacrum Mark-Simulacrum added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Dec 17, 2018
@alexcrichton
Copy link
Member

cc @rust-lang/libs, this is a regression from #56207, tracking the issue #52963. We added from_le_bytes inherent methods to integer types, and they're shadowing trait-based methods that were presumably already in scope.

Also cc @rtrbt as you're listed as the owner of this crate on crates.io, good to give you a heads up!

@SimonSapin
Copy link
Contributor

This seems like business as usual, unless we decide to never add new methods to existing language or standard library types.

@rtrbt
Copy link

rtrbt commented Dec 21, 2018

I've fixed it on my end. Thank you for ccing.

@alexcrichton
Copy link
Member

Thanks for the heads up @rtrbt!

I'm going to preemptively close this as mentioned by @SimonSapin this is a pretty standard change/breakage, but if others from libs disagree feel free to comment so!

If anyone runs into this into the wild and has difficulty upgrading and/or fixing the issue, also please comment here and let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants