Skip to content

stringify! space adds strange space before :tt symbol #65940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stevenroose opened this issue Oct 29, 2019 · 1 comment
Closed

stringify! space adds strange space before :tt symbol #65940

stevenroose opened this issue Oct 29, 2019 · 1 comment

Comments

@stevenroose
Copy link

stevenroose commented Oct 29, 2019

Ok sorry for the strange title at first, that was my search query entered in a wrong text box.

So I'm trying to use a macro to use a string and prefix it for usage in a build tag.

But the issue is quite well summed up in this code snippet:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9905252de14993fa6a31b3c73c5d0a01

The result is prefix_ doe. Note the space.

Seems to be related to #55658. But in his example he does some much more complex things.

@stevenroose stevenroose changed the title stringify space stringify! space adds strange space before :tt symbol Oct 29, 2019
@ExpHP
Copy link
Contributor

ExpHP commented Oct 29, 2019

Yes. You stringified two identifiers, so the output deliberately contains a space to ensure it contains two identifiers.

If you need to concatenate identifiers, look at the paste crate.

Alternatively, since you're already stringifying:

concat!("prefix_", stringify!($symbol))

@Centril Centril closed this as completed Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants