Why does Rust not implement DerefMut when Deref is specified?

You could still mark the impl Deref for MyType block though, or derive(DerefMut, Deref(field = "foo")) on the type.

That is true for user-provided macros, but not for built-in macros. While all built-in macros currently operate strictly on the tagged item, they could theoretically access any other part of code. With that said, there are other solutions that I have explored that make more sense and would be less magical.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.