@@ -1490,42 +1490,43 @@ impl fmt::Debug for Literal {
14901490}
14911491
14921492#[ unstable( feature = "proc_macro_tracked_env" , issue = "74690" ) ]
1493- /// Tracked access to env and path.
1494- pub mod tracked {
1495- #[ unstable( feature = "proc_macro_tracked_path" , issue = "73921" ) ]
1496- use std:: path:: Path ;
1497-
1498- /// Track a file as if it was a dependency.
1499- ///
1500- /// The file is located relative to the current file where the proc-macro
1501- /// is used (similarly to how modules are found). The provided path is
1502- /// interpreted in a platform-specific way at compile time. So, for
1503- /// instance, an invocation with a Windows path
1504- /// containing backslashes `\` would not compile correctly on Unix.
1505- ///
1506- /// Errors if the provided `Path` cannot be encoded as a `str`
1507- ///
1508- /// Commonly used for tracking asset preprocessing.
1509- #[ unstable( feature = "proc_macro_tracked_path" , issue = "73921" ) ]
1510- pub fn path < P : AsRef < Path > > ( path : P ) {
1511- let path: & Path = path. as_ref ( ) ;
1512- crate :: bridge:: client:: FreeFunctions :: track_path ( PathBuf :: from ( path) ) ;
1513- }
1514-
1493+ /// Tracked access to env variables.
1494+ pub mod tracked_env {
15151495 use std:: env:: { self , VarError } ;
15161496 use std:: ffi:: OsStr ;
1517- use std:: path:: PathBuf ;
15181497
15191498 /// Retrieve an environment variable and add it to build dependency info.
15201499 /// The build system executing the compiler will know that the variable was accessed during
15211500 /// compilation, and will be able to rerun the build when the value of that variable changes.
15221501 /// Besides the dependency tracking this function should be equivalent to `env::var` from the
15231502 /// standard library, except that the argument must be UTF-8.
15241503 #[ unstable( feature = "proc_macro_tracked_env" , issue = "74690" ) ]
1525- pub fn env_var < K : AsRef < OsStr > + AsRef < str > > ( key : K ) -> Result < String , VarError > {
1504+ pub fn var < K : AsRef < OsStr > + AsRef < str > > ( key : K ) -> Result < String , VarError > {
15261505 let key: & str = key. as_ref ( ) ;
15271506 let value = env:: var ( key) ;
15281507 crate :: bridge:: client:: FreeFunctions :: track_env_var ( key, value. as_deref ( ) . ok ( ) ) ;
15291508 value
15301509 }
15311510}
1511+
1512+ /// Tracked access to additional files.
1513+ #[ unstable( feature = "track_path" , issue = "99515" ) ]
1514+ pub mod tracked_path {
1515+ use std:: path:: { Path , PathBuf } ;
1516+
1517+ /// Track a file as if it was a dependency.
1518+ ///
1519+ /// The file is located relative to the current file where the proc-macro
1520+ /// is used (similarly to how modules are found). The provided path is
1521+ /// interpreted in a platform-specific way at compile time. So, for
1522+ /// instance, an invocation with a Windows path
1523+ /// containing backslashes `\` would not compile correctly on Unix.
1524+ ///
1525+ /// Errors if the provided `Path` cannot be encoded as a `str`
1526+ ///
1527+ /// Commonly used for tracking asset preprocessing.
1528+ pub fn path < P : AsRef < Path > > ( path : P ) {
1529+ let path = PathBuf :: from ( path. as_ref ( ) ) ;
1530+ crate :: bridge:: client:: FreeFunctions :: track_path ( path) ;
1531+ }
1532+ }
0 commit comments