diff options
| author | Michael Goulet <michael@errs.io> | 2022-10-19 01:20:24 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-10-19 17:10:59 +0000 |
| commit | a6b5f95fb028f9feb4a2957c06b35035be2c6155 (patch) | |
| tree | 159ce992866baae21955751068e5dfafc872e1de /compiler/rustc_middle | |
| parent | 91af4f5d0b9ae9a2f8adafc02d61d18c60ddb200 (diff) | |
| download | rust-a6b5f95fb028f9feb4a2957c06b35035be2c6155.tar.gz rust-a6b5f95fb028f9feb4a2957c06b35035be2c6155.zip | |
Make ClosureOutlivesRequirement not rely on an unresolved type
Diffstat (limited to 'compiler/rustc_middle')
| -rw-r--r-- | compiler/rustc_middle/src/infer/canonical.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/query.rs | 16 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/traits/mod.rs | 2 |
4 files changed, 14 insertions, 12 deletions
diff --git a/compiler/rustc_middle/src/infer/canonical.rs b/compiler/rustc_middle/src/infer/canonical.rs index d3cf519b633..f4f1d82c3b8 100644 --- a/compiler/rustc_middle/src/infer/canonical.rs +++ b/compiler/rustc_middle/src/infer/canonical.rs @@ -302,10 +302,8 @@ impl<'tcx, V> Canonical<'tcx, V> { } } -pub type QueryOutlivesConstraint<'tcx> = ( - ty::Binder<'tcx, ty::OutlivesPredicate<GenericArg<'tcx>, Region<'tcx>>>, - ConstraintCategory<'tcx>, -); +pub type QueryOutlivesConstraint<'tcx> = + (ty::Binder<'tcx, ty::OutlivesPredicate<GenericArg<'tcx>, Region<'tcx>>>, ConstraintCategory); TrivialTypeTraversalAndLiftImpls! { for <'tcx> { diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index f94c447e8fb..e0e823e2090 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -2875,7 +2875,7 @@ fn pretty_print_const_value<'tcx>( /// `Location` represents the position of the start of the statement; or, if /// `statement_index` equals the number of statements, then the start of the /// terminator. -#[derive(Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, HashStable)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, HashStable, TyEncodable, TyDecodable)] pub struct Location { /// The block that the location is within. pub block: BasicBlock, diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index efd7357afc4..1d847d8f3d3 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -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 { diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index e73d44bbb36..3adc2e1b73e 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -185,7 +185,7 @@ impl<'tcx> ObligationCause<'tcx> { self } - pub fn to_constraint_category(&self) -> ConstraintCategory<'tcx> { + pub fn to_constraint_category(&self) -> ConstraintCategory { match self.code() { MatchImpl(cause, _) => cause.to_constraint_category(), AscribeUserTypeProvePredicate(predicate_span) => { |
