@@ -1490,42 +1490,43 @@ impl fmt::Debug for Literal {
1490
1490
}
1491
1491
1492
1492
#[ 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 {
1515
1495
use std:: env:: { self , VarError } ;
1516
1496
use std:: ffi:: OsStr ;
1517
- use std:: path:: PathBuf ;
1518
1497
1519
1498
/// Retrieve an environment variable and add it to build dependency info.
1520
1499
/// The build system executing the compiler will know that the variable was accessed during
1521
1500
/// compilation, and will be able to rerun the build when the value of that variable changes.
1522
1501
/// Besides the dependency tracking this function should be equivalent to `env::var` from the
1523
1502
/// standard library, except that the argument must be UTF-8.
1524
1503
#[ 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 > {
1526
1505
let key: & str = key. as_ref ( ) ;
1527
1506
let value = env:: var ( key) ;
1528
1507
crate :: bridge:: client:: FreeFunctions :: track_env_var ( key, value. as_deref ( ) . ok ( ) ) ;
1529
1508
value
1530
1509
}
1531
1510
}
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