@@ -1459,42 +1459,43 @@ impl fmt::Debug for Literal {
14591459}
14601460
14611461#[ unstable( feature = "proc_macro_tracked_env" , issue = "74690" ) ]
1462- /// Tracked access to env and path.
1463- pub mod tracked {
1464- #[ unstable( feature = "proc_macro_tracked_path" , issue = "73921" ) ]
1465- use std:: path:: Path ;
1466-
1467- /// Track a file as if it was a dependency.
1468- ///
1469- /// The file is located relative to the current file where the proc-macro
1470- /// is used (similarly to how modules are found). The provided path is
1471- /// interpreted in a platform-specific way at compile time. So, for
1472- /// instance, an invocation with a Windows path
1473- /// containing backslashes `\` would not compile correctly on Unix.
1474- ///
1475- /// Errors if the provided `Path` cannot be encoded as a `str`
1476- ///
1477- /// Commonly used for tracking asset preprocessing.
1478- #[ unstable( feature = "proc_macro_tracked_path" , issue = "73921" ) ]
1479- pub fn path < P : AsRef < Path > > ( path : P ) {
1480- let path: & Path = path. as_ref ( ) ;
1481- crate :: bridge:: client:: FreeFunctions :: track_path ( PathBuf :: from ( path) ) ;
1482- }
1483-
1462+ /// Tracked access to env variables.
1463+ pub mod tracked_env {
14841464 use std:: env:: { self , VarError } ;
14851465 use std:: ffi:: OsStr ;
1486- use std:: path:: PathBuf ;
14871466
14881467 /// Retrieve an environment variable and add it to build dependency info.
14891468 /// The build system executing the compiler will know that the variable was accessed during
14901469 /// compilation, and will be able to rerun the build when the value of that variable changes.
14911470 /// Besides the dependency tracking this function should be equivalent to `env::var` from the
14921471 /// standard library, except that the argument must be UTF-8.
14931472 #[ unstable( feature = "proc_macro_tracked_env" , issue = "74690" ) ]
1494- pub fn env_var < K : AsRef < OsStr > + AsRef < str > > ( key : K ) -> Result < String , VarError > {
1473+ pub fn var < K : AsRef < OsStr > + AsRef < str > > ( key : K ) -> Result < String , VarError > {
14951474 let key: & str = key. as_ref ( ) ;
14961475 let value = env:: var ( key) ;
14971476 crate :: bridge:: client:: FreeFunctions :: track_env_var ( key, value. as_deref ( ) . ok ( ) ) ;
14981477 value
14991478 }
15001479}
1480+
1481+ /// Tracked access to additional files.
1482+ #[ unstable( feature = "track_path" , issue = "99515" ) ]
1483+ pub mod tracked_path {
1484+ use std:: path:: { Path , PathBuf } ;
1485+
1486+ /// Track a file as if it was a dependency.
1487+ ///
1488+ /// The file is located relative to the current file where the proc-macro
1489+ /// is used (similarly to how modules are found). The provided path is
1490+ /// interpreted in a platform-specific way at compile time. So, for
1491+ /// instance, an invocation with a Windows path
1492+ /// containing backslashes `\` would not compile correctly on Unix.
1493+ ///
1494+ /// Errors if the provided `Path` cannot be encoded as a `str`
1495+ ///
1496+ /// Commonly used for tracking asset preprocessing.
1497+ pub fn path < P : AsRef < Path > > ( path : P ) {
1498+ let path = PathBuf :: from ( path. as_ref ( ) ) ;
1499+ crate :: bridge:: client:: FreeFunctions :: track_path ( path) ;
1500+ }
1501+ }
0 commit comments