]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_middle/src/ty/mod.rs
Add an unused field of type `Option<DefId>` to `ParamEnv` struct.
[rust.git] / compiler / rustc_middle / src / ty / mod.rs
index f23d666cfcfdd4f63c0aa2e138224385499f8639..637ef4c17ebc8c1ae6a5773acf490c41146faa48 100644 (file)
@@ -1745,6 +1745,9 @@ pub struct ParamEnv<'tcx> {
     ///
     /// Note: This is packed, use the reveal() method to access it.
     packed: CopyTaggedPtr<&'tcx List<Predicate<'tcx>>, traits::Reveal, true>,
+
+    /// FIXME: This field is not used, but removing it causes a performance degradation. See #76913.
+    unused_field: Option<DefId>,
 }
 
 unsafe impl rustc_data_structures::tagged_ptr::Tag for traits::Reveal {
@@ -1825,7 +1828,7 @@ pub fn reveal_all() -> Self {
     /// Construct a trait environment with the given set of predicates.
     #[inline]
     pub fn new(caller_bounds: &'tcx List<Predicate<'tcx>>, reveal: Reveal) -> Self {
-        ty::ParamEnv { packed: CopyTaggedPtr::new(caller_bounds, reveal) }
+        ty::ParamEnv { packed: CopyTaggedPtr::new(caller_bounds, reveal), unused_field: None }
     }
 
     pub fn with_user_facing(mut self) -> Self {