Move infer::region_constraints::MemberConstraint to infer::types module.

This commit is contained in:
Camille GILLOT 2020-01-22 13:31:42 +01:00
parent 4e42f388c3
commit 9c07dad725
3 changed files with 32 additions and 24 deletions

View File

@ -61,6 +61,7 @@
pub mod resolve; pub mod resolve;
mod sub; mod sub;
pub mod type_variable; pub mod type_variable;
mod types;
pub mod unify_key; pub mod unify_key;
#[must_use] #[must_use]

View File

@ -23,6 +23,8 @@
mod leak_check; mod leak_check;
pub use rustc::infer::types::MemberConstraint;
#[derive(Default)] #[derive(Default)]
pub struct RegionConstraintCollector<'tcx> { pub struct RegionConstraintCollector<'tcx> {
/// For each `RegionVid`, the corresponding `RegionVariableOrigin`. /// For each `RegionVid`, the corresponding `RegionVariableOrigin`.
@ -145,30 +147,6 @@ pub fn involves_placeholders(&self) -> bool {
} }
} }
/// Requires that `region` must be equal to one of the regions in `choice_regions`.
/// We often denote this using the syntax:
///
/// ```
/// R0 member of [O1..On]
/// ```
#[derive(Debug, Clone, HashStable, TypeFoldable, Lift)]
pub struct MemberConstraint<'tcx> {
/// The `DefId` of the opaque type causing this constraint: used for error reporting.
pub opaque_type_def_id: DefId,
/// The span where the hidden type was instantiated.
pub definition_span: Span,
/// The hidden type in which `member_region` appears: used for error reporting.
pub hidden_ty: Ty<'tcx>,
/// The region `R0`.
pub member_region: Region<'tcx>,
/// The options `O1..On`.
pub choice_regions: Lrc<Vec<Region<'tcx>>>,
}
/// `VerifyGenericBound(T, _, R, RS)`: the parameter type `T` (or /// `VerifyGenericBound(T, _, R, RS)`: the parameter type `T` (or
/// associated type) must outlive the region `R`. `T` is known to /// associated type) must outlive the region `R`. `T` is known to
/// outlive `RS`. Therefore, verify that `R <= RS[i]` for some /// outlive `RS`. Therefore, verify that `R <= RS[i]` for some

View File

@ -0,0 +1,29 @@
use crate::ty::Region;
use crate::ty::Ty;
use rustc_data_structures::sync::Lrc;
use rustc_hir::def_id::DefId;
use rustc_span::Span;
/// Requires that `region` must be equal to one of the regions in `choice_regions`.
/// We often denote this using the syntax:
///
/// ```
/// R0 member of [O1..On]
/// ```
#[derive(Debug, Clone, HashStable, TypeFoldable, Lift)]
pub struct MemberConstraint<'tcx> {
/// The `DefId` of the opaque type causing this constraint: used for error reporting.
pub opaque_type_def_id: DefId,
/// The span where the hidden type was instantiated.
pub definition_span: Span,
/// The hidden type in which `member_region` appears: used for error reporting.
pub hidden_ty: Ty<'tcx>,
/// The region `R0`.
pub member_region: Region<'tcx>,
/// The options `O1..On`.
pub choice_regions: Lrc<Vec<Region<'tcx>>>,
}