mahkoh
mahkoh
>Additionally values that contain no pointers to heap allocations are allowed as the final value of a constant. So `mem::transmute::()` is undefined behavior in `const fn`?
One more question: Let's say I have a function `fn new() -> T` and `T` stores pointers to heap allocations as `usize` (maybe because it wants to store additional information...
>If you did, there would be a constant of type usize that could be used in promotion, and thus cause an error there. So once a constant is created, you...
>No, you can't do anything with a pointer beyond offset it Really? If that is so then I have no concerns. But it was my understanding that transmuting from pointer...
Actually, doesn't this scheme allow you to implement transmute yourself? E.g. ```rust fn transmute(t: T) -> U { let a: *mut T = allocate(); ptr::write(a, t); let u = ptr::read(a...
I'm sorry but I still don't get it. Where is the error in the following code: ```rust const ADDR: usize = { let b: Box = Box::new_in(42, ConstGlobal); let v:...
So the answer to > > So once a constant is created, you know for each individual bit of that constant if it was computed using the address of a...
Ok then I see no way to have UB using this method. But some containers that use the address of a pointer as a number will not work. E.g. the...
This seems to compile: ``` rust extern crate comm; use comm::spsc::one_space; use std::thread; pub fn oneshot(ms: u32) -> one_space::Consumer
I assume you're aware that it's possible to send types with non-static lifetimes over channels. For example, you can send references to stack variables between scoped threads. This alone does...