Repository navigation
Conversation
alejandro-vaz
left a comment
There was a problem hiding this comment.
it works but I don't think this is the way
I was thinking more of having conditional visibility based on attributes
something similar to what the add-syntax crate does but just about visibility
|
I found a crate called |
|
yeah but we can't add the crate as dependency this is smallvec, each dependency is a potential risk, and depending on small crates with an unknown dependency graph is extremely risky for the ecosystem whatever we do, it has to be self-hosted |
|
i think we can write our own proc-marco, do the same thing as |
|
yeah I think that's the way |
0909ccf to
70aec69
Compare
|
wait wait wait let's think through it again I don't like the idea we have another crate to publish |
|
don't we have any way to do the same thing without having a completely new crate to publish?? |
|
hi, I've updated the PR to implement the proc-macro we discussed — it works, and there are no external dependencies. but proc macros have to live in their own crate, That feels like a lot of overhead for something small. |
I also find it quite odd, but I'm not sure how else to implement it. |
maybe just back to the original approach instead, copy the api twice? |
|
I don't like copying things twice, it's just a bad practice can we hack ourselves into it with a simple macro-rules macro that injects a like macro_rules! public {
($attribute:meta) => {{
#[cfg($attribute)]
pub
}}
}or something weird like that, idk |
70aec69 to
5035f99
Compare
| // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
| // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
| // option. This file may not be copied, modified, or distributed | ||
| // except according to those terms. |
There was a problem hiding this comment.
we can move this file to src/macros.rs and convert that file to a proc-macro crate itself and then take the normal smallvec crate and re-export all those macros
There was a problem hiding this comment.
now that I think about it, this means we have to publish a new crate
I don't like that idea
|
the only thing I don't like about this approach is that processing the token stream disables IDE help |
5035f99 to
b6838f3
Compare
tried it on my vscode + rust-analyzer (0.3.3073) and completion works fine inside |
|
fuck me, give me some time to think about it and we'll see what we do |
|
okay you there?? I have found the way look at #764 I'll get that merged and then you can use it for this PR it basically is a private procedural macro similar to |
issue #725
when no allocator feature is enabled, hide them from public API