Use associated_type_bounds where applicable - closes #61738

This commit is contained in:
Ilija Tovilo 2019-07-31 21:00:35 +02:00
parent d4abb08be6
commit 3a6a29b4ec
No known key found for this signature in database
GPG key ID: 3F123D0ADD448198
25 changed files with 169 additions and 124 deletions

View file

@ -61,6 +61,7 @@
#![feature(proc_macro_hygiene)]
#![feature(log_syntax)]
#![feature(mem_take)]
#![feature(associated_type_bounds)]
#![recursion_limit="512"]

View file

@ -3901,7 +3901,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// each predicate must be preceded by the obligations required
// to normalize it.
// for example, if we have:
// impl<U: Iterator, V: Iterator<Item=U>> Foo for V where U::Item: Copy
// impl<U: Iterator<Item: Copy>, V: Iterator<Item = U>> Foo for V
// the impl will have the following predicates:
// <V as Iterator>::Item = U,
// U: Iterator, U: Sized,

View file

@ -980,8 +980,7 @@ EnumTypeFoldableImpl! {
(chalk_engine::DelayedLiteral::Negative)(a),
(chalk_engine::DelayedLiteral::Positive)(a, b),
} where
C: chalk_engine::context::Context + Clone,
C::CanonicalConstrainedSubst: TypeFoldable<'tcx>,
C: chalk_engine::context::Context<CanonicalConstrainedSubst: TypeFoldable<'tcx>> + Clone,
}
EnumTypeFoldableImpl! {
@ -989,8 +988,7 @@ EnumTypeFoldableImpl! {
(chalk_engine::Literal::Negative)(a),
(chalk_engine::Literal::Positive)(a),
} where
C: chalk_engine::context::Context + Clone,
C::GoalInEnvironment: Clone + TypeFoldable<'tcx>,
C: chalk_engine::context::Context<GoalInEnvironment: Clone + TypeFoldable<'tcx>> + Clone,
}
CloneTypeFoldableAndLiftImpls! {

View file

@ -2663,8 +2663,8 @@ impl<'tcx> TyCtxt<'tcx> {
unsafety: hir::Unsafety,
abi: abi::Abi)
-> <I::Item as InternIteratorElement<Ty<'tcx>, ty::FnSig<'tcx>>>::Output
where I: Iterator,
I::Item: InternIteratorElement<Ty<'tcx>, ty::FnSig<'tcx>>
where
I: Iterator<Item: InternIteratorElement<Ty<'tcx>, ty::FnSig<'tcx>>>,
{
inputs.chain(iter::once(output)).intern_with(|xs| ty::FnSig {
inputs_and_output: self.intern_type_list(xs),

View file

@ -2027,9 +2027,9 @@ impl ty::query::TyCtxtAt<'tcx> {
impl<'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
where
C: LayoutOf<Ty = Ty<'tcx>> + HasTyCtxt<'tcx>,
C::TyLayout: MaybeResult<TyLayout<'tcx>>,
C: HasParamEnv<'tcx>,
C: LayoutOf<Ty = Ty<'tcx>, TyLayout: MaybeResult<TyLayout<'tcx>>>
+ HasTyCtxt<'tcx>
+ HasParamEnv<'tcx>,
{
fn for_variant(this: TyLayout<'tcx>, cx: &C, variant_index: VariantIdx) -> TyLayout<'tcx> {
let details = match this.variants {

View file

@ -1055,9 +1055,8 @@ fn encode_query_results<'a, 'tcx, Q, E>(
query_result_index: &mut EncodedQueryResultIndex,
) -> Result<(), E::Error>
where
Q: super::config::QueryDescription<'tcx>,
Q: super::config::QueryDescription<'tcx, Value: Encodable>,
E: 'a + TyEncoder,
Q::Value: Encodable,
{
let desc = &format!("encode_query_results for {}",
::std::any::type_name::<Q>());