]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_borrowck/src/diagnostics/mod.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / compiler / rustc_borrowck / src / diagnostics / mod.rs
index 05d29503180ef73a6b9aacdfb97a931f92f1d8db..fbc3a8cc088fdb1504652915484730cc03dfae78 100644 (file)
@@ -35,12 +35,12 @@ mod move_errors;
 mod mutability_errors;
 mod region_errors;
 
-crate use bound_region_errors::{ToUniverseInfo, UniverseInfo};
-crate use mutability_errors::AccessKind;
-crate use outlives_suggestion::OutlivesSuggestionBuilder;
-crate use region_errors::{ErrorConstraintInfo, RegionErrorKind, RegionErrors};
-crate use region_name::{RegionName, RegionNameSource};
-crate use rustc_const_eval::util::CallKind;
+pub(crate) use bound_region_errors::{ToUniverseInfo, UniverseInfo};
+pub(crate) use mutability_errors::AccessKind;
+pub(crate) use outlives_suggestion::OutlivesSuggestionBuilder;
+pub(crate) use region_errors::{ErrorConstraintInfo, RegionErrorKind, RegionErrors};
+pub(crate) use region_name::{RegionName, RegionNameSource};
+pub(crate) use rustc_const_eval::util::CallKind;
 use rustc_middle::mir::tcx::PlaceTy;
 
 pub(super) struct IncludingDowncast(pub(super) bool);
@@ -896,7 +896,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
         let hir_id = self.infcx.tcx.hir().local_def_id_to_hir_id(local_did);
         let expr = &self.infcx.tcx.hir().expect_expr(hir_id).kind;
         debug!("closure_span: hir_id={:?} expr={:?}", hir_id, expr);
-        if let hir::ExprKind::Closure(.., body_id, args_span, _) = expr {
+        if let hir::ExprKind::Closure { body, fn_decl_span, .. } = expr {
             for (captured_place, place) in self
                 .infcx
                 .tcx
@@ -909,11 +909,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                         if target_place == place.as_ref() =>
                     {
                         debug!("closure_span: found captured local {:?}", place);
-                        let body = self.infcx.tcx.hir().body(*body_id);
+                        let body = self.infcx.tcx.hir().body(*body);
                         let generator_kind = body.generator_kind();
 
                         return Some((
-                            *args_span,
+                            *fn_decl_span,
                             generator_kind,
                             captured_place.get_capture_kind_span(self.infcx.tcx),
                             captured_place.get_path_span(self.infcx.tcx),
@@ -1023,7 +1023,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                                      avoid moving into the `for` loop",
                                     ty,
                                 ),
-                                "&".to_string(),
+                                "&",
                                 Applicability::MaybeIncorrect,
                             );
                         }
@@ -1049,7 +1049,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                                             .map(|n| format!("`{}`", n))
                                             .unwrap_or_else(|| "the mutable reference".to_string()),
                                     ),
-                                    "&mut *".to_string(),
+                                    "&mut *",
                                     Applicability::MachineApplicable,
                                 );
                             }
@@ -1067,7 +1067,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                         err.span_suggestion_verbose(
                             fn_call_span.shrink_to_lo(),
                             "consider calling `.as_ref()` to borrow the type's contents",
-                            "as_ref().".to_string(),
+                            "as_ref().",
                             Applicability::MachineApplicable,
                         );
                     }