Make ClosureOutlivesRequirement not rely on an unresolved type

This commit is contained in:
Michael Goulet
2022-10-19 01:20:24 +00:00
parent 91af4f5d0b
commit a6b5f95fb0
20 changed files with 94 additions and 93 deletions

View File

@@ -15,7 +15,7 @@ use smallvec::SmallVec;
use std::cell::Cell;
use std::fmt::{self, Debug};
use super::{Field, SourceInfo};
use super::{Field, Location, SourceInfo};
#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
pub enum UnsafetyViolationKind {
@@ -314,12 +314,12 @@ pub struct ClosureOutlivesRequirement<'tcx> {
pub blame_span: Span,
// ... due to this reason.
pub category: ConstraintCategory<'tcx>,
pub category: ConstraintCategory,
}
// 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);
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
@@ -327,8 +327,8 @@ rustc_data_structures::static_assert_size!(ConstraintCategory<'_>, 16);
///
/// See also `rustc_const_eval::borrow_check::constraints`.
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
#[derive(TyEncodable, TyDecodable, HashStable, Lift, TypeVisitable, TypeFoldable)]
pub enum ConstraintCategory<'tcx> {
#[derive(TyEncodable, TyDecodable, HashStable)]
pub enum ConstraintCategory {
Return(ReturnConstraint),
Yield,
UseAsConst,
@@ -342,7 +342,7 @@ pub enum ConstraintCategory<'tcx> {
ClosureBounds,
/// Contains the function type if available.
CallArgument(Option<Ty<'tcx>>),
CallArgument(Location),
CopyBound,
SizedBound,
Assignment,
@@ -368,6 +368,10 @@ pub enum ConstraintCategory<'tcx> {
Internal,
}
TrivialTypeTraversalAndLiftImpls! {
ConstraintCategory,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
#[derive(TyEncodable, TyDecodable, HashStable, TypeVisitable, TypeFoldable)]
pub enum ReturnConstraint {