Skip to content

Accessing the crate's version and name from within #8129

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
Seldaek opened this issue Jul 30, 2013 · 6 comments
Closed

Accessing the crate's version and name from within #8129

Seldaek opened this issue Jul 30, 2013 · 6 comments
Labels
A-syntaxext Area: Syntax extensions

Comments

@Seldaek
Copy link
Contributor

Seldaek commented Jul 30, 2013

It would be great to have a way to access the values in:

#[link(name = "blob", vers = "1.0", author = "foo")];

To print usage info in executables without duplicating this info.

@brson
Copy link
Contributor

brson commented Jul 31, 2013

The solution could maybe be related to that of #5642

@emberian
Copy link
Member

This was recently requested. Given that we have a unified crate_id now, a crate_version!() would probably be appropriate.

@alexcrichton
Copy link
Member

Cargo is now responsible for versions and exports version numbers through environment variables. Rustc, however, is still responsible for the name of the crate, so all that's really necessary to do here would be to expose the crate name via some sort of syntax extension (possibly)

@steveklabnik
Copy link
Member

@alexcrichton couldn't the Cargo.toml entry for name be exposed just like the version ones are?

@alexcrichton
Copy link
Member

@steveklabnik yes that's just passed in through --crate-name which is what the compiler would expose.

@steveklabnik
Copy link
Member

I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.

This issue has been moved to the RFCs repo: rust-lang/rfcs#782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntaxext Area: Syntax extensions
Projects
None yet
Development

No branches or pull requests

5 participants