X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_middle%2Fsrc%2Fmir%2Fquery.rs;h=da4793fa039d0f36be8d16495b450ae807ab6894;hb=705d818bd52a6324d5e7693cc4306457395eebc8;hp=7f7b8bdfc146172209da89890e85074c29d413e7;hpb=8d9f258faaecc5c3824a9b7221463c0e984e1b71;p=rust.git diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index 7f7b8bdfc14..da4793fa039 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -1,6 +1,6 @@ //! Values computed by queries that use MIR. -use crate::mir::{self, Body, Promoted}; +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; @@ -338,11 +338,12 @@ pub struct ClosureOutlivesRequirement<'tcx> { pub blame_span: Span, // ... due to this reason. - pub category: ConstraintCategory, + pub category: ConstraintCategory<'tcx>, } // Make sure this enum doesn't unintentionally grow -rustc_data_structures::static_assert_size!(ConstraintCategory, 12); +#[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 @@ -351,7 +352,7 @@ pub struct ClosureOutlivesRequirement<'tcx> { /// See also `rustc_const_eval::borrow_check::constraints`. #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)] #[derive(TyEncodable, TyDecodable, HashStable)] -pub enum ConstraintCategory { +pub enum ConstraintCategory<'tcx> { Return(ReturnConstraint), Yield, UseAsConst, @@ -363,7 +364,9 @@ pub enum ConstraintCategory { /// /// We try to get the category that the closure used when reporting this. ClosureBounds, - CallArgument, + + /// Contains the function type if available. + CallArgument(Option>), CopyBound, SizedBound, Assignment, @@ -424,7 +427,7 @@ pub struct DestructuredConst<'tcx> { #[derive(Copy, Clone, Debug, HashStable)] pub struct DestructuredMirConstant<'tcx> { pub variant: Option, - pub fields: &'tcx [mir::ConstantKind<'tcx>], + pub fields: &'tcx [ConstantKind<'tcx>], } /// Coverage information summarized from a MIR if instrumented for source code coverage (see