]> git.lizzy.rs Git - rust.git/commitdiff
Add an unused field of type `Option<DefId>` to `ParamEnv` struct.
authorBram van den Heuvel <bram@vandenheuvel.online>
Sat, 19 Sep 2020 10:06:17 +0000 (12:06 +0200)
committerBram van den Heuvel <bram@vandenheuvel.online>
Mon, 21 Sep 2020 07:39:26 +0000 (09:39 +0200)
compiler/rustc_infer/src/traits/mod.rs
compiler/rustc_middle/src/ty/mod.rs
compiler/rustc_trait_selection/src/traits/fulfill.rs

index a3c4920fa8af3dc593adff29ef4e209edb9b0165..7e7c8588ffb40a6440bce2d38c4fdc69ad0d4fa8 100644 (file)
@@ -57,7 +57,7 @@ pub struct Obligation<'tcx, T> {
 
 // `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(target_arch = "x86_64")]
-static_assert_size!(PredicateObligation<'_>, 32);
+static_assert_size!(PredicateObligation<'_>, 40);
 
 pub type Obligations<'tcx, O> = Vec<Obligation<'tcx, O>>;
 pub type PredicateObligations<'tcx> = Vec<PredicateObligation<'tcx>>;
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 {
index 5b4314598deb5e43f7f3f6914895bd6b77df7d6d..77073f51eb7af786ac86a914569194979f6fd573 100644 (file)
@@ -87,7 +87,7 @@ pub struct PendingPredicateObligation<'tcx> {
 
 // `PendingPredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
 #[cfg(target_arch = "x86_64")]
-static_assert_size!(PendingPredicateObligation<'_>, 56);
+static_assert_size!(PendingPredicateObligation<'_>, 64);
 
 impl<'a, 'tcx> FulfillmentContext<'tcx> {
     /// Creates a new fulfillment context.