Skip to content

Parsing rust cratename from toml, instead of filepath - #6

Open
diajowe wants to merge 3 commits into
YassinEldeeb:mainfrom
diajowe:parse_cratename_from_toml
Open

Parsing rust cratename from toml, instead of filepath#6
diajowe wants to merge 3 commits into
YassinEldeeb:mainfrom
diajowe:parse_cratename_from_toml

Conversation

@diajowe

@diajowe diajowe commented May 16, 2024

Copy link
Copy Markdown
Contributor

What this does

Panic-Analyzer pulls the crate name of the analyzed crate from the respective Cargo.toml file instead of pulling it out of the directory path

Why is this desired?

Since the crate name is not necessarily included in the filepath to a crate, it is safer to pull the crate name from the crate's Cargo.toml instead of the crate's file path

How is this achieved?

We are using the toml crate to parse toml files. To do so, the toml file is read into string (since the toml crate does not yet allow parsing of the toml from file directly). This should be ok since toml files are usually not gigabytes in size. The toml is then parsed for the "name" key under the "package" section.

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 this pull request may close these issues.

1 participant