2 ms·
Regular variable definition shadows. Macros expand to regular Rust code, they could always be replaced by the expanded body.
by steveklabnik 8mo ago
Regular variable definition shadows. Macros expand to regular Rust code, they could always be replaced by the expanded body.
- kobebrookskC3 8mo agoyes, but the code inside is unsafe. the pin macro is like a safe function.
- steveklabnik 8mo agoI'm not sure what that has to do with anything. The macro isn't what makes it safe. The unsafe code being properly written is.
- kobebrookskC3 8mo agobut without macros, how would you expose a safe interface? fn pin(x: T) -> Pin<&mut T> { ... } would move the value
- Philpax 8mo agoYour macroless variant of Rust would offer a safe builtin that does this. It doesn't need to be implemented with a macro.