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

Wrong path used for rustc sources #238

Closed
Jarcho opened this issue Jan 14, 2024 · 10 comments · Fixed by #239
Closed

Wrong path used for rustc sources #238

Jarcho opened this issue Jan 14, 2024 · 10 comments · Fixed by #239

Comments

@Jarcho
Copy link

Jarcho commented Jan 14, 2024

Currently rustc sources are being searched for at /lib/rustlib/src/rust/compiler/..., but the correct path is /lib/rustlib/rustc-src/rust/compiler/.... Looks like the path given to search is /rustc/<hash>/compiler/....

These are for the actual compiler sources in the rustc-dev component, not std sources.

@pacak
Copy link
Owner

pacak commented Jan 14, 2024

What platform are you on, what are the versions of rustc/cargo-show-asm? Do you have a small example?

@Jarcho
Copy link
Author

Jarcho commented Jan 14, 2024

Rustc sources being under /lib/rustlib/rustc-src has been the case since the rustc-dev package has included them (at least 2021).

Checked on both linux and windows with cargo-show-asm 0.2.26

Anything that references rustc sources will cause the problem.

extern crate rustc_span;

pub fn f(x: rustc_span::Span) -> rustc_span::SyntaxContext {
    x.ctxt()
}

@pacak
Copy link
Owner

pacak commented Jan 14, 2024

I see, I don't think I'm doing anything yet to support rustc sources themselves. Can you make a minimal crate/command for me to run? My attempts at just adding what you posted into lib.rs are not successful.

@Jarcho
Copy link
Author

Jarcho commented Jan 14, 2024

Sorry, forgot to add #![feature(rustc_private)] to the top. Needs a nightly compiler.

@pacak
Copy link
Owner

pacak commented Jan 14, 2024

I'm still having this error when I run cargo +nightly asm --manifest-path sample/Cargo.toml --rust even after rustup component add rust-src rustc-dev llvm-tools-preview

error[E0463]: can't find crate for `rustc_span`
 --> src/lib.rs:3:1
  |
3 | extern crate rustc_span;
  | ^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
  |
  = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`

@Jarcho
Copy link
Author

Jarcho commented Jan 14, 2024

You should just need rustc-dev installed to compile. Did you install it to the nightly toolchain? rustup component add only affects the default toolchain.

@pacak
Copy link
Owner

pacak commented Jan 14, 2024

I pushed a rustc branch that does the right thing for Linux. can you check if it does the right thing for Windows?

@Jarcho
Copy link
Author

Jarcho commented Jan 14, 2024

Seems to work on both 2021-01-01 and 2024-01-11.

Tried on 2020-01-01 where the directory structure is different, but it looks like something that old just isn't supported at all. Prints Cargo failed with exit code: 0 with just cargo +nightly-2020-01-01 asm.

@pacak
Copy link
Owner

pacak commented Jan 14, 2024

Awesome. I don't think 2020 nightly is worth supporting. Will make a release soon-ish.

@Jarcho
Copy link
Author

Jarcho commented Jan 15, 2024

I don't think 2020 nightly is worth supporting.

Probably not.

Thanks for being quick.

@pacak pacak mentioned this issue Jan 15, 2024
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