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

Please the compiler by suppling type hints. #3

Closed
wants to merge 1 commit into from

Conversation

HenkKalkwater
Copy link

First of all: Rust is not a language I have a good understanding of, although I do have some background in C++ and its memory management. Please request changes when I did something ugly in Rust, because I most certainly did.

I accidentally made an issue on the project this project was forked on about this (sile#2), but in short, I noticed when compiling this project, I got the following error on rustc 1.49:

error[E0282]: type annotations needed
   --> /build/mumblewebproxy-vendor.tar.gz/rtp/src/rfc3711.rs:476:19
    |
475 |         let iv = iv ^ (BigUint::from(1_u8) << (context.session_encr_key.len() * 8));
    |             -- consider giving `iv` a type
476 |         let iv = &iv.to_bytes_be()[1..context.session_encr_key.len() + 1];
    |                   ^^ cannot infer type
    |
    = note: type must be known at this point

error[E0282]: type annotations needed
   --> /build/mumblewebproxy-vendor.tar.gz/rtp/src/rfc3711.rs:512:19
    |
511 |         let iv = iv ^ (BigUint::from(1_u8) << (context.session_encr_key.len() * 8));
    |             -- consider giving `iv` a type
512 |         let iv = &iv.to_bytes_be()[1..context.session_encr_key.len() + 1];
    |                   ^^ cannot infer type
    |
    = note: type must be known at this point

error: aborting due to 2 previous errors

This pull request fixes this compile error. I've run the unit tests as well (with cargo test) and they still seem to work.

@HenkKalkwater
Copy link
Author

It may be caused by rust-lang/rust#81317. It also seems like @Skgland made a more elegant workaround in Skgland@83eb4dd, but as far as I've seen, he has made no pull request yet.

@Skgland
Copy link

Skgland commented Feb 26, 2021

It may be caused by rust-lang/rust#81317. It also seems like @Skgland made a more elegant workaround in Skgland@83eb4dd, but as far as I've seen, he has made no pull request yet.

Yeah, the mentioned Issue is exactly this, I opened that Issue as I noticed that this stopped to compile as I upgraded my rustc.

I have now also opened #4 with my workaround.

@HenkKalkwater
Copy link
Author

HenkKalkwater commented Feb 26, 2021

In that case, please merge #4 over this one. Anyways, I've learned some Rust while trying to fix this, so I don't feel like I wasted my effort :)

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