about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query/erase.rs
diff options
context:
space:
mode:
authorMads Marquart <mads@marquart.dk>2025-03-26 15:46:05 +0100
committerMads Marquart <mads@marquart.dk>2025-03-26 15:46:05 +0100
commit17db054141f909277a0c57b4698f420636a2c511 (patch)
treed9c66835ef6b5f4c27dd64e843bb211e7e291a88 /compiler/rustc_middle/src/query/erase.rs
parentc772573708cdc863d9fa03ca4973f9ab08ac9d43 (diff)
downloadrust-17db054141f909277a0c57b4698f420636a2c511.tar.gz
rust-17db054141f909277a0c57b4698f420636a2c511.zip
Add `TyCtx::env_var_os`
Along with `TyCtx::env_var` helper. These can be used to track
environment variable accesses in the query system.

Since `TyCtx::env_var_os` uses `OsStr`, this commit also adds the
necessary trait implementations for that to work.
Diffstat (limited to 'compiler/rustc_middle/src/query/erase.rs')
-rw-r--r--compiler/rustc_middle/src/query/erase.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/query/erase.rs b/compiler/rustc_middle/src/query/erase.rs
index 7bbaa0496d5..6c6b9a5510c 100644
--- a/compiler/rustc_middle/src/query/erase.rs
+++ b/compiler/rustc_middle/src/query/erase.rs
@@ -1,3 +1,4 @@
+use std::ffi::OsStr;
 use std::intrinsics::transmute_unchecked;
 use std::mem::MaybeUninit;
 
@@ -67,6 +68,10 @@ impl<T> EraseType for &'_ [T] {
     type Result = [u8; size_of::<&'static [()]>()];
 }
 
+impl EraseType for &'_ OsStr {
+    type Result = [u8; size_of::<&'static OsStr>()];
+}
+
 impl<T> EraseType for &'_ ty::List<T> {
     type Result = [u8; size_of::<&'static ty::List<()>>()];
 }
@@ -174,6 +179,10 @@ impl<T> EraseType for Option<&'_ [T]> {
     type Result = [u8; size_of::<Option<&'static [()]>>()];
 }
 
+impl EraseType for Option<&'_ OsStr> {
+    type Result = [u8; size_of::<Option<&'static OsStr>>()];
+}
+
 impl EraseType for Option<mir::DestructuredConstant<'_>> {
     type Result = [u8; size_of::<Option<mir::DestructuredConstant<'static>>>()];
 }