and few more

maybe bug here?

warning: this argument is a mutable reference, but not used mutably
    --> compiler\rustc_borrowck\src\diagnostics\conflict_errors.rs:3857:35
     |
3857 |     pub(crate) fn emit(&self, cx: &mut MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diag<'_>) -> String {
     |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&MirBorrowckCtxt<'_, 'tcx>`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_borrowck\src\type_check\liveness\trace.rs:601:17
    |
601 |         typeck: &mut TypeChecker<'_, 'tcx>,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&TypeChecker<'_, 'tcx>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
This commit is contained in:
klensy 2024-03-28 16:57:32 +03:00
parent 5488e492af
commit 9a6b3dfc06
3 changed files with 15 additions and 16 deletions

View File

@ -337,7 +337,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
fn suggest_ref_or_clone(
&mut self,
&self,
mpi: MovePathIndex,
move_span: Span,
err: &mut Diag<'tcx>,
@ -1125,7 +1125,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
pub(crate) fn report_use_while_mutably_borrowed(
&mut self,
&self,
location: Location,
(place, _span): (Place<'tcx>, Span),
borrow: &BorrowData<'tcx>,
@ -1174,7 +1174,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
pub(crate) fn report_conflicting_borrow(
&mut self,
&self,
location: Location,
(place, span): (Place<'tcx>, Span),
gen_borrow_kind: BorrowKind,
@ -2463,7 +2463,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
fn report_local_value_does_not_live_long_enough(
&mut self,
&self,
location: Location,
name: &str,
borrow: &BorrowData<'tcx>,
@ -2642,7 +2642,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
fn report_thread_local_value_does_not_live_long_enough(
&mut self,
&self,
drop_span: Span,
borrow_span: Span,
) -> Diag<'tcx> {
@ -2663,7 +2663,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
#[instrument(level = "debug", skip(self))]
fn report_temporary_value_does_not_live_long_enough(
&mut self,
&self,
location: Location,
borrow: &BorrowData<'tcx>,
drop_span: Span,
@ -2921,7 +2921,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
#[instrument(level = "debug", skip(self))]
fn report_escaping_closure_capture(
&mut self,
&self,
use_span: UseSpans<'tcx>,
var_span: Span,
fr_name: &RegionName,
@ -3031,7 +3031,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
fn report_escaping_data(
&mut self,
&self,
borrow_span: Span,
name: &Option<String>,
upvar_span: Span,
@ -3065,7 +3065,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
fn get_moved_indexes(
&mut self,
&self,
location: Location,
mpi: MovePathIndex,
) -> (Vec<MoveSite>, Vec<Location>) {
@ -3854,7 +3854,7 @@ enum AnnotatedBorrowFnSignature<'tcx> {
impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
/// Annotate the provided diagnostic with information about borrow from the fn signature that
/// helps explain.
pub(crate) fn emit(&self, cx: &mut MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diag<'_>) -> String {
pub(crate) fn emit(&self, cx: &MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diag<'_>) -> String {
match self {
&AnnotatedBorrowFnSignature::Closure { argument_ty, argument_span } => {
diag.span_label(

View File

@ -87,6 +87,8 @@ pub(super) fn populate_access_facts<'a, 'tcx>(
body: &Body<'tcx>,
location_table: &LocationTable,
move_data: &MoveData<'tcx>,
//FIXME: this is not mutated, but expected to be modified as
// out param, bug?
dropped_at: &mut Vec<(Local, Location)>,
) {
debug!("populate_access_facts()");

View File

@ -200,7 +200,7 @@ impl<'me, 'typeck, 'flow, 'tcx> LivenessResults<'me, 'typeck, 'flow, 'tcx> {
for local in boring_locals {
let local_ty = self.cx.body.local_decls[local].ty;
let drop_data = self.cx.drop_data.entry(local_ty).or_insert_with({
let typeck = &mut self.cx.typeck;
let typeck = &self.cx.typeck;
move || LivenessContext::compute_drop_data(typeck, local_ty)
});
@ -542,7 +542,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
);
let drop_data = self.drop_data.entry(dropped_ty).or_insert_with({
let typeck = &mut self.typeck;
let typeck = &self.typeck;
move || Self::compute_drop_data(typeck, dropped_ty)
});
@ -597,10 +597,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
});
}
fn compute_drop_data(
typeck: &mut TypeChecker<'_, 'tcx>,
dropped_ty: Ty<'tcx>,
) -> DropData<'tcx> {
fn compute_drop_data(typeck: &TypeChecker<'_, 'tcx>, dropped_ty: Ty<'tcx>) -> DropData<'tcx> {
debug!("compute_drop_data(dropped_ty={:?})", dropped_ty,);
match typeck