#Works on debug, but not on release
29 messages · Page 1 of 1 (latest)
Can you post the code and full errors here?
Your bitshifts (>> <<) will lose information, so your message will only be decodable if the key happens to be 0
I can't say anything before seeing the code.
As text, please. All of it that's needed to reproduce the issue.
Throw it on the playground if possible.
Multiplication and division also lose information. What's the value of the key in debug and release (try printing it)?
?eval mode=release ```rust
#![allow(arithmetic_overflow)]
let byte = 100_u8;
byte * 23 / 23
Running `target/release/playground`
10
Running `target/debug/playground`
thread 'main' panicked at 'attempt to multiply with overflow', src/main.rs:4:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The problem is most likely not running in release, but the random key being different in debug and release
Oh wait, I misread the code, i didn't see the as usize part
Then there's absolutely nothing in the code you posted that could be different in release, which means that the error is somewhere else
Why are we guessing?
I just want to see the code.
make a playground link with all the code needed to reproduce the issue
The playground doesn't support defining your own procedural macros. Replace rand!() with the value it produces when compiled instead
If the issue goes away, then it was a problem with the procedural macro
Does the procedural macro create a random number? If so, then that is probably causing the problem. rustc expects procedural macros to produce the same value each time (given the same arguments), and making it produce different values could possibly make the value of KEY different in different places of the code (because of the caching from incremental compilation)
Replace the rand!() call with a number (like 12) and see if it works in debug and release
output is in usize
I highly recommend against compile time random numbers. They end up breaking things in all sorts of ways. Changing the const to a static might help but apart from that I can't help you
why in compiling where i println!() key it is the same number?
I realized that later. I have a harder time reading images than text
It probably has something to do with how the compiler is implemented. Don't rely on it as it will probably change in some future version
ok
Then I'm out of ideas