
Rust Internals
Discussions around the design and implementation of The Rust Programming Language
internals.rust-lang.org
Discussions around the design and implementation of The Rust Programming Language
internals.rust-lang.orgrustup, and testing your code with the new compiler. That is not a realistic number of hours for that. How it actually works as a hobbyist is that I set dependabot or renovate to create two PR once a month to lift dependencies. One for semver compst deps and one for semver breaking. If it builds and passes automated tests I can merge it. Otherwise I can look at the particular failure (sometimes new clippy lint and I deny warnings. If you don't want to deal with that just don't deny warnings in CI). That is nowhere near "a couple of hours". It might become a couple of hours in the worst case for semver major dependencies. zackw: > This is possible in C not just because C moves so very slowly, but also because C's metaprogramming capabilities are more powerful than Rust's in a couple of critical aspects, especially when augmented by a "configure" script -- it's no burden at all for me to put the handful of C2011 features that are useful to me under #ifdefs because I can trivially express "does this compiler have support for _Generic?" (for example) independently of "does this C library include the function strsignal?" As a hobbyist this isn't something I would aim for. Now I need to write the code twice, once for having the feature and once for not having it. Given my 1-2 hours per week for hobby programming, I'd rather not. Either I use the new way of doing things, or the old. Not both.i586-unknown-linux-gnu without additional target features works by temporarily changing the rounding mode using fldcw to round-towards-zero, converting to an integer using fistp, and then changes the rounding mode back using another fldcw. Oh, interesting. Always exciting to learn about new ways in which the non-SSE x86-32 targets are broken... Vorpal: > What about interrupt handlers or (as Alice pointed out) signal handlers? Do all targets guarantee that FP flags are saved/reset/restored when those happen? I'm pretty surr that isn't the case on embedded ARM at least, but maybe it is on Linux and similar. Yeah I hope they guarantee that, everything else sounds kind of broken. Vorpal: > The fact that this is stateful on most architectures is pretty bad. Yes, global state is bad. Sadly hardware engineers love global state so here we are... Vorpal: > Sorry, i somehow missed the last paragraph of your post. But it doesn't seem feasible to add this (safely) without declaring existing code for interrupt handlers unsound. That doesn't seem compatible with the Rust backward compatibility guarantee. I think it is already generally understood that it's fine to temporarily change the rounding mode in an inline asm block as long as you change it back before returning from that block. So I would argue that any setup where interrupt handlers inherit the rounding mode from whatever previous code that ran is already using a non-standard contract and has to manually ensure that all the code they link in will never change the rounding mode.