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

using rust-project external to facebook #519

Open
FabianPonce opened this issue Dec 13, 2023 · 8 comments · May be fixed by #659
Open

using rust-project external to facebook #519

FabianPonce opened this issue Dec 13, 2023 · 8 comments · May be fixed by #659

Comments

@FabianPonce
Copy link

I was experimenting with Buck2 on a Rust project and wasn't able to get rust-project to generate a rust-analyzer file reliably. You can see the output that I was originally receiving below:

rust-project develop --prefer-rustup-managed-toolchain :some-code                                                        
2023-12-13T02:03:04.561917Z  INFO rust_project::cli::develop: building generated code
Error: failed to deserialize command output

Caused by:
    0: command `env -u RUST_BACKTRACE -u RUST_LIB_BACKTRACE "buck2" "--isolation-dir" ".rust-analyzer" "bxl" "--oncall" "rust_devx" "-c" "client.id=rust-project" "@fbcode//mode/mac" "prelude//rust/rust-analyzer/resolve_deps.bxl:expand_and_resolve" "-c=rust.failure_filter=true" "--" "--targets" ":some-code"` (exit code: exit status: 1)
       stderr:
       Command failed: Error expanding argsfiles
       
       Caused by:
           0: Unable to read flag file at `/Users/fponce/buck2-test/none/mode/mac`
           1: No such file or directory (os error 2)
       
    1: EOF while parsing a value at line 1 column 0

I noticed that @fbcode//mode/mac was being passed as an argument and was able to find it referenced in the source code. By dropping that, the command works as expected and I'm able to use my IDE with the generated rust-project.json files successfully. I had originally tried passing in alternative values to -m but it didn't seem to work right either.

I have no doubt that this is not the correct fix, but you can see the diff here: 91214e5

@cormacrelf
Copy link
Contributor

cormacrelf commented Dec 13, 2023

You can also just create an empty file at mode/mac as a workaround, if you have fbcode = root in your .buckconfig's repository aliases. See also #402 for the other thing you need to make it work. I never fixed it because pretty soon I stopped using system_rust_toolchain and I haven't been reminded of it since.

@iguridi
Copy link
Contributor

iguridi commented Dec 13, 2023

cc @davidbarsky

@davidbarsky
Copy link
Contributor

ah, crap, yeah. lemme get a diff up that introduces a config file/doesn't hard code this value. my bad!

@jazzdan
Copy link
Contributor

jazzdan commented Feb 29, 2024

Hey @davidbarsky, was playing with rust-project and ran across the same issue. Did you get a chance to get that diff up?

@davidbarsky
Copy link
Contributor

Hey @davidbarsky, was playing with rust-project and ran across the same issue. Did you get a chance to get that diff up?

D'oh, sorry, it fell to the wayside. I'll get that fixed today and landed today/tomorrow.

@davidbarsky
Copy link
Contributor

Didn't happen yesterday, sorry folks—was pulled into meetings. Gimme a day or two.

@jazzdan
Copy link
Contributor

jazzdan commented May 14, 2024

@davidbarsky one more friendly ping? Or if you want to roughly describe what change should be made I can try to push it through.

@davidbarsky
Copy link
Contributor

Really, really sorry: I've honestly been working on std::stream::Stream/rust-analyzer internals lately and haven't had the time.

Or if you want to roughly describe what change should be made I can try to push it through.

@jazzdan If you want to do this, I was thinking of defining a Config struct and deserializing from TOML using the toml crate crate. I was initially thinking that rust-project should look for a rust-project.toml at in the cell/project roots, but iterating over the current working directories ancestors is likely sufficient/preferable.

@jazzdan jazzdan linked a pull request May 17, 2024 that will close this issue
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.

5 participants