]> git.lizzy.rs Git - rust.git/commitdiff
restrict `stat` shim to macos only
authorChristian Poveda <git@christianpoveda.xyz>
Wed, 25 Dec 2019 16:30:01 +0000 (11:30 -0500)
committerChristian Poveda <git@christianpoveda.xyz>
Wed, 25 Dec 2019 17:38:35 +0000 (12:38 -0500)
src/shims/fs.rs

index d4a000305f643ba1b5f5964fd52e991409c7cc9e..78ec2169fd685ded4f03c19c0dbefb438e112269 100644 (file)
@@ -268,6 +268,10 @@ fn stat(
     ) -> InterpResult<'tcx, i32> {
         let this = self.eval_context_mut();
 
+        if this.tcx.sess.target.target.target_os.to_lowercase() != "macos" {
+            throw_unsup_format!("The `stat` shim is only only available in the `macos` platform.")
+        }
+
         let path_scalar = this.read_scalar(path_op)?.not_undef()?;
         let path = this.read_os_str_from_c_str(path_scalar)?;