diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-01-22 13:31:42 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2020-02-05 08:46:09 +0100 |
| commit | 9c07dad7258fad6b7504f9e2569fece97fa394b6 (patch) | |
| tree | 317a4fb5b5bd7c36edd766ddd30ce63692ea3cdf | |
| parent | 4e42f388c375b0d6eb25af087cb2a66069419529 (diff) | |
| download | rust-9c07dad7258fad6b7504f9e2569fece97fa394b6.tar.gz rust-9c07dad7258fad6b7504f9e2569fece97fa394b6.zip | |
Move infer::region_constraints::MemberConstraint to infer::types module.
| -rw-r--r-- | src/librustc/infer/mod.rs | 1 | ||||
| -rw-r--r-- | src/librustc/infer/region_constraints/mod.rs | 26 | ||||
| -rw-r--r-- | src/librustc/infer/types/mod.rs | 29 |
3 files changed, 32 insertions, 24 deletions
diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index f67669e367f..1f1ff1fd8bc 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -61,6 +61,7 @@ pub mod region_constraints; pub mod resolve; mod sub; pub mod type_variable; +mod types; pub mod unify_key; #[must_use] diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index 27ed3c78138..410058b70b5 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -23,6 +23,8 @@ use std::{cmp, fmt, mem}; mod leak_check; +pub use rustc::infer::types::MemberConstraint; + #[derive(Default)] pub struct RegionConstraintCollector<'tcx> { /// For each `RegionVid`, the corresponding `RegionVariableOrigin`. @@ -145,30 +147,6 @@ impl Constraint<'_> { } } -/// 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 /// associated type) must outlive the region `R`. `T` is known to /// outlive `RS`. Therefore, verify that `R <= RS[i]` for some diff --git a/src/librustc/infer/types/mod.rs b/src/librustc/infer/types/mod.rs new file mode 100644 index 00000000000..f9346b99cde --- /dev/null +++ b/src/librustc/infer/types/mod.rs @@ -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>>>, +} |
