dtolnay / linkme

Safe cross-platform linker shenanigans
Apache License 2.0
628 stars 42 forks source link

Reexport generated macro #19

Closed arcnmx closed 5 years ago

arcnmx commented 5 years ago

Fixes #18 by allowing definition of slices from non-crate-root contexts such as a module to work as one would expect. Feels like a kind of hacky solution, but I'm not familiar enough with rust's macro path resolution rules to know of a better one. I included a 2015 edition test just to be sure that it doesn't break anything (and I'm somewhat surprised that it works?).

arcnmx commented 5 years ago

(sorry for all the force-pushes, I kept finding very small cleanups to make, I'm done now)

arcnmx commented 5 years ago

Addressed things and cleaned it up a bit, but was unable to get it to work with rustc 1.31.x - which didn't like the use like because imports can only refer to extern crate names passed with --extern on stable channel (see issue #53130). It seems that use something to refer to current scope only started working in 1.32.0? I'm not sure of a way to work around this, though there's always the option of using rustversion to revert to the previous approach (and just accept that only definitions at the crate root will work with 1.31).

(there were also some weird visibility issues on 1.31.x but I think those have workarounds)

dtolnay commented 5 years ago

Published in 0.1.6.