mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Remove BorrowKind glob, make names longer
This commit is contained in:
parent
be4b0261c2
commit
883f8705d4
@ -816,7 +816,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
||||
) {
|
||||
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}`");
|
||||
}
|
||||
|
@ -21,13 +21,12 @@ use rustc_middle::hir::place::ProjectionKind;
|
||||
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 @@ pub trait Delegate<'tcx> {
|
||||
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 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
|
||||
}
|
||||
|
||||
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 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
|
||||
}
|
||||
|
||||
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 @@ 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
|
||||
// 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 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
|
||||
// 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.
|
||||
|
@ -44,8 +44,8 @@ use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection, Pro
|
||||
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 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
},
|
||||
|
||||
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 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
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 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
|
||||
|
||||
// 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 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
|
||||
|
||||
// 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 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
|
||||
|
||||
#[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;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ use rustc_span::def_id::LocalDefIdMap;
|
||||
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 @@ impl 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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,6 @@ use tracing::{debug, instrument};
|
||||
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,
|
||||
|
@ -1185,11 +1185,11 @@ impl<'tcx> Cx<'tcx> {
|
||||
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 }
|
||||
}
|
||||
};
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
// 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 @@ impl<'tcx> euv::Delegate<'tcx> for MutablyUsedVariablesCtxt<'tcx> {
|
||||
// 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 {
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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 {
|
||||
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)
|
||||
},
|
||||
},
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -24,8 +24,8 @@ impl Data {
|
||||
|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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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),
|
||||
|
@ -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();
|
||||
|
@ -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 }
|
||||
|
@ -24,7 +24,7 @@ pub fn test1() {
|
||||
//~| 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 test2() {
|
||||
//~| 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
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
[_, .. ,_] => {},
|
||||
_ => {}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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 <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
|
||||
//~| 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 <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
|
||||
//~| 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 <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
|
||||
//~| First Pass analysis includes:
|
||||
//~| NOTE: Capturing x[] -> ImmBorrow
|
||||
//~| NOTE: Capturing x[] -> Immutable
|
||||
//~| Min Capture analysis includes:
|
||||
//~| NOTE: Min Capture x[] -> ByValue
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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`.
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -19,10 +19,10 @@ fn test_alignment_not_affected() {
|
||||
//~^ 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 @@ fn test_alignment_affected() {
|
||||
//~^ 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 @@ fn test_truncation_when_ref_and_move() {
|
||||
//~^ 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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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 };
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user