3 ms·
This is about rust though and thats not really possible there (at least to my knowledge). You should get a compiler error if you attempt this. I got very littl
by 411111111111111 4y ago
This is about rust though and thats not really possible there (at least to my knowledge).
You should get a compiler error if you attempt this.
I got very little experience in rust though, so there might be a way (I'm just not aware of) to circumvent this check
- maxbond 4y agoIndeed, you can use interior mutability to accomplish this: https://doc.rust-lang.org/reference/interior-mutability.html https://doc.rust-lang.org/reference/interior-mutability.html Usually (read: near universally) something that provides interior mutability will implement a runtime check to protect you (eg, a lock), but you could make a footgun if you were cavalier about it. And recent I misused a framework (I kept a value returned by the framework around that should've been dropped) without realizing it was holding locks internal to the framework, and ended up with a tricky to diagnose deadlock (though only tricky before I hadn't read the documentation as closely as I should've).