Skip to content

Commit 1dcc5d4

Browse files
authored
Rollup merge of rust-lang#84029 - drahnr:master, r=petrochenkov
add `track_path::path` fn for usage in `proc_macro`s Adds a way to declare a dependency on external files without including them, to either re-trigger the build of a file as well as covering the use case of including dependencies within the `rustc` invocation, such that tools like `sccache`/`cachepot` are able to handle references to external files which are not included. Ref rust-lang#73921
2 parents deff973 + fcbf7d1 commit 1dcc5d4

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

proc_macro/src/bridge/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ macro_rules! with_api {
5555
FreeFunctions {
5656
fn drop($self: $S::FreeFunctions);
5757
fn track_env_var(var: &str, value: Option<&str>);
58+
fn track_path(path: &str);
5859
},
5960
TokenStream {
6061
fn drop($self: $S::TokenStream);

proc_macro/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,3 +1234,17 @@ pub mod tracked_env {
12341234
value
12351235
}
12361236
}
1237+
1238+
/// Tracked access to additional files.
1239+
#[unstable(feature = "track_path", issue = "73921")]
1240+
pub mod tracked_path {
1241+
1242+
/// Track a file explicitly.
1243+
///
1244+
/// Commonly used for tracking asset preprocessing.
1245+
#[unstable(feature = "track_path", issue = "73921")]
1246+
pub fn path<P: AsRef<str>>(path: P) {
1247+
let path: &str = path.as_ref();
1248+
crate::bridge::client::FreeFunctions::track_path(path);
1249+
}
1250+
}

0 commit comments

Comments
 (0)