Auto merge of #89110 - Aaron1011:adjustment-span, r=estebank
Use larger span for adjustment THIR expressions Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions. These spans are recoded when we first create the adjustment during typecheck. For example, an autoref adjustment triggered by a method call will record the span of the entire method call. The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
This commit is contained in:
commit
4aa7879b55
170 changed files with 453 additions and 583 deletions
|
@ -39,10 +39,17 @@ impl<'tcx> Cx<'tcx> {
|
||||||
|
|
||||||
let mut expr = self.make_mirror_unadjusted(hir_expr);
|
let mut expr = self.make_mirror_unadjusted(hir_expr);
|
||||||
|
|
||||||
|
let adjustment_span = match self.adjustment_span {
|
||||||
|
Some((hir_id, span)) if hir_id == hir_expr.hir_id => Some(span),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
// Now apply adjustments, if any.
|
// Now apply adjustments, if any.
|
||||||
for adjustment in self.typeck_results.expr_adjustments(hir_expr) {
|
for adjustment in self.typeck_results.expr_adjustments(hir_expr) {
|
||||||
debug!("make_mirror: expr={:?} applying adjustment={:?}", expr, adjustment);
|
debug!("make_mirror: expr={:?} applying adjustment={:?}", expr, adjustment);
|
||||||
expr = self.apply_adjustment(hir_expr, expr, adjustment);
|
let span = expr.span;
|
||||||
|
expr =
|
||||||
|
self.apply_adjustment(hir_expr, expr, adjustment, adjustment_span.unwrap_or(span));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, wrap this up in the expr's scope.
|
// Next, wrap this up in the expr's scope.
|
||||||
|
@ -82,8 +89,9 @@ impl<'tcx> Cx<'tcx> {
|
||||||
hir_expr: &'tcx hir::Expr<'tcx>,
|
hir_expr: &'tcx hir::Expr<'tcx>,
|
||||||
mut expr: Expr<'tcx>,
|
mut expr: Expr<'tcx>,
|
||||||
adjustment: &Adjustment<'tcx>,
|
adjustment: &Adjustment<'tcx>,
|
||||||
|
mut span: Span,
|
||||||
) -> Expr<'tcx> {
|
) -> Expr<'tcx> {
|
||||||
let Expr { temp_lifetime, mut span, .. } = expr;
|
let Expr { temp_lifetime, .. } = expr;
|
||||||
|
|
||||||
// Adjust the span from the block, to the last expression of the
|
// Adjust the span from the block, to the last expression of the
|
||||||
// block. This is a better span when returning a mutable reference
|
// block. This is a better span when returning a mutable reference
|
||||||
|
@ -150,6 +158,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
|
|
||||||
fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx> {
|
fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx> {
|
||||||
let expr_ty = self.typeck_results().expr_ty(expr);
|
let expr_ty = self.typeck_results().expr_ty(expr);
|
||||||
|
let expr_span = expr.span;
|
||||||
let temp_lifetime = self.region_scope_tree.temporary_scope(expr.hir_id.local_id);
|
let temp_lifetime = self.region_scope_tree.temporary_scope(expr.hir_id.local_id);
|
||||||
|
|
||||||
let kind = match expr.kind {
|
let kind = match expr.kind {
|
||||||
|
@ -157,7 +166,13 @@ impl<'tcx> Cx<'tcx> {
|
||||||
hir::ExprKind::MethodCall(_, method_span, ref args, fn_span) => {
|
hir::ExprKind::MethodCall(_, method_span, ref args, fn_span) => {
|
||||||
// Rewrite a.b(c) into UFCS form like Trait::b(a, c)
|
// Rewrite a.b(c) into UFCS form like Trait::b(a, c)
|
||||||
let expr = self.method_callee(expr, method_span, None);
|
let expr = self.method_callee(expr, method_span, None);
|
||||||
|
// When we apply adjustments to the receiver, use the span of
|
||||||
|
// the overall method call for better diagnostics. args[0]
|
||||||
|
// is guaranteed to exist, since a method call always has a receiver.
|
||||||
|
let old_adjustment_span = self.adjustment_span.replace((args[0].hir_id, expr_span));
|
||||||
|
tracing::info!("Using method span: {:?}", expr.span);
|
||||||
let args = self.mirror_exprs(args);
|
let args = self.mirror_exprs(args);
|
||||||
|
self.adjustment_span = old_adjustment_span;
|
||||||
ExprKind::Call {
|
ExprKind::Call {
|
||||||
ty: expr.ty,
|
ty: expr.ty,
|
||||||
fun: self.thir.exprs.push(expr),
|
fun: self.thir.exprs.push(expr),
|
||||||
|
|
|
@ -9,6 +9,7 @@ use rustc_ast as ast;
|
||||||
use rustc_data_structures::steal::Steal;
|
use rustc_data_structures::steal::Steal;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||||
|
use rustc_hir::HirId;
|
||||||
use rustc_hir::Node;
|
use rustc_hir::Node;
|
||||||
use rustc_middle::middle::region;
|
use rustc_middle::middle::region;
|
||||||
use rustc_middle::mir::interpret::{LitToConstError, LitToConstInput};
|
use rustc_middle::mir::interpret::{LitToConstError, LitToConstInput};
|
||||||
|
@ -46,6 +47,14 @@ struct Cx<'tcx> {
|
||||||
crate region_scope_tree: &'tcx region::ScopeTree,
|
crate region_scope_tree: &'tcx region::ScopeTree,
|
||||||
crate typeck_results: &'tcx ty::TypeckResults<'tcx>,
|
crate typeck_results: &'tcx ty::TypeckResults<'tcx>,
|
||||||
|
|
||||||
|
/// When applying adjustments to the expression
|
||||||
|
/// with the given `HirId`, use the given `Span`,
|
||||||
|
/// instead of the usual span. This is used to
|
||||||
|
/// assign the span of an overall method call
|
||||||
|
/// (e.g. `my_val.foo()`) to the adjustment expressions
|
||||||
|
/// for the receiver.
|
||||||
|
adjustment_span: Option<(HirId, Span)>,
|
||||||
|
|
||||||
/// The `DefId` of the owner of this body.
|
/// The `DefId` of the owner of this body.
|
||||||
body_owner: DefId,
|
body_owner: DefId,
|
||||||
}
|
}
|
||||||
|
@ -60,6 +69,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
region_scope_tree: tcx.region_scope_tree(def.did),
|
region_scope_tree: tcx.region_scope_tree(def.did),
|
||||||
typeck_results,
|
typeck_results,
|
||||||
body_owner: def.did.to_def_id(),
|
body_owner: def.did.to_def_id(),
|
||||||
|
adjustment_span: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// MIR for `BAR::promoted[0]` after SimplifyCfg-elaborate-drops
|
// MIR for `BAR::promoted[0]` after SimplifyCfg-elaborate-drops
|
||||||
|
|
||||||
promoted[0] in BAR: &[&i32; 1] = {
|
promoted[0] in BAR: &[&i32; 1] = {
|
||||||
let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
let mut _1: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
let mut _1: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||||
let mut _2: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
let mut _2: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||||
let mut _3: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
let mut _3: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||||
|
@ -16,8 +16,8 @@ promoted[0] in BAR: &[&i32; 1] = {
|
||||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
|
// + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
|
||||||
_2 = &(*_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
_2 = &(*_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||||
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||||
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
return; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
return; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,21 +3,21 @@
|
||||||
|
|
||||||
static mut BAR: *const &i32 = {
|
static mut BAR: *const &i32 = {
|
||||||
let mut _0: *const &i32; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:9:17: 9:28
|
let mut _0: *const &i32; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:9:17: 9:28
|
||||||
let mut _1: &[&i32]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
let mut _1: &[&i32]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
let mut _2: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
let mut _2: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
let _3: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
let _3: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||||
let mut _4: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
let mut _4: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||||
let _5: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
let _5: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||||
+ let mut _6: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
+ let mut _6: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
StorageLive(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
StorageLive(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
StorageLive(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||||
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||||
- StorageLive(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
- StorageLive(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||||
- _5 = const {alloc1: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
- _5 = const {alloc1: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||||
+ _6 = const BAR::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
+ _6 = const BAR::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
// ty::Const
|
// ty::Const
|
||||||
- // + ty: &i32
|
- // + ty: &i32
|
||||||
- // + val: Value(Scalar(alloc1))
|
- // + val: Value(Scalar(alloc1))
|
||||||
|
@ -28,11 +28,11 @@
|
||||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
|
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
|
||||||
- _4 = &(*_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
- _4 = &(*_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||||
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||||
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
+ // + span: $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
+ // + span: $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[55e6]::BAR), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) }
|
+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[55e6]::BAR), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) }
|
||||||
+ _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
+ _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
_1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
_1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
- StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35
|
- StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35
|
||||||
StorageDead(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35
|
StorageDead(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35
|
||||||
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// MIR for `FOO::promoted[0]` after SimplifyCfg-elaborate-drops
|
// MIR for `FOO::promoted[0]` after SimplifyCfg-elaborate-drops
|
||||||
|
|
||||||
promoted[0] in FOO: &[&i32; 1] = {
|
promoted[0] in FOO: &[&i32; 1] = {
|
||||||
let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
let mut _1: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
let mut _1: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||||
let mut _2: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
|
let mut _2: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
|
||||||
let mut _3: *const i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
let mut _3: *const i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||||
|
@ -16,8 +16,8 @@ promoted[0] in FOO: &[&i32; 1] = {
|
||||||
// + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
|
// + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
|
||||||
_2 = &(*_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
|
_2 = &(*_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
|
||||||
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||||
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
return; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
return; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,23 +3,23 @@
|
||||||
|
|
||||||
static mut FOO: *const &i32 = {
|
static mut FOO: *const &i32 = {
|
||||||
let mut _0: *const &i32; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:13:17: 13:28
|
let mut _0: *const &i32; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:13:17: 13:28
|
||||||
let mut _1: &[&i32]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
let mut _1: &[&i32]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
let mut _2: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
let mut _2: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
let _3: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
let _3: [&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||||
let mut _4: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
|
let mut _4: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
|
||||||
let _5: *const i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
let _5: *const i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||||
+ let mut _6: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
+ let mut _6: &[&i32; 1]; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
scope 1 {
|
scope 1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
StorageLive(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
StorageLive(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
StorageLive(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||||
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
|
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
|
||||||
- StorageLive(_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
- StorageLive(_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||||
- _5 = const {alloc3: *const i32}; // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
- _5 = const {alloc3: *const i32}; // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||||
+ _6 = const FOO::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
+ _6 = const FOO::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
// ty::Const
|
// ty::Const
|
||||||
- // + ty: *const i32
|
- // + ty: *const i32
|
||||||
- // + val: Value(Scalar(alloc3))
|
- // + val: Value(Scalar(alloc3))
|
||||||
|
@ -30,11 +30,11 @@
|
||||||
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
|
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
|
||||||
- _4 = &(*_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
|
- _4 = &(*_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
|
||||||
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||||
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
+ // + span: $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
+ // + span: $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[55e6]::FOO), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) }
|
+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[55e6]::FOO), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) }
|
||||||
+ _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
+ _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
_1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
_1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
- StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46
|
- StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46
|
||||||
StorageDead(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46
|
StorageDead(_2); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46
|
||||||
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
debug s => _1; // in scope 0 at $DIR/deduplicate_blocks.rs:2:36: 2:37
|
debug s => _1; // in scope 0 at $DIR/deduplicate_blocks.rs:2:36: 2:37
|
||||||
let mut _0: bool; // return place in scope 0 at $DIR/deduplicate_blocks.rs:2:48: 2:52
|
let mut _0: bool; // return place in scope 0 at $DIR/deduplicate_blocks.rs:2:48: 2:52
|
||||||
let mut _2: &[u8]; // in scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
let mut _2: &[u8]; // in scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
||||||
let mut _3: &str; // in scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:12
|
let mut _3: &str; // in scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
||||||
let mut _4: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31
|
let mut _4: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31
|
||||||
let mut _5: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31
|
let mut _5: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31
|
||||||
let mut _6: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37
|
let mut _6: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_2); // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
StorageLive(_2); // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
||||||
StorageLive(_3); // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:12
|
StorageLive(_3); // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
||||||
_3 = _1; // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:12
|
_3 = _1; // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
||||||
StorageLive(_8); // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
StorageLive(_8); // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
||||||
_8 = _3; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
_8 = _3; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
||||||
- _2 = transmute::<&str, &[u8]>(move _8) -> bb14; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
- _2 = transmute::<&str, &[u8]>(move _8) -> bb14; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
debug upper => _3; // in scope 0 at $DIR/funky_arms.rs:11:69: 11:74
|
debug upper => _3; // in scope 0 at $DIR/funky_arms.rs:11:69: 11:74
|
||||||
let mut _0: std::result::Result<(), std::fmt::Error>; // return place in scope 0 at $DIR/funky_arms.rs:11:85: 11:91
|
let mut _0: std::result::Result<(), std::fmt::Error>; // return place in scope 0 at $DIR/funky_arms.rs:11:85: 11:91
|
||||||
let _4: bool; // in scope 0 at $DIR/funky_arms.rs:15:9: 15:19
|
let _4: bool; // in scope 0 at $DIR/funky_arms.rs:15:9: 15:19
|
||||||
let mut _5: &std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:15:22: 15:25
|
let mut _5: &std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:15:22: 15:37
|
||||||
let mut _7: std::option::Option<usize>; // in scope 0 at $DIR/funky_arms.rs:24:30: 24:45
|
let mut _7: std::option::Option<usize>; // in scope 0 at $DIR/funky_arms.rs:24:30: 24:45
|
||||||
let mut _8: &std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:24:30: 24:33
|
let mut _8: &std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:24:30: 24:45
|
||||||
let mut _9: isize; // in scope 0 at $DIR/funky_arms.rs:24:12: 24:27
|
let mut _9: isize; // in scope 0 at $DIR/funky_arms.rs:24:12: 24:27
|
||||||
let mut _11: &mut std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:26:43: 26:46
|
let mut _11: &mut std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:26:43: 26:46
|
||||||
let mut _12: &T; // in scope 0 at $DIR/funky_arms.rs:26:48: 26:51
|
let mut _12: &T; // in scope 0 at $DIR/funky_arms.rs:26:48: 26:51
|
||||||
|
@ -36,8 +36,8 @@
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_4); // scope 0 at $DIR/funky_arms.rs:15:9: 15:19
|
StorageLive(_4); // scope 0 at $DIR/funky_arms.rs:15:9: 15:19
|
||||||
StorageLive(_5); // scope 0 at $DIR/funky_arms.rs:15:22: 15:25
|
StorageLive(_5); // scope 0 at $DIR/funky_arms.rs:15:22: 15:37
|
||||||
_5 = &(*_1); // scope 0 at $DIR/funky_arms.rs:15:22: 15:25
|
_5 = &(*_1); // scope 0 at $DIR/funky_arms.rs:15:22: 15:37
|
||||||
_4 = Formatter::sign_plus(move _5) -> bb1; // scope 0 at $DIR/funky_arms.rs:15:22: 15:37
|
_4 = Formatter::sign_plus(move _5) -> bb1; // scope 0 at $DIR/funky_arms.rs:15:22: 15:37
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/funky_arms.rs:15:26: 15:35
|
// + span: $DIR/funky_arms.rs:15:26: 15:35
|
||||||
|
@ -62,8 +62,8 @@
|
||||||
|
|
||||||
bb4: {
|
bb4: {
|
||||||
StorageLive(_7); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45
|
StorageLive(_7); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45
|
||||||
StorageLive(_8); // scope 2 at $DIR/funky_arms.rs:24:30: 24:33
|
StorageLive(_8); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45
|
||||||
_8 = &(*_1); // scope 2 at $DIR/funky_arms.rs:24:30: 24:33
|
_8 = &(*_1); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45
|
||||||
_7 = Formatter::precision(move _8) -> bb5; // scope 2 at $DIR/funky_arms.rs:24:30: 24:45
|
_7 = Formatter::precision(move _8) -> bb5; // scope 2 at $DIR/funky_arms.rs:24:30: 24:45
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/funky_arms.rs:24:34: 24:43
|
// + span: $DIR/funky_arms.rs:24:34: 24:43
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
fn clone(_1: fn(A, B)) -> fn(A, B) {
|
fn clone(_1: fn(A, B)) -> fn(A, B) {
|
||||||
debug f => _1; // in scope 0 at $DIR/inline-shims.rs:5:20: 5:21
|
debug f => _1; // in scope 0 at $DIR/inline-shims.rs:5:20: 5:21
|
||||||
let mut _0: fn(A, B); // return place in scope 0 at $DIR/inline-shims.rs:5:36: 5:44
|
let mut _0: fn(A, B); // return place in scope 0 at $DIR/inline-shims.rs:5:36: 5:44
|
||||||
let mut _2: &fn(A, B); // in scope 0 at $DIR/inline-shims.rs:6:5: 6:6
|
let mut _2: &fn(A, B); // in scope 0 at $DIR/inline-shims.rs:6:5: 6:14
|
||||||
+ scope 1 (inlined <fn(A, B) as Clone>::clone - shim(fn(A, B))) { // at $DIR/inline-shims.rs:6:5: 6:14
|
+ scope 1 (inlined <fn(A, B) as Clone>::clone - shim(fn(A, B))) { // at $DIR/inline-shims.rs:6:5: 6:14
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_2); // scope 0 at $DIR/inline-shims.rs:6:5: 6:6
|
StorageLive(_2); // scope 0 at $DIR/inline-shims.rs:6:5: 6:14
|
||||||
_2 = &_1; // scope 0 at $DIR/inline-shims.rs:6:5: 6:6
|
_2 = &_1; // scope 0 at $DIR/inline-shims.rs:6:5: 6:14
|
||||||
- _0 = <fn(A, B) as Clone>::clone(move _2) -> bb1; // scope 0 at $DIR/inline-shims.rs:6:5: 6:14
|
- _0 = <fn(A, B) as Clone>::clone(move _2) -> bb1; // scope 0 at $DIR/inline-shims.rs:6:5: 6:14
|
||||||
- // mir::Constant
|
- // mir::Constant
|
||||||
- // + span: $DIR/inline-shims.rs:6:7: 6:12
|
- // + span: $DIR/inline-shims.rs:6:7: 6:12
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
fn test(_1: &dyn X) -> u32 {
|
fn test(_1: &dyn X) -> u32 {
|
||||||
debug x => _1; // in scope 0 at $DIR/inline-trait-method.rs:8:9: 8:10
|
debug x => _1; // in scope 0 at $DIR/inline-trait-method.rs:8:9: 8:10
|
||||||
let mut _0: u32; // return place in scope 0 at $DIR/inline-trait-method.rs:8:23: 8:26
|
let mut _0: u32; // return place in scope 0 at $DIR/inline-trait-method.rs:8:23: 8:26
|
||||||
let mut _2: &dyn X; // in scope 0 at $DIR/inline-trait-method.rs:9:5: 9:6
|
let mut _2: &dyn X; // in scope 0 at $DIR/inline-trait-method.rs:9:5: 9:10
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_2); // scope 0 at $DIR/inline-trait-method.rs:9:5: 9:6
|
StorageLive(_2); // scope 0 at $DIR/inline-trait-method.rs:9:5: 9:10
|
||||||
_2 = &(*_1); // scope 0 at $DIR/inline-trait-method.rs:9:5: 9:6
|
_2 = &(*_1); // scope 0 at $DIR/inline-trait-method.rs:9:5: 9:10
|
||||||
_0 = <dyn X as X>::y(move _2) -> bb1; // scope 0 at $DIR/inline-trait-method.rs:9:5: 9:10
|
_0 = <dyn X as X>::y(move _2) -> bb1; // scope 0 at $DIR/inline-trait-method.rs:9:5: 9:10
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/inline-trait-method.rs:9:7: 9:8
|
// + span: $DIR/inline-trait-method.rs:9:7: 9:8
|
||||||
|
|
|
@ -5,7 +5,7 @@ fn a(_1: &mut [T]) -> &mut [T] {
|
||||||
let mut _0: &mut [T]; // return place in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:2:29: 2:37
|
let mut _0: &mut [T]; // return place in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:2:29: 2:37
|
||||||
let mut _2: &mut [T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
let mut _2: &mut [T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
let mut _3: &mut [T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
let mut _3: &mut [T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
let mut _4: &mut [T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:6
|
let mut _4: &mut [T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
scope 1 (inlined <[T] as AsMut<[T]>>::as_mut) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
scope 1 (inlined <[T] as AsMut<[T]>>::as_mut) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
debug self => _4; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
debug self => _4; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
let mut _5: &mut [T]; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
let mut _5: &mut [T]; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
|
@ -14,8 +14,8 @@ fn a(_1: &mut [T]) -> &mut [T] {
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
StorageLive(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
StorageLive(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
StorageLive(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
StorageLive(_4); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:6
|
StorageLive(_4); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
_4 = &mut (*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:6
|
_4 = &mut (*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
StorageLive(_5); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
StorageLive(_5); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
_5 = &mut (*_4); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
_5 = &mut (*_4); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
_3 = &mut (*_5); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
_3 = &mut (*_5); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:3:5: 3:15
|
||||||
|
|
|
@ -5,7 +5,7 @@ fn b(_1: &mut Box<T>) -> &mut T {
|
||||||
let mut _0: &mut T; // return place in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:7:32: 7:38
|
let mut _0: &mut T; // return place in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:7:32: 7:38
|
||||||
let mut _2: &mut T; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
let mut _2: &mut T; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
let mut _3: &mut T; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
let mut _3: &mut T; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
let mut _4: &mut std::boxed::Box<T>; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:6
|
let mut _4: &mut std::boxed::Box<T>; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
scope 1 (inlined <Box<T> as AsMut<T>>::as_mut) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
scope 1 (inlined <Box<T> as AsMut<T>>::as_mut) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
debug self => _4; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
debug self => _4; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
let mut _5: &mut T; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
let mut _5: &mut T; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
|
@ -15,8 +15,8 @@ fn b(_1: &mut Box<T>) -> &mut T {
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
StorageLive(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
StorageLive(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
StorageLive(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
StorageLive(_4); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:6
|
StorageLive(_4); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
_4 = &mut (*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:6
|
_4 = &mut (*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
StorageLive(_5); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
StorageLive(_5); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
StorageLive(_6); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
StorageLive(_6); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
_6 = &mut (*(*_4)); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
_6 = &mut (*(*_4)); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15
|
||||||
|
|
|
@ -4,15 +4,15 @@ fn c(_1: &[T]) -> &[T] {
|
||||||
debug x => _1; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:12:13: 12:14
|
debug x => _1; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:12:13: 12:14
|
||||||
let mut _0: &[T]; // return place in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:12:25: 12:29
|
let mut _0: &[T]; // return place in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:12:25: 12:29
|
||||||
let _2: &[T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
let _2: &[T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
||||||
let mut _3: &[T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:6
|
let mut _3: &[T]; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
||||||
scope 1 (inlined <[T] as AsRef<[T]>>::as_ref) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
scope 1 (inlined <[T] as AsRef<[T]>>::as_ref) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
||||||
debug self => _3; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
debug self => _3; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
||||||
}
|
}
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
StorageLive(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
||||||
StorageLive(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:6
|
StorageLive(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
||||||
_3 = &(*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:6
|
_3 = &(*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
||||||
_2 = _3; // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
_2 = _3; // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
||||||
_0 = &(*_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
_0 = &(*_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:5: 13:15
|
||||||
StorageDead(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:14: 13:15
|
StorageDead(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:13:14: 13:15
|
||||||
|
|
|
@ -4,15 +4,15 @@ fn d(_1: &Box<T>) -> &T {
|
||||||
debug x => _1; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:17:13: 17:14
|
debug x => _1; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:17:13: 17:14
|
||||||
let mut _0: &T; // return place in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:17:28: 17:30
|
let mut _0: &T; // return place in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:17:28: 17:30
|
||||||
let _2: &T; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
let _2: &T; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
||||||
let mut _3: &std::boxed::Box<T>; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:6
|
let mut _3: &std::boxed::Box<T>; // in scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
||||||
scope 1 (inlined <Box<T> as AsRef<T>>::as_ref) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
scope 1 (inlined <Box<T> as AsRef<T>>::as_ref) { // at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
||||||
debug self => _3; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
debug self => _3; // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
||||||
}
|
}
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
StorageLive(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
||||||
StorageLive(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:6
|
StorageLive(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
||||||
_3 = &(*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:6
|
_3 = &(*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
||||||
_2 = &(*(*_3)); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
_2 = &(*(*_3)); // scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
||||||
_0 = &(*_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
_0 = &(*_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:5: 18:15
|
||||||
StorageDead(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:14: 18:15
|
StorageDead(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:18:14: 18:15
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
let mut _3: bool; // in scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27
|
let mut _3: bool; // in scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27
|
||||||
let mut _4: usize; // in scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13
|
let mut _4: usize; // in scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13
|
||||||
let mut _5: usize; // in scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27
|
let mut _5: usize; // in scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27
|
||||||
let mut _6: &[u8]; // in scope 0 at $DIR/lower_slice_len.rs:5:16: 5:21
|
let mut _6: &[u8]; // in scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27
|
||||||
let _7: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20
|
let _7: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20
|
||||||
let mut _8: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21
|
let mut _8: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21
|
||||||
let mut _9: bool; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21
|
let mut _9: bool; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21
|
||||||
|
@ -18,8 +18,8 @@
|
||||||
StorageLive(_4); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13
|
StorageLive(_4); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13
|
||||||
_4 = _1; // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13
|
_4 = _1; // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13
|
||||||
StorageLive(_5); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27
|
StorageLive(_5); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27
|
||||||
StorageLive(_6); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:21
|
StorageLive(_6); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27
|
||||||
_6 = &(*_2); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:21
|
_6 = &(*_2); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27
|
||||||
- _5 = core::slice::<impl [u8]>::len(move _6) -> bb1; // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27
|
- _5 = core::slice::<impl [u8]>::len(move _6) -> bb1; // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27
|
||||||
- // mir::Constant
|
- // mir::Constant
|
||||||
- // + span: $DIR/lower_slice_len.rs:5:22: 5:25
|
- // + span: $DIR/lower_slice_len.rs:5:22: 5:25
|
||||||
|
|
|
@ -4,13 +4,13 @@ fn main() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/no-spurious-drop-after-call.rs:8:11: 8:11
|
let mut _0: (); // return place in scope 0 at $DIR/no-spurious-drop-after-call.rs:8:11: 8:11
|
||||||
let _1: (); // in scope 0 at $DIR/no-spurious-drop-after-call.rs:9:5: 9:35
|
let _1: (); // in scope 0 at $DIR/no-spurious-drop-after-call.rs:9:5: 9:35
|
||||||
let mut _2: std::string::String; // in scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
|
let mut _2: std::string::String; // in scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
|
||||||
let mut _3: &str; // in scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
let mut _3: &str; // in scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
|
||||||
let _4: &str; // in scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
let _4: &str; // in scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_1); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:5: 9:35
|
StorageLive(_1); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:5: 9:35
|
||||||
StorageLive(_2); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
|
StorageLive(_2); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
|
||||||
StorageLive(_3); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
StorageLive(_3); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
|
||||||
StorageLive(_4); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
StorageLive(_4); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
||||||
_4 = const ""; // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
_4 = const ""; // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
||||||
// ty::Const
|
// ty::Const
|
||||||
|
@ -19,7 +19,7 @@ fn main() -> () {
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
// + span: $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
||||||
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [], len: Size { raw: 0 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 0 }) }
|
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [], len: Size { raw: 0 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 0 }) }
|
||||||
_3 = &(*_4); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
|
_3 = &(*_4); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
|
||||||
_2 = <str as ToString>::to_string(move _3) -> bb1; // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
|
_2 = <str as ToString>::to_string(move _3) -> bb1; // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/no-spurious-drop-after-call.rs:9:23: 9:32
|
// + span: $DIR/no-spurious-drop-after-call.rs:9:23: 9:32
|
||||||
|
|
|
@ -10,15 +10,15 @@ fn main() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/receiver-ptr-mutability.rs:13:11: 13:11
|
let mut _0: (); // return place in scope 0 at $DIR/receiver-ptr-mutability.rs:13:11: 13:11
|
||||||
let _1: *mut Test as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/receiver-ptr-mutability.rs:14:9: 14:12
|
let _1: *mut Test as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/receiver-ptr-mutability.rs:14:9: 14:12
|
||||||
let _2: (); // in scope 0 at $DIR/receiver-ptr-mutability.rs:15:5: 15:12
|
let _2: (); // in scope 0 at $DIR/receiver-ptr-mutability.rs:15:5: 15:12
|
||||||
let mut _3: *const Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:15:5: 15:8
|
let mut _3: *const Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:15:5: 15:12
|
||||||
let mut _4: *mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:15:5: 15:8
|
let mut _4: *mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:15:5: 15:8
|
||||||
let _6: &&&&*mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:18:34: 18:41
|
let _6: &&&&*mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:18:34: 18:41
|
||||||
let _7: &&&*mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:18:35: 18:41
|
let _7: &&&*mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:18:35: 18:41
|
||||||
let _8: &&*mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:18:36: 18:41
|
let _8: &&*mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:18:36: 18:41
|
||||||
let _9: &*mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:18:37: 18:41
|
let _9: &*mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:18:37: 18:41
|
||||||
let _10: (); // in scope 0 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
let _10: (); // in scope 0 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
||||||
let mut _11: *const Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:19:5: 19:12
|
let mut _11: *const Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
||||||
let mut _12: *mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:19:5: 19:12
|
let mut _12: *mut Test; // in scope 0 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
||||||
scope 1 {
|
scope 1 {
|
||||||
debug ptr => _1; // in scope 1 at $DIR/receiver-ptr-mutability.rs:14:9: 14:12
|
debug ptr => _1; // in scope 1 at $DIR/receiver-ptr-mutability.rs:14:9: 14:12
|
||||||
let _5: &&&&*mut Test as UserTypeProjection { base: UserType(2), projs: [] }; // in scope 1 at $DIR/receiver-ptr-mutability.rs:18:9: 18:16
|
let _5: &&&&*mut Test as UserTypeProjection { base: UserType(2), projs: [] }; // in scope 1 at $DIR/receiver-ptr-mutability.rs:18:9: 18:16
|
||||||
|
@ -39,10 +39,10 @@ fn main() -> () {
|
||||||
FakeRead(ForLet(None), _1); // scope 0 at $DIR/receiver-ptr-mutability.rs:14:9: 14:12
|
FakeRead(ForLet(None), _1); // scope 0 at $DIR/receiver-ptr-mutability.rs:14:9: 14:12
|
||||||
AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] }); // scope 0 at $DIR/receiver-ptr-mutability.rs:14:14: 14:23
|
AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] }); // scope 0 at $DIR/receiver-ptr-mutability.rs:14:14: 14:23
|
||||||
StorageLive(_2); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:12
|
StorageLive(_2); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:12
|
||||||
StorageLive(_3); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:8
|
StorageLive(_3); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:12
|
||||||
StorageLive(_4); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:8
|
StorageLive(_4); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:8
|
||||||
_4 = _1; // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:8
|
_4 = _1; // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:8
|
||||||
_3 = move _4 as *const Test (Pointer(MutToConstPointer)); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:8
|
_3 = move _4 as *const Test (Pointer(MutToConstPointer)); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:12
|
||||||
StorageDead(_4); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:7: 15:8
|
StorageDead(_4); // scope 1 at $DIR/receiver-ptr-mutability.rs:15:7: 15:8
|
||||||
_2 = Test::x(move _3) -> [return: bb2, unwind: bb4]; // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:12
|
_2 = Test::x(move _3) -> [return: bb2, unwind: bb4]; // scope 1 at $DIR/receiver-ptr-mutability.rs:15:5: 15:12
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
|
@ -67,10 +67,10 @@ fn main() -> () {
|
||||||
AscribeUserType(_5, o, UserTypeProjection { base: UserType(3), projs: [] }); // scope 1 at $DIR/receiver-ptr-mutability.rs:18:18: 18:31
|
AscribeUserType(_5, o, UserTypeProjection { base: UserType(3), projs: [] }); // scope 1 at $DIR/receiver-ptr-mutability.rs:18:18: 18:31
|
||||||
StorageDead(_6); // scope 1 at $DIR/receiver-ptr-mutability.rs:18:41: 18:42
|
StorageDead(_6); // scope 1 at $DIR/receiver-ptr-mutability.rs:18:41: 18:42
|
||||||
StorageLive(_10); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
StorageLive(_10); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
||||||
StorageLive(_11); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:12
|
StorageLive(_11); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
||||||
StorageLive(_12); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:12
|
StorageLive(_12); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
||||||
_12 = (*(*(*(*_5)))); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:12
|
_12 = (*(*(*(*_5)))); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
||||||
_11 = move _12 as *const Test (Pointer(MutToConstPointer)); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:12
|
_11 = move _12 as *const Test (Pointer(MutToConstPointer)); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
||||||
StorageDead(_12); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:11: 19:12
|
StorageDead(_12); // scope 2 at $DIR/receiver-ptr-mutability.rs:19:11: 19:12
|
||||||
_10 = Test::x(move _11) -> [return: bb3, unwind: bb4]; // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
_10 = Test::x(move _11) -> [return: bb3, unwind: bb4]; // scope 2 at $DIR/receiver-ptr-mutability.rs:19:5: 19:16
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
|
|
|
@ -4,7 +4,7 @@ fn main() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/retag.rs:29:11: 29:11
|
let mut _0: (); // return place in scope 0 at $DIR/retag.rs:29:11: 29:11
|
||||||
let mut _1: i32; // in scope 0 at $DIR/retag.rs:30:9: 30:14
|
let mut _1: i32; // in scope 0 at $DIR/retag.rs:30:9: 30:14
|
||||||
let _2: (); // in scope 0 at $DIR/retag.rs:31:5: 37:6
|
let _2: (); // in scope 0 at $DIR/retag.rs:31:5: 37:6
|
||||||
let mut _4: &Test; // in scope 0 at $DIR/retag.rs:32:17: 32:24
|
let mut _4: &Test; // in scope 0 at $DIR/retag.rs:32:17: 32:36
|
||||||
let _5: Test; // in scope 0 at $DIR/retag.rs:32:17: 32:24
|
let _5: Test; // in scope 0 at $DIR/retag.rs:32:17: 32:24
|
||||||
let mut _6: &mut i32; // in scope 0 at $DIR/retag.rs:32:29: 32:35
|
let mut _6: &mut i32; // in scope 0 at $DIR/retag.rs:32:29: 32:35
|
||||||
let mut _7: &mut i32; // in scope 0 at $DIR/retag.rs:32:29: 32:35
|
let mut _7: &mut i32; // in scope 0 at $DIR/retag.rs:32:29: 32:35
|
||||||
|
@ -15,7 +15,7 @@ fn main() -> () {
|
||||||
let mut _17: &i32; // in scope 0 at $DIR/retag.rs:44:16: 44:18
|
let mut _17: &i32; // in scope 0 at $DIR/retag.rs:44:16: 44:18
|
||||||
let _18: &i32; // in scope 0 at $DIR/retag.rs:44:16: 44:18
|
let _18: &i32; // in scope 0 at $DIR/retag.rs:44:16: 44:18
|
||||||
let _19: &i32; // in scope 0 at $DIR/retag.rs:47:5: 47:24
|
let _19: &i32; // in scope 0 at $DIR/retag.rs:47:5: 47:24
|
||||||
let mut _20: &Test; // in scope 0 at $DIR/retag.rs:47:5: 47:12
|
let mut _20: &Test; // in scope 0 at $DIR/retag.rs:47:5: 47:24
|
||||||
let _21: Test; // in scope 0 at $DIR/retag.rs:47:5: 47:12
|
let _21: Test; // in scope 0 at $DIR/retag.rs:47:5: 47:12
|
||||||
let mut _22: &i32; // in scope 0 at $DIR/retag.rs:47:21: 47:23
|
let mut _22: &i32; // in scope 0 at $DIR/retag.rs:47:21: 47:23
|
||||||
let _23: &i32; // in scope 0 at $DIR/retag.rs:47:21: 47:23
|
let _23: &i32; // in scope 0 at $DIR/retag.rs:47:21: 47:23
|
||||||
|
@ -60,11 +60,11 @@ fn main() -> () {
|
||||||
_1 = const 0_i32; // scope 0 at $DIR/retag.rs:30:17: 30:18
|
_1 = const 0_i32; // scope 0 at $DIR/retag.rs:30:17: 30:18
|
||||||
StorageLive(_2); // scope 1 at $DIR/retag.rs:31:5: 37:6
|
StorageLive(_2); // scope 1 at $DIR/retag.rs:31:5: 37:6
|
||||||
StorageLive(_3); // scope 1 at $DIR/retag.rs:32:13: 32:14
|
StorageLive(_3); // scope 1 at $DIR/retag.rs:32:13: 32:14
|
||||||
StorageLive(_4); // scope 1 at $DIR/retag.rs:32:17: 32:24
|
StorageLive(_4); // scope 1 at $DIR/retag.rs:32:17: 32:36
|
||||||
StorageLive(_5); // scope 1 at $DIR/retag.rs:32:17: 32:24
|
StorageLive(_5); // scope 1 at $DIR/retag.rs:32:17: 32:24
|
||||||
_5 = Test(const 0_i32); // scope 1 at $DIR/retag.rs:32:17: 32:24
|
_5 = Test(const 0_i32); // scope 1 at $DIR/retag.rs:32:17: 32:24
|
||||||
_4 = &_5; // scope 1 at $DIR/retag.rs:32:17: 32:24
|
_4 = &_5; // scope 1 at $DIR/retag.rs:32:17: 32:36
|
||||||
Retag(_4); // scope 1 at $DIR/retag.rs:32:17: 32:24
|
Retag(_4); // scope 1 at $DIR/retag.rs:32:17: 32:36
|
||||||
StorageLive(_6); // scope 1 at $DIR/retag.rs:32:29: 32:35
|
StorageLive(_6); // scope 1 at $DIR/retag.rs:32:29: 32:35
|
||||||
StorageLive(_7); // scope 1 at $DIR/retag.rs:32:29: 32:35
|
StorageLive(_7); // scope 1 at $DIR/retag.rs:32:29: 32:35
|
||||||
_7 = &mut _1; // scope 1 at $DIR/retag.rs:32:29: 32:35
|
_7 = &mut _1; // scope 1 at $DIR/retag.rs:32:29: 32:35
|
||||||
|
@ -140,11 +140,11 @@ fn main() -> () {
|
||||||
StorageDead(_16); // scope 6 at $DIR/retag.rs:44:18: 44:19
|
StorageDead(_16); // scope 6 at $DIR/retag.rs:44:18: 44:19
|
||||||
StorageDead(_18); // scope 6 at $DIR/retag.rs:44:19: 44:20
|
StorageDead(_18); // scope 6 at $DIR/retag.rs:44:19: 44:20
|
||||||
StorageLive(_19); // scope 7 at $DIR/retag.rs:47:5: 47:24
|
StorageLive(_19); // scope 7 at $DIR/retag.rs:47:5: 47:24
|
||||||
StorageLive(_20); // scope 7 at $DIR/retag.rs:47:5: 47:12
|
StorageLive(_20); // scope 7 at $DIR/retag.rs:47:5: 47:24
|
||||||
StorageLive(_21); // scope 7 at $DIR/retag.rs:47:5: 47:12
|
StorageLive(_21); // scope 7 at $DIR/retag.rs:47:5: 47:12
|
||||||
_21 = Test(const 0_i32); // scope 7 at $DIR/retag.rs:47:5: 47:12
|
_21 = Test(const 0_i32); // scope 7 at $DIR/retag.rs:47:5: 47:12
|
||||||
_20 = &_21; // scope 7 at $DIR/retag.rs:47:5: 47:12
|
_20 = &_21; // scope 7 at $DIR/retag.rs:47:5: 47:24
|
||||||
Retag(_20); // scope 7 at $DIR/retag.rs:47:5: 47:12
|
Retag(_20); // scope 7 at $DIR/retag.rs:47:5: 47:24
|
||||||
StorageLive(_22); // scope 7 at $DIR/retag.rs:47:21: 47:23
|
StorageLive(_22); // scope 7 at $DIR/retag.rs:47:21: 47:23
|
||||||
StorageLive(_23); // scope 7 at $DIR/retag.rs:47:21: 47:23
|
StorageLive(_23); // scope 7 at $DIR/retag.rs:47:21: 47:23
|
||||||
_28 = const main::promoted[0]; // scope 7 at $DIR/retag.rs:47:21: 47:23
|
_28 = const main::promoted[0]; // scope 7 at $DIR/retag.rs:47:21: 47:23
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | for x in &mut xs {
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
| first borrow later used here
|
| first borrow later used here
|
||||||
LL | xs.push(1)
|
LL | xs.push(1)
|
||||||
| ^^ second mutable borrow occurs here
|
| ^^^^^^^^^^ second mutable borrow occurs here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
||||||
LL | pub async fn f(x: Option<usize>) {
|
LL | pub async fn f(x: Option<usize>) {
|
||||||
| - help: consider changing this to be mutable: `mut x`
|
| - help: consider changing this to be mutable: `mut x`
|
||||||
LL | x.take();
|
LL | x.take();
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error[E0384]: cannot assign twice to immutable variable `x`
|
error[E0384]: cannot assign twice to immutable variable `x`
|
||||||
--> $DIR/issue-61452.rs:9:5
|
--> $DIR/issue-61452.rs:9:5
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow `data` as mutable, as it is not declared as mutable
|
||||||
LL | async fn response(data: Vec<u8>) {
|
LL | async fn response(data: Vec<u8>) {
|
||||||
| ---- help: consider changing this to be mutable: `mut data`
|
| ---- help: consider changing this to be mutable: `mut data`
|
||||||
LL | data.reverse();
|
LL | data.reverse();
|
||||||
| ^^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ LL | x
|
||||||
| - value moved here
|
| - value moved here
|
||||||
LL | +
|
LL | +
|
||||||
LL | x.clone();
|
LL | x.clone();
|
||||||
| ^ value borrowed here after move
|
| ^^^^^^^^^ value borrowed here after move
|
||||||
|
|
|
|
||||||
help: consider further restricting this bound
|
help: consider further restricting this bound
|
||||||
|
|
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | let y = x;
|
||||||
| ^ move out of `x` occurs here
|
| ^ move out of `x` occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | r.use_ref();
|
LL | r.use_ref();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
|
||||||
--> $DIR/borrow-tuple-fields.rs:18:13
|
--> $DIR/borrow-tuple-fields.rs:18:13
|
||||||
|
@ -17,7 +17,7 @@ LL | let a = &x.0;
|
||||||
LL | let b = &mut x.0;
|
LL | let b = &mut x.0;
|
||||||
| ^^^^^^^^ mutable borrow occurs here
|
| ^^^^^^^^ mutable borrow occurs here
|
||||||
LL | a.use_ref();
|
LL | a.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
|
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
|
||||||
--> $DIR/borrow-tuple-fields.rs:23:13
|
--> $DIR/borrow-tuple-fields.rs:23:13
|
||||||
|
@ -27,7 +27,7 @@ LL | let a = &mut x.0;
|
||||||
LL | let b = &mut x.0;
|
LL | let b = &mut x.0;
|
||||||
| ^^^^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^ second mutable borrow occurs here
|
||||||
LL | a.use_ref();
|
LL | a.use_ref();
|
||||||
| - first borrow later used here
|
| ----------- first borrow later used here
|
||||||
|
|
||||||
error[E0505]: cannot move out of `x` because it is borrowed
|
error[E0505]: cannot move out of `x` because it is borrowed
|
||||||
--> $DIR/borrow-tuple-fields.rs:28:13
|
--> $DIR/borrow-tuple-fields.rs:28:13
|
||||||
|
@ -37,7 +37,7 @@ LL | let r = &x.0;
|
||||||
LL | let y = x;
|
LL | let y = x;
|
||||||
| ^ move out of `x` occurs here
|
| ^ move out of `x` occurs here
|
||||||
LL | r.use_ref();
|
LL | r.use_ref();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
|
||||||
--> $DIR/borrow-tuple-fields.rs:33:13
|
--> $DIR/borrow-tuple-fields.rs:33:13
|
||||||
|
@ -47,7 +47,7 @@ LL | let a = &x.0;
|
||||||
LL | let b = &mut x.0;
|
LL | let b = &mut x.0;
|
||||||
| ^^^^^^^^ mutable borrow occurs here
|
| ^^^^^^^^ mutable borrow occurs here
|
||||||
LL | a.use_ref();
|
LL | a.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
|
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
|
||||||
--> $DIR/borrow-tuple-fields.rs:38:13
|
--> $DIR/borrow-tuple-fields.rs:38:13
|
||||||
|
@ -57,7 +57,7 @@ LL | let a = &mut x.0;
|
||||||
LL | let b = &mut x.0;
|
LL | let b = &mut x.0;
|
||||||
| ^^^^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^ second mutable borrow occurs here
|
||||||
LL | a.use_mut();
|
LL | a.use_mut();
|
||||||
| - first borrow later used here
|
| ----------- first borrow later used here
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
|
||||||
LL | fn func(arg: S) {
|
LL | fn func(arg: S) {
|
||||||
| --- help: consider changing this to be mutable: `mut arg`
|
| --- help: consider changing this to be mutable: `mut arg`
|
||||||
LL | arg.mutate();
|
LL | arg.mutate();
|
||||||
| ^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
|
error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
|
||||||
--> $DIR/borrowck-argument.rs:15:9
|
--> $DIR/borrowck-argument.rs:15:9
|
||||||
|
@ -12,7 +12,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
|
||||||
LL | fn method(&self, arg: S) {
|
LL | fn method(&self, arg: S) {
|
||||||
| --- help: consider changing this to be mutable: `mut arg`
|
| --- help: consider changing this to be mutable: `mut arg`
|
||||||
LL | arg.mutate();
|
LL | arg.mutate();
|
||||||
| ^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
|
error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
|
||||||
--> $DIR/borrowck-argument.rs:21:9
|
--> $DIR/borrowck-argument.rs:21:9
|
||||||
|
@ -20,13 +20,13 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
|
||||||
LL | fn default(&self, arg: S) {
|
LL | fn default(&self, arg: S) {
|
||||||
| --- help: consider changing this to be mutable: `mut arg`
|
| --- help: consider changing this to be mutable: `mut arg`
|
||||||
LL | arg.mutate();
|
LL | arg.mutate();
|
||||||
| ^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
|
error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
|
||||||
--> $DIR/borrowck-argument.rs:32:17
|
--> $DIR/borrowck-argument.rs:32:17
|
||||||
|
|
|
|
||||||
LL | (|arg: S| { arg.mutate() })(s);
|
LL | (|arg: S| { arg.mutate() })(s);
|
||||||
| --- ^^^ cannot borrow as mutable
|
| --- ^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
| |
|
| |
|
||||||
| help: consider changing this to be mutable: `mut arg`
|
| help: consider changing this to be mutable: `mut arg`
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
||||||
LL | let x = Foo { x: 3 };
|
LL | let x = Foo { x: 3 };
|
||||||
| - help: consider changing this to be mutable: `mut x`
|
| - help: consider changing this to be mutable: `mut x`
|
||||||
LL | x.printme();
|
LL | x.printme();
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*a` as mutable, as `a` is not declared as mutable
|
||||||
LL | let a: Box<_> = Box::new(A);
|
LL | let a: Box<_> = Box::new(A);
|
||||||
| - help: consider changing this to be mutable: `mut a`
|
| - help: consider changing this to be mutable: `mut a`
|
||||||
LL | a.foo();
|
LL | a.foo();
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time
|
||||||
--> $DIR/borrowck-borrow-mut-object-twice.rs:13:5
|
--> $DIR/borrowck-borrow-mut-object-twice.rs:13:5
|
||||||
|
|
|
|
||||||
LL | let y = x.f1();
|
LL | let y = x.f1();
|
||||||
| - first mutable borrow occurs here
|
| ------ first mutable borrow occurs here
|
||||||
LL | x.f2();
|
LL | x.f2();
|
||||||
| ^ second mutable borrow occurs here
|
| ^^^^^^ second mutable borrow occurs here
|
||||||
LL | y.use_ref();
|
LL | y.use_ref();
|
||||||
| - first borrow later used here
|
| ----------- first borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
|
||||||
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:72:5
|
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:72:5
|
||||||
|
|
|
|
||||||
LL | x.set(0, 0);
|
LL | x.set(0, 0);
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
|
|
||||||
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
|
||||||
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:76:5
|
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:76:5
|
||||||
|
|
|
|
||||||
LL | x.set(0, 0);
|
LL | x.set(0, 0);
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
|
|
||||||
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
|
||||||
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:84:5
|
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:84:5
|
||||||
|
|
|
|
||||||
LL | x.y_mut()
|
LL | x.y_mut()
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
|
|
||||||
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
|
||||||
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:88:5
|
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:88:5
|
||||||
|
|
|
|
||||||
LL | x.y_mut()
|
LL | x.y_mut()
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
|
|
||||||
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
|
||||||
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:92:6
|
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:92:6
|
||||||
|
|
|
|
||||||
LL | *x.y_mut() = 3;
|
LL | *x.y_mut() = 3;
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
|
|
||||||
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
|
||||||
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:96:6
|
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:96:6
|
||||||
|
|
|
|
||||||
LL | *x.y_mut() = 3;
|
LL | *x.y_mut() = 3;
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
|
|
||||||
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
|
||||||
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:100:6
|
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:100:6
|
||||||
|
|
|
|
||||||
LL | *x.y_mut() = 3;
|
LL | *x.y_mut() = 3;
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
|
|
||||||
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | buggy_map.insert(42, &*Box::new(1));
|
||||||
| creates a temporary which is freed while still in use
|
| creates a temporary which is freed while still in use
|
||||||
...
|
...
|
||||||
LL | buggy_map.insert(43, &*tmp);
|
LL | buggy_map.insert(43, &*tmp);
|
||||||
| --------- borrow later used here
|
| --------------------------- borrow later used here
|
||||||
|
|
|
|
||||||
= note: consider using a `let` binding to create a longer lived value
|
= note: consider using a `let` binding to create a longer lived value
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | let p = &this.x;
|
||||||
LL | &mut this.x;
|
LL | &mut this.x;
|
||||||
| ^^^^^^^^^^^ mutable borrow occurs here
|
| ^^^^^^^^^^^ mutable borrow occurs here
|
||||||
LL | p.use_ref();
|
LL | p.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed
|
||||||
--> $DIR/borrowck-describe-lvalue.rs:37:9
|
--> $DIR/borrowck-describe-lvalue.rs:37:9
|
||||||
|
|
|
|
||||||
LL | let x = f.x();
|
LL | let x = f.x();
|
||||||
| - borrow of `f` occurs here
|
| ----- borrow of `f` occurs here
|
||||||
LL | f.x;
|
LL | f.x;
|
||||||
| ^^^ use of borrowed `f`
|
| ^^^ use of borrowed `f`
|
||||||
LL | drop(x);
|
LL | drop(x);
|
||||||
|
@ -51,7 +51,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed
|
||||||
--> $DIR/borrowck-describe-lvalue.rs:44:9
|
--> $DIR/borrowck-describe-lvalue.rs:44:9
|
||||||
|
|
|
|
||||||
LL | let x = g.x();
|
LL | let x = g.x();
|
||||||
| - borrow of `g` occurs here
|
| ----- borrow of `g` occurs here
|
||||||
LL | g.0;
|
LL | g.0;
|
||||||
| ^^^ use of borrowed `g`
|
| ^^^ use of borrowed `g`
|
||||||
LL | drop(x);
|
LL | drop(x);
|
||||||
|
@ -71,7 +71,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||||
--> $DIR/borrowck-describe-lvalue.rs:59:20
|
--> $DIR/borrowck-describe-lvalue.rs:59:20
|
||||||
|
|
|
|
||||||
LL | let x = e.x();
|
LL | let x = e.x();
|
||||||
| - borrow of `e` occurs here
|
| ----- borrow of `e` occurs here
|
||||||
LL | match e {
|
LL | match e {
|
||||||
LL | Baz::X(value) => value
|
LL | Baz::X(value) => value
|
||||||
| ^^^^^ use of borrowed `e`
|
| ^^^^^ use of borrowed `e`
|
||||||
|
@ -93,7 +93,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed
|
||||||
--> $DIR/borrowck-describe-lvalue.rs:74:9
|
--> $DIR/borrowck-describe-lvalue.rs:74:9
|
||||||
|
|
|
|
||||||
LL | let x = f.x();
|
LL | let x = f.x();
|
||||||
| - borrow of `*f` occurs here
|
| ----- borrow of `*f` occurs here
|
||||||
LL | f.x;
|
LL | f.x;
|
||||||
| ^^^ use of borrowed `*f`
|
| ^^^ use of borrowed `*f`
|
||||||
LL | drop(x);
|
LL | drop(x);
|
||||||
|
@ -103,7 +103,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed
|
||||||
--> $DIR/borrowck-describe-lvalue.rs:81:9
|
--> $DIR/borrowck-describe-lvalue.rs:81:9
|
||||||
|
|
|
|
||||||
LL | let x = g.x();
|
LL | let x = g.x();
|
||||||
| - borrow of `*g` occurs here
|
| ----- borrow of `*g` occurs here
|
||||||
LL | g.0;
|
LL | g.0;
|
||||||
| ^^^ use of borrowed `*g`
|
| ^^^ use of borrowed `*g`
|
||||||
LL | drop(x);
|
LL | drop(x);
|
||||||
|
@ -123,7 +123,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||||
--> $DIR/borrowck-describe-lvalue.rs:96:20
|
--> $DIR/borrowck-describe-lvalue.rs:96:20
|
||||||
|
|
|
|
||||||
LL | let x = e.x();
|
LL | let x = e.x();
|
||||||
| - borrow of `*e` occurs here
|
| ----- borrow of `*e` occurs here
|
||||||
LL | match *e {
|
LL | match *e {
|
||||||
LL | Baz::X(value) => value
|
LL | Baz::X(value) => value
|
||||||
| ^^^^^ use of borrowed `*e`
|
| ^^^^^ use of borrowed `*e`
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
|
|
||||||
--> $DIR/borrowck-for-loop-head-linkage.rs:7:9
|
|
||||||
|
|
|
||||||
LL | for &x in &vector {
|
|
||||||
| -------
|
|
||||||
| |
|
|
||||||
| immutable borrow occurs here
|
|
||||||
| immutable borrow later used here
|
|
||||||
LL | let cap = vector.capacity();
|
|
||||||
LL | vector.extend(repeat(0));
|
|
||||||
| ^^^^^^ mutable borrow occurs here
|
|
||||||
|
|
||||||
error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
|
|
||||||
--> $DIR/borrowck-for-loop-head-linkage.rs:8:9
|
|
||||||
|
|
|
||||||
LL | for &x in &vector {
|
|
||||||
| -------
|
|
||||||
| |
|
|
||||||
| immutable borrow occurs here
|
|
||||||
| immutable borrow later used here
|
|
||||||
...
|
|
||||||
LL | vector[1] = 5;
|
|
||||||
| ^^^^^^ mutable borrow occurs here
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0502`.
|
|
|
@ -16,15 +16,17 @@ LL | | })
|
||||||
error[E0500]: closure requires unique access to `f` but it is already borrowed
|
error[E0500]: closure requires unique access to `f` but it is already borrowed
|
||||||
--> $DIR/borrowck-insert-during-each.rs:18:9
|
--> $DIR/borrowck-insert-during-each.rs:18:9
|
||||||
|
|
|
|
||||||
LL | f.foo(
|
LL | f.foo(
|
||||||
| - --- first borrow later used by call
|
| - --- first borrow later used by call
|
||||||
| |
|
| _____|
|
||||||
| borrow occurs here
|
| |
|
||||||
LL |
|
LL | |
|
||||||
LL | |a| {
|
LL | | |a| {
|
||||||
| ^^^ closure construction occurs here
|
| | ^^^ closure construction occurs here
|
||||||
LL | f.n.insert(*a);
|
LL | | f.n.insert(*a);
|
||||||
| --- second borrow occurs due to use of `f` in closure
|
| | --- second borrow occurs due to use of `f` in closure
|
||||||
|
LL | | })
|
||||||
|
| |__________- borrow occurs here
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | Some(ref _y) => {
|
||||||
LL | let _a = x;
|
LL | let _a = x;
|
||||||
| ^ move out of `x` occurs here
|
| ^ move out of `x` occurs here
|
||||||
LL | _y.use_ref();
|
LL | _y.use_ref();
|
||||||
| -- borrow later used here
|
| ------------ borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | }
|
||||||
LL | borrow_mut(&mut *v);
|
LL | borrow_mut(&mut *v);
|
||||||
| ^^^^^^^ mutable borrow occurs here
|
| ^^^^^^^ mutable borrow occurs here
|
||||||
LL | _w.use_ref();
|
LL | _w.use_ref();
|
||||||
| -- immutable borrow later used here
|
| ------------ immutable borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | let _w = &v;
|
||||||
LL | borrow_mut(&mut *v);
|
LL | borrow_mut(&mut *v);
|
||||||
| ^^^^^^^ mutable borrow occurs here
|
| ^^^^^^^ mutable borrow occurs here
|
||||||
LL | _w.use_ref();
|
LL | _w.use_ref();
|
||||||
| -- immutable borrow later used here
|
| ------------ immutable borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ LL | println!("v={}", *v);
|
||||||
| -- move occurs due to use in closure
|
| -- move occurs due to use in closure
|
||||||
LL | });
|
LL | });
|
||||||
LL | w.use_ref();
|
LL | w.use_ref();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error[E0505]: cannot move out of `v` because it is borrowed
|
error[E0505]: cannot move out of `v` because it is borrowed
|
||||||
--> $DIR/borrowck-loan-blocks-move-cc.rs:24:19
|
--> $DIR/borrowck-loan-blocks-move-cc.rs:24:19
|
||||||
|
@ -24,7 +24,7 @@ LL | println!("v={}", *v);
|
||||||
| -- move occurs due to use in closure
|
| -- move occurs due to use in closure
|
||||||
LL | });
|
LL | });
|
||||||
LL | w.use_ref();
|
LL | w.use_ref();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | let w = &v;
|
||||||
LL | take(v);
|
LL | take(v);
|
||||||
| ^ move out of `v` occurs here
|
| ^ move out of `v` occurs here
|
||||||
LL | w.use_ref();
|
LL | w.use_ref();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `x`
|
||||||
LL | let x = Foo(Box::new(3));
|
LL | let x = Foo(Box::new(3));
|
||||||
| - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
|
| - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
|
||||||
LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
|
LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
|
||||||
| - ^ value borrowed here after move
|
| - ^^^^^^^^^ value borrowed here after move
|
||||||
| |
|
| |
|
||||||
| value moved here
|
| value moved here
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ LL | let q = &mut p;
|
||||||
| ------ mutable borrow occurs here
|
| ------ mutable borrow occurs here
|
||||||
...
|
...
|
||||||
LL | p.times(3);
|
LL | p.times(3);
|
||||||
| ^ immutable borrow occurs here
|
| ^^^^^^^^^^ immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | *q + 3; // OK to use the new alias `q`
|
LL | *q + 3; // OK to use the new alias `q`
|
||||||
| -- mutable borrow later used here
|
| -- mutable borrow later used here
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
|
||||||
--> $DIR/borrowck-loan-rcvr.rs:23:14
|
--> $DIR/borrowck-loan-rcvr.rs:23:14
|
||||||
|
|
|
|
||||||
LL | p.blockm(|| {
|
LL | p.blockm(|| {
|
||||||
| - ------ ^^ mutable borrow occurs here
|
| - ------ ^^ mutable borrow occurs here
|
||||||
| | |
|
| | |
|
||||||
| | immutable borrow later used by call
|
| _____| immutable borrow later used by call
|
||||||
| immutable borrow occurs here
|
| |
|
||||||
LL | p.x = 10;
|
LL | | p.x = 10;
|
||||||
| --- second borrow occurs due to use of `p` in closure
|
| | --- second borrow occurs due to use of `p` in closure
|
||||||
|
LL | | })
|
||||||
|
| |______- immutable borrow occurs here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
|
error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
|
||||||
--> $DIR/borrowck-loan-rcvr.rs:34:5
|
--> $DIR/borrowck-loan-rcvr.rs:34:5
|
||||||
|
@ -15,7 +17,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta
|
||||||
LL | let l = &mut p;
|
LL | let l = &mut p;
|
||||||
| ------ mutable borrow occurs here
|
| ------ mutable borrow occurs here
|
||||||
LL | p.impurem();
|
LL | p.impurem();
|
||||||
| ^ immutable borrow occurs here
|
| ^^^^^^^^^^^ immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | l.x += 1;
|
LL | l.x += 1;
|
||||||
| -------- mutable borrow later used here
|
| -------- mutable borrow later used here
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL |
|
||||||
LL | let z = *a;
|
LL | let z = *a;
|
||||||
| ^^ move out of `*a` occurs here
|
| ^^ move out of `*a` occurs here
|
||||||
LL | b.use_ref();
|
LL | b.use_ref();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | let t1 = t0;
|
||||||
| ^^ move out of `t0` occurs here
|
| ^^ move out of `t0` occurs here
|
||||||
LL | *t1 = 22;
|
LL | *t1 = 22;
|
||||||
LL | p.use_ref();
|
LL | p.use_ref();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0507]: cannot move out of an `Rc`
|
||||||
--> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:4:14
|
--> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:4:14
|
||||||
|
|
|
|
||||||
LL | let _x = Rc::new(vec![1, 2]).into_iter();
|
LL | let _x = Rc::new(vec![1, 2]).into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^ move occurs because value has type `Vec<i32>`, which does not implement the `Copy` trait
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ move occurs because value has type `Vec<i32>`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,9 @@ LL | 1 => { addr.push(&mut x); }
|
||||||
| ^^^^^^ second mutable borrow occurs here
|
| ^^^^^^ second mutable borrow occurs here
|
||||||
LL | 2 => { addr.push(&mut x); }
|
LL | 2 => { addr.push(&mut x); }
|
||||||
LL | _ => { addr.push(&mut x); }
|
LL | _ => { addr.push(&mut x); }
|
||||||
| ---- ------ first mutable borrow occurs here
|
| -----------------
|
||||||
| |
|
| | |
|
||||||
|
| | first mutable borrow occurs here
|
||||||
| first borrow later used here
|
| first borrow later used here
|
||||||
|
|
||||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||||
|
@ -15,8 +16,9 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||||
LL | 2 => { addr.push(&mut x); }
|
LL | 2 => { addr.push(&mut x); }
|
||||||
| ^^^^^^ second mutable borrow occurs here
|
| ^^^^^^ second mutable borrow occurs here
|
||||||
LL | _ => { addr.push(&mut x); }
|
LL | _ => { addr.push(&mut x); }
|
||||||
| ---- ------ first mutable borrow occurs here
|
| -----------------
|
||||||
| |
|
| | |
|
||||||
|
| | first mutable borrow occurs here
|
||||||
| first borrow later used here
|
| first borrow later used here
|
||||||
|
|
||||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | let mut t2 = &mut t0;
|
||||||
| ^^^^^^^ mutable borrow occurs here
|
| ^^^^^^^ mutable borrow occurs here
|
||||||
LL | **t2 += 1; // Mutates `*t0`
|
LL | **t2 += 1; // Mutates `*t0`
|
||||||
LL | p.use_ref();
|
LL | p.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error[E0499]: cannot borrow `t0` as mutable more than once at a time
|
error[E0499]: cannot borrow `t0` as mutable more than once at a time
|
||||||
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:18
|
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:18
|
||||||
|
@ -18,7 +18,7 @@ LL | let mut t2 = &mut t0;
|
||||||
| ^^^^^^^ second mutable borrow occurs here
|
| ^^^^^^^ second mutable borrow occurs here
|
||||||
LL | **t2 += 1; // Mutates `*t0` but not through `*p`
|
LL | **t2 += 1; // Mutates `*t0` but not through `*p`
|
||||||
LL | p.use_mut();
|
LL | p.use_mut();
|
||||||
| - first borrow later used here
|
| ----------- first borrow later used here
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
|
|
||||||
--> $DIR/borrowck-object-lifetime.rs:20:13
|
|
||||||
|
|
|
||||||
LL | let y = x.borrowed();
|
|
||||||
| - immutable borrow occurs here
|
|
||||||
LL | let z = x.mut_borrowed();
|
|
||||||
| ^ mutable borrow occurs here
|
|
||||||
LL | y.use_ref();
|
|
||||||
| - immutable borrow later used here
|
|
||||||
|
|
||||||
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
|
||||||
--> $DIR/borrowck-object-lifetime.rs:26:13
|
|
||||||
|
|
|
||||||
LL | let y = x.borrowed();
|
|
||||||
| - immutable borrow occurs here
|
|
||||||
LL | let z = &mut x;
|
|
||||||
| ^^^^^^ mutable borrow occurs here
|
|
||||||
LL | y.use_ref();
|
|
||||||
| - immutable borrow later used here
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0502`.
|
|
|
@ -2,21 +2,21 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immut
|
||||||
--> $DIR/borrowck-object-lifetime.rs:20:13
|
--> $DIR/borrowck-object-lifetime.rs:20:13
|
||||||
|
|
|
|
||||||
LL | let y = x.borrowed();
|
LL | let y = x.borrowed();
|
||||||
| - immutable borrow occurs here
|
| ------------ immutable borrow occurs here
|
||||||
LL | let z = x.mut_borrowed();
|
LL | let z = x.mut_borrowed();
|
||||||
| ^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
| ^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
||||||
LL | y.use_ref();
|
LL | y.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
||||||
--> $DIR/borrowck-object-lifetime.rs:26:13
|
--> $DIR/borrowck-object-lifetime.rs:26:13
|
||||||
|
|
|
|
||||||
LL | let y = x.borrowed();
|
LL | let y = x.borrowed();
|
||||||
| - immutable borrow occurs here
|
| ------------ immutable borrow occurs here
|
||||||
LL | let z = &mut x;
|
LL | let z = &mut x;
|
||||||
| ^^^^^^ mutable borrow occurs here
|
| ^^^^^^ mutable borrow occurs here
|
||||||
LL | y.use_ref();
|
LL | y.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | let p = &mut f[&s];
|
||||||
LL | let q = &f[&s];
|
LL | let q = &f[&s];
|
||||||
| ^ immutable borrow occurs here
|
| ^ immutable borrow occurs here
|
||||||
LL | p.use_mut();
|
LL | p.use_mut();
|
||||||
| - mutable borrow later used here
|
| ----------- mutable borrow later used here
|
||||||
|
|
||||||
error[E0499]: cannot borrow `*f` as mutable more than once at a time
|
error[E0499]: cannot borrow `*f` as mutable more than once at a time
|
||||||
--> $DIR/borrowck-overloaded-index-autoderef.rs:43:18
|
--> $DIR/borrowck-overloaded-index-autoderef.rs:43:18
|
||||||
|
@ -16,7 +16,7 @@ LL | let p = &mut f[&s];
|
||||||
LL | let q = &mut f[&s];
|
LL | let q = &mut f[&s];
|
||||||
| ^ second mutable borrow occurs here
|
| ^ second mutable borrow occurs here
|
||||||
LL | p.use_mut();
|
LL | p.use_mut();
|
||||||
| - first borrow later used here
|
| ----------- first borrow later used here
|
||||||
|
|
||||||
error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
|
error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
|
||||||
--> $DIR/borrowck-overloaded-index-autoderef.rs:53:18
|
--> $DIR/borrowck-overloaded-index-autoderef.rs:53:18
|
||||||
|
@ -26,7 +26,7 @@ LL | let p = &mut f.foo[&s];
|
||||||
LL | let q = &mut f.foo[&s];
|
LL | let q = &mut f.foo[&s];
|
||||||
| ^^^^^ second mutable borrow occurs here
|
| ^^^^^ second mutable borrow occurs here
|
||||||
LL | p.use_mut();
|
LL | p.use_mut();
|
||||||
| - first borrow later used here
|
| ----------- first borrow later used here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
|
||||||
--> $DIR/borrowck-overloaded-index-autoderef.rs:65:18
|
--> $DIR/borrowck-overloaded-index-autoderef.rs:65:18
|
||||||
|
@ -36,7 +36,7 @@ LL | let p = &f.foo[&s];
|
||||||
LL | let q = &mut f.foo[&s];
|
LL | let q = &mut f.foo[&s];
|
||||||
| ^^^^^ mutable borrow occurs here
|
| ^^^^^ mutable borrow occurs here
|
||||||
LL | p.use_ref();
|
LL | p.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error[E0506]: cannot assign to `f.foo` because it is borrowed
|
error[E0506]: cannot assign to `f.foo` because it is borrowed
|
||||||
--> $DIR/borrowck-overloaded-index-autoderef.rs:71:5
|
--> $DIR/borrowck-overloaded-index-autoderef.rs:71:5
|
||||||
|
@ -46,7 +46,7 @@ LL | let p = &f.foo[&s];
|
||||||
LL | f.foo = g;
|
LL | f.foo = g;
|
||||||
| ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
|
| ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
|
||||||
LL | p.use_ref();
|
LL | p.use_ref();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error[E0506]: cannot assign to `*f` because it is borrowed
|
error[E0506]: cannot assign to `*f` because it is borrowed
|
||||||
--> $DIR/borrowck-overloaded-index-autoderef.rs:77:5
|
--> $DIR/borrowck-overloaded-index-autoderef.rs:77:5
|
||||||
|
@ -56,7 +56,7 @@ LL | let p = &f.foo[&s];
|
||||||
LL | *f = g;
|
LL | *f = g;
|
||||||
| ^^^^^^ assignment to borrowed `*f` occurs here
|
| ^^^^^^ assignment to borrowed `*f` occurs here
|
||||||
LL | p.use_ref();
|
LL | p.use_ref();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error[E0506]: cannot assign to `f.foo` because it is borrowed
|
error[E0506]: cannot assign to `f.foo` because it is borrowed
|
||||||
--> $DIR/borrowck-overloaded-index-autoderef.rs:83:5
|
--> $DIR/borrowck-overloaded-index-autoderef.rs:83:5
|
||||||
|
@ -66,7 +66,7 @@ LL | let p = &mut f.foo[&s];
|
||||||
LL | f.foo = g;
|
LL | f.foo = g;
|
||||||
| ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
|
| ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
|
||||||
LL | p.use_mut();
|
LL | p.use_mut();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error[E0506]: cannot assign to `*f` because it is borrowed
|
error[E0506]: cannot assign to `*f` because it is borrowed
|
||||||
--> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
|
--> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
|
||||||
|
@ -76,7 +76,7 @@ LL | let p = &mut f.foo[&s];
|
||||||
LL | *f = g;
|
LL | *f = g;
|
||||||
| ^^^^^^ assignment to borrowed `*f` occurs here
|
| ^^^^^^ assignment to borrowed `*f` occurs here
|
||||||
LL | p.use_mut();
|
LL | p.use_mut();
|
||||||
| - borrow later used here
|
| ----------- borrow later used here
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ LL | let z = &x;
|
||||||
| ^^ immutable borrow occurs here
|
| ^^ immutable borrow occurs here
|
||||||
...
|
...
|
||||||
LL | y.use_mut();
|
LL | y.use_mut();
|
||||||
| - mutable borrow later used here
|
| ----------- mutable borrow later used here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
||||||
--> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21
|
--> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21
|
||||||
|
@ -20,7 +20,7 @@ LL | let z = &mut x;
|
||||||
| ^^^^^^ mutable borrow occurs here
|
| ^^^^^^ mutable borrow occurs here
|
||||||
...
|
...
|
||||||
LL | y.use_ref();
|
LL | y.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||||
--> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17
|
--> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17
|
||||||
|
@ -32,7 +32,7 @@ LL | let z = &mut x;
|
||||||
| ^^^^^^ second mutable borrow occurs here
|
| ^^^^^^ second mutable borrow occurs here
|
||||||
...
|
...
|
||||||
LL | y.use_mut();
|
LL | y.use_mut();
|
||||||
| - first borrow later used here
|
| ----------- first borrow later used here
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | swap(&mut t0, &mut t1);
|
||||||
| ^^^^^^^ mutable borrow occurs here
|
| ^^^^^^^ mutable borrow occurs here
|
||||||
LL | *t1 = 22;
|
LL | *t1 = 22;
|
||||||
LL | p.use_ref();
|
LL | p.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | let ra = &mut u.s.a;
|
||||||
LL | let b = u.c;
|
LL | let b = u.c;
|
||||||
| ^^^ use of borrowed `u.s.a`
|
| ^^^ use of borrowed `u.s.a`
|
||||||
LL | ra.use_mut();
|
LL | ra.use_mut();
|
||||||
| -- borrow later used here
|
| ------------ borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | let w = &mut v;
|
||||||
LL | borrow(&*v);
|
LL | borrow(&*v);
|
||||||
| ^^^ immutable borrow occurs here
|
| ^^^ immutable borrow occurs here
|
||||||
LL | w.use_mut();
|
LL | w.use_mut();
|
||||||
| - mutable borrow later used here
|
| ----------- mutable borrow later used here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
|
error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
|
||||||
--> $DIR/borrowck-uniq-via-lend.rs:53:12
|
--> $DIR/borrowck-uniq-via-lend.rs:53:12
|
||||||
|
@ -16,7 +16,7 @@ LL | x = &mut v;
|
||||||
LL | borrow(&*v);
|
LL | borrow(&*v);
|
||||||
| ^^^ immutable borrow occurs here
|
| ^^^ immutable borrow occurs here
|
||||||
LL | x.use_mut();
|
LL | x.use_mut();
|
||||||
| - mutable borrow later used here
|
| ----------- mutable borrow later used here
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,9 @@ LL | let vb: &mut [isize] = &mut v;
|
||||||
| ------ first mutable borrow occurs here
|
| ------ first mutable borrow occurs here
|
||||||
...
|
...
|
||||||
LL | v.push(tail[0] + tail[1]);
|
LL | v.push(tail[0] + tail[1]);
|
||||||
| ^ ------- first borrow later used here
|
| ^^^^^^^-------^^^^^^^^^^^
|
||||||
| |
|
| | |
|
||||||
|
| | first borrow later used here
|
||||||
| second mutable borrow occurs here
|
| second mutable borrow occurs here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -8,7 +8,7 @@ LL | vec[0] = Box::new(4);
|
||||||
| ^^^^^^ assignment to borrowed `vec[_]` occurs here
|
| ^^^^^^ assignment to borrowed `vec[_]` occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | _a.use_ref();
|
LL | _a.use_ref();
|
||||||
| -- borrow later used here
|
| ------------ borrow later used here
|
||||||
|
|
||||||
error[E0506]: cannot assign to `vec[_]` because it is borrowed
|
error[E0506]: cannot assign to `vec[_]` because it is borrowed
|
||||||
--> $DIR/borrowck-vec-pattern-nesting.rs:23:13
|
--> $DIR/borrowck-vec-pattern-nesting.rs:23:13
|
||||||
|
@ -20,7 +20,7 @@ LL | vec[0] = Box::new(4);
|
||||||
| ^^^^^^ assignment to borrowed `vec[_]` occurs here
|
| ^^^^^^ assignment to borrowed `vec[_]` occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | _b.use_ref();
|
LL | _b.use_ref();
|
||||||
| -- borrow later used here
|
| ------------ borrow later used here
|
||||||
|
|
||||||
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
|
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
|
||||||
--> $DIR/borrowck-vec-pattern-nesting.rs:34:11
|
--> $DIR/borrowck-vec-pattern-nesting.rs:34:11
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
|
||||||
--> $DIR/index-mut-help-with-impl.rs:9:5
|
--> $DIR/index-mut-help-with-impl.rs:9:5
|
||||||
|
|
|
|
||||||
LL | Index::index(&v, 1..2).make_ascii_uppercase();
|
LL | Index::index(&v, 1..2).make_ascii_uppercase();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutab
|
||||||
--> $DIR/index-mut-help.rs:11:5
|
--> $DIR/index-mut-help.rs:11:5
|
||||||
|
|
|
|
||||||
LL | map["peter"].clear();
|
LL | map["peter"].clear();
|
||||||
| ^^^^^^^^^^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
|
|
||||||
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>`
|
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>`
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable stati
|
||||||
--> $DIR/issue-42344.rs:4:5
|
--> $DIR/issue-42344.rs:4:5
|
||||||
|
|
|
|
||||||
LL | TAB[0].iter_mut();
|
LL | TAB[0].iter_mut();
|
||||||
| ^^^^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time
|
||||||
LL | Some(baz) => {
|
LL | Some(baz) => {
|
||||||
| --- first mutable borrow occurs here
|
| --- first mutable borrow occurs here
|
||||||
LL | bar.take();
|
LL | bar.take();
|
||||||
| ^^^ second mutable borrow occurs here
|
| ^^^^^^^^^^ second mutable borrow occurs here
|
||||||
LL | drop(baz);
|
LL | drop(baz);
|
||||||
| --- first borrow later used here
|
| --- first borrow later used here
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
|
||||||
--> $DIR/issue-81365-10.rs:21:9
|
--> $DIR/issue-81365-10.rs:21:9
|
||||||
|
|
|
|
||||||
LL | let first = &self.deref().target_field;
|
LL | let first = &self.deref().target_field;
|
||||||
| ---- borrow of `self.container_field` occurs here
|
| ------------ borrow of `self.container_field` occurs here
|
||||||
LL | self.container_field = true;
|
LL | self.container_field = true;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
|
||||||
LL | first;
|
LL | first;
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
|
||||||
--> $DIR/issue-81365-5.rs:28:9
|
--> $DIR/issue-81365-5.rs:28:9
|
||||||
|
|
|
|
||||||
LL | let first = self.get();
|
LL | let first = self.get();
|
||||||
| ---- borrow of `self.container_field` occurs here
|
| ---------- borrow of `self.container_field` occurs here
|
||||||
LL | self.container_field = true;
|
LL | self.container_field = true;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here
|
||||||
LL | first;
|
LL | first;
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | for v in self.0.values() {
|
||||||
| | help: use mutable method: `values_mut()`
|
| | help: use mutable method: `values_mut()`
|
||||||
| this iterator yields `&` references
|
| this iterator yields `&` references
|
||||||
LL | v.flush();
|
LL | v.flush();
|
||||||
| ^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
| ^^^^^^^^^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
|
||||||
--> $DIR/issue-82462.rs:18:9
|
|
||||||
|
|
|
||||||
LL | for x in DroppingSlice(&*v).iter() {
|
|
||||||
| ------------------
|
|
||||||
| | |
|
|
||||||
| | immutable borrow occurs here
|
|
||||||
| a temporary with access to the immutable borrow is created here ...
|
|
||||||
LL | v.push(*x);
|
|
||||||
| ^ mutable borrow occurs here
|
|
||||||
LL | break;
|
|
||||||
LL | }
|
|
||||||
| - ... and the immutable borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DroppingSlice`
|
|
||||||
|
|
|
||||||
help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
|
|
||||||
|
|
|
||||||
LL | };
|
|
||||||
| +
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0502`.
|
|
|
@ -7,7 +7,7 @@ LL | match heap.peek_mut() {
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
| a temporary with access to the first borrow is created here ...
|
| a temporary with access to the first borrow is created here ...
|
||||||
LL | Some(_) => { heap.pop(); },
|
LL | Some(_) => { heap.pop(); },
|
||||||
| ^^^^ second mutable borrow occurs here
|
| ^^^^^^^^^^ second mutable borrow occurs here
|
||||||
...
|
...
|
||||||
LL | }
|
LL | }
|
||||||
| - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<PeekMut<'_, i32>>`
|
| - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<PeekMut<'_, i32>>`
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | let rofl: &Vec<Vec<i32>> = &mut test;
|
||||||
| ---- help: consider changing this to be a mutable reference: `&mut Vec<Vec<i32>>`
|
| ---- help: consider changing this to be a mutable reference: `&mut Vec<Vec<i32>>`
|
||||||
LL |
|
LL |
|
||||||
LL | rofl.push(Vec::new());
|
LL | rofl.push(Vec::new());
|
||||||
| ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
| ^^^^^^^^^^^^^^^^^^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
||||||
|
|
||||||
error[E0594]: cannot assign to `*r`, which is behind a `&` reference
|
error[E0594]: cannot assign to `*r`, which is behind a `&` reference
|
||||||
--> $DIR/issue-85765.rs:12:5
|
--> $DIR/issue-85765.rs:12:5
|
||||||
|
|
|
@ -53,7 +53,7 @@ error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
|
||||||
--> $DIR/mut-borrow-of-mut-ref.rs:35:5
|
--> $DIR/mut-borrow-of-mut-ref.rs:35:5
|
||||||
|
|
|
|
||||||
LL | f.bar();
|
LL | f.bar();
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^ cannot borrow as mutable
|
||||||
|
|
|
|
||||||
help: consider making the binding mutable
|
help: consider making the binding mutable
|
||||||
|
|
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | let first = &mut void;
|
||||||
LL | let second = &mut void;
|
LL | let second = &mut void;
|
||||||
| ^^^^^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^^ second mutable borrow occurs here
|
||||||
LL | first.use_mut();
|
LL | first.use_mut();
|
||||||
| ----- first borrow later used here
|
| --------------- first borrow later used here
|
||||||
|
|
||||||
error[E0499]: cannot borrow `inner_void` as mutable more than once at a time
|
error[E0499]: cannot borrow `inner_void` as mutable more than once at a time
|
||||||
--> $DIR/mut-borrow-outside-loop.rs:15:28
|
--> $DIR/mut-borrow-outside-loop.rs:15:28
|
||||||
|
@ -17,7 +17,7 @@ LL | let inner_second = &mut inner_void;
|
||||||
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||||
LL | inner_second.use_mut();
|
LL | inner_second.use_mut();
|
||||||
LL | inner_first.use_mut();
|
LL | inner_first.use_mut();
|
||||||
| ----------- first borrow later used here
|
| --------------------- first borrow later used here
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time
|
||||||
--> $DIR/two-phase-across-loop.rs:17:22
|
--> $DIR/two-phase-across-loop.rs:17:22
|
||||||
|
|
|
|
||||||
LL | strings.push(foo.get_string());
|
LL | strings.push(foo.get_string());
|
||||||
| ^^^ `foo` was mutably borrowed here in the previous iteration of the loop
|
| ^^^^^^^^^^^^^^^^ `foo` was mutably borrowed here in the previous iteration of the loop
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
|
||||||
--> $DIR/two-phase-cannot-nest-mut-self-calls.rs:16:9
|
--> $DIR/two-phase-cannot-nest-mut-self-calls.rs:16:9
|
||||||
|
|
|
|
||||||
LL | vec.get({
|
LL | vec.get({
|
||||||
| --- --- immutable borrow later used by call
|
| - --- immutable borrow later used by call
|
||||||
| |
|
| _____|
|
||||||
| immutable borrow occurs here
|
| |
|
||||||
LL |
|
LL | |
|
||||||
LL | vec.push(2);
|
LL | | vec.push(2);
|
||||||
| ^^^ mutable borrow occurs here
|
| | ^^^^^^^^^^^ mutable borrow occurs here
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | | 0
|
||||||
|
LL | | });
|
||||||
|
| |______- immutable borrow occurs here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time
|
||||||
--> $DIR/two-phase-multi-mut.rs:11:16
|
--> $DIR/two-phase-multi-mut.rs:11:16
|
||||||
|
|
|
|
||||||
LL | foo.method(&mut foo);
|
LL | foo.method(&mut foo);
|
||||||
| --- ------ ^^^^^^^^ second mutable borrow occurs here
|
| -----------^^^^^^^^-
|
||||||
| | |
|
| | | |
|
||||||
|
| | | second mutable borrow occurs here
|
||||||
| | first borrow later used by call
|
| | first borrow later used by call
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(shared.len());
|
LL | v.push(shared.len());
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^------------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
|
|
||||||
= note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
|
= note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
|
||||||
|
|
|
@ -27,8 +27,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(shared.len());
|
LL | v.push(shared.len());
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^------------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
|
|
||||||
= note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
|
= note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
|
||||||
|
|
|
@ -5,8 +5,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.extend(shared);
|
LL | v.extend(shared);
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^^^------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||||
|
@ -26,8 +27,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(shared.len());
|
LL | v.push(shared.len());
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^------------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
|
@ -5,8 +5,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.extend(shared);
|
LL | v.extend(shared);
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^^^------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||||
|
@ -26,8 +27,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(shared.len());
|
LL | v.push(shared.len());
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^------------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
|
@ -5,8 +5,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(shared.len());
|
LL | v.push(shared.len());
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^------------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||||
|
@ -16,8 +17,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(shared.len());
|
LL | v.push(shared.len());
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^------------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
||||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||||
|
@ -27,8 +29,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(shared.len());
|
LL | v.push(shared.len());
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^------------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
|
@ -5,8 +5,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(shared.len());
|
LL | v.push(shared.len());
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^------------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
|
@ -24,8 +25,9 @@ LL | let shared = &v;
|
||||||
| -- immutable borrow occurs here
|
| -- immutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(shared.len());
|
LL | v.push(shared.len());
|
||||||
| ^ ------ immutable borrow later used here
|
| ^^^^^^^------------^
|
||||||
| |
|
| | |
|
||||||
|
| | immutable borrow later used here
|
||||||
| mutable borrow occurs here
|
| mutable borrow occurs here
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | v[0].push_str({
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
LL |
|
LL |
|
||||||
LL | v.push(format!("foo"));
|
LL | v.push(format!("foo"));
|
||||||
| ^ second mutable borrow occurs here
|
| ^^^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as im
|
||||||
--> $DIR/two-phase-surprise-no-conflict.rs:57:17
|
--> $DIR/two-phase-surprise-no-conflict.rs:57:17
|
||||||
|
|
|
|
||||||
LL | self.hash_expr(&self.cx_mut.body(eid).value);
|
LL | self.hash_expr(&self.cx_mut.body(eid).value);
|
||||||
| ^^^^^---------^^-----------^^^^^^^^^^^^^^^^^
|
| ^^^^^---------^^---------------------^^^^^^^
|
||||||
| | | |
|
| | | |
|
||||||
| | | immutable borrow occurs here
|
| | | immutable borrow occurs here
|
||||||
| | immutable borrow later used by call
|
| | immutable borrow later used by call
|
||||||
|
@ -23,8 +23,9 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||||
--> $DIR/two-phase-surprise-no-conflict.rs:119:51
|
--> $DIR/two-phase-surprise-no-conflict.rs:119:51
|
||||||
|
|
|
|
||||||
LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
|
LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
|
||||||
| --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
| ----------------------------------------------^^^^^^^^^^^^^^^^^---
|
||||||
| | |
|
| | | |
|
||||||
|
| | | second mutable borrow occurs here
|
||||||
| | first borrow later used by call
|
| | first borrow later used by call
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
|
|
||||||
|
@ -32,8 +33,9 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||||
--> $DIR/two-phase-surprise-no-conflict.rs:122:54
|
--> $DIR/two-phase-surprise-no-conflict.rs:122:54
|
||||||
|
|
|
|
||||||
LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
|
LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
|
||||||
| --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
| -------------------------------------------------^^^^^^^^^^^^^^^^^---
|
||||||
| | |
|
| | | |
|
||||||
|
| | | second mutable borrow occurs here
|
||||||
| | first borrow later used by call
|
| | first borrow later used by call
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
|
|
||||||
|
@ -41,8 +43,9 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||||
--> $DIR/two-phase-surprise-no-conflict.rs:125:53
|
--> $DIR/two-phase-surprise-no-conflict.rs:125:53
|
||||||
|
|
|
|
||||||
LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
|
LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
|
||||||
| --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
| ------------------------------------------------^^^^^^^^^^^^^^^^^---
|
||||||
| | |
|
| | | |
|
||||||
|
| | | second mutable borrow occurs here
|
||||||
| | first borrow later used by call
|
| | first borrow later used by call
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
|
|
||||||
|
@ -50,8 +53,9 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||||
--> $DIR/two-phase-surprise-no-conflict.rs:128:44
|
--> $DIR/two-phase-surprise-no-conflict.rs:128:44
|
||||||
|
|
|
|
||||||
LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
|
LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
|
||||||
| --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
| ---------------------------------------^^^^^^^^^^^^^^^^^--
|
||||||
| | |
|
| | | |
|
||||||
|
| | | second mutable borrow occurs here
|
||||||
| | first borrow later used by call
|
| | first borrow later used by call
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
|
|
||||||
|
@ -102,8 +106,9 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||||
--> $DIR/two-phase-surprise-no-conflict.rs:154:54
|
--> $DIR/two-phase-surprise-no-conflict.rs:154:54
|
||||||
|
|
|
|
||||||
LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
|
LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
|
||||||
| --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
| -------------------------------------------------^^^^^^^^^^^^^^^^^---
|
||||||
| | |
|
| | | |
|
||||||
|
| | | second mutable borrow occurs here
|
||||||
| | first borrow later used by call
|
| | first borrow later used by call
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
|
|
||||||
|
@ -124,8 +129,9 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||||
--> $DIR/two-phase-surprise-no-conflict.rs:158:53
|
--> $DIR/two-phase-surprise-no-conflict.rs:158:53
|
||||||
|
|
|
|
||||||
LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
|
LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
|
||||||
| --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
| ------------------------------------------------^^^^^^^^^^^^^^^^^---
|
||||||
| | |
|
| | | |
|
||||||
|
| | | second mutable borrow occurs here
|
||||||
| | first borrow later used by call
|
| | first borrow later used by call
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
|
|
||||||
|
@ -143,8 +149,9 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||||
--> $DIR/two-phase-surprise-no-conflict.rs:162:44
|
--> $DIR/two-phase-surprise-no-conflict.rs:162:44
|
||||||
|
|
|
|
||||||
LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
|
LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
|
||||||
| --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
| ---------------------------------------^^^^^^^^^^^^^^^^^--
|
||||||
| | |
|
| | | |
|
||||||
|
| | | second mutable borrow occurs here
|
||||||
| | first borrow later used by call
|
| | first borrow later used by call
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0505]: cannot move out of `alloc` because it is borrowed
|
||||||
--> $DIR/leak-alloc.rs:26:10
|
--> $DIR/leak-alloc.rs:26:10
|
||||||
|
|
|
|
||||||
LL | let boxed = Box::new_in(10, alloc.by_ref());
|
LL | let boxed = Box::new_in(10, alloc.by_ref());
|
||||||
| ----- borrow of `alloc` occurs here
|
| -------------- borrow of `alloc` occurs here
|
||||||
LL | let theref = Box::leak(boxed);
|
LL | let theref = Box::leak(boxed);
|
||||||
LL | drop(alloc);
|
LL | drop(alloc);
|
||||||
| ^^^^^ move out of `alloc` occurs here
|
| ^^^^^ move out of `alloc` occurs here
|
||||||
|
|
|
@ -12,7 +12,7 @@ error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
|
||||||
LL | let s = std::io::stdin();
|
LL | let s = std::io::stdin();
|
||||||
| - help: consider changing this to be mutable: `mut s`
|
| - help: consider changing this to be mutable: `mut s`
|
||||||
LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
|
LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
|
||||||
| ^ cannot borrow as mutable
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | let z = &mut x;
|
||||||
| ^^^^^^ second mutable borrow occurs here
|
| ^^^^^^ second mutable borrow occurs here
|
||||||
LL | z.use_mut();
|
LL | z.use_mut();
|
||||||
LL | y.use_mut();
|
LL | y.use_mut();
|
||||||
| - first borrow later used here
|
| ----------- first borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,9 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time
|
||||||
--> $DIR/one_line.rs:3:12
|
--> $DIR/one_line.rs:3:12
|
||||||
|
|
|
|
||||||
LL | v.push(v.pop().unwrap());
|
LL | v.push(v.pop().unwrap());
|
||||||
| - ---- ^ second mutable borrow occurs here
|
| -------^^^^^^^----------
|
||||||
| | |
|
| | | |
|
||||||
|
| | | second mutable borrow occurs here
|
||||||
| | first borrow later used by call
|
| | first borrow later used by call
|
||||||
| first mutable borrow occurs here
|
| first mutable borrow occurs here
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error: overly complex generic constant
|
||||||
--> $DIR/issue-67375.rs:7:17
|
--> $DIR/issue-67375.rs:7:17
|
||||||
|
|
|
|
||||||
LL | inner: [(); { [|_: &T| {}; 0].len() }],
|
LL | inner: [(); { [|_: &T| {}; 0].len() }],
|
||||||
| ^^---------------^^^^^^^^
|
| ^^---------------------^^
|
||||||
| |
|
| |
|
||||||
| unsupported operation in generic constant
|
| unsupported operation in generic constant
|
||||||
|
|
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ error[E0658]: mutable references are not allowed in constants
|
||||||
--> $DIR/const_let_assign3.rs:14:5
|
--> $DIR/const_let_assign3.rs:14:5
|
||||||
|
|
|
|
||||||
LL | s.foo(3);
|
LL | s.foo(3);
|
||||||
| ^
|
| ^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
||||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
|
@ -19,8 +19,9 @@ error[E0502]: cannot borrow `self` as mutable because it is also borrowed as imm
|
||||||
--> $DIR/issue-34126.rs:6:18
|
--> $DIR/issue-34126.rs:6:18
|
||||||
|
|
|
|
||||||
LL | self.run(&mut self);
|
LL | self.run(&mut self);
|
||||||
| ---- --- ^^^^^^^^^ mutable borrow occurs here
|
| ---------^^^^^^^^^-
|
||||||
| | |
|
| | | |
|
||||||
|
| | | mutable borrow occurs here
|
||||||
| | immutable borrow later used by call
|
| | immutable borrow later used by call
|
||||||
| immutable borrow occurs here
|
| immutable borrow occurs here
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow `f.v` as mutable, as `f` is not declared as mutable
|
||||||
LL | let f = Foo { v: Vec::new() };
|
LL | let f = Foo { v: Vec::new() };
|
||||||
| - help: consider changing this to be mutable: `mut f`
|
| - help: consider changing this to be mutable: `mut f`
|
||||||
LL | f.v.push("cat".to_string());
|
LL | f.v.push("cat".to_string());
|
||||||
| ^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable
|
error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable
|
||||||
--> $DIR/issue-35937.rs:16:5
|
--> $DIR/issue-35937.rs:16:5
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc
|
||||||
LL | fn f(&self) {
|
LL | fn f(&self) {
|
||||||
| ----- help: consider changing this to be a mutable reference: `&mut self`
|
| ----- help: consider changing this to be a mutable reference: `&mut self`
|
||||||
LL | self.s.push('x');
|
LL | self.s.push('x');
|
||||||
| ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
| ^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | s: &'a String
|
||||||
| ---------- help: consider changing this to be mutable: `&'a mut String`
|
| ---------- help: consider changing this to be mutable: `&'a mut String`
|
||||||
...
|
...
|
||||||
LL | self.s.push('x');
|
LL | self.s.push('x');
|
||||||
| ^^^^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | s: &'a String
|
||||||
| ---------- help: consider changing this to be mutable: `&'a mut String`
|
| ---------- help: consider changing this to be mutable: `&'a mut String`
|
||||||
...
|
...
|
||||||
LL | self.s.push('x');
|
LL | self.s.push('x');
|
||||||
| ^^^^^^ cannot borrow as mutable
|
| ^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*f.s` as mutable, as it is behind a `&` reference
|
||||||
LL | fn f(x: usize, f: &Foo) {
|
LL | fn f(x: usize, f: &Foo) {
|
||||||
| ---- help: consider changing this to be a mutable reference: `&mut Foo<'_>`
|
| ---- help: consider changing this to be a mutable reference: `&mut Foo<'_>`
|
||||||
LL | f.s.push('x');
|
LL | f.s.push('x');
|
||||||
| ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
| ^^^^^^^^^^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*buf` as mutable, as it is behind a `&` reference
|
||||||
LL | let mut buf = &[1, 2, 3, 4];
|
LL | let mut buf = &[1, 2, 3, 4];
|
||||||
| ------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4]`
|
| ------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4]`
|
||||||
LL | buf.iter_mut();
|
LL | buf.iter_mut();
|
||||||
| ^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
| ^^^^^^^^^^^^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0505]: cannot move out of `a` because it is borrowed
|
||||||
--> $DIR/drop-with-active-borrows-1.rs:4:10
|
--> $DIR/drop-with-active-borrows-1.rs:4:10
|
||||||
|
|
|
|
||||||
LL | let b: Vec<&str> = a.lines().collect();
|
LL | let b: Vec<&str> = a.lines().collect();
|
||||||
| - borrow of `a` occurs here
|
| --------- borrow of `a` occurs here
|
||||||
LL | drop(a);
|
LL | drop(a);
|
||||||
| ^ move out of `a` occurs here
|
| ^ move out of `a` occurs here
|
||||||
LL | for s in &b {
|
LL | for s in &b {
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0515]: cannot return value referencing local variable `raw_lines`
|
||||||
--> $DIR/drop-with-active-borrows-2.rs:3:5
|
--> $DIR/drop-with-active-borrows-2.rs:3:5
|
||||||
|
|
|
|
||||||
LL | raw_lines.iter().map(|l| l.trim()).collect()
|
LL | raw_lines.iter().map(|l| l.trim()).collect()
|
||||||
| ---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| returns a value referencing data owned by the current function
|
| returns a value referencing data owned by the current function
|
||||||
| `raw_lines` is borrowed here
|
| `raw_lines` is borrowed here
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be
|
||||||
--> $DIR/E0161.rs:29:5
|
--> $DIR/E0161.rs:29:5
|
||||||
|
|
|
|
||||||
LL | x.f();
|
LL | x.f();
|
||||||
| ^
|
| ^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be
|
||||||
--> $DIR/E0161.rs:29:5
|
--> $DIR/E0161.rs:29:5
|
||||||
|
|
|
|
||||||
LL | x.f();
|
LL | x.f();
|
||||||
| ^
|
| ^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be
|
||||||
--> $DIR/E0161.rs:29:5
|
--> $DIR/E0161.rs:29:5
|
||||||
|
|
|
|
||||||
LL | x.f();
|
LL | x.f();
|
||||||
| ^
|
| ^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be
|
||||||
--> $DIR/E0161.rs:29:5
|
--> $DIR/E0161.rs:29:5
|
||||||
|
|
|
|
||||||
LL | x.f();
|
LL | x.f();
|
||||||
| ^
|
| ^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | let mut a = &mut i;
|
||||||
| ^^^^^^ second mutable borrow occurs here
|
| ^^^^^^ second mutable borrow occurs here
|
||||||
LL | a.use_mut();
|
LL | a.use_mut();
|
||||||
LL | x.use_mut();
|
LL | x.use_mut();
|
||||||
| - first borrow later used here
|
| ----------- first borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | let ref y = a;
|
||||||
LL | bar(a);
|
LL | bar(a);
|
||||||
| ^ mutable borrow occurs here
|
| ^ mutable borrow occurs here
|
||||||
LL | y.use_ref();
|
LL | y.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | let ref y = a;
|
||||||
LL | bar(a);
|
LL | bar(a);
|
||||||
| ^^^^^^ mutable borrow occurs here
|
| ^^^^^^ mutable borrow occurs here
|
||||||
LL | y.use_ref();
|
LL | y.use_ref();
|
||||||
| - immutable borrow later used here
|
| ----------- immutable borrow later used here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue