X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_typeck%2Fcheck%2Fautoderef.rs;h=e0e946a9c63fa7b367a5ef37c80da9ee7de024b0;hb=6f4ab9458a7ad06c8ce630604f533c8c0c0acef4;hp=92044737df1cad683325f6cf2913bd2200cb987d;hpb=194fe695e3af6f03953cbb4ca66f159993f6214d;p=rust.git diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 92044737df1..e0e946a9c63 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -118,17 +118,21 @@ fn overloaded_deref_ty(&mut self, ty: Ty<'tcx>) -> Option> { let cause = traits::ObligationCause::misc(self.span, self.fcx.body_id); let mut selcx = traits::SelectionContext::new(self.fcx); - let obligation = traits::Obligation::new(cause.clone(), trait_ref.to_predicate()); + let obligation = traits::Obligation::new(cause.clone(), + self.fcx.param_env, + trait_ref.to_predicate()); if !selcx.evaluate_obligation(&obligation) { debug!("overloaded_deref_ty: cannot match obligation"); return None; } let normalized = traits::normalize_projection_type(&mut selcx, - ty::ProjectionTy { - trait_ref: trait_ref, - item_name: Symbol::intern("Target"), - }, + self.fcx.param_env, + ty::ProjectionTy::from_ref_and_name( + tcx, + trait_ref, + Symbol::intern("Target"), + ), cause, 0); @@ -213,7 +217,7 @@ pub fn autoderef(&'a self, span: Span, base_ty: Ty<'tcx>) -> Autoderef<'a, 'gcx, cur_ty: self.resolve_type_vars_if_possible(&base_ty), obligations: vec![], at_start: true, - span: span, + span, } }