X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_typeck%2Fsrc%2Fmem_categorization.rs;h=9992094117dfc847c9f32e5540bcf5866c6fa776;hb=cb4553bdae56b41c295137ab694fab0050f7c29d;hp=04ead74936f88c25241855a5f46517076dac3031;hpb=ac4f7deb2f3558d2d923fa6ddcbb7210db9c2d52;p=rust.git diff --git a/compiler/rustc_typeck/src/mem_categorization.rs b/compiler/rustc_typeck/src/mem_categorization.rs index 04ead74936f..9992094117d 100644 --- a/compiler/rustc_typeck/src/mem_categorization.rs +++ b/compiler/rustc_typeck/src/mem_categorization.rs @@ -124,7 +124,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { self.infcx.type_is_copy_modulo_regions(self.param_env, ty, span) } - fn resolve_vars_if_possible(&self, value: &T) -> T + fn resolve_vars_if_possible(&self, value: T) -> T where T: TypeFoldable<'tcx>, { @@ -142,7 +142,7 @@ fn resolve_type_vars_or_error( ) -> McResult> { match ty { Some(ty) => { - let ty = self.resolve_vars_if_possible(&ty); + let ty = self.resolve_vars_if_possible(ty); if ty.references_error() || ty.is_ty_var() { debug!("resolve_type_vars_or_error: error from {:?}", ty); Err(()) @@ -274,7 +274,7 @@ fn cat_expr_adjusted_with( F: FnOnce() -> McResult>, { debug!("cat_expr_adjusted_with({:?}): {:?}", adjustment, expr); - let target = self.resolve_vars_if_possible(&adjustment.target); + let target = self.resolve_vars_if_possible(adjustment.target); match adjustment.kind { adjustment::Adjust::Deref(overloaded) => { // Equivalent to *expr or something similar. @@ -370,6 +370,7 @@ fn cat_expr_adjusted_with( | hir::ExprKind::Loop(..) | hir::ExprKind::Match(..) | hir::ExprKind::Lit(..) + | hir::ExprKind::ConstBlock(..) | hir::ExprKind::Break(..) | hir::ExprKind::Continue(..) | hir::ExprKind::Struct(..)