]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_middle/src/mir/query.rs
implement valtrees as the type-system representation for constant values
[rust.git] / compiler / rustc_middle / src / mir / query.rs
index 4f71e3a8234faac8f4a776438e71ad5629db07c4..da4793fa039d0f36be8d16495b450ae807ab6894 100644 (file)
@@ -1,7 +1,7 @@
 //! Values computed by queries that use MIR.
 
-use crate::mir::{self, Body, Promoted};
-use crate::ty::{self, subst::SubstsRef, OpaqueHiddenType, Ty, TyCtxt};
+use crate::mir::{Body, ConstantKind, Promoted};
+use crate::ty::{self, OpaqueHiddenType, Ty, TyCtxt};
 use rustc_data_structures::stable_map::FxHashMap;
 use rustc_data_structures::vec_map::VecMap;
 use rustc_errors::ErrorGuaranteed;
@@ -341,6 +341,10 @@ pub struct ClosureOutlivesRequirement<'tcx> {
     pub category: ConstraintCategory<'tcx>,
 }
 
+// Make sure this enum doesn't unintentionally grow
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
+rustc_data_structures::static_assert_size!(ConstraintCategory<'_>, 16);
+
 /// Outlives-constraints can be categorized to determine whether and why they
 /// are interesting (for error reporting). Order of variants indicates sort
 /// order of the category, thereby influencing diagnostic output.
@@ -360,7 +364,9 @@ pub enum ConstraintCategory<'tcx> {
     ///
     /// We try to get the category that the closure used when reporting this.
     ClosureBounds,
-    CallArgument(Option<(DefId, SubstsRef<'tcx>)>),
+
+    /// Contains the function type if available.
+    CallArgument(Option<Ty<'tcx>>),
     CopyBound,
     SizedBound,
     Assignment,
@@ -421,7 +427,7 @@ pub struct DestructuredConst<'tcx> {
 #[derive(Copy, Clone, Debug, HashStable)]
 pub struct DestructuredMirConstant<'tcx> {
     pub variant: Option<VariantIdx>,
-    pub fields: &'tcx [mir::ConstantKind<'tcx>],
+    pub fields: &'tcx [ConstantKind<'tcx>],
 }
 
 /// Coverage information summarized from a MIR if instrumented for source code coverage (see