Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Use PathBuf instead of String where appropiate #1338

Open
Xanewok opened this issue Feb 25, 2019 · 3 comments
Open

Use PathBuf instead of String where appropiate #1338

Xanewok opened this issue Feb 25, 2019 · 3 comments

Comments

@Xanewok
Copy link
Member

Xanewok commented Feb 25, 2019

Originally created by @jonasbb (rust-dev-tools/rls-data#7):

CratePreludeData.crate_root and ExternalCrateData.file_name both store file paths, so using PathBuf as the type would semantically make more sense.

@Xanewok
Copy link
Member Author

Xanewok commented Feb 25, 2019

Originally replied by @nrc (rust-dev-tools/rls-data#7 (comment)):

iirc there was some issues with serialising these types

@Xanewok
Copy link
Member Author

Xanewok commented Feb 25, 2019

Originally replied by @Xanewok (rust-dev-tools/rls-data#7 (comment)):

These are serialized as an array of bytes in JSON, and is used now for SpanData::file_name.
Is the representation something that would require 'fixing' on the rustc-serialize side?
I assume it's encoded as bytes to handle platform differences with path/string representations but it seems to be working now.
Should we, then, avoid using PathBuf with rustc-serialize altogether or change some Strings to PathBufs and possibly change the JSON representation?

@Xanewok
Copy link
Member Author

Xanewok commented Feb 25, 2019

Originally replied by @kamalmarhubi (rust-dev-tools/rls-data#7 (comment)):

Assuming that #15 is accepted, moving to serde with custom serialize_with / deserialize_with becomes an option.

@Xanewok Xanewok added the bug label Mar 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant