From 883f8705d490a3d1f8f83610663958d1f3ac5f1c Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 3 Nov 2024 22:02:31 +0000 Subject: [PATCH] Remove BorrowKind glob, make names longer --- .../src/diagnostics/mutability_errors.rs | 2 +- .../rustc_hir_typeck/src/expr_use_visitor.rs | 19 ++++---- compiler/rustc_hir_typeck/src/upvar.rs | 34 ++++++------- compiler/rustc_middle/src/ty/closure.rs | 17 ++++--- compiler/rustc_middle/src/ty/mod.rs | 1 - compiler/rustc_mir_build/src/thir/cx/expr.rs | 6 +-- .../clippy_lints/src/loops/mut_range_bound.rs | 2 +- .../src/needless_pass_by_ref_mut.rs | 6 +-- .../src/operators/assign_op_pattern.rs | 4 +- src/tools/clippy/clippy_lints/src/unwrap.rs | 2 +- src/tools/clippy/clippy_utils/src/lib.rs | 4 +- src/tools/clippy/clippy_utils/src/usage.rs | 2 +- .../arrays-completely-captured.rs | 6 +-- .../arrays-completely-captured.stderr | 6 +-- .../2229_closure_analysis/by_value.rs | 4 +- .../2229_closure_analysis/by_value.stderr | 4 +- .../capture-analysis-1.rs | 12 ++--- .../capture-analysis-1.stderr | 12 ++--- .../capture-analysis-2.rs | 2 +- .../capture-analysis-2.stderr | 2 +- .../capture-analysis-3.rs | 2 +- .../capture-analysis-3.stderr | 2 +- .../capture-analysis-4.rs | 2 +- .../capture-analysis-4.stderr | 2 +- .../capture-disjoint-field-struct.rs | 4 +- .../capture-disjoint-field-struct.stderr | 4 +- .../capture-disjoint-field-tuple.rs | 4 +- .../capture-disjoint-field-tuple.stderr | 4 +- .../2229_closure_analysis/capture-enums.rs | 4 +- .../capture-enums.stderr | 4 +- .../deep-multilevel-struct.rs | 10 ++-- .../deep-multilevel-struct.stderr | 10 ++-- .../deep-multilevel-tuple.rs | 10 ++-- .../deep-multilevel-tuple.stderr | 10 ++-- .../destructure_patterns.rs | 12 ++--- .../destructure_patterns.stderr | 12 ++--- .../feature-gate-capture_disjoint_fields.rs | 4 +- ...eature-gate-capture_disjoint_fields.stderr | 4 +- .../filter-on-struct-member.rs | 4 +- .../filter-on-struct-member.stderr | 4 +- .../2229_closure_analysis/issue-87378.rs | 4 +- .../2229_closure_analysis/issue-87378.stderr | 4 +- .../2229_closure_analysis/issue-88476.rs | 4 +- .../2229_closure_analysis/issue-88476.stderr | 4 +- .../match/patterns-capture-analysis.rs | 26 +++++----- .../match/patterns-capture-analysis.stderr | 26 +++++----- .../2229_closure_analysis/move_closure.rs | 20 ++++---- .../2229_closure_analysis/move_closure.stderr | 20 ++++---- .../multilevel-path-1.rs | 4 +- .../multilevel-path-1.stderr | 4 +- .../multilevel-path-2.rs | 4 +- .../multilevel-path-2.stderr | 4 +- .../2229_closure_analysis/nested-closure.rs | 18 +++---- .../nested-closure.stderr | 18 +++---- .../optimization/edge_case.rs | 4 +- .../optimization/edge_case.stderr | 4 +- .../path-with-array-access.rs | 4 +- .../path-with-array-access.stderr | 4 +- .../preserve_field_drop_order.rs | 24 +++++----- .../preserve_field_drop_order.stderr | 48 +++++++++---------- .../2229_closure_analysis/repr_packed.rs | 14 +++--- .../2229_closure_analysis/repr_packed.stderr | 14 +++--- .../simple-struct-min-capture.rs | 10 ++-- .../simple-struct-min-capture.stderr | 8 ++-- .../2229_closure_analysis/unsafe_ptr.rs | 8 ++-- .../2229_closure_analysis/unsafe_ptr.stderr | 8 ++-- .../2229_closure_analysis/wild_patterns.rs | 4 +- .../wild_patterns.stderr | 4 +- 68 files changed, 289 insertions(+), 288 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index 33bd4f37b7f..b7df46a4cbd 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -816,7 +816,7 @@ fn show_mutating_upvar( ) { match captured_place.info.capture_kind { ty::UpvarCapture::ByRef( - ty::BorrowKind::MutBorrow | ty::BorrowKind::UniqueImmBorrow, + ty::BorrowKind::Mutable | ty::BorrowKind::UniqueImmutable, ) => { capture_reason = format!("mutable borrow of `{upvar}`"); } diff --git a/compiler/rustc_hir_typeck/src/expr_use_visitor.rs b/compiler/rustc_hir_typeck/src/expr_use_visitor.rs index 361fd55d5de..59bef8315d8 100644 --- a/compiler/rustc_hir_typeck/src/expr_use_visitor.rs +++ b/compiler/rustc_hir_typeck/src/expr_use_visitor.rs @@ -21,13 +21,12 @@ pub use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection}; use rustc_middle::mir::FakeReadCause; use rustc_middle::ty::{ - self, AdtKind, Ty, TyCtxt, TypeFoldable, TypeVisitableExt as _, adjustment, + self, AdtKind, BorrowKind, Ty, TyCtxt, TypeFoldable, TypeVisitableExt as _, adjustment, }; use rustc_middle::{bug, span_bug}; use rustc_span::{ErrorGuaranteed, Span}; use rustc_trait_selection::infer::InferCtxtExt; use tracing::{debug, trace}; -use ty::BorrowKind::ImmBorrow; use crate::fn_ctxt::FnCtxt; @@ -63,7 +62,7 @@ fn borrow( fn copy(&mut self, place_with_id: &PlaceWithHirId<'tcx>, diag_expr_id: HirId) { // In most cases, copying data from `x` is equivalent to doing `*&x`, so by default // we treat a copy of `x` as a borrow of `x`. - self.borrow(place_with_id, diag_expr_id, ty::BorrowKind::ImmBorrow) + self.borrow(place_with_id, diag_expr_id, ty::BorrowKind::Immutable) } /// The path at `assignee_place` is being assigned to. @@ -387,7 +386,7 @@ pub fn walk_expr(&self, expr: &hir::Expr<'_>) -> Result<(), Cx::Error> { } hir::ExprKind::Let(hir::LetExpr { pat, init, .. }) => { - self.walk_local(init, pat, None, || self.borrow_expr(init, ty::ImmBorrow))?; + self.walk_local(init, pat, None, || self.borrow_expr(init, BorrowKind::Immutable))?; } hir::ExprKind::Match(discr, arms, _) => { @@ -626,7 +625,7 @@ fn maybe_read_scrutinee<'t>( } if needs_to_be_read { - self.borrow_expr(discr, ty::ImmBorrow)?; + self.borrow_expr(discr, BorrowKind::Immutable)?; } else { let closure_def_id = match discr_place.place.base { PlaceBase::Upvar(upvar_id) => Some(upvar_id.closure_expr_id), @@ -785,8 +784,8 @@ fn walk_adjustment(&self, expr: &hir::Expr<'_>) -> Result<(), Cx::Error> { // Reborrowing a Pin is like a combinations of a deref and a borrow, so we do // both. let bk = match mutbl { - ty::Mutability::Not => ty::BorrowKind::ImmBorrow, - ty::Mutability::Mut => ty::BorrowKind::MutBorrow, + ty::Mutability::Not => ty::BorrowKind::Immutable, + ty::Mutability::Mut => ty::BorrowKind::Mutable, }; self.delegate.borrow_mut().borrow(&place_with_id, place_with_id.hir_id, bk); } @@ -909,7 +908,11 @@ fn walk_pat( // binding when lowering pattern guards to ensure that the guard does not // modify the scrutinee. if has_guard { - self.delegate.borrow_mut().borrow(place, discr_place.hir_id, ImmBorrow); + self.delegate.borrow_mut().borrow( + place, + discr_place.hir_id, + BorrowKind::Immutable, + ); } // It is also a borrow or copy/move of the value being matched. diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs index fbb427da103..2d5e8fdd720 100644 --- a/compiler/rustc_hir_typeck/src/upvar.rs +++ b/compiler/rustc_hir_typeck/src/upvar.rs @@ -44,8 +44,8 @@ use rustc_middle::mir::FakeReadCause; use rustc_middle::traits::ObligationCauseCode; use rustc_middle::ty::{ - self, ClosureSizeProfileData, Ty, TyCtxt, TypeVisitableExt as _, TypeckResults, UpvarArgs, - UpvarCapture, + self, BorrowKind, ClosureSizeProfileData, Ty, TyCtxt, TypeVisitableExt as _, TypeckResults, + UpvarArgs, UpvarCapture, }; use rustc_middle::{bug, span_bug}; use rustc_session::lint; @@ -646,7 +646,7 @@ fn process_collected_capture_information( }, ty::UpvarCapture::ByRef( - ty::BorrowKind::MutBorrow | ty::BorrowKind::UniqueImmBorrow, + ty::BorrowKind::Mutable | ty::BorrowKind::UniqueImmutable, ) => { match closure_kind { ty::ClosureKind::Fn => { @@ -1681,7 +1681,7 @@ fn init_capture_kind_for_place( ty::UpvarCapture::ByValue } hir::CaptureBy::Value { .. } | hir::CaptureBy::Ref => { - ty::UpvarCapture::ByRef(ty::ImmBorrow) + ty::UpvarCapture::ByRef(BorrowKind::Immutable) } } } @@ -1869,7 +1869,7 @@ fn should_reborrow_from_env_of_parent_coroutine_closure<'tcx>( Some(Projection { kind: ProjectionKind::Deref, .. }) )) // (2.) - || matches!(child_capture.info.capture_kind, UpvarCapture::ByRef(ty::BorrowKind::MutBorrow)) + || matches!(child_capture.info.capture_kind, UpvarCapture::ByRef(ty::BorrowKind::Mutable)) } /// Truncate the capture so that the place being borrowed is in accordance with RFC 1240, @@ -1984,7 +1984,7 @@ fn fake_read( // We need to restrict Fake Read precision to avoid fake reading unsafe code, // such as deref of a raw pointer. - let dummy_capture_kind = ty::UpvarCapture::ByRef(ty::BorrowKind::ImmBorrow); + let dummy_capture_kind = ty::UpvarCapture::ByRef(ty::BorrowKind::Immutable); let (place, _) = restrict_capture_precision(place.place.clone(), dummy_capture_kind); @@ -2025,7 +2025,7 @@ fn borrow( // Raw pointers don't inherit mutability if place_with_id.place.deref_tys().any(Ty::is_unsafe_ptr) { - capture_kind = ty::UpvarCapture::ByRef(ty::BorrowKind::ImmBorrow); + capture_kind = ty::UpvarCapture::ByRef(ty::BorrowKind::Immutable); } self.capture_information.push((place, ty::CaptureInfo { @@ -2037,7 +2037,7 @@ fn borrow( #[instrument(skip(self), level = "debug")] fn mutate(&mut self, assignee_place: &PlaceWithHirId<'tcx>, diag_expr_id: HirId) { - self.borrow(assignee_place, diag_expr_id, ty::BorrowKind::MutBorrow); + self.borrow(assignee_place, diag_expr_id, ty::BorrowKind::Mutable); } } @@ -2331,16 +2331,16 @@ fn determine_capture_info( (ty::UpvarCapture::ByRef(ref_a), ty::UpvarCapture::ByRef(ref_b)) => { match (ref_a, ref_b) { // Take LHS: - (ty::UniqueImmBorrow | ty::MutBorrow, ty::ImmBorrow) - | (ty::MutBorrow, ty::UniqueImmBorrow) => capture_info_a, + (BorrowKind::UniqueImmutable | BorrowKind::Mutable, BorrowKind::Immutable) + | (BorrowKind::Mutable, BorrowKind::UniqueImmutable) => capture_info_a, // Take RHS: - (ty::ImmBorrow, ty::UniqueImmBorrow | ty::MutBorrow) - | (ty::UniqueImmBorrow, ty::MutBorrow) => capture_info_b, + (BorrowKind::Immutable, BorrowKind::UniqueImmutable | BorrowKind::Mutable) + | (BorrowKind::UniqueImmutable, BorrowKind::Mutable) => capture_info_b, - (ty::ImmBorrow, ty::ImmBorrow) - | (ty::UniqueImmBorrow, ty::UniqueImmBorrow) - | (ty::MutBorrow, ty::MutBorrow) => { + (BorrowKind::Immutable, BorrowKind::Immutable) + | (BorrowKind::UniqueImmutable, BorrowKind::UniqueImmutable) + | (BorrowKind::Mutable, BorrowKind::Mutable) => { bug!("Expected unequal capture kinds"); } } @@ -2367,12 +2367,12 @@ fn truncate_place_to_len_and_update_capture_kind<'tcx>( // Note that if the place contained Deref of a raw pointer it would've not been MutBorrow, so // we don't need to worry about that case here. match curr_mode { - ty::UpvarCapture::ByRef(ty::BorrowKind::MutBorrow) => { + ty::UpvarCapture::ByRef(ty::BorrowKind::Mutable) => { for i in len..place.projections.len() { if place.projections[i].kind == ProjectionKind::Deref && is_mut_ref(place.ty_before_projection(i)) { - *curr_mode = ty::UpvarCapture::ByRef(ty::BorrowKind::UniqueImmBorrow); + *curr_mode = ty::UpvarCapture::ByRef(ty::BorrowKind::UniqueImmutable); break; } } diff --git a/compiler/rustc_middle/src/ty/closure.rs b/compiler/rustc_middle/src/ty/closure.rs index 9ee82942911..6ab4d76e545 100644 --- a/compiler/rustc_middle/src/ty/closure.rs +++ b/compiler/rustc_middle/src/ty/closure.rs @@ -10,7 +10,6 @@ use rustc_span::symbol::Ident; use rustc_span::{Span, Symbol}; -use self::BorrowKind::*; use super::TyCtxt; use crate::hir::place::{ Place as HirPlace, PlaceBase as HirPlaceBase, ProjectionKind as HirProjectionKind, @@ -334,7 +333,7 @@ pub fn place_to_string_for_capture<'tcx>(tcx: TyCtxt<'tcx>, place: &HirPlace<'tc #[derive(TypeFoldable, TypeVisitable)] pub enum BorrowKind { /// Data must be immutable and is aliasable. - ImmBorrow, + Immutable, /// Data must be immutable but not aliasable. This kind of borrow /// cannot currently be expressed by the user and is used only in @@ -382,17 +381,17 @@ pub enum BorrowKind { /// borrow, it's just used when translating closures. /// /// FIXME: Rename this to indicate the borrow is actually not immutable. - UniqueImmBorrow, + UniqueImmutable, /// Data is mutable and not aliasable. - MutBorrow, + Mutable, } impl BorrowKind { pub fn from_mutbl(m: hir::Mutability) -> BorrowKind { match m { - hir::Mutability::Mut => MutBorrow, - hir::Mutability::Not => ImmBorrow, + hir::Mutability::Mut => BorrowKind::Mutable, + hir::Mutability::Not => BorrowKind::Immutable, } } @@ -402,13 +401,13 @@ pub fn from_mutbl(m: hir::Mutability) -> BorrowKind { /// question. pub fn to_mutbl_lossy(self) -> hir::Mutability { match self { - MutBorrow => hir::Mutability::Mut, - ImmBorrow => hir::Mutability::Not, + BorrowKind::Mutable => hir::Mutability::Mut, + BorrowKind::Immutable => hir::Mutability::Not, // We have no type corresponding to a unique imm borrow, so // use `&mut`. It gives all the capabilities of a `&uniq` // and hence is a safe "over approximation". - UniqueImmBorrow => hir::Mutability::Mut, + BorrowKind::UniqueImmutable => hir::Mutability::Mut, } } } diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index df47ac2099a..ce02d0f308e 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -55,7 +55,6 @@ pub use vtable::*; use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir}; -pub use self::BorrowKind::*; pub use self::closure::{ BorrowKind, CAPTURE_STRUCT_LOCAL, CaptureInfo, CapturedPlace, ClosureTypeInfo, MinCaptureInformationMap, MinCaptureList, RootVariableMinCaptureList, UpvarCapture, UpvarId, diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index 0481f715019..6c6ca21c6c7 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -1185,11 +1185,11 @@ fn capture_upvar( ty::UpvarCapture::ByValue => captured_place_expr, ty::UpvarCapture::ByRef(upvar_borrow) => { let borrow_kind = match upvar_borrow { - ty::BorrowKind::ImmBorrow => BorrowKind::Shared, - ty::BorrowKind::UniqueImmBorrow => { + ty::BorrowKind::Immutable => BorrowKind::Shared, + ty::BorrowKind::UniqueImmutable => { BorrowKind::Mut { kind: mir::MutBorrowKind::ClosureCapture } } - ty::BorrowKind::MutBorrow => { + ty::BorrowKind::Mutable => { BorrowKind::Mut { kind: mir::MutBorrowKind::Default } } }; diff --git a/src/tools/clippy/clippy_lints/src/loops/mut_range_bound.rs b/src/tools/clippy/clippy_lints/src/loops/mut_range_bound.rs index 21f9a71f2c5..094b1947324 100644 --- a/src/tools/clippy/clippy_lints/src/loops/mut_range_bound.rs +++ b/src/tools/clippy/clippy_lints/src/loops/mut_range_bound.rs @@ -80,7 +80,7 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate<'_, 'tcx> { fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {} fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, diag_expr_id: HirId, bk: ty::BorrowKind) { - if bk == ty::BorrowKind::MutBorrow { + if bk == ty::BorrowKind::Mutable { if let PlaceBase::Local(id) = cmt.place.base { if Some(id) == self.hir_id_low && !BreakAfterExprVisitor::is_found(self.cx, diag_expr_id) { self.span_low = Some(self.cx.tcx.hir().span(diag_expr_id)); diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs index 5c631a176c4..f8c815d9729 100644 --- a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs +++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs @@ -417,8 +417,8 @@ fn borrow(&mut self, cmt: &euv::PlaceWithHirId<'tcx>, id: HirId, borrow: ty::Bor // a closure, it'll return this variant whereas if you have just an index access, it'll // return `ImmBorrow`. So if there is "Unique" and it's a mutable reference, we add it // to the mutably used variables set. - if borrow == ty::BorrowKind::MutBorrow - || (borrow == ty::BorrowKind::UniqueImmBorrow && base_ty.ref_mutability() == Some(Mutability::Mut)) + if borrow == ty::BorrowKind::Mutable + || (borrow == ty::BorrowKind::UniqueImmutable && base_ty.ref_mutability() == Some(Mutability::Mut)) { self.add_mutably_used_var(*vid); } else if self.is_in_unsafe_block(id) { @@ -426,7 +426,7 @@ fn borrow(&mut self, cmt: &euv::PlaceWithHirId<'tcx>, id: HirId, borrow: ty::Bor // upon! self.add_mutably_used_var(*vid); } - } else if borrow == ty::ImmBorrow { + } else if borrow == ty::BorrowKind::Immutable { // If there is an `async block`, it'll contain a call to a closure which we need to // go into to ensure all "mutate" checks are found. if let Node::Expr(Expr { diff --git a/src/tools/clippy/clippy_lints/src/operators/assign_op_pattern.rs b/src/tools/clippy/clippy_lints/src/operators/assign_op_pattern.rs index 11c97b4ef00..0dcaec1c9a7 100644 --- a/src/tools/clippy/clippy_lints/src/operators/assign_op_pattern.rs +++ b/src/tools/clippy/clippy_lints/src/operators/assign_op_pattern.rs @@ -102,7 +102,7 @@ fn imm_borrows_in_expr(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> HirIdSet { struct S(HirIdSet); impl Delegate<'_> for S { fn borrow(&mut self, place: &PlaceWithHirId<'_>, _: HirId, kind: BorrowKind) { - if matches!(kind, BorrowKind::ImmBorrow | BorrowKind::UniqueImmBorrow) { + if matches!(kind, BorrowKind::Immutable | BorrowKind::UniqueImmutable) { self.0.insert(match place.place.base { PlaceBase::Local(id) => id, PlaceBase::Upvar(id) => id.var_path.hir_id, @@ -127,7 +127,7 @@ fn mut_borrows_in_expr(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> HirIdSet { struct S(HirIdSet); impl Delegate<'_> for S { fn borrow(&mut self, place: &PlaceWithHirId<'_>, _: HirId, kind: BorrowKind) { - if matches!(kind, BorrowKind::MutBorrow) { + if matches!(kind, BorrowKind::Mutable) { self.0.insert(match place.place.base { PlaceBase::Local(id) => id, PlaceBase::Upvar(id) => id.var_path.hir_id, diff --git a/src/tools/clippy/clippy_lints/src/unwrap.rs b/src/tools/clippy/clippy_lints/src/unwrap.rs index 096b3ff9a2e..89bb429e265 100644 --- a/src/tools/clippy/clippy_lints/src/unwrap.rs +++ b/src/tools/clippy/clippy_lints/src/unwrap.rs @@ -217,7 +217,7 @@ fn is_option_as_mut_use(tcx: TyCtxt<'_>, expr_id: HirId) -> bool { impl<'tcx> Delegate<'tcx> for MutationVisitor<'tcx> { fn borrow(&mut self, cat: &PlaceWithHirId<'tcx>, diag_expr_id: HirId, bk: ty::BorrowKind) { - if let ty::BorrowKind::MutBorrow = bk + if let ty::BorrowKind::Mutable = bk && is_potentially_local_place(self.local_id, &cat.place) && !is_option_as_mut_use(self.tcx, diag_expr_id) { diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 2b91f528807..0f712068e65 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -1209,8 +1209,8 @@ fn visit_expr(&mut self, e: &'tcx Expr<'_>) { let capture = match capture.info.capture_kind { UpvarCapture::ByValue => CaptureKind::Value, UpvarCapture::ByRef(kind) => match kind { - BorrowKind::ImmBorrow => CaptureKind::Ref(Mutability::Not), - BorrowKind::UniqueImmBorrow | BorrowKind::MutBorrow => { + BorrowKind::Immutable => CaptureKind::Ref(Mutability::Not), + BorrowKind::UniqueImmutable | BorrowKind::Mutable => { CaptureKind::Ref(Mutability::Mut) }, }, diff --git a/src/tools/clippy/clippy_utils/src/usage.rs b/src/tools/clippy/clippy_utils/src/usage.rs index 8af3bdccaa1..4bfc9dd9213 100644 --- a/src/tools/clippy/clippy_utils/src/usage.rs +++ b/src/tools/clippy/clippy_utils/src/usage.rs @@ -67,7 +67,7 @@ impl<'tcx> Delegate<'tcx> for MutVarsDelegate { fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {} fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, bk: ty::BorrowKind) { - if bk == ty::BorrowKind::MutBorrow { + if bk == ty::BorrowKind::Mutable { self.update(cmt); } } diff --git a/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.rs b/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.rs index c194cea2e37..27b17a56f12 100644 --- a/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.rs +++ b/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.rs @@ -13,10 +13,10 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: m[0] += 10; - //~^ NOTE: Capturing m[] -> MutBorrow - //~| NOTE: Min Capture m[] -> MutBorrow + //~^ NOTE: Capturing m[] -> Mutable + //~| NOTE: Min Capture m[] -> Mutable m[1] += 40; - //~^ NOTE: Capturing m[] -> MutBorrow + //~^ NOTE: Capturing m[] -> Mutable }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr b/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr index d7582dcfcc7..3c4f2de73a4 100644 --- a/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr +++ b/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr @@ -20,12 +20,12 @@ LL | | LL | | }; | |_____^ | -note: Capturing m[] -> MutBorrow +note: Capturing m[] -> Mutable --> $DIR/arrays-completely-captured.rs:15:9 | LL | m[0] += 10; | ^ -note: Capturing m[] -> MutBorrow +note: Capturing m[] -> Mutable --> $DIR/arrays-completely-captured.rs:18:9 | LL | m[1] += 40; @@ -43,7 +43,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture m[] -> MutBorrow +note: Min Capture m[] -> Mutable --> $DIR/arrays-completely-captured.rs:15:9 | LL | m[0] += 10; diff --git a/tests/ui/closures/2229_closure_analysis/by_value.rs b/tests/ui/closures/2229_closure_analysis/by_value.rs index 3fa28a1c6e9..2c9202fd617 100644 --- a/tests/ui/closures/2229_closure_analysis/by_value.rs +++ b/tests/ui/closures/2229_closure_analysis/by_value.rs @@ -26,8 +26,8 @@ fn big_box() { //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue //~| NOTE: Min Capture t[(0, 0)] -> ByValue println!("{} {:?}", t.1, p); - //~^ NOTE: Capturing t[(1, 0)] -> ImmBorrow - //~| NOTE: Min Capture t[(1, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(1, 0)] -> Immutable + //~| NOTE: Min Capture t[(1, 0)] -> Immutable }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/by_value.stderr b/tests/ui/closures/2229_closure_analysis/by_value.stderr index 0dd9991cf84..f843b76d723 100644 --- a/tests/ui/closures/2229_closure_analysis/by_value.stderr +++ b/tests/ui/closures/2229_closure_analysis/by_value.stderr @@ -25,7 +25,7 @@ note: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue | LL | let p = t.0.0; | ^^^^^ -note: Capturing t[(1, 0)] -> ImmBorrow +note: Capturing t[(1, 0)] -> Immutable --> $DIR/by_value.rs:28:29 | LL | println!("{} {:?}", t.1, p); @@ -48,7 +48,7 @@ note: Min Capture t[(0, 0)] -> ByValue | LL | let p = t.0.0; | ^^^^^ -note: Min Capture t[(1, 0)] -> ImmBorrow +note: Min Capture t[(1, 0)] -> Immutable --> $DIR/by_value.rs:28:29 | LL | println!("{} {:?}", t.1, p); diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs index fa1ddeb0176..0c42e66a2fa 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs @@ -20,15 +20,15 @@ fn main() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: println!("{:?}", p); - //~^ NOTE: Capturing p[] -> ImmBorrow - //~| NOTE: Min Capture p[] -> ImmBorrow + //~^ NOTE: Capturing p[] -> Immutable + //~| NOTE: Min Capture p[] -> Immutable println!("{:?}", p.x); - //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Immutable println!("{:?}", q.x); - //~^ NOTE: Capturing q[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing q[(0, 0)] -> Immutable println!("{:?}", q); - //~^ NOTE: Capturing q[] -> ImmBorrow - //~| NOTE: Min Capture q[] -> ImmBorrow + //~^ NOTE: Capturing q[] -> Immutable + //~| NOTE: Min Capture q[] -> Immutable }; } diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.stderr b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.stderr index d2409c9367c..64ae704bc90 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.stderr @@ -20,22 +20,22 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[] -> ImmBorrow +note: Capturing p[] -> Immutable --> $DIR/capture-analysis-1.rs:22:26 | LL | println!("{:?}", p); | ^ -note: Capturing p[(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0)] -> Immutable --> $DIR/capture-analysis-1.rs:25:26 | LL | println!("{:?}", p.x); | ^^^ -note: Capturing q[(0, 0)] -> ImmBorrow +note: Capturing q[(0, 0)] -> Immutable --> $DIR/capture-analysis-1.rs:28:26 | LL | println!("{:?}", q.x); | ^^^ -note: Capturing q[] -> ImmBorrow +note: Capturing q[] -> Immutable --> $DIR/capture-analysis-1.rs:30:26 | LL | println!("{:?}", q); @@ -53,12 +53,12 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[] -> ImmBorrow +note: Min Capture p[] -> Immutable --> $DIR/capture-analysis-1.rs:22:26 | LL | println!("{:?}", p); | ^ -note: Min Capture q[] -> ImmBorrow +note: Min Capture q[] -> Immutable --> $DIR/capture-analysis-1.rs:30:26 | LL | println!("{:?}", q); diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs index eb342b303f9..adb618d1771 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs @@ -22,7 +22,7 @@ fn main() { //~^ NOTE: Capturing p[(0, 0)] -> ByValue //~| NOTE: p[] captured as ByValue here println!("{:?}", p); - //~^ NOTE: Capturing p[] -> ImmBorrow + //~^ NOTE: Capturing p[] -> Immutable //~| NOTE: Min Capture p[] -> ByValue //~| NOTE: p[] used here }; diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.stderr b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.stderr index 7049c708bb8..40c075f3cc8 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.stderr @@ -25,7 +25,7 @@ note: Capturing p[(0, 0)] -> ByValue | LL | let _x = p.x; | ^^^ -note: Capturing p[] -> ImmBorrow +note: Capturing p[] -> Immutable --> $DIR/capture-analysis-2.rs:24:26 | LL | println!("{:?}", p); diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs index e1476e415d9..0a21eaaaa12 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs @@ -27,7 +27,7 @@ fn main() { //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ByValue //~| NOTE: a[(0, 0)] captured as ByValue here println!("{:?}", a.b); - //~^ NOTE: Capturing a[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing a[(0, 0)] -> Immutable //~| NOTE: Min Capture a[(0, 0)] -> ByValue //~| NOTE: a[(0, 0)] used here }; diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.stderr b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.stderr index 698b51a4fdb..a4689f2ea96 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.stderr @@ -25,7 +25,7 @@ note: Capturing a[(0, 0),(0, 0)] -> ByValue | LL | let _x = a.b.c; | ^^^^^ -note: Capturing a[(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0)] -> Immutable --> $DIR/capture-analysis-3.rs:29:26 | LL | println!("{:?}", a.b); diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs index 6d53a0ac634..790dad0710b 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs @@ -27,6 +27,6 @@ fn main() { //~^ NOTE: Capturing a[(0, 0)] -> ByValue //~| NOTE: Min Capture a[(0, 0)] -> ByValue println!("{:?}", a.b.c); - //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> Immutable }; } diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.stderr b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.stderr index 9cd0dcf720e..9d3004dbbb0 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.stderr @@ -25,7 +25,7 @@ note: Capturing a[(0, 0)] -> ByValue | LL | let _x = a.b; | ^^^ -note: Capturing a[(0, 0),(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0),(0, 0)] -> Immutable --> $DIR/capture-analysis-4.rs:29:26 | LL | println!("{:?}", a.b.c); diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs index 68703333fa8..af12e0b259d 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs @@ -18,8 +18,8 @@ fn main() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: println!("{}", p.x); - //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Immutable + //~| NOTE: Min Capture p[(0, 0)] -> Immutable }; // `c` should only capture `p.x`, therefore mutating `p.y` is allowed. diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr index 92a719d6098..48fbd682a5b 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0)] -> Immutable --> $DIR/capture-disjoint-field-struct.rs:20:24 | LL | println!("{}", p.x); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[(0, 0)] -> ImmBorrow +note: Min Capture p[(0, 0)] -> Immutable --> $DIR/capture-disjoint-field-struct.rs:20:24 | LL | println!("{}", p.x); diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs index 0c006ffdd72..ccd26049264 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs @@ -13,8 +13,8 @@ fn main() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: println!("{}", t.0); - //~^ NOTE: Capturing t[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture t[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0)] -> Immutable + //~| NOTE: Min Capture t[(0, 0)] -> Immutable }; // `c` only captures t.0, therefore mutating t.1 is allowed. diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr index d5333bf71db..496511d6025 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0)] -> ImmBorrow +note: Capturing t[(0, 0)] -> Immutable --> $DIR/capture-disjoint-field-tuple.rs:15:24 | LL | println!("{}", t.0); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture t[(0, 0)] -> ImmBorrow +note: Min Capture t[(0, 0)] -> Immutable --> $DIR/capture-disjoint-field-tuple.rs:15:24 | LL | println!("{}", t.0); diff --git a/tests/ui/closures/2229_closure_analysis/capture-enums.rs b/tests/ui/closures/2229_closure_analysis/capture-enums.rs index 6f973739e66..b1e21bd0f8d 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-enums.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-enums.rs @@ -21,14 +21,14 @@ fn multi_variant_enum() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: if let Info::Point(_, _, str) = point { - //~^ NOTE: Capturing point[] -> ImmBorrow + //~^ NOTE: Capturing point[] -> Immutable //~| NOTE: Capturing point[(2, 0)] -> ByValue //~| NOTE: Min Capture point[] -> ByValue println!("{}", str); } if let Info::Meta(_, v) = meta { - //~^ NOTE: Capturing meta[] -> ImmBorrow + //~^ NOTE: Capturing meta[] -> Immutable //~| NOTE: Capturing meta[(1, 1)] -> ByValue //~| NOTE: Min Capture meta[] -> ByValue println!("{:?}", v); diff --git a/tests/ui/closures/2229_closure_analysis/capture-enums.stderr b/tests/ui/closures/2229_closure_analysis/capture-enums.stderr index 8b258569d95..2d70b614858 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-enums.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-enums.stderr @@ -30,7 +30,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing point[] -> ImmBorrow +note: Capturing point[] -> Immutable --> $DIR/capture-enums.rs:23:41 | LL | if let Info::Point(_, _, str) = point { @@ -40,7 +40,7 @@ note: Capturing point[(2, 0)] -> ByValue | LL | if let Info::Point(_, _, str) = point { | ^^^^^ -note: Capturing meta[] -> ImmBorrow +note: Capturing meta[] -> Immutable --> $DIR/capture-enums.rs:30:35 | LL | if let Info::Meta(_, v) = meta { diff --git a/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs b/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs index 5143836ad6b..61b707605c2 100644 --- a/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs +++ b/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs @@ -39,13 +39,13 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let x = &p.a.p.x; - //~^ NOTE: Capturing p[(0, 0),(0, 0),(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0),(0, 0),(0, 0)] -> Immutable p.b.q.y = 9; - //~^ NOTE: Capturing p[(1, 0),(1, 0),(1, 0)] -> MutBorrow - //~| NOTE: p[] captured as MutBorrow here + //~^ NOTE: Capturing p[(1, 0),(1, 0),(1, 0)] -> Mutable + //~| NOTE: p[] captured as Mutable here println!("{:?}", p); - //~^ NOTE: Capturing p[] -> ImmBorrow - //~| NOTE: Min Capture p[] -> MutBorrow + //~^ NOTE: Capturing p[] -> Immutable + //~| NOTE: Min Capture p[] -> Mutable //~| NOTE: p[] used here }; } diff --git a/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr b/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr index 55ba416dfd9..d118f7573a4 100644 --- a/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr +++ b/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr @@ -20,17 +20,17 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0),(0, 0),(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0),(0, 0),(0, 0)] -> Immutable --> $DIR/deep-multilevel-struct.rs:41:18 | LL | let x = &p.a.p.x; | ^^^^^^^ -note: Capturing p[(1, 0),(1, 0),(1, 0)] -> MutBorrow +note: Capturing p[(1, 0),(1, 0),(1, 0)] -> Mutable --> $DIR/deep-multilevel-struct.rs:43:9 | LL | p.b.q.y = 9; | ^^^^^^^ -note: Capturing p[] -> ImmBorrow +note: Capturing p[] -> Immutable --> $DIR/deep-multilevel-struct.rs:46:26 | LL | println!("{:?}", p); @@ -48,11 +48,11 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[] -> MutBorrow +note: Min Capture p[] -> Mutable --> $DIR/deep-multilevel-struct.rs:43:9 | LL | p.b.q.y = 9; - | ^^^^^^^ p[] captured as MutBorrow here + | ^^^^^^^ p[] captured as Mutable here ... LL | println!("{:?}", p); | ^ p[] used here diff --git a/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs b/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs index 0cb0aeb824e..6c7eab1eeb7 100644 --- a/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs +++ b/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs @@ -13,13 +13,13 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let x = &t.0.0.0; - //~^ NOTE: Capturing t[(0, 0),(0, 0),(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0),(0, 0),(0, 0)] -> Immutable t.1.1.1 = 9; - //~^ NOTE: Capturing t[(1, 0),(1, 0),(1, 0)] -> MutBorrow - //~| NOTE: t[] captured as MutBorrow here + //~^ NOTE: Capturing t[(1, 0),(1, 0),(1, 0)] -> Mutable + //~| NOTE: t[] captured as Mutable here println!("{:?}", t); - //~^ NOTE: Min Capture t[] -> MutBorrow - //~| NOTE: Capturing t[] -> ImmBorrow + //~^ NOTE: Min Capture t[] -> Mutable + //~| NOTE: Capturing t[] -> Immutable //~| NOTE: t[] used here }; } diff --git a/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr b/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr index 5e45fe1ca8b..cc5f74613e4 100644 --- a/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr +++ b/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr @@ -20,17 +20,17 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),(0, 0),(0, 0)] -> ImmBorrow +note: Capturing t[(0, 0),(0, 0),(0, 0)] -> Immutable --> $DIR/deep-multilevel-tuple.rs:15:18 | LL | let x = &t.0.0.0; | ^^^^^^^ -note: Capturing t[(1, 0),(1, 0),(1, 0)] -> MutBorrow +note: Capturing t[(1, 0),(1, 0),(1, 0)] -> Mutable --> $DIR/deep-multilevel-tuple.rs:17:9 | LL | t.1.1.1 = 9; | ^^^^^^^ -note: Capturing t[] -> ImmBorrow +note: Capturing t[] -> Immutable --> $DIR/deep-multilevel-tuple.rs:20:26 | LL | println!("{:?}", t); @@ -48,11 +48,11 @@ LL | | LL | | }; | |_____^ | -note: Min Capture t[] -> MutBorrow +note: Min Capture t[] -> Mutable --> $DIR/deep-multilevel-tuple.rs:17:9 | LL | t.1.1.1 = 9; - | ^^^^^^^ t[] captured as MutBorrow here + | ^^^^^^^ t[] captured as Mutable here ... LL | println!("{:?}", t); | ^ t[] used here diff --git a/tests/ui/closures/2229_closure_analysis/destructure_patterns.rs b/tests/ui/closures/2229_closure_analysis/destructure_patterns.rs index 3106c478d00..68e8d66762d 100644 --- a/tests/ui/closures/2229_closure_analysis/destructure_patterns.rs +++ b/tests/ui/closures/2229_closure_analysis/destructure_patterns.rs @@ -44,9 +44,9 @@ fn structs() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let Point { x: ref mut x, y: _, id: moved_id } = p; - //~^ NOTE: Capturing p[(0, 0)] -> MutBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Mutable //~| NOTE: Capturing p[(2, 0)] -> ByValue - //~| NOTE: Min Capture p[(0, 0)] -> MutBorrow + //~| NOTE: Min Capture p[(0, 0)] -> Mutable //~| NOTE: Min Capture p[(2, 0)] -> ByValue println!("{}, {}", x, moved_id); @@ -65,11 +65,11 @@ fn tuples() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let (ref mut x, ref ref_str, (moved_s, _)) = t; - //~^ NOTE: Capturing t[(0, 0)] -> MutBorrow - //~| NOTE: Capturing t[(1, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0)] -> Mutable + //~| NOTE: Capturing t[(1, 0)] -> Immutable //~| NOTE: Capturing t[(2, 0),(0, 0)] -> ByValue - //~| NOTE: Min Capture t[(0, 0)] -> MutBorrow - //~| NOTE: Min Capture t[(1, 0)] -> ImmBorrow + //~| NOTE: Min Capture t[(0, 0)] -> Mutable + //~| NOTE: Min Capture t[(1, 0)] -> Immutable //~| NOTE: Min Capture t[(2, 0),(0, 0)] -> ByValue println!("{}, {} {}", x, ref_str, moved_s); diff --git a/tests/ui/closures/2229_closure_analysis/destructure_patterns.stderr b/tests/ui/closures/2229_closure_analysis/destructure_patterns.stderr index 7fc85de499f..6f8295ac095 100644 --- a/tests/ui/closures/2229_closure_analysis/destructure_patterns.stderr +++ b/tests/ui/closures/2229_closure_analysis/destructure_patterns.stderr @@ -86,7 +86,7 @@ LL | | println!("{}, {}", x, moved_id); LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> MutBorrow +note: Capturing p[(0, 0)] -> Mutable --> $DIR/destructure_patterns.rs:46:58 | LL | let Point { x: ref mut x, y: _, id: moved_id } = p; @@ -109,7 +109,7 @@ LL | | println!("{}, {}", x, moved_id); LL | | }; | |_____^ | -note: Min Capture p[(0, 0)] -> MutBorrow +note: Min Capture p[(0, 0)] -> Mutable --> $DIR/destructure_patterns.rs:46:58 | LL | let Point { x: ref mut x, y: _, id: moved_id } = p; @@ -132,12 +132,12 @@ LL | | println!("{}, {} {}", x, ref_str, moved_s); LL | | }; | |_____^ | -note: Capturing t[(0, 0)] -> MutBorrow +note: Capturing t[(0, 0)] -> Mutable --> $DIR/destructure_patterns.rs:67:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ -note: Capturing t[(1, 0)] -> ImmBorrow +note: Capturing t[(1, 0)] -> Immutable --> $DIR/destructure_patterns.rs:67:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; @@ -160,12 +160,12 @@ LL | | println!("{}, {} {}", x, ref_str, moved_s); LL | | }; | |_____^ | -note: Min Capture t[(0, 0)] -> MutBorrow +note: Min Capture t[(0, 0)] -> Mutable --> $DIR/destructure_patterns.rs:67:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ -note: Min Capture t[(1, 0)] -> ImmBorrow +note: Min Capture t[(1, 0)] -> Immutable --> $DIR/destructure_patterns.rs:67:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; diff --git a/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs b/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs index 059c248a3e8..7467c13b337 100644 --- a/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs +++ b/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs @@ -13,7 +13,7 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("This uses new capture analyysis to capture s={}", s); - //~^ NOTE: Capturing s[] -> ImmBorrow - //~| NOTE: Min Capture s[] -> ImmBorrow + //~^ NOTE: Capturing s[] -> Immutable + //~| NOTE: Min Capture s[] -> Immutable }; } diff --git a/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr b/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr index 4e76070dcf7..6dbe8c153c0 100644 --- a/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr +++ b/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing s[] -> ImmBorrow +note: Capturing s[] -> Immutable --> $DIR/feature-gate-capture_disjoint_fields.rs:15:69 | LL | println!("This uses new capture analyysis to capture s={}", s); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture s[] -> ImmBorrow +note: Min Capture s[] -> Immutable --> $DIR/feature-gate-capture_disjoint_fields.rs:15:69 | LL | println!("This uses new capture analyysis to capture s={}", s); diff --git a/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.rs b/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.rs index 11ef92367ca..feef8cabb39 100644 --- a/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.rs +++ b/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.rs @@ -24,8 +24,8 @@ fn update(&mut self) { |v| self.filter.allowed(*v), //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: - //~| NOTE: Capturing self[Deref,(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture self[Deref,(0, 0)] -> ImmBorrow + //~| NOTE: Capturing self[Deref,(0, 0)] -> Immutable + //~| NOTE: Min Capture self[Deref,(0, 0)] -> Immutable ); } } diff --git a/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr b/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr index 10e0d076b42..ffe7dd4d108 100644 --- a/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr +++ b/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr @@ -4,7 +4,7 @@ error: First Pass analysis includes: LL | |v| self.filter.allowed(*v), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: Capturing self[Deref,(0, 0)] -> ImmBorrow +note: Capturing self[Deref,(0, 0)] -> Immutable --> $DIR/filter-on-struct-member.rs:24:17 | LL | |v| self.filter.allowed(*v), @@ -16,7 +16,7 @@ error: Min Capture analysis includes: LL | |v| self.filter.allowed(*v), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: Min Capture self[Deref,(0, 0)] -> ImmBorrow +note: Min Capture self[Deref,(0, 0)] -> Immutable --> $DIR/filter-on-struct-member.rs:24:17 | LL | |v| self.filter.allowed(*v), diff --git a/tests/ui/closures/2229_closure_analysis/issue-87378.rs b/tests/ui/closures/2229_closure_analysis/issue-87378.rs index 0a771466e1e..9c89a4538be 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-87378.rs +++ b/tests/ui/closures/2229_closure_analysis/issue-87378.rs @@ -19,8 +19,8 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: unsafe { u.value } - //~^ NOTE: Capturing u[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture u[] -> ImmBorrow + //~^ NOTE: Capturing u[(0, 0)] -> Immutable + //~| NOTE: Min Capture u[] -> Immutable }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/issue-87378.stderr b/tests/ui/closures/2229_closure_analysis/issue-87378.stderr index 19c0c59170b..3273e92d9d1 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-87378.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-87378.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing u[(0, 0)] -> ImmBorrow +note: Capturing u[(0, 0)] -> Immutable --> $DIR/issue-87378.rs:21:17 | LL | unsafe { u.value } @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture u[] -> ImmBorrow +note: Min Capture u[] -> Immutable --> $DIR/issue-87378.rs:21:17 | LL | unsafe { u.value } diff --git a/tests/ui/closures/2229_closure_analysis/issue-88476.rs b/tests/ui/closures/2229_closure_analysis/issue-88476.rs index 7f833839d56..45fe73b76e2 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-88476.rs +++ b/tests/ui/closures/2229_closure_analysis/issue-88476.rs @@ -24,7 +24,7 @@ fn drop(self: &mut Foo) {} //~| ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{:?}", f.0); - //~^ NOTE: Capturing f[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing f[(0, 0)] -> Immutable //~| NOTE: Min Capture f[] -> ByValue }; @@ -52,7 +52,7 @@ fn drop(&mut self) {} //~| ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", character.hp) - //~^ NOTE: Capturing character[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing character[(0, 0)] -> Immutable //~| NOTE: Min Capture character[(0, 0)] -> ByValue }; diff --git a/tests/ui/closures/2229_closure_analysis/issue-88476.stderr b/tests/ui/closures/2229_closure_analysis/issue-88476.stderr index d0201757157..1c0e254dbf7 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-88476.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-88476.stderr @@ -31,7 +31,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing f[(0, 0)] -> ImmBorrow +note: Capturing f[(0, 0)] -> Immutable --> $DIR/issue-88476.rs:26:26 | LL | println!("{:?}", f.0); @@ -69,7 +69,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing character[(0, 0)] -> ImmBorrow +note: Capturing character[(0, 0)] -> Immutable --> $DIR/issue-88476.rs:54:24 | LL | println!("{}", character.hp) diff --git a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs index 8dd20fc2a74..9c7b70457d9 100644 --- a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs +++ b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs @@ -13,8 +13,8 @@ fn test_1_should_capture() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match variant { - //~^ NOTE: Capturing variant[] -> ImmBorrow - //~| NOTE: Min Capture variant[] -> ImmBorrow + //~^ NOTE: Capturing variant[] -> Immutable + //~| NOTE: Min Capture variant[] -> Immutable Some(_) => {} _ => {} } @@ -64,9 +64,9 @@ fn test_6_should_capture_single_variant() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match variant { - //~^ NOTE: Capturing variant[] -> ImmBorrow - //~| NOTE: Capturing variant[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture variant[] -> ImmBorrow + //~^ NOTE: Capturing variant[] -> Immutable + //~| NOTE: Capturing variant[(0, 0)] -> Immutable + //~| NOTE: Min Capture variant[] -> Immutable SingleVariant::Points(a) => { println!("{:?}", a); } @@ -131,8 +131,8 @@ fn test_5_should_capture_multi_variant() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match variant { - //~^ NOTE: Capturing variant[] -> ImmBorrow - //~| NOTE: Min Capture variant[] -> ImmBorrow + //~^ NOTE: Capturing variant[] -> Immutable + //~| NOTE: Min Capture variant[] -> Immutable MVariant::A => {} _ => {} } @@ -149,8 +149,8 @@ fn test_7_should_capture_slice_len() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match slice { - //~^ NOTE: Capturing slice[] -> ImmBorrow - //~| NOTE: Min Capture slice[] -> ImmBorrow + //~^ NOTE: Capturing slice[] -> Immutable + //~| NOTE: Min Capture slice[] -> Immutable [_,_,_] => {}, _ => {} } @@ -161,8 +161,8 @@ fn test_7_should_capture_slice_len() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match slice { - //~^ NOTE: Capturing slice[] -> ImmBorrow - //~| NOTE: Min Capture slice[] -> ImmBorrow + //~^ NOTE: Capturing slice[] -> Immutable + //~| NOTE: Min Capture slice[] -> Immutable [] => {}, _ => {} } @@ -173,8 +173,8 @@ fn test_7_should_capture_slice_len() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match slice { - //~^ NOTE: Capturing slice[] -> ImmBorrow - //~| NOTE: Min Capture slice[] -> ImmBorrow + //~^ NOTE: Capturing slice[] -> Immutable + //~| NOTE: Min Capture slice[] -> Immutable [_, .. ,_] => {}, _ => {} } diff --git a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.stderr b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.stderr index c3c3f8b8477..7125bfa3101 100644 --- a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.stderr @@ -10,7 +10,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing variant[] -> ImmBorrow +note: Capturing variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:15:15 | LL | match variant { @@ -28,7 +28,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture variant[] -> ImmBorrow +note: Min Capture variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:15:15 | LL | match variant { @@ -68,12 +68,12 @@ LL | | } LL | | }; | |_____^ | -note: Capturing variant[] -> ImmBorrow +note: Capturing variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:66:15 | LL | match variant { | ^^^^^^^ -note: Capturing variant[(0, 0)] -> ImmBorrow +note: Capturing variant[(0, 0)] -> Immutable --> $DIR/patterns-capture-analysis.rs:66:15 | LL | match variant { @@ -91,7 +91,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture variant[] -> ImmBorrow +note: Min Capture variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:66:15 | LL | match variant { @@ -142,7 +142,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing variant[] -> ImmBorrow +note: Capturing variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:133:15 | LL | match variant { @@ -160,7 +160,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture variant[] -> ImmBorrow +note: Min Capture variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:133:15 | LL | match variant { @@ -178,7 +178,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing slice[] -> ImmBorrow +note: Capturing slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:151:15 | LL | match slice { @@ -196,7 +196,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture slice[] -> ImmBorrow +note: Min Capture slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:151:15 | LL | match slice { @@ -214,7 +214,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing slice[] -> ImmBorrow +note: Capturing slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:163:15 | LL | match slice { @@ -232,7 +232,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture slice[] -> ImmBorrow +note: Min Capture slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:163:15 | LL | match slice { @@ -250,7 +250,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing slice[] -> ImmBorrow +note: Capturing slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:175:15 | LL | match slice { @@ -268,7 +268,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture slice[] -> ImmBorrow +note: Min Capture slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:175:15 | LL | match slice { diff --git a/tests/ui/closures/2229_closure_analysis/move_closure.rs b/tests/ui/closures/2229_closure_analysis/move_closure.rs index 3b7f036dfe7..b6690d06011 100644 --- a/tests/ui/closures/2229_closure_analysis/move_closure.rs +++ b/tests/ui/closures/2229_closure_analysis/move_closure.rs @@ -17,7 +17,7 @@ fn simple_move_closure() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: t.0.0 = "new S".into(); - //~^ NOTE: Capturing t[(0, 0),(0, 0)] -> MutBorrow + //~^ NOTE: Capturing t[(0, 0),(0, 0)] -> Mutable //~| NOTE: Min Capture t[(0, 0),(0, 0)] -> ByValue }; c(); @@ -36,7 +36,7 @@ fn simple_ref() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: *ref_s += 10; - //~^ NOTE: Capturing ref_s[Deref] -> MutBorrow + //~^ NOTE: Capturing ref_s[Deref] -> Mutable //~| NOTE: Min Capture ref_s[] -> ByValue }; c(); @@ -58,7 +58,7 @@ fn struct_contains_ref_to_another_struct_1() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: t.0.0 = "new s".into(); - //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> MutBorrow + //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> Mutable //~| NOTE: Min Capture t[(0, 0)] -> ByValue }; @@ -82,7 +82,7 @@ fn struct_contains_ref_to_another_struct_2() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let _t = t.0.0; - //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> Immutable //~| NOTE: Min Capture t[(0, 0)] -> ByValue }; @@ -127,7 +127,7 @@ fn truncate_box_derefs() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let _t = b.0; - //~^ NOTE: Capturing b[Deref,(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing b[Deref,(0, 0)] -> Immutable //~| NOTE: Min Capture b[] -> ByValue }; @@ -144,7 +144,7 @@ fn truncate_box_derefs() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", b.0); - //~^ NOTE: Capturing b[Deref,(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing b[Deref,(0, 0)] -> Immutable //~| NOTE: Min Capture b[] -> ByValue }; @@ -162,7 +162,7 @@ fn truncate_box_derefs() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", t.1.0); - //~^ NOTE: Capturing t[(1, 0),Deref,(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(1, 0),Deref,(0, 0)] -> Immutable //~| NOTE: Min Capture t[(1, 0)] -> ByValue }; } @@ -182,7 +182,7 @@ fn box_mut_1() { //~| NOTE: see issue #15701 //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| First Pass analysis includes: - //~| NOTE: Capturing box_p_foo[Deref,Deref,(0, 0)] -> MutBorrow + //~| NOTE: Capturing box_p_foo[Deref,Deref,(0, 0)] -> Mutable //~| Min Capture analysis includes: //~| NOTE: Min Capture box_p_foo[] -> ByValue } @@ -200,7 +200,7 @@ fn box_mut_2() { //~| NOTE: see issue #15701 //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| First Pass analysis includes: - //~| NOTE: Capturing p_foo[Deref,Deref,(0, 0)] -> MutBorrow + //~| NOTE: Capturing p_foo[Deref,Deref,(0, 0)] -> Mutable //~| Min Capture analysis includes: //~| NOTE: Min Capture p_foo[] -> ByValue } @@ -214,7 +214,7 @@ fn returned_closure_owns_copy_type_data() -> impl Fn() -> i32 { //~| NOTE: see issue #15701 //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| First Pass analysis includes: - //~| NOTE: Capturing x[] -> ImmBorrow + //~| NOTE: Capturing x[] -> Immutable //~| Min Capture analysis includes: //~| NOTE: Min Capture x[] -> ByValue diff --git a/tests/ui/closures/2229_closure_analysis/move_closure.stderr b/tests/ui/closures/2229_closure_analysis/move_closure.stderr index 7e9e3c5fed3..68754b8f7be 100644 --- a/tests/ui/closures/2229_closure_analysis/move_closure.stderr +++ b/tests/ui/closures/2229_closure_analysis/move_closure.stderr @@ -114,7 +114,7 @@ error: First Pass analysis includes: LL | let c = #[rustc_capture_analysis] move || x; | ^^^^^^^^^ | -note: Capturing x[] -> ImmBorrow +note: Capturing x[] -> Immutable --> $DIR/move_closure.rs:212:47 | LL | let c = #[rustc_capture_analysis] move || x; @@ -144,7 +144,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),(0, 0)] -> MutBorrow +note: Capturing t[(0, 0),(0, 0)] -> Mutable --> $DIR/move_closure.rs:19:9 | LL | t.0.0 = "new S".into(); @@ -180,7 +180,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing ref_s[Deref] -> MutBorrow +note: Capturing ref_s[Deref] -> Mutable --> $DIR/move_closure.rs:38:9 | LL | *ref_s += 10; @@ -216,7 +216,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),Deref,(0, 0)] -> MutBorrow +note: Capturing t[(0, 0),Deref,(0, 0)] -> Mutable --> $DIR/move_closure.rs:60:9 | LL | t.0.0 = "new s".into(); @@ -252,7 +252,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow +note: Capturing t[(0, 0),Deref,(0, 0)] -> Immutable --> $DIR/move_closure.rs:84:18 | LL | let _t = t.0.0; @@ -324,7 +324,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing b[Deref,(0, 0)] -> ImmBorrow +note: Capturing b[Deref,(0, 0)] -> Immutable --> $DIR/move_closure.rs:129:18 | LL | let _t = b.0; @@ -360,7 +360,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing b[Deref,(0, 0)] -> ImmBorrow +note: Capturing b[Deref,(0, 0)] -> Immutable --> $DIR/move_closure.rs:146:24 | LL | println!("{}", b.0); @@ -396,7 +396,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(1, 0),Deref,(0, 0)] -> ImmBorrow +note: Capturing t[(1, 0),Deref,(0, 0)] -> Immutable --> $DIR/move_closure.rs:164:24 | LL | println!("{}", t.1.0); @@ -426,7 +426,7 @@ error: First Pass analysis includes: LL | let c = #[rustc_capture_analysis] move || box_p_foo.x += 10; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: Capturing box_p_foo[Deref,Deref,(0, 0)] -> MutBorrow +note: Capturing box_p_foo[Deref,Deref,(0, 0)] -> Mutable --> $DIR/move_closure.rs:180:47 | LL | let c = #[rustc_capture_analysis] move || box_p_foo.x += 10; @@ -450,7 +450,7 @@ error: First Pass analysis includes: LL | let c = #[rustc_capture_analysis] move || p_foo.x += 10; | ^^^^^^^^^^^^^^^^^^^^^ | -note: Capturing p_foo[Deref,Deref,(0, 0)] -> MutBorrow +note: Capturing p_foo[Deref,Deref,(0, 0)] -> Mutable --> $DIR/move_closure.rs:198:47 | LL | let c = #[rustc_capture_analysis] move || p_foo.x += 10; diff --git a/tests/ui/closures/2229_closure_analysis/multilevel-path-1.rs b/tests/ui/closures/2229_closure_analysis/multilevel-path-1.rs index 2d7c26074cb..501aebe725a 100644 --- a/tests/ui/closures/2229_closure_analysis/multilevel-path-1.rs +++ b/tests/ui/closures/2229_closure_analysis/multilevel-path-1.rs @@ -27,8 +27,8 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let wp = &w.p; - //~^ NOTE: Capturing w[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture w[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing w[(0, 0)] -> Immutable + //~| NOTE: Min Capture w[(0, 0)] -> Immutable println!("{}", wp.x); }; diff --git a/tests/ui/closures/2229_closure_analysis/multilevel-path-1.stderr b/tests/ui/closures/2229_closure_analysis/multilevel-path-1.stderr index 118a7dacec6..000d929f07f 100644 --- a/tests/ui/closures/2229_closure_analysis/multilevel-path-1.stderr +++ b/tests/ui/closures/2229_closure_analysis/multilevel-path-1.stderr @@ -20,7 +20,7 @@ LL | | println!("{}", wp.x); LL | | }; | |_____^ | -note: Capturing w[(0, 0)] -> ImmBorrow +note: Capturing w[(0, 0)] -> Immutable --> $DIR/multilevel-path-1.rs:29:19 | LL | let wp = &w.p; @@ -38,7 +38,7 @@ LL | | println!("{}", wp.x); LL | | }; | |_____^ | -note: Min Capture w[(0, 0)] -> ImmBorrow +note: Min Capture w[(0, 0)] -> Immutable --> $DIR/multilevel-path-1.rs:29:19 | LL | let wp = &w.p; diff --git a/tests/ui/closures/2229_closure_analysis/multilevel-path-2.rs b/tests/ui/closures/2229_closure_analysis/multilevel-path-2.rs index bcf0ed35137..f73627d14da 100644 --- a/tests/ui/closures/2229_closure_analysis/multilevel-path-2.rs +++ b/tests/ui/closures/2229_closure_analysis/multilevel-path-2.rs @@ -22,8 +22,8 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", w.p.x); - //~^ NOTE: Capturing w[(0, 0),(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing w[(0, 0),(0, 0)] -> Immutable + //~| NOTE: Min Capture w[(0, 0),(0, 0)] -> Immutable }; // `c` only captures `w.p.x`, therefore it's safe to mutate `w.p.y`. diff --git a/tests/ui/closures/2229_closure_analysis/multilevel-path-2.stderr b/tests/ui/closures/2229_closure_analysis/multilevel-path-2.stderr index a7112531d9a..97f53e490e8 100644 --- a/tests/ui/closures/2229_closure_analysis/multilevel-path-2.stderr +++ b/tests/ui/closures/2229_closure_analysis/multilevel-path-2.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing w[(0, 0),(0, 0)] -> ImmBorrow +note: Capturing w[(0, 0),(0, 0)] -> Immutable --> $DIR/multilevel-path-2.rs:24:24 | LL | println!("{}", w.p.x); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow +note: Min Capture w[(0, 0),(0, 0)] -> Immutable --> $DIR/multilevel-path-2.rs:24:24 | LL | println!("{}", w.p.x); diff --git a/tests/ui/closures/2229_closure_analysis/nested-closure.rs b/tests/ui/closures/2229_closure_analysis/nested-closure.rs index c481b3d853b..54166d068cb 100644 --- a/tests/ui/closures/2229_closure_analysis/nested-closure.rs +++ b/tests/ui/closures/2229_closure_analysis/nested-closure.rs @@ -24,8 +24,8 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", p.x); - //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Immutable + //~| NOTE: Min Capture p[(0, 0)] -> Immutable let incr = 10; let mut c2 = #[rustc_capture_analysis] //~^ ERROR: attributes on expressions are experimental @@ -34,15 +34,15 @@ fn main() { || p.y += incr; //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: - //~| NOTE: Capturing p[(1, 0)] -> MutBorrow - //~| NOTE: Capturing incr[] -> ImmBorrow - //~| NOTE: Min Capture p[(1, 0)] -> MutBorrow - //~| NOTE: Min Capture incr[] -> ImmBorrow - //~| NOTE: Capturing p[(1, 0)] -> MutBorrow - //~| NOTE: Min Capture p[(1, 0)] -> MutBorrow + //~| NOTE: Capturing p[(1, 0)] -> Mutable + //~| NOTE: Capturing incr[] -> Immutable + //~| NOTE: Min Capture p[(1, 0)] -> Mutable + //~| NOTE: Min Capture incr[] -> Immutable + //~| NOTE: Capturing p[(1, 0)] -> Mutable + //~| NOTE: Min Capture p[(1, 0)] -> Mutable c2(); println!("{}", p.y); - //~^ NOTE: Capturing p[(1, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(1, 0)] -> Immutable }; c1(); diff --git a/tests/ui/closures/2229_closure_analysis/nested-closure.stderr b/tests/ui/closures/2229_closure_analysis/nested-closure.stderr index 256bfd58597..03550cb2d35 100644 --- a/tests/ui/closures/2229_closure_analysis/nested-closure.stderr +++ b/tests/ui/closures/2229_closure_analysis/nested-closure.stderr @@ -24,12 +24,12 @@ error: First Pass analysis includes: LL | || p.y += incr; | ^^^^^^^^^^^^^^ | -note: Capturing p[(1, 0)] -> MutBorrow +note: Capturing p[(1, 0)] -> Mutable --> $DIR/nested-closure.rs:34:12 | LL | || p.y += incr; | ^^^ -note: Capturing incr[] -> ImmBorrow +note: Capturing incr[] -> Immutable --> $DIR/nested-closure.rs:34:19 | LL | || p.y += incr; @@ -41,12 +41,12 @@ error: Min Capture analysis includes: LL | || p.y += incr; | ^^^^^^^^^^^^^^ | -note: Min Capture p[(1, 0)] -> MutBorrow +note: Min Capture p[(1, 0)] -> Mutable --> $DIR/nested-closure.rs:34:12 | LL | || p.y += incr; | ^^^ -note: Min Capture incr[] -> ImmBorrow +note: Min Capture incr[] -> Immutable --> $DIR/nested-closure.rs:34:19 | LL | || p.y += incr; @@ -64,17 +64,17 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0)] -> Immutable --> $DIR/nested-closure.rs:26:24 | LL | println!("{}", p.x); | ^^^ -note: Capturing p[(1, 0)] -> MutBorrow +note: Capturing p[(1, 0)] -> Mutable --> $DIR/nested-closure.rs:34:12 | LL | || p.y += incr; | ^^^ -note: Capturing p[(1, 0)] -> ImmBorrow +note: Capturing p[(1, 0)] -> Immutable --> $DIR/nested-closure.rs:44:24 | LL | println!("{}", p.y); @@ -92,12 +92,12 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[(0, 0)] -> ImmBorrow +note: Min Capture p[(0, 0)] -> Immutable --> $DIR/nested-closure.rs:26:24 | LL | println!("{}", p.x); | ^^^ -note: Min Capture p[(1, 0)] -> MutBorrow +note: Min Capture p[(1, 0)] -> Mutable --> $DIR/nested-closure.rs:34:12 | LL | || p.y += incr; diff --git a/tests/ui/closures/2229_closure_analysis/optimization/edge_case.rs b/tests/ui/closures/2229_closure_analysis/optimization/edge_case.rs index 8df0eeb0eb4..70c20cf5aef 100644 --- a/tests/ui/closures/2229_closure_analysis/optimization/edge_case.rs +++ b/tests/ui/closures/2229_closure_analysis/optimization/edge_case.rs @@ -23,8 +23,8 @@ fn foo<'a, 'b>(m: &'a MyStruct<'b>) -> impl FnMut() + 'static { //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: - //~| NOTE: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture m[Deref,(0, 0),Deref] -> ImmBorrow + //~| NOTE: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> Immutable + //~| NOTE: Min Capture m[Deref,(0, 0),Deref] -> Immutable c } diff --git a/tests/ui/closures/2229_closure_analysis/optimization/edge_case.stderr b/tests/ui/closures/2229_closure_analysis/optimization/edge_case.stderr index 99159ab58a2..86f7a6a6bca 100644 --- a/tests/ui/closures/2229_closure_analysis/optimization/edge_case.stderr +++ b/tests/ui/closures/2229_closure_analysis/optimization/edge_case.stderr @@ -14,7 +14,7 @@ error: First Pass analysis includes: LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); | ^^^^^^^^^^^^^^^ | -note: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> ImmBorrow +note: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> Immutable --> $DIR/edge_case.rs:20:48 | LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); @@ -26,7 +26,7 @@ error: Min Capture analysis includes: LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); | ^^^^^^^^^^^^^^^ | -note: Min Capture m[Deref,(0, 0),Deref] -> ImmBorrow +note: Min Capture m[Deref,(0, 0),Deref] -> Immutable --> $DIR/edge_case.rs:20:48 | LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); diff --git a/tests/ui/closures/2229_closure_analysis/path-with-array-access.rs b/tests/ui/closures/2229_closure_analysis/path-with-array-access.rs index 2d3db4fde72..ed740f3a167 100644 --- a/tests/ui/closures/2229_closure_analysis/path-with-array-access.rs +++ b/tests/ui/closures/2229_closure_analysis/path-with-array-access.rs @@ -28,7 +28,7 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", pent.points[5].x); - //~^ NOTE: Capturing pent[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture pent[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing pent[(0, 0)] -> Immutable + //~| NOTE: Min Capture pent[(0, 0)] -> Immutable }; } diff --git a/tests/ui/closures/2229_closure_analysis/path-with-array-access.stderr b/tests/ui/closures/2229_closure_analysis/path-with-array-access.stderr index 22bd13617c1..e82295f047b 100644 --- a/tests/ui/closures/2229_closure_analysis/path-with-array-access.stderr +++ b/tests/ui/closures/2229_closure_analysis/path-with-array-access.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing pent[(0, 0)] -> ImmBorrow +note: Capturing pent[(0, 0)] -> Immutable --> $DIR/path-with-array-access.rs:30:24 | LL | println!("{}", pent.points[5].x); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture pent[(0, 0)] -> ImmBorrow +note: Min Capture pent[(0, 0)] -> Immutable --> $DIR/path-with-array-access.rs:30:24 | LL | println!("{}", pent.points[5].x); diff --git a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs index c30eaf8fb1b..159be843edb 100644 --- a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs +++ b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs @@ -28,17 +28,17 @@ fn test_one() { //~^ ERROR: Min Capture analysis includes: //~| ERROR println!("{:?}", a.0); - //~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(0, 0)] -> Immutable //~| NOTE println!("{:?}", a.1); - //~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(1, 0)] -> Immutable //~| NOTE println!("{:?}", b.0); - //~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(0, 0)] -> Immutable //~| NOTE println!("{:?}", b.1); - //~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(1, 0)] -> Immutable //~| NOTE }; } @@ -55,17 +55,17 @@ fn test_two() { //~^ ERROR: Min Capture analysis includes: //~| ERROR println!("{:?}", a.1); - //~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(1, 0)] -> Immutable //~| NOTE println!("{:?}", a.0); - //~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(0, 0)] -> Immutable //~| NOTE println!("{:?}", b.1); - //~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(1, 0)] -> Immutable //~| NOTE println!("{:?}", b.0); - //~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(0, 0)] -> Immutable //~| NOTE }; } @@ -82,17 +82,17 @@ fn test_three() { //~^ ERROR: Min Capture analysis includes: //~| ERROR println!("{:?}", b.1); - //~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(1, 0)] -> Immutable //~| NOTE println!("{:?}", a.1); - //~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(1, 0)] -> Immutable //~| NOTE println!("{:?}", a.0); - //~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(0, 0)] -> Immutable //~| NOTE println!("{:?}", b.0); - //~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(0, 0)] -> Immutable //~| NOTE }; } diff --git a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.stderr b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.stderr index 82f770eafed..65a0a317ab6 100644 --- a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.stderr +++ b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.stderr @@ -40,22 +40,22 @@ LL | | LL | | }; | |_____^ | -note: Capturing a[(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:30:26 | LL | println!("{:?}", a.0); | ^^^ -note: Capturing a[(1, 0)] -> ImmBorrow +note: Capturing a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:33:26 | LL | println!("{:?}", a.1); | ^^^ -note: Capturing b[(0, 0)] -> ImmBorrow +note: Capturing b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:37:26 | LL | println!("{:?}", b.0); | ^^^ -note: Capturing b[(1, 0)] -> ImmBorrow +note: Capturing b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:40:26 | LL | println!("{:?}", b.1); @@ -73,22 +73,22 @@ LL | | LL | | }; | |_____^ | -note: Min Capture a[(0, 0)] -> ImmBorrow +note: Min Capture a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:30:26 | LL | println!("{:?}", a.0); | ^^^ -note: Min Capture a[(1, 0)] -> ImmBorrow +note: Min Capture a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:33:26 | LL | println!("{:?}", a.1); | ^^^ -note: Min Capture b[(0, 0)] -> ImmBorrow +note: Min Capture b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:37:26 | LL | println!("{:?}", b.0); | ^^^ -note: Min Capture b[(1, 0)] -> ImmBorrow +note: Min Capture b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:40:26 | LL | println!("{:?}", b.1); @@ -106,22 +106,22 @@ LL | | LL | | }; | |_____^ | -note: Capturing a[(1, 0)] -> ImmBorrow +note: Capturing a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:57:26 | LL | println!("{:?}", a.1); | ^^^ -note: Capturing a[(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:60:26 | LL | println!("{:?}", a.0); | ^^^ -note: Capturing b[(1, 0)] -> ImmBorrow +note: Capturing b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:64:26 | LL | println!("{:?}", b.1); | ^^^ -note: Capturing b[(0, 0)] -> ImmBorrow +note: Capturing b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:67:26 | LL | println!("{:?}", b.0); @@ -139,22 +139,22 @@ LL | | LL | | }; | |_____^ | -note: Min Capture a[(0, 0)] -> ImmBorrow +note: Min Capture a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:60:26 | LL | println!("{:?}", a.0); | ^^^ -note: Min Capture a[(1, 0)] -> ImmBorrow +note: Min Capture a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:57:26 | LL | println!("{:?}", a.1); | ^^^ -note: Min Capture b[(0, 0)] -> ImmBorrow +note: Min Capture b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:67:26 | LL | println!("{:?}", b.0); | ^^^ -note: Min Capture b[(1, 0)] -> ImmBorrow +note: Min Capture b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:64:26 | LL | println!("{:?}", b.1); @@ -172,22 +172,22 @@ LL | | LL | | }; | |_____^ | -note: Capturing b[(1, 0)] -> ImmBorrow +note: Capturing b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:84:26 | LL | println!("{:?}", b.1); | ^^^ -note: Capturing a[(1, 0)] -> ImmBorrow +note: Capturing a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:87:26 | LL | println!("{:?}", a.1); | ^^^ -note: Capturing a[(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:90:26 | LL | println!("{:?}", a.0); | ^^^ -note: Capturing b[(0, 0)] -> ImmBorrow +note: Capturing b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:94:26 | LL | println!("{:?}", b.0); @@ -205,22 +205,22 @@ LL | | LL | | }; | |_____^ | -note: Min Capture b[(0, 0)] -> ImmBorrow +note: Min Capture b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:94:26 | LL | println!("{:?}", b.0); | ^^^ -note: Min Capture b[(1, 0)] -> ImmBorrow +note: Min Capture b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:84:26 | LL | println!("{:?}", b.1); | ^^^ -note: Min Capture a[(0, 0)] -> ImmBorrow +note: Min Capture a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:90:26 | LL | println!("{:?}", a.0); | ^^^ -note: Min Capture a[(1, 0)] -> ImmBorrow +note: Min Capture a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:87:26 | LL | println!("{:?}", a.1); diff --git a/tests/ui/closures/2229_closure_analysis/repr_packed.rs b/tests/ui/closures/2229_closure_analysis/repr_packed.rs index 0dde2b12b87..2525af37eaa 100644 --- a/tests/ui/closures/2229_closure_analysis/repr_packed.rs +++ b/tests/ui/closures/2229_closure_analysis/repr_packed.rs @@ -19,10 +19,10 @@ struct Foo { x: u8, y: u8 } //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let z1: &u8 = &foo.x; - //~^ NOTE: Capturing foo[] -> ImmBorrow + //~^ NOTE: Capturing foo[] -> Immutable let z2: &mut u8 = &mut foo.y; - //~^ NOTE: Capturing foo[] -> MutBorrow - //~| NOTE: Min Capture foo[] -> MutBorrow + //~^ NOTE: Capturing foo[] -> Mutable + //~| NOTE: Min Capture foo[] -> Mutable *z2 = 42; @@ -50,10 +50,10 @@ struct Foo { x: String, y: u16 } //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let z1: &String = &foo.x; - //~^ NOTE: Capturing foo[] -> ImmBorrow + //~^ NOTE: Capturing foo[] -> Immutable let z2: &mut u16 = &mut foo.y; - //~^ NOTE: Capturing foo[] -> MutBorrow - //~| NOTE: Min Capture foo[] -> MutBorrow + //~^ NOTE: Capturing foo[] -> Mutable + //~| NOTE: Min Capture foo[] -> Mutable *z2 = 42; @@ -86,7 +86,7 @@ struct Foo { x: String } //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", foo.x); - //~^ NOTE: Capturing foo[] -> ImmBorrow + //~^ NOTE: Capturing foo[] -> Immutable //~| NOTE: Min Capture foo[] -> ByValue //~| NOTE: foo[] used here let _z = foo.x; diff --git a/tests/ui/closures/2229_closure_analysis/repr_packed.stderr b/tests/ui/closures/2229_closure_analysis/repr_packed.stderr index 3bac41d60d5..d4b2f8bfeae 100644 --- a/tests/ui/closures/2229_closure_analysis/repr_packed.stderr +++ b/tests/ui/closures/2229_closure_analysis/repr_packed.stderr @@ -40,12 +40,12 @@ LL | | println!("({}, {})", z1, z2); LL | | }; | |_____^ | -note: Capturing foo[] -> ImmBorrow +note: Capturing foo[] -> Immutable --> $DIR/repr_packed.rs:21:24 | LL | let z1: &u8 = &foo.x; | ^^^^^ -note: Capturing foo[] -> MutBorrow +note: Capturing foo[] -> Mutable --> $DIR/repr_packed.rs:23:32 | LL | let z2: &mut u8 = &mut foo.y; @@ -63,7 +63,7 @@ LL | | println!("({}, {})", z1, z2); LL | | }; | |_____^ | -note: Min Capture foo[] -> MutBorrow +note: Min Capture foo[] -> Mutable --> $DIR/repr_packed.rs:23:32 | LL | let z2: &mut u8 = &mut foo.y; @@ -81,12 +81,12 @@ LL | | println!("({}, {})", z1, z2); LL | | }; | |_____^ | -note: Capturing foo[] -> ImmBorrow +note: Capturing foo[] -> Immutable --> $DIR/repr_packed.rs:52:28 | LL | let z1: &String = &foo.x; | ^^^^^ -note: Capturing foo[] -> MutBorrow +note: Capturing foo[] -> Mutable --> $DIR/repr_packed.rs:54:33 | LL | let z2: &mut u16 = &mut foo.y; @@ -104,7 +104,7 @@ LL | | println!("({}, {})", z1, z2); LL | | }; | |_____^ | -note: Min Capture foo[] -> MutBorrow +note: Min Capture foo[] -> Mutable --> $DIR/repr_packed.rs:54:33 | LL | let z2: &mut u16 = &mut foo.y; @@ -122,7 +122,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing foo[] -> ImmBorrow +note: Capturing foo[] -> Immutable --> $DIR/repr_packed.rs:88:24 | LL | println!("{}", foo.x); diff --git a/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs b/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs index 4b749a70577..38aa76999fb 100644 --- a/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs +++ b/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs @@ -16,7 +16,7 @@ fn main() { // // Requirements: // p.x -> MutBoorrow - // p -> ImmBorrow + // p -> Immutable // // Requirements met when p is captured via MutBorrow // @@ -28,11 +28,11 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: p.x += 10; - //~^ NOTE: Capturing p[(0, 0)] -> MutBorrow - //~| NOTE: p[] captured as MutBorrow here + //~^ NOTE: Capturing p[(0, 0)] -> Mutable + //~| NOTE: p[] captured as Mutable here println!("{:?}", p); - //~^ NOTE: Capturing p[] -> ImmBorrow - //~| NOTE: Min Capture p[] -> MutBorrow + //~^ NOTE: Capturing p[] -> Immutable + //~| NOTE: Min Capture p[] -> Mutable //~| NOTE: p[] used here }; diff --git a/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr b/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr index 247dcbe94bc..a88bd01093a 100644 --- a/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr +++ b/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr @@ -20,12 +20,12 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> MutBorrow +note: Capturing p[(0, 0)] -> Mutable --> $DIR/simple-struct-min-capture.rs:30:9 | LL | p.x += 10; | ^^^ -note: Capturing p[] -> ImmBorrow +note: Capturing p[] -> Immutable --> $DIR/simple-struct-min-capture.rs:33:26 | LL | println!("{:?}", p); @@ -43,11 +43,11 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[] -> MutBorrow +note: Min Capture p[] -> Mutable --> $DIR/simple-struct-min-capture.rs:30:9 | LL | p.x += 10; - | ^^^ p[] captured as MutBorrow here + | ^^^ p[] captured as Mutable here ... LL | println!("{:?}", p); | ^ p[] used here diff --git a/tests/ui/closures/2229_closure_analysis/unsafe_ptr.rs b/tests/ui/closures/2229_closure_analysis/unsafe_ptr.rs index 33d43c5f526..667f244f612 100644 --- a/tests/ui/closures/2229_closure_analysis/unsafe_ptr.rs +++ b/tests/ui/closures/2229_closure_analysis/unsafe_ptr.rs @@ -30,8 +30,8 @@ fn unsafe_imm() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{:?}", (*t.0).s); - //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture t[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> Immutable + //~| NOTE: Min Capture t[(0, 0)] -> Immutable }; c(); @@ -51,8 +51,8 @@ fn unsafe_mut() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let x = unsafe { &mut (*p).s }; - //~^ NOTE: Capturing p[Deref,(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture p[] -> ImmBorrow + //~^ NOTE: Capturing p[Deref,(0, 0)] -> Immutable + //~| NOTE: Min Capture p[] -> Immutable *x = "s".into(); }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/unsafe_ptr.stderr b/tests/ui/closures/2229_closure_analysis/unsafe_ptr.stderr index 4f3de075054..54463c5277d 100644 --- a/tests/ui/closures/2229_closure_analysis/unsafe_ptr.stderr +++ b/tests/ui/closures/2229_closure_analysis/unsafe_ptr.stderr @@ -30,7 +30,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow +note: Capturing t[(0, 0),Deref,(0, 0)] -> Immutable --> $DIR/unsafe_ptr.rs:32:26 | LL | println!("{:?}", (*t.0).s); @@ -48,7 +48,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture t[(0, 0)] -> ImmBorrow +note: Min Capture t[(0, 0)] -> Immutable --> $DIR/unsafe_ptr.rs:32:26 | LL | println!("{:?}", (*t.0).s); @@ -66,7 +66,7 @@ LL | | *x = "s".into(); LL | | }; | |_____^ | -note: Capturing p[Deref,(0, 0)] -> ImmBorrow +note: Capturing p[Deref,(0, 0)] -> Immutable --> $DIR/unsafe_ptr.rs:53:31 | LL | let x = unsafe { &mut (*p).s }; @@ -84,7 +84,7 @@ LL | | *x = "s".into(); LL | | }; | |_____^ | -note: Min Capture p[] -> ImmBorrow +note: Min Capture p[] -> Immutable --> $DIR/unsafe_ptr.rs:53:31 | LL | let x = unsafe { &mut (*p).s }; diff --git a/tests/ui/closures/2229_closure_analysis/wild_patterns.rs b/tests/ui/closures/2229_closure_analysis/wild_patterns.rs index 9adf20c21d5..d220cfce9ce 100644 --- a/tests/ui/closures/2229_closure_analysis/wild_patterns.rs +++ b/tests/ui/closures/2229_closure_analysis/wild_patterns.rs @@ -28,8 +28,8 @@ fn wild_struct() { //~| ERROR: Min Capture analysis includes: // FIXME(arora-aman): Change `_x` to `_` let Point { x: _x, y: _ } = p; - //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Immutable + //~| NOTE: Min Capture p[(0, 0)] -> Immutable }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr b/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr index 88b48aaaf8c..4d6d85649da 100644 --- a/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr +++ b/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr @@ -40,7 +40,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0)] -> Immutable --> $DIR/wild_patterns.rs:30:37 | LL | let Point { x: _x, y: _ } = p; @@ -58,7 +58,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[(0, 0)] -> ImmBorrow +note: Min Capture p[(0, 0)] -> Immutable --> $DIR/wild_patterns.rs:30:37 | LL | let Point { x: _x, y: _ } = p;