Skip to content

rustpkg strips all crate attributes other than pkgid #10947

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
sfackler opened this issue Dec 13, 2013 · 3 comments
Closed

rustpkg strips all crate attributes other than pkgid #10947

sfackler opened this issue Dec 13, 2013 · 3 comments

Comments

@sfackler
Copy link
Member

If I build a crate like https://github.com/sfackler/rust-ssl with rustpkg, almost all of the crate attributes are stripped:

> rustpkg install
> rustc --ls .rust/lib/x86_64-unknown-linux-gnu/librust-ssl-8dab4bb9-0.0.so
=Crate Attributes (8dab4bb9f4fff5ebdbe14781c77c825b6ca4ff68c0b80c2e27930d44964863cd)=
#[pkgid = "rust-ssl#0.0"]


=External Dependencies=
1 std-04ff901ef9eb93b7ed8d17b7ddf76fa8eb8b4c7295ad21af7133790d77381330-0.9-pre

But if I build with rustc, they aren't:

> rustc --lib lib.rs
> rustc --ls liblib-9ed81b85-0.0.so
=Crate Attributes (9ed81b850cddab4573c0cde384af6edb8ee6c46b3a139e41b05018f8c3b53079)=
#[feature(struct_variant, macro_rules)]
#[link(name = "rust-ssl",
       vers = "0.1",
       package_id = "github.com/sfackler/rust-ssl")]
#[doc(html_root_url = "http://sfackler.github.io/rust-ssl/doc/rust-ssl/")]
#[pkgid = "lib#0.0"]


=External Dependencies=
1 std-04ff901ef9eb93b7ed8d17b7ddf76fa8eb8b4c7295ad21af7133790d77381330-0.9-pre
@sfackler
Copy link
Member Author

It turns out that this line has been bogus for a while if you were missing a #[link] attribute and now a #[pkgid] attribute: https://github.com/mozilla/rust/blob/master/src/librustpkg/util.rs#L303

@metajack
Copy link
Contributor

Comparing https://github.com/mozilla/rust/blob/1755408d1a58684b6c9bce11aeceb18a1ec2d66e/src/librustpkg/util.rs#L309 with https://github.com/mozilla/rust/blob/master/src/librustpkg/util.rs#L303 it looks like it used to strip everything but link metadata.

The fix for this is to change crate.attrs = ~[...] into a push(...).

@metajack
Copy link
Contributor

This will be fixed by #10948

flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 30, 2023
Improve suggestion for [`needless_lifetimes`]

Fixes rust-lang#10093

changelog: [`needless_lifetimes`]: Suggestion now points at the elidable lifetimes, rather than the entire function declaration
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

2 participants