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);
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
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),
avoid moving into the `for` loop",
ty,
),
- "&".to_string(),
+ "&",
Applicability::MaybeIncorrect,
);
}
.map(|n| format!("`{}`", n))
.unwrap_or_else(|| "the mutable reference".to_string()),
),
- "&mut *".to_string(),
+ "&mut *",
Applicability::MachineApplicable,
);
}
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,
);
}