On 15.07. 13 23:37, Patrick Walton wrote:

>On 7/14/13 1:04 PM, Svetoslav Neykov wrote:

>> ."unsafe" is not a normal block and doesn't return a value, can't be

>> used as an expression. This made it impossible to wrap the unsafe casts

>> from fixed memory locations to borrowed pointers in macros. Instead I

>> had to use inline functions and assign the resulting value to a local

>> function variable.

> 

>This should not be the case. There may be a bug in the way macros 

>interact with unsafe checking. Do you have a test case by any chance?

 

Yes, my bad. I double checked, there is no problem using "unsafe" as an
expression or wrapping it inside of a macro.

The real problem, turns out, is that the macro can't be used as an
expression unless wrapped inside parentheses.

GPIOD!().MODER //doesn't compile (error: unexpected token: `.`)

(GPIOD!()).MODER //OK

 

Svetoslav.

 

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to