Rollup merge of #127309 - its-the-shrimp:jsondocck_add_file_var, r=aDotInTheVoid

jsondocck: add `$FILE` built-in variable

This built-in variable will allow accessing the full path to the currently tested file and allow to test things like source code spans generated by rustdoc-json, and that is exactly the reason why I've come up with the idea to add this

[futher discussion on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/rustdoc-json.20test.20help/near/449039819)
This commit is contained in:
Matthias Krüger 2024-07-04 18:16:25 +02:00 committed by GitHub
commit 6f43a02c12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,7 +23,7 @@ impl Cache {
Cache {
value: serde_json::from_str::<Value>(&content).expect("failed to convert from JSON"),
variables: HashMap::new(),
variables: HashMap::from([("FILE".to_owned(), config.template.clone().into())]),
}
}