1
Fork 0

Remove BorrowKind glob, make names longer

This commit is contained in:
Michael Goulet 2024-11-03 22:02:31 +00:00
parent be4b0261c2
commit 883f8705d4
68 changed files with 289 additions and 288 deletions

View file

@ -816,7 +816,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
) { ) {
match captured_place.info.capture_kind { match captured_place.info.capture_kind {
ty::UpvarCapture::ByRef( ty::UpvarCapture::ByRef(
ty::BorrowKind::MutBorrow | ty::BorrowKind::UniqueImmBorrow, ty::BorrowKind::Mutable | ty::BorrowKind::UniqueImmutable,
) => { ) => {
capture_reason = format!("mutable borrow of `{upvar}`"); capture_reason = format!("mutable borrow of `{upvar}`");
} }

View file

@ -21,13 +21,12 @@ use rustc_middle::hir::place::ProjectionKind;
pub use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection}; pub use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection};
use rustc_middle::mir::FakeReadCause; use rustc_middle::mir::FakeReadCause;
use rustc_middle::ty::{ 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_middle::{bug, span_bug};
use rustc_span::{ErrorGuaranteed, Span}; use rustc_span::{ErrorGuaranteed, Span};
use rustc_trait_selection::infer::InferCtxtExt; use rustc_trait_selection::infer::InferCtxtExt;
use tracing::{debug, trace}; use tracing::{debug, trace};
use ty::BorrowKind::ImmBorrow;
use crate::fn_ctxt::FnCtxt; use crate::fn_ctxt::FnCtxt;
@ -63,7 +62,7 @@ pub trait Delegate<'tcx> {
fn copy(&mut self, place_with_id: &PlaceWithHirId<'tcx>, diag_expr_id: HirId) { 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 // 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`. // 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. /// The path at `assignee_place` is being assigned to.
@ -387,7 +386,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
} }
hir::ExprKind::Let(hir::LetExpr { pat, init, .. }) => { 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, _) => { hir::ExprKind::Match(discr, arms, _) => {
@ -626,7 +625,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
} }
if needs_to_be_read { if needs_to_be_read {
self.borrow_expr(discr, ty::ImmBorrow)?; self.borrow_expr(discr, BorrowKind::Immutable)?;
} else { } else {
let closure_def_id = match discr_place.place.base { let closure_def_id = match discr_place.place.base {
PlaceBase::Upvar(upvar_id) => Some(upvar_id.closure_expr_id), PlaceBase::Upvar(upvar_id) => Some(upvar_id.closure_expr_id),
@ -785,8 +784,8 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
// Reborrowing a Pin is like a combinations of a deref and a borrow, so we do // Reborrowing a Pin is like a combinations of a deref and a borrow, so we do
// both. // both.
let bk = match mutbl { let bk = match mutbl {
ty::Mutability::Not => ty::BorrowKind::ImmBorrow, ty::Mutability::Not => ty::BorrowKind::Immutable,
ty::Mutability::Mut => ty::BorrowKind::MutBorrow, ty::Mutability::Mut => ty::BorrowKind::Mutable,
}; };
self.delegate.borrow_mut().borrow(&place_with_id, place_with_id.hir_id, bk); self.delegate.borrow_mut().borrow(&place_with_id, place_with_id.hir_id, bk);
} }
@ -909,7 +908,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
// binding when lowering pattern guards to ensure that the guard does not // binding when lowering pattern guards to ensure that the guard does not
// modify the scrutinee. // modify the scrutinee.
if has_guard { 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. // It is also a borrow or copy/move of the value being matched.

View file

@ -44,8 +44,8 @@ use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection, Pro
use rustc_middle::mir::FakeReadCause; use rustc_middle::mir::FakeReadCause;
use rustc_middle::traits::ObligationCauseCode; use rustc_middle::traits::ObligationCauseCode;
use rustc_middle::ty::{ use rustc_middle::ty::{
self, ClosureSizeProfileData, Ty, TyCtxt, TypeVisitableExt as _, TypeckResults, UpvarArgs, self, BorrowKind, ClosureSizeProfileData, Ty, TyCtxt, TypeVisitableExt as _, TypeckResults,
UpvarCapture, UpvarArgs, UpvarCapture,
}; };
use rustc_middle::{bug, span_bug}; use rustc_middle::{bug, span_bug};
use rustc_session::lint; use rustc_session::lint;
@ -646,7 +646,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}, },
ty::UpvarCapture::ByRef( ty::UpvarCapture::ByRef(
ty::BorrowKind::MutBorrow | ty::BorrowKind::UniqueImmBorrow, ty::BorrowKind::Mutable | ty::BorrowKind::UniqueImmutable,
) => { ) => {
match closure_kind { match closure_kind {
ty::ClosureKind::Fn => { ty::ClosureKind::Fn => {
@ -1681,7 +1681,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
ty::UpvarCapture::ByValue ty::UpvarCapture::ByValue
} }
hir::CaptureBy::Value { .. } | hir::CaptureBy::Ref => { 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, .. }) Some(Projection { kind: ProjectionKind::Deref, .. })
)) ))
// (2.) // (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, /// Truncate the capture so that the place being borrowed is in accordance with RFC 1240,
@ -1984,7 +1984,7 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
// We need to restrict Fake Read precision to avoid fake reading unsafe code, // We need to restrict Fake Read precision to avoid fake reading unsafe code,
// such as deref of a raw pointer. // 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); let (place, _) = restrict_capture_precision(place.place.clone(), dummy_capture_kind);
@ -2025,7 +2025,7 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
// Raw pointers don't inherit mutability // Raw pointers don't inherit mutability
if place_with_id.place.deref_tys().any(Ty::is_unsafe_ptr) { 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 { self.capture_information.push((place, ty::CaptureInfo {
@ -2037,7 +2037,7 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
#[instrument(skip(self), level = "debug")] #[instrument(skip(self), level = "debug")]
fn mutate(&mut self, assignee_place: &PlaceWithHirId<'tcx>, diag_expr_id: HirId) { 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)) => { (ty::UpvarCapture::ByRef(ref_a), ty::UpvarCapture::ByRef(ref_b)) => {
match (ref_a, ref_b) { match (ref_a, ref_b) {
// Take LHS: // Take LHS:
(ty::UniqueImmBorrow | ty::MutBorrow, ty::ImmBorrow) (BorrowKind::UniqueImmutable | BorrowKind::Mutable, BorrowKind::Immutable)
| (ty::MutBorrow, ty::UniqueImmBorrow) => capture_info_a, | (BorrowKind::Mutable, BorrowKind::UniqueImmutable) => capture_info_a,
// Take RHS: // Take RHS:
(ty::ImmBorrow, ty::UniqueImmBorrow | ty::MutBorrow) (BorrowKind::Immutable, BorrowKind::UniqueImmutable | BorrowKind::Mutable)
| (ty::UniqueImmBorrow, ty::MutBorrow) => capture_info_b, | (BorrowKind::UniqueImmutable, BorrowKind::Mutable) => capture_info_b,
(ty::ImmBorrow, ty::ImmBorrow) (BorrowKind::Immutable, BorrowKind::Immutable)
| (ty::UniqueImmBorrow, ty::UniqueImmBorrow) | (BorrowKind::UniqueImmutable, BorrowKind::UniqueImmutable)
| (ty::MutBorrow, ty::MutBorrow) => { | (BorrowKind::Mutable, BorrowKind::Mutable) => {
bug!("Expected unequal capture kinds"); 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 // 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. // we don't need to worry about that case here.
match curr_mode { match curr_mode {
ty::UpvarCapture::ByRef(ty::BorrowKind::MutBorrow) => { ty::UpvarCapture::ByRef(ty::BorrowKind::Mutable) => {
for i in len..place.projections.len() { for i in len..place.projections.len() {
if place.projections[i].kind == ProjectionKind::Deref if place.projections[i].kind == ProjectionKind::Deref
&& is_mut_ref(place.ty_before_projection(i)) && 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; break;
} }
} }

View file

@ -10,7 +10,6 @@ use rustc_span::def_id::LocalDefIdMap;
use rustc_span::symbol::Ident; use rustc_span::symbol::Ident;
use rustc_span::{Span, Symbol}; use rustc_span::{Span, Symbol};
use self::BorrowKind::*;
use super::TyCtxt; use super::TyCtxt;
use crate::hir::place::{ use crate::hir::place::{
Place as HirPlace, PlaceBase as HirPlaceBase, ProjectionKind as HirProjectionKind, 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)] #[derive(TypeFoldable, TypeVisitable)]
pub enum BorrowKind { pub enum BorrowKind {
/// Data must be immutable and is aliasable. /// Data must be immutable and is aliasable.
ImmBorrow, Immutable,
/// Data must be immutable but not aliasable. This kind of borrow /// Data must be immutable but not aliasable. This kind of borrow
/// cannot currently be expressed by the user and is used only in /// 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. /// borrow, it's just used when translating closures.
/// ///
/// FIXME: Rename this to indicate the borrow is actually not immutable. /// FIXME: Rename this to indicate the borrow is actually not immutable.
UniqueImmBorrow, UniqueImmutable,
/// Data is mutable and not aliasable. /// Data is mutable and not aliasable.
MutBorrow, Mutable,
} }
impl BorrowKind { impl BorrowKind {
pub fn from_mutbl(m: hir::Mutability) -> BorrowKind { pub fn from_mutbl(m: hir::Mutability) -> BorrowKind {
match m { match m {
hir::Mutability::Mut => MutBorrow, hir::Mutability::Mut => BorrowKind::Mutable,
hir::Mutability::Not => ImmBorrow, hir::Mutability::Not => BorrowKind::Immutable,
} }
} }
@ -402,13 +401,13 @@ impl BorrowKind {
/// question. /// question.
pub fn to_mutbl_lossy(self) -> hir::Mutability { pub fn to_mutbl_lossy(self) -> hir::Mutability {
match self { match self {
MutBorrow => hir::Mutability::Mut, BorrowKind::Mutable => hir::Mutability::Mut,
ImmBorrow => hir::Mutability::Not, BorrowKind::Immutable => hir::Mutability::Not,
// We have no type corresponding to a unique imm borrow, so // We have no type corresponding to a unique imm borrow, so
// use `&mut`. It gives all the capabilities of a `&uniq` // use `&mut`. It gives all the capabilities of a `&uniq`
// and hence is a safe "over approximation". // and hence is a safe "over approximation".
UniqueImmBorrow => hir::Mutability::Mut, BorrowKind::UniqueImmutable => hir::Mutability::Mut,
} }
} }
} }

View file

@ -55,7 +55,6 @@ use tracing::{debug, instrument};
pub use vtable::*; pub use vtable::*;
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir}; use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
pub use self::BorrowKind::*;
pub use self::closure::{ pub use self::closure::{
BorrowKind, CAPTURE_STRUCT_LOCAL, CaptureInfo, CapturedPlace, ClosureTypeInfo, BorrowKind, CAPTURE_STRUCT_LOCAL, CaptureInfo, CapturedPlace, ClosureTypeInfo,
MinCaptureInformationMap, MinCaptureList, RootVariableMinCaptureList, UpvarCapture, UpvarId, MinCaptureInformationMap, MinCaptureList, RootVariableMinCaptureList, UpvarCapture, UpvarId,

View file

@ -1185,11 +1185,11 @@ impl<'tcx> Cx<'tcx> {
ty::UpvarCapture::ByValue => captured_place_expr, ty::UpvarCapture::ByValue => captured_place_expr,
ty::UpvarCapture::ByRef(upvar_borrow) => { ty::UpvarCapture::ByRef(upvar_borrow) => {
let borrow_kind = match upvar_borrow { let borrow_kind = match upvar_borrow {
ty::BorrowKind::ImmBorrow => BorrowKind::Shared, ty::BorrowKind::Immutable => BorrowKind::Shared,
ty::BorrowKind::UniqueImmBorrow => { ty::BorrowKind::UniqueImmutable => {
BorrowKind::Mut { kind: mir::MutBorrowKind::ClosureCapture } BorrowKind::Mut { kind: mir::MutBorrowKind::ClosureCapture }
} }
ty::BorrowKind::MutBorrow => { ty::BorrowKind::Mutable => {
BorrowKind::Mut { kind: mir::MutBorrowKind::Default } BorrowKind::Mut { kind: mir::MutBorrowKind::Default }
} }
}; };

View file

@ -80,7 +80,7 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate<'_, 'tcx> {
fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {} fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {}
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, diag_expr_id: HirId, bk: ty::BorrowKind) { 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 let PlaceBase::Local(id) = cmt.place.base {
if Some(id) == self.hir_id_low && !BreakAfterExprVisitor::is_found(self.cx, diag_expr_id) { 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)); self.span_low = Some(self.cx.tcx.hir().span(diag_expr_id));

View file

@ -417,8 +417,8 @@ impl<'tcx> euv::Delegate<'tcx> for MutablyUsedVariablesCtxt<'tcx> {
// a closure, it'll return this variant whereas if you have just an index access, it'll // 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 // return `ImmBorrow`. So if there is "Unique" and it's a mutable reference, we add it
// to the mutably used variables set. // to the mutably used variables set.
if borrow == ty::BorrowKind::MutBorrow if borrow == ty::BorrowKind::Mutable
|| (borrow == ty::BorrowKind::UniqueImmBorrow && base_ty.ref_mutability() == Some(Mutability::Mut)) || (borrow == ty::BorrowKind::UniqueImmutable && base_ty.ref_mutability() == Some(Mutability::Mut))
{ {
self.add_mutably_used_var(*vid); self.add_mutably_used_var(*vid);
} else if self.is_in_unsafe_block(id) { } else if self.is_in_unsafe_block(id) {
@ -426,7 +426,7 @@ impl<'tcx> euv::Delegate<'tcx> for MutablyUsedVariablesCtxt<'tcx> {
// upon! // upon!
self.add_mutably_used_var(*vid); 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 // 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. // go into to ensure all "mutate" checks are found.
if let Node::Expr(Expr { if let Node::Expr(Expr {

View file

@ -102,7 +102,7 @@ fn imm_borrows_in_expr(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> HirIdSet {
struct S(HirIdSet); struct S(HirIdSet);
impl Delegate<'_> for S { impl Delegate<'_> for S {
fn borrow(&mut self, place: &PlaceWithHirId<'_>, _: HirId, kind: BorrowKind) { 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 { self.0.insert(match place.place.base {
PlaceBase::Local(id) => id, PlaceBase::Local(id) => id,
PlaceBase::Upvar(id) => id.var_path.hir_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); struct S(HirIdSet);
impl Delegate<'_> for S { impl Delegate<'_> for S {
fn borrow(&mut self, place: &PlaceWithHirId<'_>, _: HirId, kind: BorrowKind) { 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 { self.0.insert(match place.place.base {
PlaceBase::Local(id) => id, PlaceBase::Local(id) => id,
PlaceBase::Upvar(id) => id.var_path.hir_id, PlaceBase::Upvar(id) => id.var_path.hir_id,

View file

@ -217,7 +217,7 @@ fn is_option_as_mut_use(tcx: TyCtxt<'_>, expr_id: HirId) -> bool {
impl<'tcx> Delegate<'tcx> for MutationVisitor<'tcx> { impl<'tcx> Delegate<'tcx> for MutationVisitor<'tcx> {
fn borrow(&mut self, cat: &PlaceWithHirId<'tcx>, diag_expr_id: HirId, bk: ty::BorrowKind) { 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_potentially_local_place(self.local_id, &cat.place)
&& !is_option_as_mut_use(self.tcx, diag_expr_id) && !is_option_as_mut_use(self.tcx, diag_expr_id)
{ {

View file

@ -1209,8 +1209,8 @@ pub fn can_move_expr_to_closure<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'
let capture = match capture.info.capture_kind { let capture = match capture.info.capture_kind {
UpvarCapture::ByValue => CaptureKind::Value, UpvarCapture::ByValue => CaptureKind::Value,
UpvarCapture::ByRef(kind) => match kind { UpvarCapture::ByRef(kind) => match kind {
BorrowKind::ImmBorrow => CaptureKind::Ref(Mutability::Not), BorrowKind::Immutable => CaptureKind::Ref(Mutability::Not),
BorrowKind::UniqueImmBorrow | BorrowKind::MutBorrow => { BorrowKind::UniqueImmutable | BorrowKind::Mutable => {
CaptureKind::Ref(Mutability::Mut) CaptureKind::Ref(Mutability::Mut)
}, },
}, },

View file

@ -67,7 +67,7 @@ impl<'tcx> Delegate<'tcx> for MutVarsDelegate {
fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {} fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {}
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, bk: ty::BorrowKind) { fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, bk: ty::BorrowKind) {
if bk == ty::BorrowKind::MutBorrow { if bk == ty::BorrowKind::Mutable {
self.update(cmt); self.update(cmt);
} }
} }

View file

@ -13,10 +13,10 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
m[0] += 10; m[0] += 10;
//~^ NOTE: Capturing m[] -> MutBorrow //~^ NOTE: Capturing m[] -> Mutable
//~| NOTE: Min Capture m[] -> MutBorrow //~| NOTE: Min Capture m[] -> Mutable
m[1] += 40; m[1] += 40;
//~^ NOTE: Capturing m[] -> MutBorrow //~^ NOTE: Capturing m[] -> Mutable
}; };
c(); c();

View file

@ -20,12 +20,12 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing m[] -> MutBorrow note: Capturing m[] -> Mutable
--> $DIR/arrays-completely-captured.rs:15:9 --> $DIR/arrays-completely-captured.rs:15:9
| |
LL | m[0] += 10; LL | m[0] += 10;
| ^ | ^
note: Capturing m[] -> MutBorrow note: Capturing m[] -> Mutable
--> $DIR/arrays-completely-captured.rs:18:9 --> $DIR/arrays-completely-captured.rs:18:9
| |
LL | m[1] += 40; LL | m[1] += 40;
@ -43,7 +43,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture m[] -> MutBorrow note: Min Capture m[] -> Mutable
--> $DIR/arrays-completely-captured.rs:15:9 --> $DIR/arrays-completely-captured.rs:15:9
| |
LL | m[0] += 10; LL | m[0] += 10;

View file

@ -26,8 +26,8 @@ fn big_box() {
//~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue
//~| NOTE: Min Capture t[(0, 0)] -> ByValue //~| NOTE: Min Capture t[(0, 0)] -> ByValue
println!("{} {:?}", t.1, p); println!("{} {:?}", t.1, p);
//~^ NOTE: Capturing t[(1, 0)] -> ImmBorrow //~^ NOTE: Capturing t[(1, 0)] -> Immutable
//~| NOTE: Min Capture t[(1, 0)] -> ImmBorrow //~| NOTE: Min Capture t[(1, 0)] -> Immutable
}; };
c(); c();

View file

@ -25,7 +25,7 @@ note: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue
| |
LL | let p = t.0.0; LL | let p = t.0.0;
| ^^^^^ | ^^^^^
note: Capturing t[(1, 0)] -> ImmBorrow note: Capturing t[(1, 0)] -> Immutable
--> $DIR/by_value.rs:28:29 --> $DIR/by_value.rs:28:29
| |
LL | println!("{} {:?}", t.1, p); LL | println!("{} {:?}", t.1, p);
@ -48,7 +48,7 @@ note: Min Capture t[(0, 0)] -> ByValue
| |
LL | let p = t.0.0; 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 --> $DIR/by_value.rs:28:29
| |
LL | println!("{} {:?}", t.1, p); LL | println!("{} {:?}", t.1, p);

View file

@ -20,15 +20,15 @@ fn main() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
println!("{:?}", p); println!("{:?}", p);
//~^ NOTE: Capturing p[] -> ImmBorrow //~^ NOTE: Capturing p[] -> Immutable
//~| NOTE: Min Capture p[] -> ImmBorrow //~| NOTE: Min Capture p[] -> Immutable
println!("{:?}", p.x); println!("{:?}", p.x);
//~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing p[(0, 0)] -> Immutable
println!("{:?}", q.x); println!("{:?}", q.x);
//~^ NOTE: Capturing q[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing q[(0, 0)] -> Immutable
println!("{:?}", q); println!("{:?}", q);
//~^ NOTE: Capturing q[] -> ImmBorrow //~^ NOTE: Capturing q[] -> Immutable
//~| NOTE: Min Capture q[] -> ImmBorrow //~| NOTE: Min Capture q[] -> Immutable
}; };
} }

View file

@ -20,22 +20,22 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing p[] -> ImmBorrow note: Capturing p[] -> Immutable
--> $DIR/capture-analysis-1.rs:22:26 --> $DIR/capture-analysis-1.rs:22:26
| |
LL | println!("{:?}", p); LL | println!("{:?}", p);
| ^ | ^
note: Capturing p[(0, 0)] -> ImmBorrow note: Capturing p[(0, 0)] -> Immutable
--> $DIR/capture-analysis-1.rs:25:26 --> $DIR/capture-analysis-1.rs:25:26
| |
LL | println!("{:?}", p.x); LL | println!("{:?}", p.x);
| ^^^ | ^^^
note: Capturing q[(0, 0)] -> ImmBorrow note: Capturing q[(0, 0)] -> Immutable
--> $DIR/capture-analysis-1.rs:28:26 --> $DIR/capture-analysis-1.rs:28:26
| |
LL | println!("{:?}", q.x); LL | println!("{:?}", q.x);
| ^^^ | ^^^
note: Capturing q[] -> ImmBorrow note: Capturing q[] -> Immutable
--> $DIR/capture-analysis-1.rs:30:26 --> $DIR/capture-analysis-1.rs:30:26
| |
LL | println!("{:?}", q); LL | println!("{:?}", q);
@ -53,12 +53,12 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture p[] -> ImmBorrow note: Min Capture p[] -> Immutable
--> $DIR/capture-analysis-1.rs:22:26 --> $DIR/capture-analysis-1.rs:22:26
| |
LL | println!("{:?}", p); LL | println!("{:?}", p);
| ^ | ^
note: Min Capture q[] -> ImmBorrow note: Min Capture q[] -> Immutable
--> $DIR/capture-analysis-1.rs:30:26 --> $DIR/capture-analysis-1.rs:30:26
| |
LL | println!("{:?}", q); LL | println!("{:?}", q);

View file

@ -22,7 +22,7 @@ fn main() {
//~^ NOTE: Capturing p[(0, 0)] -> ByValue //~^ NOTE: Capturing p[(0, 0)] -> ByValue
//~| NOTE: p[] captured as ByValue here //~| NOTE: p[] captured as ByValue here
println!("{:?}", p); println!("{:?}", p);
//~^ NOTE: Capturing p[] -> ImmBorrow //~^ NOTE: Capturing p[] -> Immutable
//~| NOTE: Min Capture p[] -> ByValue //~| NOTE: Min Capture p[] -> ByValue
//~| NOTE: p[] used here //~| NOTE: p[] used here
}; };

View file

@ -25,7 +25,7 @@ note: Capturing p[(0, 0)] -> ByValue
| |
LL | let _x = p.x; LL | let _x = p.x;
| ^^^ | ^^^
note: Capturing p[] -> ImmBorrow note: Capturing p[] -> Immutable
--> $DIR/capture-analysis-2.rs:24:26 --> $DIR/capture-analysis-2.rs:24:26
| |
LL | println!("{:?}", p); LL | println!("{:?}", p);

View file

@ -27,7 +27,7 @@ fn main() {
//~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ByValue //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ByValue
//~| NOTE: a[(0, 0)] captured as ByValue here //~| NOTE: a[(0, 0)] captured as ByValue here
println!("{:?}", a.b); println!("{:?}", a.b);
//~^ NOTE: Capturing a[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing a[(0, 0)] -> Immutable
//~| NOTE: Min Capture a[(0, 0)] -> ByValue //~| NOTE: Min Capture a[(0, 0)] -> ByValue
//~| NOTE: a[(0, 0)] used here //~| NOTE: a[(0, 0)] used here
}; };

View file

@ -25,7 +25,7 @@ note: Capturing a[(0, 0),(0, 0)] -> ByValue
| |
LL | let _x = a.b.c; 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 --> $DIR/capture-analysis-3.rs:29:26
| |
LL | println!("{:?}", a.b); LL | println!("{:?}", a.b);

View file

@ -27,6 +27,6 @@ fn main() {
//~^ NOTE: Capturing a[(0, 0)] -> ByValue //~^ NOTE: Capturing a[(0, 0)] -> ByValue
//~| NOTE: Min Capture a[(0, 0)] -> ByValue //~| NOTE: Min Capture a[(0, 0)] -> ByValue
println!("{:?}", a.b.c); println!("{:?}", a.b.c);
//~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ImmBorrow //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> Immutable
}; };
} }

View file

@ -25,7 +25,7 @@ note: Capturing a[(0, 0)] -> ByValue
| |
LL | let _x = a.b; 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 --> $DIR/capture-analysis-4.rs:29:26
| |
LL | println!("{:?}", a.b.c); LL | println!("{:?}", a.b.c);

View file

@ -18,8 +18,8 @@ fn main() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
println!("{}", p.x); println!("{}", p.x);
//~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing p[(0, 0)] -> Immutable
//~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow //~| NOTE: Min Capture p[(0, 0)] -> Immutable
}; };
// `c` should only capture `p.x`, therefore mutating `p.y` is allowed. // `c` should only capture `p.x`, therefore mutating `p.y` is allowed.

View file

@ -20,7 +20,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing p[(0, 0)] -> ImmBorrow note: Capturing p[(0, 0)] -> Immutable
--> $DIR/capture-disjoint-field-struct.rs:20:24 --> $DIR/capture-disjoint-field-struct.rs:20:24
| |
LL | println!("{}", p.x); LL | println!("{}", p.x);
@ -38,7 +38,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture p[(0, 0)] -> ImmBorrow note: Min Capture p[(0, 0)] -> Immutable
--> $DIR/capture-disjoint-field-struct.rs:20:24 --> $DIR/capture-disjoint-field-struct.rs:20:24
| |
LL | println!("{}", p.x); LL | println!("{}", p.x);

View file

@ -13,8 +13,8 @@ fn main() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
println!("{}", t.0); println!("{}", t.0);
//~^ NOTE: Capturing t[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing t[(0, 0)] -> Immutable
//~| NOTE: Min Capture t[(0, 0)] -> ImmBorrow //~| NOTE: Min Capture t[(0, 0)] -> Immutable
}; };
// `c` only captures t.0, therefore mutating t.1 is allowed. // `c` only captures t.0, therefore mutating t.1 is allowed.

View file

@ -20,7 +20,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing t[(0, 0)] -> ImmBorrow note: Capturing t[(0, 0)] -> Immutable
--> $DIR/capture-disjoint-field-tuple.rs:15:24 --> $DIR/capture-disjoint-field-tuple.rs:15:24
| |
LL | println!("{}", t.0); LL | println!("{}", t.0);
@ -38,7 +38,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture t[(0, 0)] -> ImmBorrow note: Min Capture t[(0, 0)] -> Immutable
--> $DIR/capture-disjoint-field-tuple.rs:15:24 --> $DIR/capture-disjoint-field-tuple.rs:15:24
| |
LL | println!("{}", t.0); LL | println!("{}", t.0);

View file

@ -21,14 +21,14 @@ fn multi_variant_enum() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
if let Info::Point(_, _, str) = point { if let Info::Point(_, _, str) = point {
//~^ NOTE: Capturing point[] -> ImmBorrow //~^ NOTE: Capturing point[] -> Immutable
//~| NOTE: Capturing point[(2, 0)] -> ByValue //~| NOTE: Capturing point[(2, 0)] -> ByValue
//~| NOTE: Min Capture point[] -> ByValue //~| NOTE: Min Capture point[] -> ByValue
println!("{}", str); println!("{}", str);
} }
if let Info::Meta(_, v) = meta { if let Info::Meta(_, v) = meta {
//~^ NOTE: Capturing meta[] -> ImmBorrow //~^ NOTE: Capturing meta[] -> Immutable
//~| NOTE: Capturing meta[(1, 1)] -> ByValue //~| NOTE: Capturing meta[(1, 1)] -> ByValue
//~| NOTE: Min Capture meta[] -> ByValue //~| NOTE: Min Capture meta[] -> ByValue
println!("{:?}", v); println!("{:?}", v);

View file

@ -30,7 +30,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing point[] -> ImmBorrow note: Capturing point[] -> Immutable
--> $DIR/capture-enums.rs:23:41 --> $DIR/capture-enums.rs:23:41
| |
LL | if let Info::Point(_, _, str) = point { LL | if let Info::Point(_, _, str) = point {
@ -40,7 +40,7 @@ note: Capturing point[(2, 0)] -> ByValue
| |
LL | if let Info::Point(_, _, str) = point { LL | if let Info::Point(_, _, str) = point {
| ^^^^^ | ^^^^^
note: Capturing meta[] -> ImmBorrow note: Capturing meta[] -> Immutable
--> $DIR/capture-enums.rs:30:35 --> $DIR/capture-enums.rs:30:35
| |
LL | if let Info::Meta(_, v) = meta { LL | if let Info::Meta(_, v) = meta {

View file

@ -39,13 +39,13 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let x = &p.a.p.x; 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; p.b.q.y = 9;
//~^ NOTE: Capturing p[(1, 0),(1, 0),(1, 0)] -> MutBorrow //~^ NOTE: Capturing p[(1, 0),(1, 0),(1, 0)] -> Mutable
//~| NOTE: p[] captured as MutBorrow here //~| NOTE: p[] captured as Mutable here
println!("{:?}", p); println!("{:?}", p);
//~^ NOTE: Capturing p[] -> ImmBorrow //~^ NOTE: Capturing p[] -> Immutable
//~| NOTE: Min Capture p[] -> MutBorrow //~| NOTE: Min Capture p[] -> Mutable
//~| NOTE: p[] used here //~| NOTE: p[] used here
}; };
} }

View file

@ -20,17 +20,17 @@ LL | |
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 --> $DIR/deep-multilevel-struct.rs:41:18
| |
LL | let x = &p.a.p.x; 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 --> $DIR/deep-multilevel-struct.rs:43:9
| |
LL | p.b.q.y = 9; LL | p.b.q.y = 9;
| ^^^^^^^ | ^^^^^^^
note: Capturing p[] -> ImmBorrow note: Capturing p[] -> Immutable
--> $DIR/deep-multilevel-struct.rs:46:26 --> $DIR/deep-multilevel-struct.rs:46:26
| |
LL | println!("{:?}", p); LL | println!("{:?}", p);
@ -48,11 +48,11 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture p[] -> MutBorrow note: Min Capture p[] -> Mutable
--> $DIR/deep-multilevel-struct.rs:43:9 --> $DIR/deep-multilevel-struct.rs:43:9
| |
LL | p.b.q.y = 9; LL | p.b.q.y = 9;
| ^^^^^^^ p[] captured as MutBorrow here | ^^^^^^^ p[] captured as Mutable here
... ...
LL | println!("{:?}", p); LL | println!("{:?}", p);
| ^ p[] used here | ^ p[] used here

View file

@ -13,13 +13,13 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let x = &t.0.0.0; 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; t.1.1.1 = 9;
//~^ NOTE: Capturing t[(1, 0),(1, 0),(1, 0)] -> MutBorrow //~^ NOTE: Capturing t[(1, 0),(1, 0),(1, 0)] -> Mutable
//~| NOTE: t[] captured as MutBorrow here //~| NOTE: t[] captured as Mutable here
println!("{:?}", t); println!("{:?}", t);
//~^ NOTE: Min Capture t[] -> MutBorrow //~^ NOTE: Min Capture t[] -> Mutable
//~| NOTE: Capturing t[] -> ImmBorrow //~| NOTE: Capturing t[] -> Immutable
//~| NOTE: t[] used here //~| NOTE: t[] used here
}; };
} }

View file

@ -20,17 +20,17 @@ LL | |
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 --> $DIR/deep-multilevel-tuple.rs:15:18
| |
LL | let x = &t.0.0.0; 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 --> $DIR/deep-multilevel-tuple.rs:17:9
| |
LL | t.1.1.1 = 9; LL | t.1.1.1 = 9;
| ^^^^^^^ | ^^^^^^^
note: Capturing t[] -> ImmBorrow note: Capturing t[] -> Immutable
--> $DIR/deep-multilevel-tuple.rs:20:26 --> $DIR/deep-multilevel-tuple.rs:20:26
| |
LL | println!("{:?}", t); LL | println!("{:?}", t);
@ -48,11 +48,11 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture t[] -> MutBorrow note: Min Capture t[] -> Mutable
--> $DIR/deep-multilevel-tuple.rs:17:9 --> $DIR/deep-multilevel-tuple.rs:17:9
| |
LL | t.1.1.1 = 9; LL | t.1.1.1 = 9;
| ^^^^^^^ t[] captured as MutBorrow here | ^^^^^^^ t[] captured as Mutable here
... ...
LL | println!("{:?}", t); LL | println!("{:?}", t);
| ^ t[] used here | ^ t[] used here

View file

@ -44,9 +44,9 @@ fn structs() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let Point { x: ref mut x, y: _, id: moved_id } = p; 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: 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 //~| NOTE: Min Capture p[(2, 0)] -> ByValue
println!("{}, {}", x, moved_id); println!("{}, {}", x, moved_id);
@ -65,11 +65,11 @@ fn tuples() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let (ref mut x, ref ref_str, (moved_s, _)) = t; let (ref mut x, ref ref_str, (moved_s, _)) = t;
//~^ NOTE: Capturing t[(0, 0)] -> MutBorrow //~^ NOTE: Capturing t[(0, 0)] -> Mutable
//~| NOTE: Capturing t[(1, 0)] -> ImmBorrow //~| NOTE: Capturing t[(1, 0)] -> Immutable
//~| NOTE: Capturing t[(2, 0),(0, 0)] -> ByValue //~| NOTE: Capturing t[(2, 0),(0, 0)] -> ByValue
//~| NOTE: Min Capture t[(0, 0)] -> MutBorrow //~| NOTE: Min Capture t[(0, 0)] -> Mutable
//~| NOTE: Min Capture t[(1, 0)] -> ImmBorrow //~| NOTE: Min Capture t[(1, 0)] -> Immutable
//~| NOTE: Min Capture t[(2, 0),(0, 0)] -> ByValue //~| NOTE: Min Capture t[(2, 0),(0, 0)] -> ByValue
println!("{}, {} {}", x, ref_str, moved_s); println!("{}, {} {}", x, ref_str, moved_s);

View file

@ -86,7 +86,7 @@ LL | | println!("{}, {}", x, moved_id);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing p[(0, 0)] -> MutBorrow note: Capturing p[(0, 0)] -> Mutable
--> $DIR/destructure_patterns.rs:46:58 --> $DIR/destructure_patterns.rs:46:58
| |
LL | let Point { x: ref mut x, y: _, id: moved_id } = p; LL | let Point { x: ref mut x, y: _, id: moved_id } = p;
@ -109,7 +109,7 @@ LL | | println!("{}, {}", x, moved_id);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture p[(0, 0)] -> MutBorrow note: Min Capture p[(0, 0)] -> Mutable
--> $DIR/destructure_patterns.rs:46:58 --> $DIR/destructure_patterns.rs:46:58
| |
LL | let Point { x: ref mut x, y: _, id: moved_id } = p; LL | let Point { x: ref mut x, y: _, id: moved_id } = p;
@ -132,12 +132,12 @@ LL | | println!("{}, {} {}", x, ref_str, moved_s);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing t[(0, 0)] -> MutBorrow note: Capturing t[(0, 0)] -> Mutable
--> $DIR/destructure_patterns.rs:67:54 --> $DIR/destructure_patterns.rs:67:54
| |
LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; 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 --> $DIR/destructure_patterns.rs:67:54
| |
LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; LL | let (ref mut x, ref ref_str, (moved_s, _)) = t;
@ -160,12 +160,12 @@ LL | | println!("{}, {} {}", x, ref_str, moved_s);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture t[(0, 0)] -> MutBorrow note: Min Capture t[(0, 0)] -> Mutable
--> $DIR/destructure_patterns.rs:67:54 --> $DIR/destructure_patterns.rs:67:54
| |
LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; 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 --> $DIR/destructure_patterns.rs:67:54
| |
LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; LL | let (ref mut x, ref ref_str, (moved_s, _)) = t;

View file

@ -13,7 +13,7 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("This uses new capture analyysis to capture s={}", s); println!("This uses new capture analyysis to capture s={}", s);
//~^ NOTE: Capturing s[] -> ImmBorrow //~^ NOTE: Capturing s[] -> Immutable
//~| NOTE: Min Capture s[] -> ImmBorrow //~| NOTE: Min Capture s[] -> Immutable
}; };
} }

View file

@ -20,7 +20,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing s[] -> ImmBorrow note: Capturing s[] -> Immutable
--> $DIR/feature-gate-capture_disjoint_fields.rs:15:69 --> $DIR/feature-gate-capture_disjoint_fields.rs:15:69
| |
LL | println!("This uses new capture analyysis to capture s={}", s); LL | println!("This uses new capture analyysis to capture s={}", s);
@ -38,7 +38,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture s[] -> ImmBorrow note: Min Capture s[] -> Immutable
--> $DIR/feature-gate-capture_disjoint_fields.rs:15:69 --> $DIR/feature-gate-capture_disjoint_fields.rs:15:69
| |
LL | println!("This uses new capture analyysis to capture s={}", s); LL | println!("This uses new capture analyysis to capture s={}", s);

View file

@ -24,8 +24,8 @@ impl Data {
|v| self.filter.allowed(*v), |v| self.filter.allowed(*v),
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
//~| NOTE: Capturing self[Deref,(0, 0)] -> ImmBorrow //~| NOTE: Capturing self[Deref,(0, 0)] -> Immutable
//~| NOTE: Min Capture self[Deref,(0, 0)] -> ImmBorrow //~| NOTE: Min Capture self[Deref,(0, 0)] -> Immutable
); );
} }
} }

View file

@ -4,7 +4,7 @@ error: First Pass analysis includes:
LL | |v| self.filter.allowed(*v), 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 --> $DIR/filter-on-struct-member.rs:24:17
| |
LL | |v| self.filter.allowed(*v), LL | |v| self.filter.allowed(*v),
@ -16,7 +16,7 @@ error: Min Capture analysis includes:
LL | |v| self.filter.allowed(*v), 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 --> $DIR/filter-on-struct-member.rs:24:17
| |
LL | |v| self.filter.allowed(*v), LL | |v| self.filter.allowed(*v),

View file

@ -19,8 +19,8 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
unsafe { u.value } unsafe { u.value }
//~^ NOTE: Capturing u[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing u[(0, 0)] -> Immutable
//~| NOTE: Min Capture u[] -> ImmBorrow //~| NOTE: Min Capture u[] -> Immutable
}; };
c(); c();

View file

@ -20,7 +20,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing u[(0, 0)] -> ImmBorrow note: Capturing u[(0, 0)] -> Immutable
--> $DIR/issue-87378.rs:21:17 --> $DIR/issue-87378.rs:21:17
| |
LL | unsafe { u.value } LL | unsafe { u.value }
@ -38,7 +38,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture u[] -> ImmBorrow note: Min Capture u[] -> Immutable
--> $DIR/issue-87378.rs:21:17 --> $DIR/issue-87378.rs:21:17
| |
LL | unsafe { u.value } LL | unsafe { u.value }

View file

@ -24,7 +24,7 @@ pub fn test1() {
//~| ERROR: First Pass analysis includes: //~| ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("{:?}", f.0); println!("{:?}", f.0);
//~^ NOTE: Capturing f[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing f[(0, 0)] -> Immutable
//~| NOTE: Min Capture f[] -> ByValue //~| NOTE: Min Capture f[] -> ByValue
}; };
@ -52,7 +52,7 @@ fn test2() {
//~| ERROR: First Pass analysis includes: //~| ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("{}", character.hp) println!("{}", character.hp)
//~^ NOTE: Capturing character[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing character[(0, 0)] -> Immutable
//~| NOTE: Min Capture character[(0, 0)] -> ByValue //~| NOTE: Min Capture character[(0, 0)] -> ByValue
}; };

View file

@ -31,7 +31,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing f[(0, 0)] -> ImmBorrow note: Capturing f[(0, 0)] -> Immutable
--> $DIR/issue-88476.rs:26:26 --> $DIR/issue-88476.rs:26:26
| |
LL | println!("{:?}", f.0); LL | println!("{:?}", f.0);
@ -69,7 +69,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing character[(0, 0)] -> ImmBorrow note: Capturing character[(0, 0)] -> Immutable
--> $DIR/issue-88476.rs:54:24 --> $DIR/issue-88476.rs:54:24
| |
LL | println!("{}", character.hp) LL | println!("{}", character.hp)

View file

@ -13,8 +13,8 @@ fn test_1_should_capture() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
match variant { match variant {
//~^ NOTE: Capturing variant[] -> ImmBorrow //~^ NOTE: Capturing variant[] -> Immutable
//~| NOTE: Min Capture variant[] -> ImmBorrow //~| NOTE: Min Capture variant[] -> Immutable
Some(_) => {} Some(_) => {}
_ => {} _ => {}
} }
@ -64,9 +64,9 @@ fn test_6_should_capture_single_variant() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
match variant { match variant {
//~^ NOTE: Capturing variant[] -> ImmBorrow //~^ NOTE: Capturing variant[] -> Immutable
//~| NOTE: Capturing variant[(0, 0)] -> ImmBorrow //~| NOTE: Capturing variant[(0, 0)] -> Immutable
//~| NOTE: Min Capture variant[] -> ImmBorrow //~| NOTE: Min Capture variant[] -> Immutable
SingleVariant::Points(a) => { SingleVariant::Points(a) => {
println!("{:?}", a); println!("{:?}", a);
} }
@ -131,8 +131,8 @@ fn test_5_should_capture_multi_variant() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
match variant { match variant {
//~^ NOTE: Capturing variant[] -> ImmBorrow //~^ NOTE: Capturing variant[] -> Immutable
//~| NOTE: Min Capture variant[] -> ImmBorrow //~| NOTE: Min Capture variant[] -> Immutable
MVariant::A => {} MVariant::A => {}
_ => {} _ => {}
} }
@ -149,8 +149,8 @@ fn test_7_should_capture_slice_len() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
match slice { match slice {
//~^ NOTE: Capturing slice[] -> ImmBorrow //~^ NOTE: Capturing slice[] -> Immutable
//~| NOTE: Min Capture slice[] -> ImmBorrow //~| NOTE: Min Capture slice[] -> Immutable
[_,_,_] => {}, [_,_,_] => {},
_ => {} _ => {}
} }
@ -161,8 +161,8 @@ fn test_7_should_capture_slice_len() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
match slice { match slice {
//~^ NOTE: Capturing slice[] -> ImmBorrow //~^ NOTE: Capturing slice[] -> Immutable
//~| NOTE: Min Capture slice[] -> ImmBorrow //~| NOTE: Min Capture slice[] -> Immutable
[] => {}, [] => {},
_ => {} _ => {}
} }
@ -173,8 +173,8 @@ fn test_7_should_capture_slice_len() {
//~^ First Pass analysis includes: //~^ First Pass analysis includes:
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
match slice { match slice {
//~^ NOTE: Capturing slice[] -> ImmBorrow //~^ NOTE: Capturing slice[] -> Immutable
//~| NOTE: Min Capture slice[] -> ImmBorrow //~| NOTE: Min Capture slice[] -> Immutable
[_, .. ,_] => {}, [_, .. ,_] => {},
_ => {} _ => {}
} }

View file

@ -10,7 +10,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing variant[] -> ImmBorrow note: Capturing variant[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:15:15 --> $DIR/patterns-capture-analysis.rs:15:15
| |
LL | match variant { LL | match variant {
@ -28,7 +28,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture variant[] -> ImmBorrow note: Min Capture variant[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:15:15 --> $DIR/patterns-capture-analysis.rs:15:15
| |
LL | match variant { LL | match variant {
@ -68,12 +68,12 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing variant[] -> ImmBorrow note: Capturing variant[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:66:15 --> $DIR/patterns-capture-analysis.rs:66:15
| |
LL | match variant { LL | match variant {
| ^^^^^^^ | ^^^^^^^
note: Capturing variant[(0, 0)] -> ImmBorrow note: Capturing variant[(0, 0)] -> Immutable
--> $DIR/patterns-capture-analysis.rs:66:15 --> $DIR/patterns-capture-analysis.rs:66:15
| |
LL | match variant { LL | match variant {
@ -91,7 +91,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture variant[] -> ImmBorrow note: Min Capture variant[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:66:15 --> $DIR/patterns-capture-analysis.rs:66:15
| |
LL | match variant { LL | match variant {
@ -142,7 +142,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing variant[] -> ImmBorrow note: Capturing variant[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:133:15 --> $DIR/patterns-capture-analysis.rs:133:15
| |
LL | match variant { LL | match variant {
@ -160,7 +160,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture variant[] -> ImmBorrow note: Min Capture variant[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:133:15 --> $DIR/patterns-capture-analysis.rs:133:15
| |
LL | match variant { LL | match variant {
@ -178,7 +178,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing slice[] -> ImmBorrow note: Capturing slice[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:151:15 --> $DIR/patterns-capture-analysis.rs:151:15
| |
LL | match slice { LL | match slice {
@ -196,7 +196,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture slice[] -> ImmBorrow note: Min Capture slice[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:151:15 --> $DIR/patterns-capture-analysis.rs:151:15
| |
LL | match slice { LL | match slice {
@ -214,7 +214,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing slice[] -> ImmBorrow note: Capturing slice[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:163:15 --> $DIR/patterns-capture-analysis.rs:163:15
| |
LL | match slice { LL | match slice {
@ -232,7 +232,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture slice[] -> ImmBorrow note: Min Capture slice[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:163:15 --> $DIR/patterns-capture-analysis.rs:163:15
| |
LL | match slice { LL | match slice {
@ -250,7 +250,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing slice[] -> ImmBorrow note: Capturing slice[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:175:15 --> $DIR/patterns-capture-analysis.rs:175:15
| |
LL | match slice { LL | match slice {
@ -268,7 +268,7 @@ LL | | }
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture slice[] -> ImmBorrow note: Min Capture slice[] -> Immutable
--> $DIR/patterns-capture-analysis.rs:175:15 --> $DIR/patterns-capture-analysis.rs:175:15
| |
LL | match slice { LL | match slice {

View file

@ -17,7 +17,7 @@ fn simple_move_closure() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
t.0.0 = "new S".into(); 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 //~| NOTE: Min Capture t[(0, 0),(0, 0)] -> ByValue
}; };
c(); c();
@ -36,7 +36,7 @@ fn simple_ref() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
*ref_s += 10; *ref_s += 10;
//~^ NOTE: Capturing ref_s[Deref] -> MutBorrow //~^ NOTE: Capturing ref_s[Deref] -> Mutable
//~| NOTE: Min Capture ref_s[] -> ByValue //~| NOTE: Min Capture ref_s[] -> ByValue
}; };
c(); c();
@ -58,7 +58,7 @@ fn struct_contains_ref_to_another_struct_1() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
t.0.0 = "new s".into(); 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 //~| 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: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let _t = t.0.0; 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 //~| NOTE: Min Capture t[(0, 0)] -> ByValue
}; };
@ -127,7 +127,7 @@ fn truncate_box_derefs() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let _t = b.0; let _t = b.0;
//~^ NOTE: Capturing b[Deref,(0, 0)] -> ImmBorrow //~^ NOTE: Capturing b[Deref,(0, 0)] -> Immutable
//~| NOTE: Min Capture b[] -> ByValue //~| NOTE: Min Capture b[] -> ByValue
}; };
@ -144,7 +144,7 @@ fn truncate_box_derefs() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("{}", b.0); println!("{}", b.0);
//~^ NOTE: Capturing b[Deref,(0, 0)] -> ImmBorrow //~^ NOTE: Capturing b[Deref,(0, 0)] -> Immutable
//~| NOTE: Min Capture b[] -> ByValue //~| NOTE: Min Capture b[] -> ByValue
}; };
@ -162,7 +162,7 @@ fn truncate_box_derefs() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("{}", t.1.0); 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 //~| NOTE: Min Capture t[(1, 0)] -> ByValue
}; };
} }
@ -182,7 +182,7 @@ fn box_mut_1() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
//~| First Pass analysis includes: //~| 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: //~| Min Capture analysis includes:
//~| NOTE: Min Capture box_p_foo[] -> ByValue //~| NOTE: Min Capture box_p_foo[] -> ByValue
} }
@ -200,7 +200,7 @@ fn box_mut_2() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
//~| First Pass analysis includes: //~| 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: //~| Min Capture analysis includes:
//~| NOTE: Min Capture p_foo[] -> ByValue //~| NOTE: Min Capture p_foo[] -> ByValue
} }
@ -214,7 +214,7 @@ fn returned_closure_owns_copy_type_data() -> impl Fn() -> i32 {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
//~| First Pass analysis includes: //~| First Pass analysis includes:
//~| NOTE: Capturing x[] -> ImmBorrow //~| NOTE: Capturing x[] -> Immutable
//~| Min Capture analysis includes: //~| Min Capture analysis includes:
//~| NOTE: Min Capture x[] -> ByValue //~| NOTE: Min Capture x[] -> ByValue

View file

@ -114,7 +114,7 @@ error: First Pass analysis includes:
LL | let c = #[rustc_capture_analysis] move || x; LL | let c = #[rustc_capture_analysis] move || x;
| ^^^^^^^^^ | ^^^^^^^^^
| |
note: Capturing x[] -> ImmBorrow note: Capturing x[] -> Immutable
--> $DIR/move_closure.rs:212:47 --> $DIR/move_closure.rs:212:47
| |
LL | let c = #[rustc_capture_analysis] move || x; LL | let c = #[rustc_capture_analysis] move || x;
@ -144,7 +144,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing t[(0, 0),(0, 0)] -> MutBorrow note: Capturing t[(0, 0),(0, 0)] -> Mutable
--> $DIR/move_closure.rs:19:9 --> $DIR/move_closure.rs:19:9
| |
LL | t.0.0 = "new S".into(); LL | t.0.0 = "new S".into();
@ -180,7 +180,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing ref_s[Deref] -> MutBorrow note: Capturing ref_s[Deref] -> Mutable
--> $DIR/move_closure.rs:38:9 --> $DIR/move_closure.rs:38:9
| |
LL | *ref_s += 10; LL | *ref_s += 10;
@ -216,7 +216,7 @@ LL | |
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 --> $DIR/move_closure.rs:60:9
| |
LL | t.0.0 = "new s".into(); LL | t.0.0 = "new s".into();
@ -252,7 +252,7 @@ LL | |
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 --> $DIR/move_closure.rs:84:18
| |
LL | let _t = t.0.0; LL | let _t = t.0.0;
@ -324,7 +324,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing b[Deref,(0, 0)] -> ImmBorrow note: Capturing b[Deref,(0, 0)] -> Immutable
--> $DIR/move_closure.rs:129:18 --> $DIR/move_closure.rs:129:18
| |
LL | let _t = b.0; LL | let _t = b.0;
@ -360,7 +360,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing b[Deref,(0, 0)] -> ImmBorrow note: Capturing b[Deref,(0, 0)] -> Immutable
--> $DIR/move_closure.rs:146:24 --> $DIR/move_closure.rs:146:24
| |
LL | println!("{}", b.0); LL | println!("{}", b.0);
@ -396,7 +396,7 @@ LL | |
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 --> $DIR/move_closure.rs:164:24
| |
LL | println!("{}", t.1.0); 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; 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 --> $DIR/move_closure.rs:180:47
| |
LL | let c = #[rustc_capture_analysis] move || box_p_foo.x += 10; 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; 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 --> $DIR/move_closure.rs:198:47
| |
LL | let c = #[rustc_capture_analysis] move || p_foo.x += 10; LL | let c = #[rustc_capture_analysis] move || p_foo.x += 10;

View file

@ -27,8 +27,8 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let wp = &w.p; let wp = &w.p;
//~^ NOTE: Capturing w[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing w[(0, 0)] -> Immutable
//~| NOTE: Min Capture w[(0, 0)] -> ImmBorrow //~| NOTE: Min Capture w[(0, 0)] -> Immutable
println!("{}", wp.x); println!("{}", wp.x);
}; };

View file

@ -20,7 +20,7 @@ LL | | println!("{}", wp.x);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing w[(0, 0)] -> ImmBorrow note: Capturing w[(0, 0)] -> Immutable
--> $DIR/multilevel-path-1.rs:29:19 --> $DIR/multilevel-path-1.rs:29:19
| |
LL | let wp = &w.p; LL | let wp = &w.p;
@ -38,7 +38,7 @@ LL | | println!("{}", wp.x);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture w[(0, 0)] -> ImmBorrow note: Min Capture w[(0, 0)] -> Immutable
--> $DIR/multilevel-path-1.rs:29:19 --> $DIR/multilevel-path-1.rs:29:19
| |
LL | let wp = &w.p; LL | let wp = &w.p;

View file

@ -22,8 +22,8 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("{}", w.p.x); println!("{}", w.p.x);
//~^ NOTE: Capturing w[(0, 0),(0, 0)] -> ImmBorrow //~^ NOTE: Capturing w[(0, 0),(0, 0)] -> Immutable
//~| NOTE: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow //~| NOTE: Min Capture w[(0, 0),(0, 0)] -> Immutable
}; };
// `c` only captures `w.p.x`, therefore it's safe to mutate `w.p.y`. // `c` only captures `w.p.x`, therefore it's safe to mutate `w.p.y`.

View file

@ -20,7 +20,7 @@ LL | |
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 --> $DIR/multilevel-path-2.rs:24:24
| |
LL | println!("{}", w.p.x); LL | println!("{}", w.p.x);
@ -38,7 +38,7 @@ LL | |
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 --> $DIR/multilevel-path-2.rs:24:24
| |
LL | println!("{}", w.p.x); LL | println!("{}", w.p.x);

View file

@ -24,8 +24,8 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("{}", p.x); println!("{}", p.x);
//~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing p[(0, 0)] -> Immutable
//~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow //~| NOTE: Min Capture p[(0, 0)] -> Immutable
let incr = 10; let incr = 10;
let mut c2 = #[rustc_capture_analysis] let mut c2 = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental //~^ ERROR: attributes on expressions are experimental
@ -34,15 +34,15 @@ fn main() {
|| p.y += incr; || p.y += incr;
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
//~| NOTE: Capturing p[(1, 0)] -> MutBorrow //~| NOTE: Capturing p[(1, 0)] -> Mutable
//~| NOTE: Capturing incr[] -> ImmBorrow //~| NOTE: Capturing incr[] -> Immutable
//~| NOTE: Min Capture p[(1, 0)] -> MutBorrow //~| NOTE: Min Capture p[(1, 0)] -> Mutable
//~| NOTE: Min Capture incr[] -> ImmBorrow //~| NOTE: Min Capture incr[] -> Immutable
//~| NOTE: Capturing p[(1, 0)] -> MutBorrow //~| NOTE: Capturing p[(1, 0)] -> Mutable
//~| NOTE: Min Capture p[(1, 0)] -> MutBorrow //~| NOTE: Min Capture p[(1, 0)] -> Mutable
c2(); c2();
println!("{}", p.y); println!("{}", p.y);
//~^ NOTE: Capturing p[(1, 0)] -> ImmBorrow //~^ NOTE: Capturing p[(1, 0)] -> Immutable
}; };
c1(); c1();

View file

@ -24,12 +24,12 @@ error: First Pass analysis includes:
LL | || p.y += incr; LL | || p.y += incr;
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
note: Capturing p[(1, 0)] -> MutBorrow note: Capturing p[(1, 0)] -> Mutable
--> $DIR/nested-closure.rs:34:12 --> $DIR/nested-closure.rs:34:12
| |
LL | || p.y += incr; LL | || p.y += incr;
| ^^^ | ^^^
note: Capturing incr[] -> ImmBorrow note: Capturing incr[] -> Immutable
--> $DIR/nested-closure.rs:34:19 --> $DIR/nested-closure.rs:34:19
| |
LL | || p.y += incr; LL | || p.y += incr;
@ -41,12 +41,12 @@ error: Min Capture analysis includes:
LL | || p.y += incr; LL | || p.y += incr;
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
note: Min Capture p[(1, 0)] -> MutBorrow note: Min Capture p[(1, 0)] -> Mutable
--> $DIR/nested-closure.rs:34:12 --> $DIR/nested-closure.rs:34:12
| |
LL | || p.y += incr; LL | || p.y += incr;
| ^^^ | ^^^
note: Min Capture incr[] -> ImmBorrow note: Min Capture incr[] -> Immutable
--> $DIR/nested-closure.rs:34:19 --> $DIR/nested-closure.rs:34:19
| |
LL | || p.y += incr; LL | || p.y += incr;
@ -64,17 +64,17 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing p[(0, 0)] -> ImmBorrow note: Capturing p[(0, 0)] -> Immutable
--> $DIR/nested-closure.rs:26:24 --> $DIR/nested-closure.rs:26:24
| |
LL | println!("{}", p.x); LL | println!("{}", p.x);
| ^^^ | ^^^
note: Capturing p[(1, 0)] -> MutBorrow note: Capturing p[(1, 0)] -> Mutable
--> $DIR/nested-closure.rs:34:12 --> $DIR/nested-closure.rs:34:12
| |
LL | || p.y += incr; LL | || p.y += incr;
| ^^^ | ^^^
note: Capturing p[(1, 0)] -> ImmBorrow note: Capturing p[(1, 0)] -> Immutable
--> $DIR/nested-closure.rs:44:24 --> $DIR/nested-closure.rs:44:24
| |
LL | println!("{}", p.y); LL | println!("{}", p.y);
@ -92,12 +92,12 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture p[(0, 0)] -> ImmBorrow note: Min Capture p[(0, 0)] -> Immutable
--> $DIR/nested-closure.rs:26:24 --> $DIR/nested-closure.rs:26:24
| |
LL | println!("{}", p.x); LL | println!("{}", p.x);
| ^^^ | ^^^
note: Min Capture p[(1, 0)] -> MutBorrow note: Min Capture p[(1, 0)] -> Mutable
--> $DIR/nested-closure.rs:34:12 --> $DIR/nested-closure.rs:34:12
| |
LL | || p.y += incr; LL | || p.y += incr;

View file

@ -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 //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
//~| ERROR: First Pass analysis includes: //~| ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
//~| NOTE: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> ImmBorrow //~| NOTE: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> Immutable
//~| NOTE: Min Capture m[Deref,(0, 0),Deref] -> ImmBorrow //~| NOTE: Min Capture m[Deref,(0, 0),Deref] -> Immutable
c c
} }

View file

@ -14,7 +14,7 @@ error: First Pass analysis includes:
LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); 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 --> $DIR/edge_case.rs:20:48
| |
LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); 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); 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 --> $DIR/edge_case.rs:20:48
| |
LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); LL | let c = #[rustc_capture_analysis] || drop(&m.a.0);

View file

@ -28,7 +28,7 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("{}", pent.points[5].x); println!("{}", pent.points[5].x);
//~^ NOTE: Capturing pent[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing pent[(0, 0)] -> Immutable
//~| NOTE: Min Capture pent[(0, 0)] -> ImmBorrow //~| NOTE: Min Capture pent[(0, 0)] -> Immutable
}; };
} }

View file

@ -20,7 +20,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing pent[(0, 0)] -> ImmBorrow note: Capturing pent[(0, 0)] -> Immutable
--> $DIR/path-with-array-access.rs:30:24 --> $DIR/path-with-array-access.rs:30:24
| |
LL | println!("{}", pent.points[5].x); LL | println!("{}", pent.points[5].x);
@ -38,7 +38,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture pent[(0, 0)] -> ImmBorrow note: Min Capture pent[(0, 0)] -> Immutable
--> $DIR/path-with-array-access.rs:30:24 --> $DIR/path-with-array-access.rs:30:24
| |
LL | println!("{}", pent.points[5].x); LL | println!("{}", pent.points[5].x);

View file

@ -28,17 +28,17 @@ fn test_one() {
//~^ ERROR: Min Capture analysis includes: //~^ ERROR: Min Capture analysis includes:
//~| ERROR //~| ERROR
println!("{:?}", a.0); println!("{:?}", a.0);
//~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow //~^ NOTE: Min Capture a[(0, 0)] -> Immutable
//~| NOTE //~| NOTE
println!("{:?}", a.1); println!("{:?}", a.1);
//~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow //~^ NOTE: Min Capture a[(1, 0)] -> Immutable
//~| NOTE //~| NOTE
println!("{:?}", b.0); println!("{:?}", b.0);
//~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow //~^ NOTE: Min Capture b[(0, 0)] -> Immutable
//~| NOTE //~| NOTE
println!("{:?}", b.1); println!("{:?}", b.1);
//~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow //~^ NOTE: Min Capture b[(1, 0)] -> Immutable
//~| NOTE //~| NOTE
}; };
} }
@ -55,17 +55,17 @@ fn test_two() {
//~^ ERROR: Min Capture analysis includes: //~^ ERROR: Min Capture analysis includes:
//~| ERROR //~| ERROR
println!("{:?}", a.1); println!("{:?}", a.1);
//~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow //~^ NOTE: Min Capture a[(1, 0)] -> Immutable
//~| NOTE //~| NOTE
println!("{:?}", a.0); println!("{:?}", a.0);
//~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow //~^ NOTE: Min Capture a[(0, 0)] -> Immutable
//~| NOTE //~| NOTE
println!("{:?}", b.1); println!("{:?}", b.1);
//~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow //~^ NOTE: Min Capture b[(1, 0)] -> Immutable
//~| NOTE //~| NOTE
println!("{:?}", b.0); println!("{:?}", b.0);
//~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow //~^ NOTE: Min Capture b[(0, 0)] -> Immutable
//~| NOTE //~| NOTE
}; };
} }
@ -82,17 +82,17 @@ fn test_three() {
//~^ ERROR: Min Capture analysis includes: //~^ ERROR: Min Capture analysis includes:
//~| ERROR //~| ERROR
println!("{:?}", b.1); println!("{:?}", b.1);
//~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow //~^ NOTE: Min Capture b[(1, 0)] -> Immutable
//~| NOTE //~| NOTE
println!("{:?}", a.1); println!("{:?}", a.1);
//~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow //~^ NOTE: Min Capture a[(1, 0)] -> Immutable
//~| NOTE //~| NOTE
println!("{:?}", a.0); println!("{:?}", a.0);
//~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow //~^ NOTE: Min Capture a[(0, 0)] -> Immutable
//~| NOTE //~| NOTE
println!("{:?}", b.0); println!("{:?}", b.0);
//~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow //~^ NOTE: Min Capture b[(0, 0)] -> Immutable
//~| NOTE //~| NOTE
}; };
} }

View file

@ -40,22 +40,22 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing a[(0, 0)] -> ImmBorrow note: Capturing a[(0, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:30:26 --> $DIR/preserve_field_drop_order.rs:30:26
| |
LL | println!("{:?}", a.0); LL | println!("{:?}", a.0);
| ^^^ | ^^^
note: Capturing a[(1, 0)] -> ImmBorrow note: Capturing a[(1, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:33:26 --> $DIR/preserve_field_drop_order.rs:33:26
| |
LL | println!("{:?}", a.1); LL | println!("{:?}", a.1);
| ^^^ | ^^^
note: Capturing b[(0, 0)] -> ImmBorrow note: Capturing b[(0, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:37:26 --> $DIR/preserve_field_drop_order.rs:37:26
| |
LL | println!("{:?}", b.0); LL | println!("{:?}", b.0);
| ^^^ | ^^^
note: Capturing b[(1, 0)] -> ImmBorrow note: Capturing b[(1, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:40:26 --> $DIR/preserve_field_drop_order.rs:40:26
| |
LL | println!("{:?}", b.1); LL | println!("{:?}", b.1);
@ -73,22 +73,22 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture a[(0, 0)] -> ImmBorrow note: Min Capture a[(0, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:30:26 --> $DIR/preserve_field_drop_order.rs:30:26
| |
LL | println!("{:?}", a.0); 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 --> $DIR/preserve_field_drop_order.rs:33:26
| |
LL | println!("{:?}", a.1); 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 --> $DIR/preserve_field_drop_order.rs:37:26
| |
LL | println!("{:?}", b.0); 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 --> $DIR/preserve_field_drop_order.rs:40:26
| |
LL | println!("{:?}", b.1); LL | println!("{:?}", b.1);
@ -106,22 +106,22 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing a[(1, 0)] -> ImmBorrow note: Capturing a[(1, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:57:26 --> $DIR/preserve_field_drop_order.rs:57:26
| |
LL | println!("{:?}", a.1); LL | println!("{:?}", a.1);
| ^^^ | ^^^
note: Capturing a[(0, 0)] -> ImmBorrow note: Capturing a[(0, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:60:26 --> $DIR/preserve_field_drop_order.rs:60:26
| |
LL | println!("{:?}", a.0); LL | println!("{:?}", a.0);
| ^^^ | ^^^
note: Capturing b[(1, 0)] -> ImmBorrow note: Capturing b[(1, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:64:26 --> $DIR/preserve_field_drop_order.rs:64:26
| |
LL | println!("{:?}", b.1); LL | println!("{:?}", b.1);
| ^^^ | ^^^
note: Capturing b[(0, 0)] -> ImmBorrow note: Capturing b[(0, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:67:26 --> $DIR/preserve_field_drop_order.rs:67:26
| |
LL | println!("{:?}", b.0); LL | println!("{:?}", b.0);
@ -139,22 +139,22 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture a[(0, 0)] -> ImmBorrow note: Min Capture a[(0, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:60:26 --> $DIR/preserve_field_drop_order.rs:60:26
| |
LL | println!("{:?}", a.0); 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 --> $DIR/preserve_field_drop_order.rs:57:26
| |
LL | println!("{:?}", a.1); 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 --> $DIR/preserve_field_drop_order.rs:67:26
| |
LL | println!("{:?}", b.0); 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 --> $DIR/preserve_field_drop_order.rs:64:26
| |
LL | println!("{:?}", b.1); LL | println!("{:?}", b.1);
@ -172,22 +172,22 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing b[(1, 0)] -> ImmBorrow note: Capturing b[(1, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:84:26 --> $DIR/preserve_field_drop_order.rs:84:26
| |
LL | println!("{:?}", b.1); LL | println!("{:?}", b.1);
| ^^^ | ^^^
note: Capturing a[(1, 0)] -> ImmBorrow note: Capturing a[(1, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:87:26 --> $DIR/preserve_field_drop_order.rs:87:26
| |
LL | println!("{:?}", a.1); LL | println!("{:?}", a.1);
| ^^^ | ^^^
note: Capturing a[(0, 0)] -> ImmBorrow note: Capturing a[(0, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:90:26 --> $DIR/preserve_field_drop_order.rs:90:26
| |
LL | println!("{:?}", a.0); LL | println!("{:?}", a.0);
| ^^^ | ^^^
note: Capturing b[(0, 0)] -> ImmBorrow note: Capturing b[(0, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:94:26 --> $DIR/preserve_field_drop_order.rs:94:26
| |
LL | println!("{:?}", b.0); LL | println!("{:?}", b.0);
@ -205,22 +205,22 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture b[(0, 0)] -> ImmBorrow note: Min Capture b[(0, 0)] -> Immutable
--> $DIR/preserve_field_drop_order.rs:94:26 --> $DIR/preserve_field_drop_order.rs:94:26
| |
LL | println!("{:?}", b.0); 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 --> $DIR/preserve_field_drop_order.rs:84:26
| |
LL | println!("{:?}", b.1); 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 --> $DIR/preserve_field_drop_order.rs:90:26
| |
LL | println!("{:?}", a.0); 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 --> $DIR/preserve_field_drop_order.rs:87:26
| |
LL | println!("{:?}", a.1); LL | println!("{:?}", a.1);

View file

@ -19,10 +19,10 @@ fn test_alignment_not_affected() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let z1: &u8 = &foo.x; let z1: &u8 = &foo.x;
//~^ NOTE: Capturing foo[] -> ImmBorrow //~^ NOTE: Capturing foo[] -> Immutable
let z2: &mut u8 = &mut foo.y; let z2: &mut u8 = &mut foo.y;
//~^ NOTE: Capturing foo[] -> MutBorrow //~^ NOTE: Capturing foo[] -> Mutable
//~| NOTE: Min Capture foo[] -> MutBorrow //~| NOTE: Min Capture foo[] -> Mutable
*z2 = 42; *z2 = 42;
@ -50,10 +50,10 @@ fn test_alignment_affected() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let z1: &String = &foo.x; let z1: &String = &foo.x;
//~^ NOTE: Capturing foo[] -> ImmBorrow //~^ NOTE: Capturing foo[] -> Immutable
let z2: &mut u16 = &mut foo.y; let z2: &mut u16 = &mut foo.y;
//~^ NOTE: Capturing foo[] -> MutBorrow //~^ NOTE: Capturing foo[] -> Mutable
//~| NOTE: Min Capture foo[] -> MutBorrow //~| NOTE: Min Capture foo[] -> Mutable
*z2 = 42; *z2 = 42;
@ -86,7 +86,7 @@ fn test_truncation_when_ref_and_move() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("{}", foo.x); println!("{}", foo.x);
//~^ NOTE: Capturing foo[] -> ImmBorrow //~^ NOTE: Capturing foo[] -> Immutable
//~| NOTE: Min Capture foo[] -> ByValue //~| NOTE: Min Capture foo[] -> ByValue
//~| NOTE: foo[] used here //~| NOTE: foo[] used here
let _z = foo.x; let _z = foo.x;

View file

@ -40,12 +40,12 @@ LL | | println!("({}, {})", z1, z2);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing foo[] -> ImmBorrow note: Capturing foo[] -> Immutable
--> $DIR/repr_packed.rs:21:24 --> $DIR/repr_packed.rs:21:24
| |
LL | let z1: &u8 = &foo.x; LL | let z1: &u8 = &foo.x;
| ^^^^^ | ^^^^^
note: Capturing foo[] -> MutBorrow note: Capturing foo[] -> Mutable
--> $DIR/repr_packed.rs:23:32 --> $DIR/repr_packed.rs:23:32
| |
LL | let z2: &mut u8 = &mut foo.y; LL | let z2: &mut u8 = &mut foo.y;
@ -63,7 +63,7 @@ LL | | println!("({}, {})", z1, z2);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture foo[] -> MutBorrow note: Min Capture foo[] -> Mutable
--> $DIR/repr_packed.rs:23:32 --> $DIR/repr_packed.rs:23:32
| |
LL | let z2: &mut u8 = &mut foo.y; LL | let z2: &mut u8 = &mut foo.y;
@ -81,12 +81,12 @@ LL | | println!("({}, {})", z1, z2);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing foo[] -> ImmBorrow note: Capturing foo[] -> Immutable
--> $DIR/repr_packed.rs:52:28 --> $DIR/repr_packed.rs:52:28
| |
LL | let z1: &String = &foo.x; LL | let z1: &String = &foo.x;
| ^^^^^ | ^^^^^
note: Capturing foo[] -> MutBorrow note: Capturing foo[] -> Mutable
--> $DIR/repr_packed.rs:54:33 --> $DIR/repr_packed.rs:54:33
| |
LL | let z2: &mut u16 = &mut foo.y; LL | let z2: &mut u16 = &mut foo.y;
@ -104,7 +104,7 @@ LL | | println!("({}, {})", z1, z2);
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture foo[] -> MutBorrow note: Min Capture foo[] -> Mutable
--> $DIR/repr_packed.rs:54:33 --> $DIR/repr_packed.rs:54:33
| |
LL | let z2: &mut u16 = &mut foo.y; LL | let z2: &mut u16 = &mut foo.y;
@ -122,7 +122,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing foo[] -> ImmBorrow note: Capturing foo[] -> Immutable
--> $DIR/repr_packed.rs:88:24 --> $DIR/repr_packed.rs:88:24
| |
LL | println!("{}", foo.x); LL | println!("{}", foo.x);

View file

@ -16,7 +16,7 @@ fn main() {
// //
// Requirements: // Requirements:
// p.x -> MutBoorrow // p.x -> MutBoorrow
// p -> ImmBorrow // p -> Immutable
// //
// Requirements met when p is captured via MutBorrow // Requirements met when p is captured via MutBorrow
// //
@ -28,11 +28,11 @@ fn main() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
p.x += 10; p.x += 10;
//~^ NOTE: Capturing p[(0, 0)] -> MutBorrow //~^ NOTE: Capturing p[(0, 0)] -> Mutable
//~| NOTE: p[] captured as MutBorrow here //~| NOTE: p[] captured as Mutable here
println!("{:?}", p); println!("{:?}", p);
//~^ NOTE: Capturing p[] -> ImmBorrow //~^ NOTE: Capturing p[] -> Immutable
//~| NOTE: Min Capture p[] -> MutBorrow //~| NOTE: Min Capture p[] -> Mutable
//~| NOTE: p[] used here //~| NOTE: p[] used here
}; };

View file

@ -20,12 +20,12 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing p[(0, 0)] -> MutBorrow note: Capturing p[(0, 0)] -> Mutable
--> $DIR/simple-struct-min-capture.rs:30:9 --> $DIR/simple-struct-min-capture.rs:30:9
| |
LL | p.x += 10; LL | p.x += 10;
| ^^^ | ^^^
note: Capturing p[] -> ImmBorrow note: Capturing p[] -> Immutable
--> $DIR/simple-struct-min-capture.rs:33:26 --> $DIR/simple-struct-min-capture.rs:33:26
| |
LL | println!("{:?}", p); LL | println!("{:?}", p);
@ -43,11 +43,11 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture p[] -> MutBorrow note: Min Capture p[] -> Mutable
--> $DIR/simple-struct-min-capture.rs:30:9 --> $DIR/simple-struct-min-capture.rs:30:9
| |
LL | p.x += 10; LL | p.x += 10;
| ^^^ p[] captured as MutBorrow here | ^^^ p[] captured as Mutable here
... ...
LL | println!("{:?}", p); LL | println!("{:?}", p);
| ^ p[] used here | ^ p[] used here

View file

@ -30,8 +30,8 @@ fn unsafe_imm() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
println!("{:?}", (*t.0).s); println!("{:?}", (*t.0).s);
//~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> Immutable
//~| NOTE: Min Capture t[(0, 0)] -> ImmBorrow //~| NOTE: Min Capture t[(0, 0)] -> Immutable
}; };
c(); c();
@ -51,8 +51,8 @@ fn unsafe_mut() {
//~^ ERROR: First Pass analysis includes: //~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
let x = unsafe { &mut (*p).s }; let x = unsafe { &mut (*p).s };
//~^ NOTE: Capturing p[Deref,(0, 0)] -> ImmBorrow //~^ NOTE: Capturing p[Deref,(0, 0)] -> Immutable
//~| NOTE: Min Capture p[] -> ImmBorrow //~| NOTE: Min Capture p[] -> Immutable
*x = "s".into(); *x = "s".into();
}; };
c(); c();

View file

@ -30,7 +30,7 @@ LL | |
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 --> $DIR/unsafe_ptr.rs:32:26
| |
LL | println!("{:?}", (*t.0).s); LL | println!("{:?}", (*t.0).s);
@ -48,7 +48,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture t[(0, 0)] -> ImmBorrow note: Min Capture t[(0, 0)] -> Immutable
--> $DIR/unsafe_ptr.rs:32:26 --> $DIR/unsafe_ptr.rs:32:26
| |
LL | println!("{:?}", (*t.0).s); LL | println!("{:?}", (*t.0).s);
@ -66,7 +66,7 @@ LL | | *x = "s".into();
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing p[Deref,(0, 0)] -> ImmBorrow note: Capturing p[Deref,(0, 0)] -> Immutable
--> $DIR/unsafe_ptr.rs:53:31 --> $DIR/unsafe_ptr.rs:53:31
| |
LL | let x = unsafe { &mut (*p).s }; LL | let x = unsafe { &mut (*p).s };
@ -84,7 +84,7 @@ LL | | *x = "s".into();
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture p[] -> ImmBorrow note: Min Capture p[] -> Immutable
--> $DIR/unsafe_ptr.rs:53:31 --> $DIR/unsafe_ptr.rs:53:31
| |
LL | let x = unsafe { &mut (*p).s }; LL | let x = unsafe { &mut (*p).s };

View file

@ -28,8 +28,8 @@ fn wild_struct() {
//~| ERROR: Min Capture analysis includes: //~| ERROR: Min Capture analysis includes:
// FIXME(arora-aman): Change `_x` to `_` // FIXME(arora-aman): Change `_x` to `_`
let Point { x: _x, y: _ } = p; let Point { x: _x, y: _ } = p;
//~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow //~^ NOTE: Capturing p[(0, 0)] -> Immutable
//~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow //~| NOTE: Min Capture p[(0, 0)] -> Immutable
}; };
c(); c();

View file

@ -40,7 +40,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Capturing p[(0, 0)] -> ImmBorrow note: Capturing p[(0, 0)] -> Immutable
--> $DIR/wild_patterns.rs:30:37 --> $DIR/wild_patterns.rs:30:37
| |
LL | let Point { x: _x, y: _ } = p; LL | let Point { x: _x, y: _ } = p;
@ -58,7 +58,7 @@ LL | |
LL | | }; LL | | };
| |_____^ | |_____^
| |
note: Min Capture p[(0, 0)] -> ImmBorrow note: Min Capture p[(0, 0)] -> Immutable
--> $DIR/wild_patterns.rs:30:37 --> $DIR/wild_patterns.rs:30:37
| |
LL | let Point { x: _x, y: _ } = p; LL | let Point { x: _x, y: _ } = p;