Closed dtolnay closed 2 years ago
Could TypeId
somehow be used for this? It's const
in more recent builds.
In the interest of "principle of least surprise" I would suggest:
#[distributed_slice(X)]
should be equivalent to #[distributed_slice(::crate::X)]
–that is, if an explicit crate name is not provided, it should use the current crate name as a prefix. env-logger
. An alternative would be to explicitly include the target crate's version number in the section name and allow multiple versions to coexist. That would fit with cargo's existing willingness to work with multiple versions of crates in your dependency tree, since that's a situation people find themselves in in the real world.
The only unique identifier in the link section name currently is the name of the static. Multiple crates could make distributed slices with the same name. We should do one of: