thisKai / rust-windows-dll

Macro for dynamically loading windows dll functions
MIT License
19 stars 6 forks source link

Don't error when Result is shadowed #1

Closed roblabla closed 3 years ago

roblabla commented 4 years ago

Currently, if Result is redefined in the same context #[dll] is used, it will cause a compiler error:

error[E0107]: wrong number of type arguments: expected 1, found 2
   --> src/lib.rs:4:1
    |
4   | #[dll("user32.dll")]
    | ^^^^^^^^^^^^^^^^^^^^^^ unexpected type argument
    |
    = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

To avoid this, we reexport Result from our crate, and access it through our crate name.

We don't use it through std to avoid cases where std might be renamed (unsure if it can happen, but better safe than sorry).

thisKai commented 3 years ago

Thanks! I had a feeling I'd missed something like this