Skip to content
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

Ignore build commit and build date from build artifacts for proc macros #9916

Closed
sp1ritCS opened this issue Aug 16, 2021 · 3 comments · Fixed by #9936
Closed

Ignore build commit and build date from build artifacts for proc macros #9916

sp1ritCS opened this issue Aug 16, 2021 · 3 comments · Fixed by #9936

Comments

@sp1ritCS
Copy link
Contributor

sp1ritCS commented Aug 16, 2021

I'm running rustc 1.54.0 provided by my distribution (openSUSE Tumbleweed). However, different to the rustc compiled for rustup, running rustc --version just returns

rustc 1.54.0

without any additional (commit builtdate) suffix. However
https://github.com/rust-analyzer/rust-analyzer/blob/b641a66078ce2f2363e9a3b050ba448b93fb7cb6/crates/proc_macro_api/src/version.rs#L41
tries to parse it and thus throws an error on projects using proc macros:

proc-macro /home/admin/workspace/utopia/core/target/debug/deps/libpin_project_internal-626b9b04409c0257.so failed to find the given version. Reason: no commit info
Failed to find proc macros. Error: ExpansionError(
    "Cannot create expander for /home/admin/workspace/utopia/core/target/debug/deps/libpin_project_internal-626b9b04409c0257.so: Io(Custom { kind: InvalidData, error: \"no commit info\" })",
)
proc-macro /home/admin/workspace/utopia/core/target/debug/deps/libserde_derive-06f5854d568d3852.so failed to find the given version. Reason: no commit info
Failed to find proc macros. Error: ExpansionError(
    "Cannot create expander for /home/admin/workspace/utopia/core/target/debug/deps/libserde_derive-06f5854d568d3852.so: Io(Custom { kind: InvalidData, error: \"no commit info\" })",
)
proc-macro /home/admin/workspace/utopia/core/target/debug/deps/libserde_derive-06f5854d568d3852.so failed to find the given version. Reason: no commit info
Failed to find proc macros. Error: ExpansionError(
    "Cannot create expander for /home/admin/workspace/utopia/core/target/debug/deps/libserde_derive-06f5854d568d3852.so: Io(Custom { kind: InvalidData, error: \"no commit info\" })",
)
proc-macro /home/admin/workspace/utopia/core/target/debug/deps/libthiserror_impl-ffd65b6359e21d55.so failed to find the given version. Reason: no commit info
Failed to find proc macros. Error: ExpansionError(
    "Cannot create expander for /home/admin/workspace/utopia/core/arget/debug/deps/libthiserror_impl-ffd65b6359e21d55.so: Io(Custom { kind: InvalidData, error: \"no commit info\" })",
)
proc-macro /home/admin/workspace/utopia/core/target/debug/deps/libtokio_macros-333f39eaae1b9a91.so failed to find the given version. Reason: no commit info
Failed to find proc macros. Error: ExpansionError(
    "Cannot create expander for /home/admin/workspace/utopia/core/target/debug/deps/libtokio_macros-333f39eaae1b9a91.so: Io(Custom { kind: InvalidData, error: \"no commit info\" })",
)
Database loaded:     313.58ms, 168minstr
  crates: 1, mods: 1, decls: 12, fns: 3
Item Collection:     6.77s, 48ginstr
  exprs: 364, ??ty: 18 (4%), ?ty: 19 (5%), !ty: 0
Inference:           2.72s, 18ginstr
Total:               9.49s, 66ginstr

I've attached a fairly simple patch for rust-analyzer that fixes it (at least in my case), by making commit and date optional. Feel free to merge it, if you consider it quality enough.
0001-proc_macro_api-make-commit-date-suffix-of-binary-ver.patch.gz

@lnicola
Copy link
Member

lnicola commented Aug 17, 2021

What does rustc -vV print? There's another place (debugging) where we use that information.

The commit and date here seem to be unused, currently.

@sp1ritCS
Copy link
Contributor Author

rustc 1.54.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.54.0
LLVM version: 12.0.1

the patch I sent makes it work, so that seems to be the only place that happens

@lnicola
Copy link
Member

lnicola commented Aug 17, 2021

the patch I sent makes it work, so that seems to be the only place that happens

There's another place -- #8624, but I'm not sure how that works, since my toolchain doesn't seem to embed the commit hash in the symbol paths. On the other hand, #9872 implies they are still needed.

Anyway, it seems reasonable to merge your changes. I'll do that a bit later, unless you come up with a PR first.

bors bot added a commit that referenced this issue Aug 17, 2021
9936: proc_macro_api: make commit & date suffix of binary version optional r=lnicola a=lnicola

Closes #9916

bors r+

Co-authored-by: Florian sp1rit​ <sp1ritCS@protonmail.com>
@bors bors bot closed this as completed in d1ba993 Aug 17, 2021
@bors bors bot closed this as completed in #9936 Aug 17, 2021
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

Successfully merging a pull request may close this issue.

2 participants