@@ -1459,42 +1459,43 @@ impl fmt::Debug for Literal {
1459
1459
}
1460
1460
1461
1461
#[ 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 {
1484
1464
use std:: env:: { self , VarError } ;
1485
1465
use std:: ffi:: OsStr ;
1486
- use std:: path:: PathBuf ;
1487
1466
1488
1467
/// Retrieve an environment variable and add it to build dependency info.
1489
1468
/// The build system executing the compiler will know that the variable was accessed during
1490
1469
/// compilation, and will be able to rerun the build when the value of that variable changes.
1491
1470
/// Besides the dependency tracking this function should be equivalent to `env::var` from the
1492
1471
/// standard library, except that the argument must be UTF-8.
1493
1472
#[ 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 > {
1495
1474
let key: & str = key. as_ref ( ) ;
1496
1475
let value = env:: var ( key) ;
1497
1476
crate :: bridge:: client:: FreeFunctions :: track_env_var ( key, value. as_deref ( ) . ok ( ) ) ;
1498
1477
value
1499
1478
}
1500
1479
}
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