Auto merge of #59114 - matthewjasper:enable-migate-2015, r=pnkfelix
Enable NLL migrate mode on the 2015 edition
## What is in this PR?
* Remove the `-Zborrowck=ast` flag option from rustc.
* The default in the 2015 edition is now `-Zborrowck=migrate`.
* The 2018 edition default is unchanged: it's still `-Zborrowck=migrate`.
* Enable two-phase borrows (currently toggled via the `-Ztwo-phase-borrows` flag) on all editions.
* Remove most dead code that handled these options.
* Update tests for the above changes.
## What is *not* in this PR?
These are left for future PRs
* Use `-Zborrowck=mir` in NLL compare mode tests (#56993)
* Remove the `-Zborrowck=compare` option (#59193)
* Remove the `-Ztwo-phase-borrows` flag. It's kept, as a flag that does nothing so that perf.rlo has time to stop using it (cc @Mark-Simulacrum)
* Remove MIR typeck as its own MIR pass - it's now run by NLL.
* Enabling `-Zborrowck=mir` by default (#58781)
* Replace `allow_bind_by_move_patterns_with_guards` and `check_for_mutation_in_guard_via_ast_walk` with just using the feature gate. (#59192)
Soundness issues that are fixed by NLL will stay open until full NLL is emitting hard errors. However, these diagnostics and completeness issues can now be closed:
Closes #18330
Closes #22323
Closes #23591
Closes #26736
Closes #27487
Closes #28092
Closes #28970
Closes #29733
Closes #30104
Closes #38915
Closes #39908
Closes #43407
Closes #47524
Closes #48540
Closes #49073
Closes #52614
Closes #55085
Closes #56093
Closes #56496
Closes #57804
cc #43234
r? @pnkfelix
cc @rust-lang/lang
cc @rust-lang/wg-compiler-nll
diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs
index 16140d0..747f0a6 100644
--- a/src/librustc/infer/mod.rs
+++ b/src/librustc/infer/mod.rs
@@ -92,8 +92,8 @@
/// enabled.
pub fn when_nll_is_enabled(tcx: TyCtxt<'_, '_, '_>) -> Self {
match tcx.borrowck_mode() {
- // If we're on AST or Migrate mode, report AST region errors
- BorrowckMode::Ast | BorrowckMode::Migrate => SuppressRegionErrors { suppressed: false },
+ // If we're on Migrate mode, report AST region errors
+ BorrowckMode::Migrate => SuppressRegionErrors { suppressed: false },
// If we're on MIR or Compare mode, don't report AST region errors as they should
// be reported by NLL
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 97a1c83..cb30780 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -460,7 +460,6 @@
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum BorrowckMode {
- Ast,
Mir,
Compare,
Migrate,
@@ -471,7 +470,6 @@
/// on the AST borrow check if the MIR-based one errors.
pub fn migrate(self) -> bool {
match self {
- BorrowckMode::Ast => false,
BorrowckMode::Compare => false,
BorrowckMode::Mir => false,
BorrowckMode::Migrate => true,
@@ -481,21 +479,11 @@
/// Should we emit the AST-based borrow checker errors?
pub fn use_ast(self) -> bool {
match self {
- BorrowckMode::Ast => true,
BorrowckMode::Compare => true,
BorrowckMode::Mir => false,
BorrowckMode::Migrate => false,
}
}
- /// Should we emit the MIR-based borrow checker errors?
- pub fn use_mir(self) -> bool {
- match self {
- BorrowckMode::Ast => false,
- BorrowckMode::Compare => true,
- BorrowckMode::Mir => true,
- BorrowckMode::Migrate => true,
- }
- }
}
pub enum Input {
@@ -627,7 +615,7 @@
incremental: None,
debugging_opts: basic_debugging_options(),
prints: Vec::new(),
- borrowck_mode: BorrowckMode::Ast,
+ borrowck_mode: BorrowckMode::Migrate,
cg: basic_codegen_options(),
error_format: ErrorOutputType::default(),
externs: Externs(BTreeMap::new()),
@@ -2326,10 +2314,9 @@
}));
let borrowck_mode = match debugging_opts.borrowck.as_ref().map(|s| &s[..]) {
- None | Some("ast") => BorrowckMode::Ast,
+ None | Some("migrate") => BorrowckMode::Migrate,
Some("mir") => BorrowckMode::Mir,
Some("compare") => BorrowckMode::Compare,
- Some("migrate") => BorrowckMode::Migrate,
Some(m) => early_error(error_format, &format!("unknown borrowck mode `{}`", m)),
};
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index 1ce9ffd..ed500d1 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -70,7 +70,6 @@
use syntax::ast;
use syntax::attr;
use syntax::source_map::MultiSpan;
-use syntax::edition::Edition;
use syntax::feature_gate;
use syntax::symbol::{Symbol, keywords, InternedString};
use syntax_pos::Span;
@@ -1496,21 +1495,13 @@
/// because that method has a narrower effect that can be toggled
/// off via a separate `-Z` flag, at least for the short term.
pub fn allow_bind_by_move_patterns_with_guards(self) -> bool {
- self.features().bind_by_move_pattern_guards && self.use_mir_borrowck()
+ self.features().bind_by_move_pattern_guards
}
/// If true, we should use a naive AST walk to determine if match
/// guard could perform bad mutations (or mutable-borrows).
pub fn check_for_mutation_in_guard_via_ast_walk(self) -> bool {
- // If someone requests the feature, then be a little more
- // careful and ensure that MIR-borrowck is enabled (which can
- // happen via edition selection, via `feature(nll)`, or via an
- // appropriate `-Z` flag) before disabling the mutation check.
- if self.allow_bind_by_move_patterns_with_guards() {
- return false;
- }
-
- return true;
+ !self.allow_bind_by_move_patterns_with_guards()
}
/// If true, we should use the AST-based borrowck (we may *also* use
@@ -1519,12 +1510,6 @@
self.borrowck_mode().use_ast()
}
- /// If true, we should use the MIR-based borrowck (we may *also* use
- /// the AST-based borrowck).
- pub fn use_mir_borrowck(self) -> bool {
- self.borrowck_mode().use_mir()
- }
-
/// If true, we should use the MIR-based borrow check, but also
/// fall back on the AST borrow check if the MIR-based one errors.
pub fn migrate_borrowck(self) -> bool {
@@ -1541,23 +1526,7 @@
/// statements (which simulate the maximal effect of executing the
/// patterns in a match arm).
pub fn emit_read_for_match(&self) -> bool {
- self.use_mir_borrowck() && !self.sess.opts.debugging_opts.nll_dont_emit_read_for_match
- }
-
- /// If true, pattern variables for use in guards on match arms
- /// will be bound as references to the data, and occurrences of
- /// those variables in the guard expression will implicitly
- /// dereference those bindings. (See rust-lang/rust#27282.)
- pub fn all_pat_vars_are_implicit_refs_within_guards(self) -> bool {
- self.borrowck_mode().use_mir()
- }
-
- /// If true, we should enable two-phase borrows checks. This is
- /// done with either: `-Ztwo-phase-borrows`, `#![feature(nll)]`,
- /// or by opting into an edition after 2015.
- pub fn two_phase_borrows(self) -> bool {
- self.sess.rust_2018() || self.features().nll ||
- self.sess.opts.debugging_opts.two_phase_borrows
+ !self.sess.opts.debugging_opts.nll_dont_emit_read_for_match
}
/// What mode(s) of borrowck should we run? AST? MIR? both?
@@ -1565,14 +1534,10 @@
pub fn borrowck_mode(&self) -> BorrowckMode {
// Here are the main constraints we need to deal with:
//
- // 1. An opts.borrowck_mode of `BorrowckMode::Ast` is
+ // 1. An opts.borrowck_mode of `BorrowckMode::Migrate` is
// synonymous with no `-Z borrowck=...` flag at all.
- // (This is arguably a historical accident.)
//
- // 2. `BorrowckMode::Migrate` is the limited migration to
- // NLL that we are deploying with the 2018 edition.
- //
- // 3. We want to allow developers on the Nightly channel
+ // 2. We want to allow developers on the Nightly channel
// to opt back into the "hard error" mode for NLL,
// (which they can do via specifying `#![feature(nll)]`
// explicitly in their crate).
@@ -1585,24 +1550,13 @@
// a user's attempt to specify `-Z borrowck=compare`, which
// we arguably do not need anymore and should remove.)
//
- // * Otherwise, if no `-Z borrowck=...` flag was given (or
- // if `borrowck=ast` was specified), then use the default
- // as required by the edition.
+ // * Otherwise, if no `-Z borrowck=...` then use migrate mode
//
// * Otherwise, use the behavior requested via `-Z borrowck=...`
if self.features().nll { return BorrowckMode::Mir; }
- match self.sess.opts.borrowck_mode {
- mode @ BorrowckMode::Mir |
- mode @ BorrowckMode::Compare |
- mode @ BorrowckMode::Migrate => mode,
-
- BorrowckMode::Ast => match self.sess.edition() {
- Edition::Edition2015 => BorrowckMode::Ast,
- Edition::Edition2018 => BorrowckMode::Migrate,
- },
- }
+ self.sess.opts.borrowck_mode
}
#[inline]
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs
index a2f6d97..540f374 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -49,8 +49,6 @@
pub mod move_data;
-mod unused;
-
#[derive(Clone, Copy)]
pub struct LoanDataFlowOperator;
@@ -138,10 +136,6 @@
check_loans::check_loans(&mut bccx, &loan_dfcx, &flowed_moves, &all_loans, body);
}
- if !tcx.use_mir_borrowck() {
- unused::check(&mut bccx, body);
- }
-
Lrc::new(BorrowCheckResult {
used_mut_nodes: bccx.used_mut_nodes.into_inner(),
signalled_any_error: bccx.signalled_any_error.into_inner(),
diff --git a/src/librustc_borrowck/borrowck/unused.rs b/src/librustc_borrowck/borrowck/unused.rs
deleted file mode 100644
index 60a9c18..0000000
--- a/src/librustc_borrowck/borrowck/unused.rs
+++ /dev/null
@@ -1,116 +0,0 @@
-use rustc::hir::intravisit::{Visitor, NestedVisitorMap};
-use rustc::hir::{self, HirId};
-use rustc::lint::builtin::UNUSED_MUT;
-use rustc::ty;
-use rustc::util::nodemap::{FxHashMap, FxHashSet};
-use errors::Applicability;
-use std::slice;
-use syntax::ptr::P;
-
-use crate::borrowck::BorrowckCtxt;
-
-pub fn check<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, body: &'tcx hir::Body) {
- let mut used_mut = bccx.used_mut_nodes.borrow().clone();
- UsedMutFinder {
- bccx,
- set: &mut used_mut,
- }.visit_expr(&body.value);
- let mut cx = UnusedMutCx { bccx, used_mut };
- for arg in body.arguments.iter() {
- cx.check_unused_mut_pat(slice::from_ref(&arg.pat));
- }
- cx.visit_expr(&body.value);
-}
-
-struct UsedMutFinder<'a, 'tcx: 'a> {
- bccx: &'a BorrowckCtxt<'a, 'tcx>,
- set: &'a mut FxHashSet<HirId>,
-}
-
-struct UnusedMutCx<'a, 'tcx: 'a> {
- bccx: &'a BorrowckCtxt<'a, 'tcx>,
- used_mut: FxHashSet<HirId>,
-}
-
-impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> {
- fn check_unused_mut_pat(&self, pats: &[P<hir::Pat>]) {
- let tcx = self.bccx.tcx;
- let mut mutables: FxHashMap<_, Vec<_>> = Default::default();
- for p in pats {
- p.each_binding(|_, hir_id, span, ident| {
- // Skip anything that looks like `_foo`
- if ident.as_str().starts_with("_") {
- return;
- }
-
- // Skip anything that looks like `&foo` or `&mut foo`, only look
- // for by-value bindings
- if let Some(&bm) = self.bccx.tables.pat_binding_modes().get(hir_id) {
- match bm {
- ty::BindByValue(hir::MutMutable) => {}
- _ => return,
- }
-
- mutables.entry(ident.name).or_default().push((hir_id, span));
- } else {
- tcx.sess.delay_span_bug(span, "missing binding mode");
- }
- });
- }
-
- for (_name, ids) in mutables {
- // If any id for this name was used mutably then consider them all
- // ok, so move on to the next
- if ids.iter().any(|&(ref hir_id, _)| self.used_mut.contains(hir_id)) {
- continue;
- }
-
- let (hir_id, span) = ids[0];
- if span.compiler_desugaring_kind().is_some() {
- // If the `mut` arises as part of a desugaring, we should ignore it.
- continue;
- }
-
- // Ok, every name wasn't used mutably, so issue a warning that this
- // didn't need to be mutable.
- let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
- tcx.struct_span_lint_hir(UNUSED_MUT,
- hir_id,
- span,
- "variable does not need to be mutable")
- .span_suggestion_short(
- mut_span,
- "remove this `mut`",
- String::new(),
- Applicability::MachineApplicable,
- )
- .emit();
- }
- }
-}
-
-impl<'a, 'tcx> Visitor<'tcx> for UnusedMutCx<'a, 'tcx> {
- fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
- NestedVisitorMap::OnlyBodies(&self.bccx.tcx.hir())
- }
-
- fn visit_arm(&mut self, arm: &hir::Arm) {
- self.check_unused_mut_pat(&arm.pats)
- }
-
- fn visit_local(&mut self, local: &hir::Local) {
- self.check_unused_mut_pat(slice::from_ref(&local.pat));
- }
-}
-
-impl<'a, 'tcx> Visitor<'tcx> for UsedMutFinder<'a, 'tcx> {
- fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
- NestedVisitorMap::OnlyBodies(&self.bccx.tcx.hir())
- }
-
- fn visit_nested_body(&mut self, id: hir::BodyId) {
- let def_id = self.bccx.tcx.hir().body_owner_def_id(id);
- self.set.extend(self.bccx.tcx.borrowck(def_id).used_mut_nodes.iter().cloned());
- self.visit_body(self.bccx.tcx.hir().body(id));
- }
-}
diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs
index c81da66..9181923 100644
--- a/src/librustc_mir/borrow_check/borrow_set.rs
+++ b/src/librustc_mir/borrow_check/borrow_set.rs
@@ -303,9 +303,8 @@
/// allowed to be split into separate Reservation and
/// Activation phases.
fn allow_two_phase_borrow(&self, kind: mir::BorrowKind) -> bool {
- self.tcx.two_phase_borrows()
- && (kind.allows_two_phase_borrow()
- || self.tcx.sess.opts.debugging_opts.two_phase_beyond_autoref)
+ kind.allows_two_phase_borrow()
+ || self.tcx.sess.opts.debugging_opts.two_phase_beyond_autoref
}
/// If this is a two-phase borrow, then we will record it
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index 43ed85d..4a3159d 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -74,37 +74,28 @@
let input_mir = tcx.mir_validated(def_id);
debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id));
- let mut return_early;
-
- // Return early if we are not supposed to use MIR borrow checker for this function.
- return_early = !tcx.has_attr(def_id, "rustc_mir") && !tcx.use_mir_borrowck();
-
+ // We are not borrow checking the automatically generated struct/variant constructors
+ // because we want to accept structs such as this (taken from the `linked-hash-map`
+ // crate):
+ // ```rust
+ // struct Qey<Q: ?Sized>(Q);
+ // ```
+ // MIR of this struct constructor looks something like this:
+ // ```rust
+ // fn Qey(_1: Q) -> Qey<Q>{
+ // let mut _0: Qey<Q>; // return place
+ //
+ // bb0: {
+ // (_0.0: Q) = move _1; // bb0[0]: scope 0 at src/main.rs:1:1: 1:26
+ // return; // bb0[1]: scope 0 at src/main.rs:1:1: 1:26
+ // }
+ // }
+ // ```
+ // The problem here is that `(_0.0: Q) = move _1;` is valid only if `Q` is
+ // of statically known size, which is not known to be true because of the
+ // `Q: ?Sized` constraint. However, it is true because the constructor can be
+ // called only when `Q` is of statically known size.
if tcx.is_constructor(def_id) {
- // We are not borrow checking the automatically generated struct/variant constructors
- // because we want to accept structs such as this (taken from the `linked-hash-map`
- // crate):
- // ```rust
- // struct Qey<Q: ?Sized>(Q);
- // ```
- // MIR of this struct constructor looks something like this:
- // ```rust
- // fn Qey(_1: Q) -> Qey<Q>{
- // let mut _0: Qey<Q>; // return place
- //
- // bb0: {
- // (_0.0: Q) = move _1; // bb0[0]: scope 0 at src/main.rs:1:1: 1:26
- // return; // bb0[1]: scope 0 at src/main.rs:1:1: 1:26
- // }
- // }
- // ```
- // The problem here is that `(_0.0: Q) = move _1;` is valid only if `Q` is
- // of statically known size, which is not known to be true because of the
- // `Q: ?Sized` constraint. However, it is true because the constructor can be
- // called only when `Q` is of statically known size.
- return_early = true;
- }
-
- if return_early {
return BorrowCheckResult {
closure_requirements: None,
used_mut_upvars: SmallVec::new(),
@@ -1505,10 +1496,6 @@
span: Span,
flow_state: &Flows<'cx, 'gcx, 'tcx>,
) {
- if !self.infcx.tcx.two_phase_borrows() {
- return;
- }
-
// Two-phase borrow support: For each activation that is newly
// generated at this statement, check if it interferes with
// another borrow.
diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs
index 36d3a03..a5230e6 100644
--- a/src/librustc_mir/borrow_check/nll/invalidation.rs
+++ b/src/librustc_mir/borrow_check/nll/invalidation.rs
@@ -474,10 +474,6 @@
&mut self,
location: Location,
) {
- if !self.tcx.two_phase_borrows() {
- return;
- }
-
// Two-phase borrow support: For each activation that is newly
// generated at this statement, check if it interferes with
// another borrow.
diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs
index ce8f185..0dee64d 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs
@@ -2672,9 +2672,8 @@
let def_id = src.def_id();
debug!("run_pass: {:?}", def_id);
- // When NLL is enabled, the borrow checker runs the typeck
- // itself, so we don't need this MIR pass anymore.
- if tcx.use_mir_borrowck() {
+ // FIXME: We don't need this MIR pass anymore.
+ if true {
return;
}
diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs
index 42eb502..c68dee2 100644
--- a/src/librustc_mir/borrow_check/path_utils.rs
+++ b/src/librustc_mir/borrow_check/path_utils.rs
@@ -15,9 +15,8 @@
tcx: &TyCtxt<'a, 'gcx, 'tcx>,
kind: BorrowKind
) -> bool {
- tcx.two_phase_borrows()
- && (kind.allows_two_phase_borrow()
- || tcx.sess.opts.debugging_opts.two_phase_beyond_autoref)
+ kind.allows_two_phase_borrow()
+ || tcx.sess.opts.debugging_opts.two_phase_beyond_autoref
}
/// Control for the path borrow checking code
diff --git a/src/librustc_mir/build/expr/as_place.rs b/src/librustc_mir/build/expr/as_place.rs
index b500060..713e3fe 100644
--- a/src/librustc_mir/build/expr/as_place.rs
+++ b/src/librustc_mir/build/expr/as_place.rs
@@ -112,11 +112,7 @@
}
ExprKind::SelfRef => block.and(Place::Base(PlaceBase::Local(Local::new(1)))),
ExprKind::VarRef { id } => {
- let place = if this.is_bound_var_in_guard(id) && this
- .hir
- .tcx()
- .all_pat_vars_are_implicit_refs_within_guards()
- {
+ let place = if this.is_bound_var_in_guard(id) {
let index = this.var_local_id(id, RefWithinGuard);
Place::Base(PlaceBase::Local(index)).deref()
} else {
diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs
index 566f179..b5b2d78 100644
--- a/src/librustc_mir/build/matches/mod.rs
+++ b/src/librustc_mir/build/matches/mod.rs
@@ -1425,26 +1425,22 @@
// the reference that we create for the arm.
// * So we eagerly create the reference for the arm and then take a
// reference to that.
- let tcx = self.hir.tcx();
- let autoref = tcx.all_pat_vars_are_implicit_refs_within_guards();
if let Some(guard) = guard {
- if autoref {
- self.bind_matched_candidate_for_guard(
- block,
- &candidate.bindings,
- );
- let guard_frame = GuardFrame {
- locals: candidate
- .bindings
- .iter()
- .map(|b| GuardFrameLocal::new(b.var_id, b.binding_mode))
- .collect(),
- };
- debug!("Entering guard building context: {:?}", guard_frame);
- self.guard_context.push(guard_frame);
- } else {
- self.bind_matched_candidate_for_arm_body(block, &candidate.bindings);
- }
+ let tcx = self.hir.tcx();
+
+ self.bind_matched_candidate_for_guard(
+ block,
+ &candidate.bindings,
+ );
+ let guard_frame = GuardFrame {
+ locals: candidate
+ .bindings
+ .iter()
+ .map(|b| GuardFrameLocal::new(b.var_id, b.binding_mode))
+ .collect(),
+ };
+ debug!("Entering guard building context: {:?}", guard_frame);
+ self.guard_context.push(guard_frame);
let re_erased = tcx.types.re_erased;
let scrutinee_source_info = self.source_info(scrutinee_span);
@@ -1470,13 +1466,11 @@
let source_info = self.source_info(guard.span);
let guard_end = self.source_info(tcx.sess.source_map().end_point(guard.span));
let cond = unpack!(block = self.as_local_operand(block, guard));
- if autoref {
- let guard_frame = self.guard_context.pop().unwrap();
- debug!(
- "Exiting guard building context with locals: {:?}",
- guard_frame
- );
- }
+ let guard_frame = self.guard_context.pop().unwrap();
+ debug!(
+ "Exiting guard building context with locals: {:?}",
+ guard_frame
+ );
for &(_, temp) in fake_borrows {
self.cfg.push(block, Statement {
@@ -1526,28 +1520,26 @@
),
);
- if autoref {
- let by_value_bindings = candidate.bindings.iter().filter(|binding| {
- if let BindingMode::ByValue = binding.binding_mode { true } else { false }
- });
- // Read all of the by reference bindings to ensure that the
- // place they refer to can't be modified by the guard.
- for binding in by_value_bindings.clone() {
- let local_id = self.var_local_id(binding.var_id, RefWithinGuard);
+ let by_value_bindings = candidate.bindings.iter().filter(|binding| {
+ if let BindingMode::ByValue = binding.binding_mode { true } else { false }
+ });
+ // Read all of the by reference bindings to ensure that the
+ // place they refer to can't be modified by the guard.
+ for binding in by_value_bindings.clone() {
+ let local_id = self.var_local_id(binding.var_id, RefWithinGuard);
let place = Place::Base(PlaceBase::Local(local_id));
- self.cfg.push(
- block,
- Statement {
- source_info: guard_end,
- kind: StatementKind::FakeRead(FakeReadCause::ForGuardBinding, place),
- },
- );
- }
- self.bind_matched_candidate_for_arm_body(
- post_guard_block,
- by_value_bindings,
+ self.cfg.push(
+ block,
+ Statement {
+ source_info: guard_end,
+ kind: StatementKind::FakeRead(FakeReadCause::ForGuardBinding, place),
+ },
);
}
+ self.bind_matched_candidate_for_arm_body(
+ post_guard_block,
+ by_value_bindings,
+ );
self.cfg.terminate(
post_guard_block,
@@ -1604,8 +1596,6 @@
}
}
- // Only called when all_pat_vars_are_implicit_refs_within_guards,
- // and thus all code/comments assume we are in that context.
fn bind_matched_candidate_for_guard(
&mut self,
block: BasicBlock,
@@ -1739,7 +1729,7 @@
}))),
};
let for_arm_body = self.local_decls.push(local.clone());
- let locals = if has_guard.0 && tcx.all_pat_vars_are_implicit_refs_within_guards() {
+ let locals = if has_guard.0 {
let ref_for_guard = self.local_decls.push(LocalDecl::<'tcx> {
// This variable isn't mutated but has a name, so has to be
// immutable to avoid the unused mut lint.
diff --git a/src/librustc_mir/error_codes.rs b/src/librustc_mir/error_codes.rs
index c8836fe..74a4278 100644
--- a/src/librustc_mir/error_codes.rs
+++ b/src/librustc_mir/error_codes.rs
@@ -877,12 +877,14 @@
"##,
E0383: r##"
+#### Note: this error code is no longer emitted by the compiler.
+
This error occurs when an attempt is made to partially reinitialize a
structure that is currently uninitialized.
For example, this can happen when a drop has taken place:
-```compile_fail,E0383
+```compile_fail
struct Foo {
a: u32,
}
@@ -966,10 +968,12 @@
"##,*/
E0387: r##"
+#### Note: this error code is no longer emitted by the compiler.
+
This error occurs when an attempt is made to mutate or mutably reference data
that a closure has captured immutably. Examples of this error are shown below:
-```compile_fail,E0387
+```compile_fail
// Accepts a function or a closure that captures its environment immutably.
// Closures passed to foo will not be able to mutate their closed-over state.
fn foo<F: Fn()>(f: F) { }
@@ -1026,13 +1030,15 @@
"##,
E0389: r##"
+#### Note: this error code is no longer emitted by the compiler.
+
An attempt was made to mutate data using a non-mutable reference. This
commonly occurs when attempting to assign to a non-mutable reference of a
mutable reference (`&(&mut T)`).
Example of erroneous code:
-```compile_fail,E0389
+```compile_fail
struct FancyNum {
num: u8,
}
@@ -1202,6 +1208,7 @@
let mut i = 0;
let mut x = &mut i;
let mut a = &mut i;
+x;
// error: cannot borrow `i` as mutable more than once at a time
```
@@ -1220,35 +1227,33 @@
let a = &i; // ok!
let b = &i; // still ok!
let c = &i; // still ok!
+b;
+a;
```
"##,
E0500: r##"
-A borrowed variable was used in another closure. Example of erroneous code:
+A borrowed variable was used by a closure. Example of erroneous code:
-```compile_fail
+```compile_fail,E0500
fn you_know_nothing(jon_snow: &mut i32) {
- let nights_watch = || {
- *jon_snow = 2;
- };
+ let nights_watch = &jon_snow;
let starks = || {
*jon_snow = 3; // error: closure requires unique access to `jon_snow`
// but it is already borrowed
};
+ println!("{}", nights_watch);
}
```
-In here, `jon_snow` is already borrowed by the `nights_watch` closure, so it
+In here, `jon_snow` is already borrowed by the `nights_watch` reference, so it
cannot be borrowed by the `starks` closure at the same time. To fix this issue,
-you can put the closure in its own scope:
+you can create the closure after the borrow has ended:
```
fn you_know_nothing(jon_snow: &mut i32) {
- {
- let nights_watch = || {
- *jon_snow = 2;
- };
- } // At this point, `jon_snow` is free.
+ let nights_watch = &jon_snow;
+ println!("{}", nights_watch);
let starks = || {
*jon_snow = 3;
};
@@ -1261,12 +1266,10 @@
```
fn you_know_nothing(jon_snow: &mut i32) {
let mut jon_copy = jon_snow.clone();
- let nights_watch = || {
- jon_copy = 2;
- };
let starks = || {
*jon_snow = 3;
};
+ println!("{}", jon_copy);
}
```
"##,
@@ -1293,26 +1296,28 @@
}
fn foo(a: &mut i32) {
- let bar = || {
+ let mut bar = || {
inside_closure(a)
};
outside_closure(a); // error: cannot borrow `*a` as mutable because previous
// closure requires unique access.
+ bar();
}
```
-To fix this error, you can place the closure in its own scope:
+To fix this error, you can finish using the closure before using the captured
+variable:
```
fn inside_closure(x: &mut i32) {}
fn outside_closure(x: &mut i32) {}
fn foo(a: &mut i32) {
- {
- let bar = || {
- inside_closure(a)
- };
- } // borrow on `a` ends.
+ let mut bar = || {
+ inside_closure(a)
+ };
+ bar();
+ // borrow on `a` ends.
outside_closure(a); // ok!
}
```
@@ -1324,7 +1329,7 @@
fn outside_closure(x: &mut i32) {}
fn foo(a: &mut i32) {
- let bar = |s: &mut i32| {
+ let mut bar = |s: &mut i32| {
inside_closure(s)
};
outside_closure(a);
@@ -1340,9 +1345,10 @@
fn foo(a: &mut i32) {
outside_closure(a);
- let bar = || {
+ let mut bar = || {
inside_closure(a)
};
+ bar();
}
```
"##,
@@ -1359,6 +1365,7 @@
let ref y = a; // a is borrowed as immutable.
bar(a); // error: cannot borrow `*a` as mutable because `a` is also borrowed
// as immutable
+ println!("{}", y);
}
```
@@ -1370,6 +1377,7 @@
fn foo(a: &mut i32) {
bar(a);
let ref y = a; // ok!
+ println!("{}", y);
}
```
@@ -1385,11 +1393,11 @@
```compile_fail,E0503
fn main() {
let mut value = 3;
- // Create a mutable borrow of `value`. This borrow
- // lives until the end of this function.
- let _borrow = &mut value;
+ // Create a mutable borrow of `value`.
+ let borrow = &mut value;
let _sum = value + 1; // error: cannot use `value` because
// it was mutably borrowed
+ println!("{}", borrow);
}
```
@@ -1397,16 +1405,14 @@
used to calculate `sum`. This is not possible because this would violate
Rust's mutability rules.
-You can fix this error by limiting the scope of the borrow:
+You can fix this error by finishing using the borrow before the next use of
+the value:
```
fn main() {
let mut value = 3;
- // By creating a new block, you can limit the scope
- // of the reference.
- {
- let _borrow = &mut value; // Use `_borrow` inside this block.
- }
+ let borrow = &mut value;
+ println!("{}", borrow);
// The block has ended and with it the borrow.
// You can now use `value` again.
let _sum = value + 1;
@@ -1422,10 +1428,11 @@
let value_cloned = value.clone();
// The mutable borrow is a reference to `value` and
// not to `value_cloned`...
- let _borrow = &mut value;
+ let borrow = &mut value;
// ... which means we can still use `value_cloned`,
let _sum = value_cloned + 1;
// even though the borrow only ends here.
+ println!("{}", borrow);
}
```
@@ -1434,12 +1441,14 @@
"##,
E0504: r##"
+#### Note: this error code is no longer emitted by the compiler.
+
This error occurs when an attempt is made to move a borrowed variable into a
closure.
Example of erroneous code:
-```compile_fail,E0504
+```compile_fail
struct FancyNum {
num: u8,
}
@@ -1577,9 +1586,10 @@
fn main() {
let x = Value{};
- let _ref_to_val: &Value = &x;
+
+ let ref_to_val: &Value = &x;
eat(&x); // pass by reference, if it's possible
- borrow(_ref_to_val);
+ borrow(ref_to_val);
}
```
@@ -1594,11 +1604,11 @@
fn main() {
let x = Value{};
- {
- let _ref_to_val: &Value = &x;
- borrow(_ref_to_val);
- }
- eat(x); // release borrow and then move it.
+
+ let ref_to_val: &Value = &x;
+ borrow(ref_to_val);
+ // ref_to_val is no longer used.
+ eat(x);
}
```
@@ -1614,9 +1624,9 @@
fn main() {
let x = Value{};
- let _ref_to_val: &Value = &x;
+ let ref_to_val: &Value = &x;
eat(x); // it will be copied here.
- borrow(_ref_to_val);
+ borrow(ref_to_val);
}
```
@@ -2053,11 +2063,13 @@
"##,
E0595: r##"
+#### Note: this error code is no longer emitted by the compiler.
+
Closures cannot mutate immutable captured variables.
Erroneous code example:
-```compile_fail,E0595
+```compile_fail,E0594
let x = 3; // error: closure cannot assign to immutable local variable `x`
let mut c = || { x += 1 };
```
@@ -2090,8 +2102,7 @@
"##,
E0597: r##"
-This error occurs because a borrow was made inside a variable which has a
-greater lifetime than the borrowed one.
+This error occurs because a value was dropped while it was still borrowed
Example of erroneous code:
@@ -2101,23 +2112,28 @@
}
let mut x = Foo { x: None };
-let y = 0;
-x.x = Some(&y); // error: `y` does not live long enough
+{
+ let y = 0;
+ x.x = Some(&y); // error: `y` does not live long enough
+}
+println!("{:?}", x.x);
```
-In here, `x` is created before `y` and therefore has a greater lifetime. Always
-keep in mind that values in a scope are dropped in the opposite order they are
-created. So to fix the previous example, just make the `y` lifetime greater than
-the `x`'s one:
+In here, `y` is dropped at the end of the inner scope, but it is borrowed by
+`x` until the `println`. To fix the previous example, just remove the scope
+so that `y` isn't dropped until after the println
```
struct Foo<'a> {
x: Option<&'a u32>,
}
-let y = 0;
let mut x = Foo { x: None };
+
+let y = 0;
x.x = Some(&y);
+
+println!("{:?}", x.x);
```
"##,
diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs
index 7ded973..7bfb0a4 100644
--- a/src/librustc_mir/hair/pattern/check_match.rs
+++ b/src/librustc_mir/hair/pattern/check_match.rs
@@ -565,7 +565,7 @@
let mut err = struct_span_err!(cx.tcx.sess, p.span, E0008,
"cannot bind by-move into a pattern guard");
err.span_label(p.span, "moves value into pattern guard");
- if cx.tcx.sess.opts.unstable_features.is_nightly_build() && cx.tcx.use_mir_borrowck() {
+ if cx.tcx.sess.opts.unstable_features.is_nightly_build() {
err.help("add #![feature(bind_by_move_pattern_guards)] to the \
crate attributes to enable");
}
@@ -649,9 +649,7 @@
let mut err = struct_span_err!(self.cx.tcx.sess, span, E0301,
"cannot mutably borrow in a pattern guard");
err.span_label(span, "borrowed mutably in pattern guard");
- if self.cx.tcx.sess.opts.unstable_features.is_nightly_build() &&
- self.cx.tcx.use_mir_borrowck()
- {
+ if self.cx.tcx.sess.opts.unstable_features.is_nightly_build() {
err.help("add #![feature(bind_by_move_pattern_guards)] to the \
crate attributes to enable");
}
diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs
index fd694dd..e334e27 100644
--- a/src/librustc_mir/util/borrowck_errors.rs
+++ b/src/librustc_mir/util/borrowck_errors.rs
@@ -40,7 +40,7 @@
pub fn should_emit_errors(self, mode: BorrowckMode) -> bool {
match self {
Origin::Ast => mode.use_ast(),
- Origin::Mir => mode.use_mir(),
+ Origin::Mir => true,
}
}
}
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index bc87a88..ba567a1 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -445,9 +445,7 @@
(active, custom_inner_attributes, "1.30.0", Some(54726), None),
// Allow mixing of bind-by-move in patterns and references to
- // those identifiers in guards, *if* we are using MIR-borrowck
- // (aka NLL). Essentially this means you need to be using the
- // 2018 edition or later.
+ // those identifiers in guards.
(active, bind_by_move_pattern_guards, "1.30.0", Some(15287), None),
// Allows `impl Trait` in bindings (`let`, `const`, `static`).
diff --git a/src/test/incremental/feature_gate.rs b/src/test/incremental/feature_gate.rs
index d36044e..5317a99 100644
--- a/src/test/incremental/feature_gate.rs
+++ b/src/test/incremental/feature_gate.rs
@@ -4,10 +4,10 @@
// compile-flags: -Z query-dep-graph
#![feature(rustc_attrs)]
-#![cfg_attr(rpass1, feature(nll))]
+#![cfg_attr(rpass1, feature(abi_unadjusted))]
fn main() {
- let mut v = vec![1];
- v.push(v[0]);
- //[cfail2]~^ ERROR cannot borrow
}
+
+extern "unadjusted" fn foo() {}
+//[cfail2]~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable
diff --git a/src/test/mir-opt/match_test.rs b/src/test/mir-opt/match_test.rs
index 3f248f3..a5317f9 100644
--- a/src/test/mir-opt/match_test.rs
+++ b/src/test/mir-opt/match_test.rs
@@ -60,9 +60,11 @@
// goto -> bb16;
// }
// bb12: {
-// StorageLive(_8);
-// _8 = _2;
-// switchInt(move _8) -> [false: bb6, otherwise: bb11];
+// _8 = &shallow _1;
+// StorageLive(_9);
+// _9 = _2;
+// FakeRead(ForMatchGuard, _8);
+// switchInt(move _9) -> [false: bb6, otherwise: bb11];
// }
// bb13: {
// _3 = const 1i32;
@@ -77,7 +79,7 @@
// goto -> bb16;
// }
// bb16: {
-// StorageDead(_8);
+// StorageDead(_9);
// _0 = ();
// StorageDead(_2);
// StorageDead(_1);
diff --git a/src/test/run-fail/borrowck-local-borrow.rs b/src/test/run-fail/borrowck-local-borrow.rs
index cb17a63..d07f76b 100644
--- a/src/test/run-fail/borrowck-local-borrow.rs
+++ b/src/test/run-fail/borrowck-local-borrow.rs
@@ -1,6 +1,6 @@
// error-pattern:panic 1
-// revisions: ast mir
+// revisions: migrate mir
//[mir]compile-flags: -Z borrowck=mir
fn main() {
diff --git a/src/test/run-pass/asm-in-moved.rs b/src/test/run-pass/asm-in-moved.rs
index dc73f83..8726db3 100644
--- a/src/test/run-pass/asm-in-moved.rs
+++ b/src/test/run-pass/asm-in-moved.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(asm)]
#![allow(dead_code)]
diff --git a/src/test/run-pass/asm-out-assign.rs b/src/test/run-pass/asm-out-assign.rs
index d0978cc..5c46cb9 100644
--- a/src/test/run-pass/asm-out-assign.rs
+++ b/src/test/run-pass/asm-out-assign.rs
@@ -1,6 +1,3 @@
-// revisions ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(asm)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
diff --git a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs
index 25ef48d..72bf43d 100644
--- a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs
+++ b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs
@@ -2,9 +2,6 @@
#![allow(dead_code)]
// Test taken from #45641 (https://github.com/rust-lang/rust/issues/45641)
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
static mut Y: u32 = 0;
unsafe fn should_ok() {
diff --git a/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs
index 0487c17..adc7dfd 100644
--- a/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs
+++ b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs
@@ -1,6 +1,4 @@
// run-pass
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
// Test file taken from issue 45129 (https://github.com/rust-lang/rust/issues/45129)
diff --git a/src/test/run-pass/borrowck/two-phase-baseline.rs b/src/test/run-pass/borrowck/two-phase-baseline.rs
index aa8d183..994dc82 100644
--- a/src/test/run-pass/borrowck/two-phase-baseline.rs
+++ b/src/test/run-pass/borrowck/two-phase-baseline.rs
@@ -1,5 +1,4 @@
// run-pass
-// compile-flags: -Z borrowck=mir -Z two-phase-borrows
// This is the "goto example" for why we want two phase borrows.
diff --git a/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs b/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs
index 9759223..0b20e19 100644
--- a/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs
+++ b/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs
@@ -1,8 +1,4 @@
// run-pass
-// revisions: lxl nll
-//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
-
-#![cfg_attr(nll, feature(nll))]
fn main() {
let mut a = 0;
diff --git a/src/test/run-pass/drop/dynamic-drop.rs b/src/test/run-pass/drop/dynamic-drop.rs
index 97e4cde..399b577 100644
--- a/src/test/run-pass/drop/dynamic-drop.rs
+++ b/src/test/run-pass/drop/dynamic-drop.rs
@@ -1,8 +1,6 @@
// run-pass
#![allow(unused_assignments)]
#![allow(unused_variables)]
-// revisions:lexical nll
-#![cfg_attr(nll, feature(nll))]
// ignore-wasm32-bare compiled with panic=abort by default
diff --git a/src/test/run-pass/generator/yield-subtype.rs b/src/test/run-pass/generator/yield-subtype.rs
index c3852485..fe88d42 100644
--- a/src/test/run-pass/generator/yield-subtype.rs
+++ b/src/test/run-pass/generator/yield-subtype.rs
@@ -2,9 +2,6 @@
#![allow(dead_code)]
#![allow(dead_code)]
-// revisions:lexical nll
-#![cfg_attr(nll, feature(nll))]
-
#![feature(generators)]
fn bar<'a>() {
diff --git a/src/test/run-pass/impl-trait/example-calendar.rs b/src/test/run-pass/impl-trait/example-calendar.rs
index cd3d48f..968e9b7 100644
--- a/src/test/run-pass/impl-trait/example-calendar.rs
+++ b/src/test/run-pass/impl-trait/example-calendar.rs
@@ -1,8 +1,5 @@
// run-pass
-// revisions: normal nll
-//[nll] compile-flags:-Zborrowck=mir
-
#![feature(fn_traits,
step_trait,
unboxed_closures,
diff --git a/src/test/run-pass/issues/issue-26996.rs b/src/test/run-pass/issues/issue-26996.rs
index 8c5d244..04382be 100644
--- a/src/test/run-pass/issues/issue-26996.rs
+++ b/src/test/run-pass/issues/issue-26996.rs
@@ -2,9 +2,9 @@
// This test is bogus (i.e., should be compile-fail) during the period
// where #54986 is implemented and #54987 is *not* implemented. For
-// now: just ignore it under nll
+// now: just ignore it
//
-// ignore-compare-mode-nll
+// ignore-test
// This test is checking that the write to `c.0` (which has been moved out of)
// won't overwrite the state in `c2`.
diff --git a/src/test/run-pass/issues/issue-27021.rs b/src/test/run-pass/issues/issue-27021.rs
index ecb065b..3055137 100644
--- a/src/test/run-pass/issues/issue-27021.rs
+++ b/src/test/run-pass/issues/issue-27021.rs
@@ -2,9 +2,9 @@
// This test is bogus (i.e., should be compile-fail) during the period
// where #54986 is implemented and #54987 is *not* implemented. For
-// now: just ignore it under nll
+// now: just ignore it
//
-// ignore-compare-mode-nll
+// ignore-test
// These are variants of issue-26996.rs. In all cases we are writing
// into a record field that has been moved out of, and ensuring that
diff --git a/src/test/run-pass/issues/issue-49298.rs b/src/test/run-pass/issues/issue-49298.rs
index 56443f4..697a160 100644
--- a/src/test/run-pass/issues/issue-49298.rs
+++ b/src/test/run-pass/issues/issue-49298.rs
@@ -4,9 +4,9 @@
// This test is bogus (i.e., should be compile-fail) during the period
// where #54986 is implemented and #54987 is *not* implemented. For
-// now: just ignore it under nll
+// now: just ignore it
//
-// ignore-compare-mode-nll
+// ignore-test
// This test is checking that the space allocated for `x.1` does not
// overlap with `y`. (The reason why such a thing happened at one
diff --git a/src/test/ui-fulldeps/dropck-tarena-cycle-checked.stderr b/src/test/ui-fulldeps/dropck-tarena-cycle-checked.stderr
index b6d5ee0..7009c0b 100644
--- a/src/test/ui-fulldeps/dropck-tarena-cycle-checked.stderr
+++ b/src/test/ui-fulldeps/dropck-tarena-cycle-checked.stderr
@@ -1,12 +1,13 @@
error[E0597]: `arena` does not live long enough
- --> $DIR/dropck-tarena-cycle-checked.rs:116:8
+ --> $DIR/dropck-tarena-cycle-checked.rs:116:7
|
LL | f(&arena);
- | ^^^^^ borrowed value does not live long enough
+ | ^^^^^^ borrowed value does not live long enough
LL | }
- | - `arena` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `arena` dropped here while still borrowed
+ | borrow might be used here, when `arena` is dropped and runs the `Drop` code for type `arena::TypedArena`
error: aborting due to previous error
diff --git a/src/test/ui-fulldeps/dropck-tarena-unsound-drop.stderr b/src/test/ui-fulldeps/dropck-tarena-unsound-drop.stderr
index 1e612f0..319848b 100644
--- a/src/test/ui-fulldeps/dropck-tarena-unsound-drop.stderr
+++ b/src/test/ui-fulldeps/dropck-tarena-unsound-drop.stderr
@@ -1,12 +1,13 @@
error[E0597]: `arena` does not live long enough
- --> $DIR/dropck-tarena-unsound-drop.rs:41:8
+ --> $DIR/dropck-tarena-unsound-drop.rs:41:7
|
LL | f(&arena);
- | ^^^^^ borrowed value does not live long enough
+ | ^^^^^^ borrowed value does not live long enough
LL | }
- | - `arena` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `arena` dropped here while still borrowed
+ | borrow might be used here, when `arena` is dropped and runs the `Drop` code for type `arena::TypedArena`
error: aborting due to previous error
diff --git a/src/test/ui/E0501.ast.nll.stderr b/src/test/ui/E0501.ast.nll.stderr
deleted file mode 100644
index 74f14beb..0000000
--- a/src/test/ui/E0501.ast.nll.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
- --> $DIR/E0501.rs:18:23
- |
-LL | let bar = || {
- | -- closure construction occurs here
-LL | inside_closure(a)
- | - first borrow occurs due to use of `a` in closure
-LL | };
-LL | outside_closure_1(a);
- | ^ second borrow occurs here
-...
-LL | drop(bar);
- | --- first borrow later used here
-
-error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
- --> $DIR/E0501.rs:21:23
- |
-LL | let bar = || {
- | -- closure construction occurs here
-LL | inside_closure(a)
- | - first borrow occurs due to use of `a` in closure
-...
-LL | outside_closure_2(a);
- | ^ second borrow occurs here
-...
-LL | drop(bar);
- | --- first borrow later used here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0501`.
diff --git a/src/test/ui/E0501.ast.stderr b/src/test/ui/E0501.ast.stderr
deleted file mode 100644
index e2f54c6..0000000
--- a/src/test/ui/E0501.ast.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
- --> $DIR/E0501.rs:18:23
- |
-LL | let bar = || {
- | -- closure construction occurs here
-LL | inside_closure(a)
- | - previous borrow occurs due to use of `a` in closure
-LL | };
-LL | outside_closure_1(a);
- | ^ borrow occurs here
-...
-LL | }
- | - borrow from closure ends here
-
-error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
- --> $DIR/E0501.rs:21:23
- |
-LL | let bar = || {
- | -- closure construction occurs here
-LL | inside_closure(a)
- | - previous borrow occurs due to use of `a` in closure
-...
-LL | outside_closure_2(a);
- | ^ borrow occurs here
-...
-LL | }
- | - borrow from closure ends here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0501`.
diff --git a/src/test/ui/E0501.mir.stderr b/src/test/ui/E0501.mir.stderr
deleted file mode 100644
index 74f14beb..0000000
--- a/src/test/ui/E0501.mir.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
- --> $DIR/E0501.rs:18:23
- |
-LL | let bar = || {
- | -- closure construction occurs here
-LL | inside_closure(a)
- | - first borrow occurs due to use of `a` in closure
-LL | };
-LL | outside_closure_1(a);
- | ^ second borrow occurs here
-...
-LL | drop(bar);
- | --- first borrow later used here
-
-error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
- --> $DIR/E0501.rs:21:23
- |
-LL | let bar = || {
- | -- closure construction occurs here
-LL | inside_closure(a)
- | - first borrow occurs due to use of `a` in closure
-...
-LL | outside_closure_2(a);
- | ^ second borrow occurs here
-...
-LL | drop(bar);
- | --- first borrow later used here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0501`.
diff --git a/src/test/ui/E0501.rs b/src/test/ui/E0501.rs
index a710e23..3e39d9a 100644
--- a/src/test/ui/E0501.rs
+++ b/src/test/ui/E0501.rs
@@ -1,7 +1,3 @@
-// ignore-tidy-linelength
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn inside_closure(x: &mut i32) {
}
@@ -15,11 +11,11 @@
let bar = || {
inside_closure(a)
};
- outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
- //[mir]~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
+ outside_closure_1(a);
+ //~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
- outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
- //[mir]~^ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
+ outside_closure_2(a);
+ //~^ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
drop(bar);
}
diff --git a/src/test/ui/E0501.stderr b/src/test/ui/E0501.stderr
new file mode 100644
index 0000000..53d98d7
--- /dev/null
+++ b/src/test/ui/E0501.stderr
@@ -0,0 +1,31 @@
+error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
+ --> $DIR/E0501.rs:14:23
+ |
+LL | let bar = || {
+ | -- closure construction occurs here
+LL | inside_closure(a)
+ | - first borrow occurs due to use of `a` in closure
+LL | };
+LL | outside_closure_1(a);
+ | ^ second borrow occurs here
+...
+LL | drop(bar);
+ | --- first borrow later used here
+
+error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
+ --> $DIR/E0501.rs:17:23
+ |
+LL | let bar = || {
+ | -- closure construction occurs here
+LL | inside_closure(a)
+ | - first borrow occurs due to use of `a` in closure
+...
+LL | outside_closure_2(a);
+ | ^ second borrow occurs here
+...
+LL | drop(bar);
+ | --- first borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0501`.
diff --git a/src/test/ui/E0506.ast.nll.stderr b/src/test/ui/E0506.ast.nll.stderr
deleted file mode 100644
index 6e2d634..0000000
--- a/src/test/ui/E0506.ast.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `fancy_num` because it is borrowed
- --> $DIR/E0506.rs:11:5
- |
-LL | let fancy_ref = &fancy_num;
- | ---------- borrow of `fancy_num` occurs here
-LL | fancy_num = FancyNum { num: 6 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
-...
-LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
- | ------------- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/E0506.ast.stderr b/src/test/ui/E0506.ast.stderr
deleted file mode 100644
index 3e3001f..0000000
--- a/src/test/ui/E0506.ast.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0506]: cannot assign to `fancy_num` because it is borrowed
- --> $DIR/E0506.rs:11:5
- |
-LL | let fancy_ref = &fancy_num;
- | --------- borrow of `fancy_num` occurs here
-LL | fancy_num = FancyNum { num: 6 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/E0506.mir.stderr b/src/test/ui/E0506.mir.stderr
deleted file mode 100644
index 6e2d634..0000000
--- a/src/test/ui/E0506.mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `fancy_num` because it is borrowed
- --> $DIR/E0506.rs:11:5
- |
-LL | let fancy_ref = &fancy_num;
- | ---------- borrow of `fancy_num` occurs here
-LL | fancy_num = FancyNum { num: 6 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
-...
-LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
- | ------------- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/E0506.rs b/src/test/ui/E0506.rs
index 04aaa00..062a44a 100644
--- a/src/test/ui/E0506.rs
+++ b/src/test/ui/E0506.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
struct FancyNum {
num: u8,
}
@@ -8,8 +5,7 @@
fn main() {
let mut fancy_num = FancyNum { num: 5 };
let fancy_ref = &fancy_num;
- fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
- //[mir]~^ ERROR [E0506]
+ fancy_num = FancyNum { num: 6 }; //~ ERROR [E0506]
println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
}
diff --git a/src/test/ui/E0506.stderr b/src/test/ui/E0506.stderr
new file mode 100644
index 0000000..17f883f
--- /dev/null
+++ b/src/test/ui/E0506.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `fancy_num` because it is borrowed
+ --> $DIR/E0506.rs:8:5
+ |
+LL | let fancy_ref = &fancy_num;
+ | ---------- borrow of `fancy_num` occurs here
+LL | fancy_num = FancyNum { num: 6 };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
+LL |
+LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
+ | ------------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/E0508-fail.ast.nll.stderr b/src/test/ui/E0508-fail.ast.nll.stderr
deleted file mode 100644
index 972b84e..0000000
--- a/src/test/ui/E0508-fail.ast.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
- --> $DIR/E0508-fail.rs:8:18
- |
-LL | let _value = array[0];
- | ^^^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&array[0]`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/E0508-fail.ast.stderr b/src/test/ui/E0508-fail.ast.stderr
deleted file mode 100644
index 8b24983..0000000
--- a/src/test/ui/E0508-fail.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
- --> $DIR/E0508-fail.rs:8:18
- |
-LL | let _value = array[0];
- | ^^^^^^^^
- | |
- | cannot move out of here
- | help: consider using a reference instead: `&array[0]`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/E0508-fail.mir.stderr b/src/test/ui/E0508-fail.mir.stderr
deleted file mode 100644
index 972b84e..0000000
--- a/src/test/ui/E0508-fail.mir.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
- --> $DIR/E0508-fail.rs:8:18
- |
-LL | let _value = array[0];
- | ^^^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&array[0]`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/E0508-fail.rs b/src/test/ui/E0508-fail.rs
index 20eac6c..072c3d6 100644
--- a/src/test/ui/E0508-fail.rs
+++ b/src/test/ui/E0508-fail.rs
@@ -1,10 +1,6 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
struct NonCopy;
fn main() {
let array = [NonCopy; 1];
- let _value = array[0]; //[ast]~ ERROR [E0508]
- //[mir]~^ ERROR [E0508]
+ let _value = array[0]; //~ ERROR [E0508]
}
diff --git a/src/test/ui/E0508-fail.stderr b/src/test/ui/E0508-fail.stderr
new file mode 100644
index 0000000..63590be
--- /dev/null
+++ b/src/test/ui/E0508-fail.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
+ --> $DIR/E0508-fail.rs:5:18
+ |
+LL | let _value = array[0];
+ | ^^^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider borrowing here: `&array[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/E0508.nll.stderr b/src/test/ui/E0508.nll.stderr
deleted file mode 100644
index 983062e..0000000
--- a/src/test/ui/E0508.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
- --> $DIR/E0508.rs:5:18
- |
-LL | let _value = array[0];
- | ^^^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&array[0]`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/E0508.stderr b/src/test/ui/E0508.stderr
index ba6cff8..983062e 100644
--- a/src/test/ui/E0508.stderr
+++ b/src/test/ui/E0508.stderr
@@ -5,7 +5,7 @@
| ^^^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&array[0]`
+ | help: consider borrowing here: `&array[0]`
error: aborting due to previous error
diff --git a/src/test/ui/E0594.ast.nll.stderr b/src/test/ui/E0594.ast.nll.stderr
deleted file mode 100644
index 4bc7fcf..0000000
--- a/src/test/ui/E0594.ast.nll.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error[E0594]: cannot assign to immutable static item `NUM`
- --> $DIR/E0594.rs:7:5
- |
-LL | NUM = 20;
- | ^^^^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/E0594.ast.stderr b/src/test/ui/E0594.ast.stderr
deleted file mode 100644
index 06171f1..0000000
--- a/src/test/ui/E0594.ast.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error[E0594]: cannot assign to immutable static item
- --> $DIR/E0594.rs:7:5
- |
-LL | NUM = 20;
- | ^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/E0594.mir.stderr b/src/test/ui/E0594.mir.stderr
deleted file mode 100644
index 4bc7fcf..0000000
--- a/src/test/ui/E0594.mir.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error[E0594]: cannot assign to immutable static item `NUM`
- --> $DIR/E0594.rs:7:5
- |
-LL | NUM = 20;
- | ^^^^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/E0594.rs b/src/test/ui/E0594.rs
index a8ca2fe..8b0cae7 100644
--- a/src/test/ui/E0594.rs
+++ b/src/test/ui/E0594.rs
@@ -1,9 +1,5 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
static NUM: i32 = 18;
fn main() {
- NUM = 20; //[ast]~ ERROR E0594
- //[mir]~^ ERROR cannot assign to immutable static item `NUM`
+ NUM = 20; //~ ERROR cannot assign to immutable static item `NUM`
}
diff --git a/src/test/ui/E0594.stderr b/src/test/ui/E0594.stderr
new file mode 100644
index 0000000..c00ec42
--- /dev/null
+++ b/src/test/ui/E0594.stderr
@@ -0,0 +1,8 @@
+error[E0594]: cannot assign to immutable static item `NUM`
+ --> $DIR/E0594.rs:4:5
+ |
+LL | NUM = 20;
+ | ^^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/E0596.ast.nll.stderr b/src/test/ui/E0596.ast.nll.stderr
deleted file mode 100644
index c89a915..0000000
--- a/src/test/ui/E0596.ast.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/E0596.rs:6:13
- |
-LL | let x = 1;
- | - help: consider changing this to be mutable: `mut x`
-LL | let y = &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/E0596.ast.stderr b/src/test/ui/E0596.ast.stderr
deleted file mode 100644
index 4b66e49..0000000
--- a/src/test/ui/E0596.ast.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow immutable local variable `x` as mutable
- --> $DIR/E0596.rs:6:18
- |
-LL | let x = 1;
- | - help: make this binding mutable: `mut x`
-LL | let y = &mut x;
- | ^ cannot borrow mutably
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/E0596.mir.stderr b/src/test/ui/E0596.mir.stderr
deleted file mode 100644
index c89a915..0000000
--- a/src/test/ui/E0596.mir.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/E0596.rs:6:13
- |
-LL | let x = 1;
- | - help: consider changing this to be mutable: `mut x`
-LL | let y = &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/E0596.rs b/src/test/ui/E0596.rs
index 3ea2d64..9e2f5ee 100644
--- a/src/test/ui/E0596.rs
+++ b/src/test/ui/E0596.rs
@@ -1,8 +1,4 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn main() {
let x = 1;
- let y = &mut x; //[ast]~ ERROR [E0596]
- //[mir]~^ ERROR [E0596]
+ let y = &mut x; //~ ERROR [E0596]
}
diff --git a/src/test/ui/E0596.stderr b/src/test/ui/E0596.stderr
new file mode 100644
index 0000000..79bc258
--- /dev/null
+++ b/src/test/ui/E0596.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/E0596.rs:3:13
+ |
+LL | let x = 1;
+ | - help: consider changing this to be mutable: `mut x`
+LL | let y = &mut x;
+ | ^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/access-mode-in-closures.nll.stderr b/src/test/ui/access-mode-in-closures.nll.stderr
deleted file mode 100644
index 713eeba..0000000
--- a/src/test/ui/access-mode-in-closures.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/access-mode-in-closures.rs:8:15
- |
-LL | match *s { S(v) => v }
- | ^^ - data moved here
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `s`
- |
-note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
- --> $DIR/access-mode-in-closures.rs:8:22
- |
-LL | match *s { S(v) => v }
- | ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/access-mode-in-closures.stderr b/src/test/ui/access-mode-in-closures.stderr
index 9976dfe..713eeba 100644
--- a/src/test/ui/access-mode-in-closures.stderr
+++ b/src/test/ui/access-mode-in-closures.stderr
@@ -2,9 +2,16 @@
--> $DIR/access-mode-in-closures.rs:8:15
|
LL | match *s { S(v) => v }
- | ^^ - hint: to prevent move, use `ref v` or `ref mut v`
+ | ^^ - data moved here
| |
| cannot move out of borrowed content
+ | help: consider removing the `*`: `s`
+ |
+note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
+ --> $DIR/access-mode-in-closures.rs:8:22
+ |
+LL | match *s { S(v) => v }
+ | ^
error: aborting due to previous error
diff --git a/src/test/ui/asm/asm-out-assign-imm.nll.stderr b/src/test/ui/asm/asm-out-assign-imm.nll.stderr
deleted file mode 100644
index ac38218..0000000
--- a/src/test/ui/asm/asm-out-assign-imm.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/asm-out-assign-imm.rs:24:34
- |
-LL | let x: isize;
- | - help: make this binding mutable: `mut x`
-LL | x = 1;
- | ----- first assignment to `x`
-...
-LL | asm!("mov $1, $0" : "=r"(x) : "r"(5));
- | ^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/asm/asm-out-assign-imm.stderr b/src/test/ui/asm/asm-out-assign-imm.stderr
index 98f2f68..ac38218 100644
--- a/src/test/ui/asm/asm-out-assign-imm.stderr
+++ b/src/test/ui/asm/asm-out-assign-imm.stderr
@@ -1,6 +1,8 @@
error[E0384]: cannot assign twice to immutable variable `x`
--> $DIR/asm-out-assign-imm.rs:24:34
|
+LL | let x: isize;
+ | - help: make this binding mutable: `mut x`
LL | x = 1;
| ----- first assignment to `x`
...
diff --git a/src/test/ui/asm/asm-out-read-uninit.ast.stderr b/src/test/ui/asm/asm-out-read-uninit.ast.stderr
deleted file mode 100644
index cf74298..0000000
--- a/src/test/ui/asm/asm-out-read-uninit.ast.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `x`
- --> $DIR/asm-out-read-uninit.rs:25:43
- |
-LL | asm!("mov $1, $0" : "=r"(x) : "r"(x));
- | ^ use of possibly uninitialized `x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/asm/asm-out-read-uninit.mir.stderr b/src/test/ui/asm/asm-out-read-uninit.mir.stderr
deleted file mode 100644
index cf74298..0000000
--- a/src/test/ui/asm/asm-out-read-uninit.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `x`
- --> $DIR/asm-out-read-uninit.rs:25:43
- |
-LL | asm!("mov $1, $0" : "=r"(x) : "r"(x));
- | ^ use of possibly uninitialized `x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/asm/asm-out-read-uninit.rs b/src/test/ui/asm/asm-out-read-uninit.rs
index 44dd050..003f1fc 100644
--- a/src/test/ui/asm/asm-out-read-uninit.rs
+++ b/src/test/ui/asm/asm-out-read-uninit.rs
@@ -8,9 +8,6 @@
// ignore-mips
// ignore-mips64
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(asm)]
fn foo(x: isize) { println!("{}", x); }
@@ -23,8 +20,7 @@
let x: isize;
unsafe {
asm!("mov $1, $0" : "=r"(x) : "r"(x));
- //[ast]~^ ERROR use of possibly uninitialized variable: `x`
- //[mir]~^^ ERROR use of possibly uninitialized variable: `x`
+ //~^ ERROR use of possibly uninitialized variable: `x`
}
foo(x);
}
diff --git a/src/test/ui/asm/asm-out-read-uninit.stderr b/src/test/ui/asm/asm-out-read-uninit.stderr
new file mode 100644
index 0000000..6d0445d
--- /dev/null
+++ b/src/test/ui/asm/asm-out-read-uninit.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/asm-out-read-uninit.rs:22:43
+ |
+LL | asm!("mov $1, $0" : "=r"(x) : "r"(x));
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/assign-imm-local-twice.ast.nll.stderr b/src/test/ui/assign-imm-local-twice.ast.nll.stderr
deleted file mode 100644
index 2995a13..0000000
--- a/src/test/ui/assign-imm-local-twice.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/assign-imm-local-twice.rs:11:5
- |
-LL | let v: isize;
- | - help: make this binding mutable: `mut v`
-...
-LL | v = 1;
- | ----- first assignment to `v`
-...
-LL | v = 2;
- | ^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/assign-imm-local-twice.ast.stderr b/src/test/ui/assign-imm-local-twice.ast.stderr
deleted file mode 100644
index f16b8e2..0000000
--- a/src/test/ui/assign-imm-local-twice.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/assign-imm-local-twice.rs:11:5
- |
-LL | v = 1;
- | ----- first assignment to `v`
-...
-LL | v = 2;
- | ^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/assign-imm-local-twice.mir.stderr b/src/test/ui/assign-imm-local-twice.mir.stderr
deleted file mode 100644
index 2995a13..0000000
--- a/src/test/ui/assign-imm-local-twice.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/assign-imm-local-twice.rs:11:5
- |
-LL | let v: isize;
- | - help: make this binding mutable: `mut v`
-...
-LL | v = 1;
- | ----- first assignment to `v`
-...
-LL | v = 2;
- | ^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/assign-imm-local-twice.rs b/src/test/ui/assign-imm-local-twice.rs
index de966a1..c1c9bf6 100644
--- a/src/test/ui/assign-imm-local-twice.rs
+++ b/src/test/ui/assign-imm-local-twice.rs
@@ -1,17 +1,11 @@
-// revisions: ast mir
-//[mir]compile-flags: -Zborrowck=mir
-
fn test() {
let v: isize;
- //[mir]~^ HELP make this binding mutable
- //[mir]~| SUGGESTION mut v
- v = 1; //[ast]~ NOTE first assignment
- //[mir]~^ NOTE first assignment
+ //~^ HELP make this binding mutable
+ //~| SUGGESTION mut v
+ v = 1; //~ NOTE first assignment
println!("v={}", v);
- v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `v`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign twice to immutable
+ v = 2; //~ ERROR cannot assign twice to immutable variable
+ //~| NOTE cannot assign twice to immutable
println!("v={}", v);
}
diff --git a/src/test/ui/assign-imm-local-twice.stderr b/src/test/ui/assign-imm-local-twice.stderr
new file mode 100644
index 0000000..df0f4c4
--- /dev/null
+++ b/src/test/ui/assign-imm-local-twice.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/assign-imm-local-twice.rs:7:5
+ |
+LL | let v: isize;
+ | - help: make this binding mutable: `mut v`
+...
+LL | v = 1;
+ | ----- first assignment to `v`
+LL | println!("v={}", v);
+LL | v = 2;
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/associated-types/associated-types-outlives.nll.stderr b/src/test/ui/associated-types/associated-types-outlives.nll.stderr
deleted file mode 100644
index 840e33b..0000000
--- a/src/test/ui/associated-types/associated-types-outlives.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/associated-types-outlives.rs:22:14
- |
-LL | 's: loop { y = denormalise(&x); break }
- | -- borrow of `x` occurs here
-LL | drop(x);
- | ^ move out of `x` occurs here
-LL | return f(y);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/associated-types/associated-types-outlives.stderr b/src/test/ui/associated-types/associated-types-outlives.stderr
index e35862d..840e33b 100644
--- a/src/test/ui/associated-types/associated-types-outlives.stderr
+++ b/src/test/ui/associated-types/associated-types-outlives.stderr
@@ -2,9 +2,11 @@
--> $DIR/associated-types-outlives.rs:22:14
|
LL | 's: loop { y = denormalise(&x); break }
- | - borrow of `x` occurs here
+ | -- borrow of `x` occurs here
LL | drop(x);
| ^ move out of `x` occurs here
+LL | return f(y);
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/augmented-assignments.nll.stderr b/src/test/ui/augmented-assignments.nll.stderr
deleted file mode 100644
index 1b3c2fc..0000000
--- a/src/test/ui/augmented-assignments.nll.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/augmented-assignments.rs:16:5
- |
-LL | x
- | - borrow of `x` occurs here
-...
-LL | x;
- | ^ move out of `x` occurs here
-
-error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
- --> $DIR/augmented-assignments.rs:21:5
- |
-LL | let y = Int(2);
- | - help: consider changing this to be mutable: `mut y`
-...
-LL | y
- | ^ cannot borrow as mutable
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0505, E0596.
-For more information about an error, try `rustc --explain E0505`.
diff --git a/src/test/ui/augmented-assignments.rs b/src/test/ui/augmented-assignments.rs
index eea15ea..1b4ac6e 100644
--- a/src/test/ui/augmented-assignments.rs
+++ b/src/test/ui/augmented-assignments.rs
@@ -10,16 +10,18 @@
fn main() {
let mut x = Int(1);
- x //~ error: use of moved value: `x`
- //~^ value used here after move
+ x
+ //~^ NOTE borrow of `x` occurs here
+=
- x; //~ value moved here
+ x;
+ //~^ ERROR cannot move out of `x` because it is borrowed
+ //~| move out of `x` occurs here
let y = Int(2);
- //~^ HELP make this binding mutable
+ //~^ HELP consider changing this to be mutable
//~| SUGGESTION mut y
- y //~ error: cannot borrow immutable local variable `y` as mutable
- //~| cannot borrow
+ y //~ ERROR cannot borrow `y` as mutable, as it is not declared as mutable
+ //~| cannot borrow as mutable
+=
Int(1);
}
diff --git a/src/test/ui/augmented-assignments.stderr b/src/test/ui/augmented-assignments.stderr
index c0eddb4..ce555da 100644
--- a/src/test/ui/augmented-assignments.stderr
+++ b/src/test/ui/augmented-assignments.stderr
@@ -1,24 +1,22 @@
-error[E0596]: cannot borrow immutable local variable `y` as mutable
- --> $DIR/augmented-assignments.rs:21:5
- |
-LL | let y = Int(2);
- | - help: make this binding mutable: `mut y`
-...
-LL | y
- | ^ cannot borrow mutably
-
-error[E0382]: use of moved value: `x`
- --> $DIR/augmented-assignments.rs:13:5
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/augmented-assignments.rs:16:5
|
LL | x
- | ^ value used here after move
+ | - borrow of `x` occurs here
...
LL | x;
- | - value moved here
+ | ^ move out of `x` occurs here
+
+error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
+ --> $DIR/augmented-assignments.rs:23:5
|
- = note: move occurs because `x` has type `Int`, which does not implement the `Copy` trait
+LL | let y = Int(2);
+ | - help: consider changing this to be mutable: `mut y`
+...
+LL | y
+ | ^ cannot borrow as mutable
error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0382, E0596.
-For more information about an error, try `rustc --explain E0382`.
+Some errors have detailed explanations: E0505, E0596.
+For more information about an error, try `rustc --explain E0505`.
diff --git a/src/test/ui/bind-by-move/bind-by-move-no-guards.nll.stderr b/src/test/ui/bind-by-move/bind-by-move-no-guards.nll.stderr
deleted file mode 100644
index 5f8b700..0000000
--- a/src/test/ui/bind-by-move/bind-by-move-no-guards.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0008]: cannot bind by-move into a pattern guard
- --> $DIR/bind-by-move-no-guards.rs:8:14
- |
-LL | Some(z) if z.recv().unwrap() => { panic!() },
- | ^ moves value into pattern guard
- |
- = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0008`.
diff --git a/src/test/ui/bind-by-move/bind-by-move-no-guards.stderr b/src/test/ui/bind-by-move/bind-by-move-no-guards.stderr
index 2af2b0d..5f8b700 100644
--- a/src/test/ui/bind-by-move/bind-by-move-no-guards.stderr
+++ b/src/test/ui/bind-by-move/bind-by-move-no-guards.stderr
@@ -3,6 +3,8 @@
|
LL | Some(z) if z.recv().unwrap() => { panic!() },
| ^ moves value into pattern guard
+ |
+ = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
error: aborting due to previous error
diff --git a/src/test/ui/binop/binop-consume-args.nll.stderr b/src/test/ui/binop/binop-consume-args.nll.stderr
deleted file mode 100644
index 5751af2..0000000
--- a/src/test/ui/binop/binop-consume-args.nll.stderr
+++ /dev/null
@@ -1,253 +0,0 @@
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:7:10
- |
-LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs + rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:8:10
- |
-LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs + rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:13:10
- |
-LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs - rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:14:10
- |
-LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs - rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:19:10
- |
-LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs * rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:20:10
- |
-LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs * rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:25:10
- |
-LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs / rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:26:10
- |
-LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs / rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:31:10
- |
-LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs % rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:32:10
- |
-LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs % rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:37:10
- |
-LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs & rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:38:10
- |
-LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs & rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:43:10
- |
-LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs | rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:44:10
- |
-LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs | rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:49:10
- |
-LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs ^ rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:50:10
- |
-LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs ^ rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:55:10
- |
-LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs << rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:56:10
- |
-LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs << rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `lhs`
- --> $DIR/binop-consume-args.rs:61:10
- |
-LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs >> rhs;
- | --- value moved here
-LL | drop(lhs);
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `rhs`
- --> $DIR/binop-consume-args.rs:62:10
- |
-LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
- | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | lhs >> rhs;
- | --- value moved here
-LL | drop(lhs);
-LL | drop(rhs);
- | ^^^ value used here after move
-
-error: aborting due to 20 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr
index 9246c11..5751af2 100644
--- a/src/test/ui/binop/binop-consume-args.stderr
+++ b/src/test/ui/binop/binop-consume-args.stderr
@@ -1,212 +1,252 @@
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:7:10
|
+LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs + rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:8:10
|
+LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs + rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:13:10
|
+LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs - rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:14:10
|
+LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs - rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:19:10
|
+LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs * rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:20:10
|
+LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs * rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:25:10
|
+LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs / rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:26:10
|
+LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs / rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:31:10
|
+LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs % rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:32:10
|
+LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs % rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:37:10
|
+LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs & rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:38:10
|
+LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs & rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:43:10
|
+LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs | rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:44:10
|
+LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs | rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:49:10
|
+LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs ^ rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:50:10
|
+LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs ^ rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:55:10
|
+LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs << rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:56:10
|
+LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs << rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:61:10
|
+LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs >> rhs;
| --- value moved here
LL | drop(lhs);
| ^^^ value used here after move
- |
- = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:62:10
|
+LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
+ | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | lhs >> rhs;
| --- value moved here
LL | drop(lhs);
LL | drop(rhs);
| ^^^ value used here after move
- |
- = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
error: aborting due to 20 previous errors
diff --git a/src/test/ui/binop/binop-move-semantics.nll.stderr b/src/test/ui/binop/binop-move-semantics.nll.stderr
deleted file mode 100644
index 146e378..0000000
--- a/src/test/ui/binop/binop-move-semantics.nll.stderr
+++ /dev/null
@@ -1,95 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/binop-move-semantics.rs:8:5
- |
-LL | fn double_move<T: Add<Output=()>>(x: T) {
- | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | x
- | - value moved here
-LL | +
-LL | x;
- | ^ value used here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/binop-move-semantics.rs:14:5
- |
-LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) {
- | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | x
- | - value moved here
-LL | +
-LL | x.clone();
- | ^ value borrowed here after move
-
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/binop-move-semantics.rs:21:5
- |
-LL | let m = &x;
- | -- borrow of `x` occurs here
-...
-LL | x
- | ^ move out of `x` occurs here
-...
-LL | use_mut(n); use_imm(m);
- | - borrow later used here
-
-error[E0505]: cannot move out of `y` because it is borrowed
- --> $DIR/binop-move-semantics.rs:23:5
- |
-LL | let n = &mut y;
- | ------ borrow of `y` occurs here
-...
-LL | y;
- | ^ move out of `y` occurs here
-LL | use_mut(n); use_imm(m);
- | - borrow later used here
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/binop-move-semantics.rs:30:5
- |
-LL | *m
- | ^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/binop-move-semantics.rs:32:5
- |
-LL | *n;
- | ^^ cannot move out of borrowed content
-
-error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
- --> $DIR/binop-move-semantics.rs:54:5
- |
-LL | &mut f
- | ------
- | |
- | _____mutable borrow occurs here
- | |
-LL | | +
-LL | | &f;
- | | ^-
- | |_____||
- | |mutable borrow later used here
- | immutable borrow occurs here
-
-error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable
- --> $DIR/binop-move-semantics.rs:62:5
- |
-LL | &f
- | --
- | |
- | _____immutable borrow occurs here
- | |
-LL | | +
-LL | | &mut f;
- | | ^^^^^-
- | |_____|____|
- | | immutable borrow later used here
- | mutable borrow occurs here
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0382, E0502, E0505, E0507.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/binop/binop-move-semantics.rs b/src/test/ui/binop/binop-move-semantics.rs
index 2bcf16f..17dec59 100644
--- a/src/test/ui/binop/binop-move-semantics.rs
+++ b/src/test/ui/binop/binop-move-semantics.rs
@@ -11,7 +11,7 @@
fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) {
x
+
- x.clone(); //~ ERROR: use of moved value
+ x.clone(); //~ ERROR: borrow of moved value
}
fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) {
diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr
index 1e48ad2..146e378 100644
--- a/src/test/ui/binop/binop-move-semantics.stderr
+++ b/src/test/ui/binop/binop-move-semantics.stderr
@@ -1,42 +1,51 @@
error[E0382]: use of moved value: `x`
--> $DIR/binop-move-semantics.rs:8:5
|
+LL | fn double_move<T: Add<Output=()>>(x: T) {
+ | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | x
| - value moved here
LL | +
LL | x;
| ^ value used here after move
- |
- = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
-error[E0382]: use of moved value: `x`
+error[E0382]: borrow of moved value: `x`
--> $DIR/binop-move-semantics.rs:14:5
|
+LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) {
+ | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | x
| - value moved here
LL | +
LL | x.clone();
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
+ | ^ value borrowed here after move
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/binop-move-semantics.rs:21:5
|
LL | let m = &x;
- | - borrow of `x` occurs here
+ | -- borrow of `x` occurs here
...
LL | x
| ^ move out of `x` occurs here
+...
+LL | use_mut(n); use_imm(m);
+ | - borrow later used here
error[E0505]: cannot move out of `y` because it is borrowed
--> $DIR/binop-move-semantics.rs:23:5
|
LL | let n = &mut y;
- | - borrow of `y` occurs here
+ | ------ borrow of `y` occurs here
...
LL | y;
| ^ move out of `y` occurs here
+LL | use_mut(n); use_imm(m);
+ | - borrow later used here
error[E0507]: cannot move out of borrowed content
--> $DIR/binop-move-semantics.rs:30:5
@@ -51,28 +60,34 @@
| ^^ cannot move out of borrowed content
error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
- --> $DIR/binop-move-semantics.rs:54:6
+ --> $DIR/binop-move-semantics.rs:54:5
|
-LL | &mut f
- | - mutable borrow occurs here
-LL | +
-LL | &f;
- | ^
- | |
- | immutable borrow occurs here
- | mutable borrow ends here
+LL | &mut f
+ | ------
+ | |
+ | _____mutable borrow occurs here
+ | |
+LL | | +
+LL | | &f;
+ | | ^-
+ | |_____||
+ | |mutable borrow later used here
+ | immutable borrow occurs here
error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable
- --> $DIR/binop-move-semantics.rs:62:10
+ --> $DIR/binop-move-semantics.rs:62:5
|
-LL | &f
- | - immutable borrow occurs here
-LL | +
-LL | &mut f;
- | ^
- | |
- | mutable borrow occurs here
- | immutable borrow ends here
+LL | &f
+ | --
+ | |
+ | _____immutable borrow occurs here
+ | |
+LL | | +
+LL | | &mut f;
+ | | ^^^^^-
+ | |_____|____|
+ | | immutable borrow later used here
+ | mutable borrow occurs here
error: aborting due to 8 previous errors
diff --git a/src/test/ui/borrowck/assign_mutable_fields.nll.stderr b/src/test/ui/borrowck/assign_mutable_fields.nll.stderr
deleted file mode 100644
index 35101df..0000000
--- a/src/test/ui/borrowck/assign_mutable_fields.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0381]: assign to part of possibly uninitialized variable: `x`
- --> $DIR/assign_mutable_fields.rs:9:5
- |
-LL | x.0 = 1;
- | ^^^^^^^ use of possibly uninitialized `x`
-
-error[E0381]: assign to part of possibly uninitialized variable: `x`
- --> $DIR/assign_mutable_fields.rs:17:5
- |
-LL | x.0 = 1;
- | ^^^^^^^ use of possibly uninitialized `x`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/assign_mutable_fields.rs b/src/test/ui/borrowck/assign_mutable_fields.rs
index 85d6f3b..b60726d 100644
--- a/src/test/ui/borrowck/assign_mutable_fields.rs
+++ b/src/test/ui/borrowck/assign_mutable_fields.rs
@@ -1,22 +1,22 @@
-// Currently, we permit you to assign to individual fields of a mut
-// var, but we do not permit you to use the complete var afterwards.
+// Currently, we do permit you to assign to individual fields of an
+// uninitialized var.
// We hope to fix this at some point.
//
// FIXME(#54987)
fn assign_both_fields_and_use() {
let mut x: (u32, u32);
- x.0 = 1;
+ x.0 = 1; //~ ERROR
x.1 = 22;
- drop(x.0); //~ ERROR
- drop(x.1); //~ ERROR
+ drop(x.0);
+ drop(x.1);
}
fn assign_both_fields_the_use_var() {
let mut x: (u32, u32);
- x.0 = 1;
+ x.0 = 1; //~ ERROR
x.1 = 22;
- drop(x); //~ ERROR
+ drop(x);
}
fn main() { }
diff --git a/src/test/ui/borrowck/assign_mutable_fields.stderr b/src/test/ui/borrowck/assign_mutable_fields.stderr
index 904d2ed..35101df 100644
--- a/src/test/ui/borrowck/assign_mutable_fields.stderr
+++ b/src/test/ui/borrowck/assign_mutable_fields.stderr
@@ -1,21 +1,15 @@
-error[E0381]: use of possibly uninitialized variable: `x.0`
- --> $DIR/assign_mutable_fields.rs:11:10
+error[E0381]: assign to part of possibly uninitialized variable: `x`
+ --> $DIR/assign_mutable_fields.rs:9:5
|
-LL | drop(x.0);
- | ^^^ use of possibly uninitialized `x.0`
+LL | x.0 = 1;
+ | ^^^^^^^ use of possibly uninitialized `x`
-error[E0381]: use of possibly uninitialized variable: `x.1`
- --> $DIR/assign_mutable_fields.rs:12:10
+error[E0381]: assign to part of possibly uninitialized variable: `x`
+ --> $DIR/assign_mutable_fields.rs:17:5
|
-LL | drop(x.1);
- | ^^^ use of possibly uninitialized `x.1`
+LL | x.0 = 1;
+ | ^^^^^^^ use of possibly uninitialized `x`
-error[E0381]: use of possibly uninitialized variable: `x`
- --> $DIR/assign_mutable_fields.rs:19:10
- |
-LL | drop(x);
- | ^ use of possibly uninitialized `x`
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr
deleted file mode 100644
index 1796913..0000000
--- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr
+++ /dev/null
@@ -1,75 +0,0 @@
-error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
- --> $DIR/borrow-immutable-upvar-mutation.rs:15:27
- |
-LL | let _f = to_fn(|| x = 42);
- | ^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/borrow-immutable-upvar-mutation.rs:15:24
- |
-LL | let _f = to_fn(|| x = 42);
- | ^^^^^^^^^
-
-error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
- --> $DIR/borrow-immutable-upvar-mutation.rs:18:31
- |
-LL | let _g = to_fn(|| set(&mut y));
- | ^^^^^^ cannot borrow as mutable
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/borrow-immutable-upvar-mutation.rs:18:24
- |
-LL | let _g = to_fn(|| set(&mut y));
- | ^^^^^^^^^^^^^^
-
-error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
- --> $DIR/borrow-immutable-upvar-mutation.rs:21:55
- |
-LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
- | ^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/borrow-immutable-upvar-mutation.rs:21:52
- |
-LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
- | ^^^^^^^^^
-
-error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
- --> $DIR/borrow-immutable-upvar-mutation.rs:27:32
- |
-LL | let _f = to_fn(move || x = 42);
- | ^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/borrow-immutable-upvar-mutation.rs:27:24
- |
-LL | let _f = to_fn(move || x = 42);
- | ^^^^^^^^^^^^^^
-
-error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
- --> $DIR/borrow-immutable-upvar-mutation.rs:30:36
- |
-LL | let _g = to_fn(move || set(&mut y));
- | ^^^^^^ cannot borrow as mutable
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/borrow-immutable-upvar-mutation.rs:30:24
- |
-LL | let _g = to_fn(move || set(&mut y));
- | ^^^^^^^^^^^^^^^^^^^
-
-error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
- --> $DIR/borrow-immutable-upvar-mutation.rs:33:65
- |
-LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
- | ^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/borrow-immutable-upvar-mutation.rs:33:57
- |
-LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
- | ^^^^^^^^^^^^^^
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
index f979f38..1796913 100644
--- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
+++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
@@ -1,72 +1,70 @@
-error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
--> $DIR/borrow-immutable-upvar-mutation.rs:15:27
|
LL | let _f = to_fn(|| x = 42);
- | ^^^^^^
+ | ^^^^^^ cannot assign
|
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/borrow-immutable-upvar-mutation.rs:15:24
|
LL | let _f = to_fn(|| x = 42);
| ^^^^^^^^^
-error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
- --> $DIR/borrow-immutable-upvar-mutation.rs:18:36
+error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:18:31
|
LL | let _g = to_fn(|| set(&mut y));
- | ^
+ | ^^^^^^ cannot borrow as mutable
|
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/borrow-immutable-upvar-mutation.rs:18:24
|
LL | let _g = to_fn(|| set(&mut y));
| ^^^^^^^^^^^^^^
-error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
--> $DIR/borrow-immutable-upvar-mutation.rs:21:55
|
LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
- | ^^^^^^
+ | ^^^^^^ cannot assign
|
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/borrow-immutable-upvar-mutation.rs:21:52
|
LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
| ^^^^^^^^^
-error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
--> $DIR/borrow-immutable-upvar-mutation.rs:27:32
|
LL | let _f = to_fn(move || x = 42);
- | ^^^^^^
+ | ^^^^^^ cannot assign
|
- = note: `Fn` closures cannot capture their enclosing environment for modifications
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/borrow-immutable-upvar-mutation.rs:27:24
|
LL | let _f = to_fn(move || x = 42);
| ^^^^^^^^^^^^^^
-error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable
- --> $DIR/borrow-immutable-upvar-mutation.rs:30:41
+error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:30:36
|
LL | let _g = to_fn(move || set(&mut y));
- | ^
+ | ^^^^^^ cannot borrow as mutable
|
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/borrow-immutable-upvar-mutation.rs:30:24
|
LL | let _g = to_fn(move || set(&mut y));
| ^^^^^^^^^^^^^^^^^^^
-error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
--> $DIR/borrow-immutable-upvar-mutation.rs:33:65
|
LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
- | ^^^^^^
+ | ^^^^^^ cannot assign
|
- = note: `Fn` closures cannot capture their enclosing environment for modifications
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/borrow-immutable-upvar-mutation.rs:33:57
|
LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
@@ -74,5 +72,4 @@
error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0387, E0596.
-For more information about an error, try `rustc --explain E0387`.
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr
deleted file mode 100644
index 503ea49..0000000
--- a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr
+++ /dev/null
@@ -1,65 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrow-tuple-fields.rs:12:13
- |
-LL | let r = &x.0;
- | ---- borrow of `x.0` occurs here
-LL | let y = x;
- | ^ move out of `x` occurs here
-LL |
-LL | r.use_ref();
- | - borrow later used here
-
-error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
- --> $DIR/borrow-tuple-fields.rs:18:13
- |
-LL | let a = &x.0;
- | ---- immutable borrow occurs here
-LL | let b = &mut x.0;
- | ^^^^^^^^ mutable borrow occurs here
-LL | a.use_ref();
- | - immutable borrow later used here
-
-error[E0499]: cannot borrow `x.0` as mutable more than once at a time
- --> $DIR/borrow-tuple-fields.rs:23:13
- |
-LL | let a = &mut x.0;
- | -------- first mutable borrow occurs here
-LL | let b = &mut x.0;
- | ^^^^^^^^ second mutable borrow occurs here
-LL | a.use_ref();
- | - first borrow later used here
-
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrow-tuple-fields.rs:28:13
- |
-LL | let r = &x.0;
- | ---- borrow of `x.0` occurs here
-LL | let y = x;
- | ^ move out of `x` occurs here
-LL | r.use_ref();
- | - borrow later used here
-
-error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
- --> $DIR/borrow-tuple-fields.rs:33:13
- |
-LL | let a = &x.0;
- | ---- immutable borrow occurs here
-LL | let b = &mut x.0;
- | ^^^^^^^^ mutable borrow occurs here
-LL | a.use_ref();
- | - immutable borrow later used here
-
-error[E0499]: cannot borrow `x.0` as mutable more than once at a time
- --> $DIR/borrow-tuple-fields.rs:38:13
- |
-LL | let a = &mut x.0;
- | -------- first mutable borrow occurs here
-LL | let b = &mut x.0;
- | ^^^^^^^^ second mutable borrow occurs here
-LL | a.use_mut();
- | - first borrow later used here
-
-error: aborting due to 6 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0505.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrow-tuple-fields.stderr b/src/test/ui/borrowck/borrow-tuple-fields.stderr
index 8301756..503ea49 100644
--- a/src/test/ui/borrowck/borrow-tuple-fields.stderr
+++ b/src/test/ui/borrowck/borrow-tuple-fields.stderr
@@ -1,62 +1,63 @@
error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrow-tuple-fields.rs:12:9
+ --> $DIR/borrow-tuple-fields.rs:12:13
|
LL | let r = &x.0;
- | --- borrow of `x.0` occurs here
+ | ---- borrow of `x.0` occurs here
LL | let y = x;
- | ^ move out of `x` occurs here
+ | ^ move out of `x` occurs here
+LL |
+LL | r.use_ref();
+ | - borrow later used here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
- --> $DIR/borrow-tuple-fields.rs:18:18
+ --> $DIR/borrow-tuple-fields.rs:18:13
|
LL | let a = &x.0;
- | --- immutable borrow occurs here
+ | ---- immutable borrow occurs here
LL | let b = &mut x.0;
- | ^^^ mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
+ | ^^^^^^^^ mutable borrow occurs here
+LL | a.use_ref();
+ | - immutable borrow later used here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
- --> $DIR/borrow-tuple-fields.rs:23:18
+ --> $DIR/borrow-tuple-fields.rs:23:13
|
LL | let a = &mut x.0;
- | --- first mutable borrow occurs here
+ | -------- first mutable borrow occurs here
LL | let b = &mut x.0;
- | ^^^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | a.use_ref();
+ | - first borrow later used here
error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrow-tuple-fields.rs:28:9
+ --> $DIR/borrow-tuple-fields.rs:28:13
|
LL | let r = &x.0;
- | --- borrow of `x.0` occurs here
+ | ---- borrow of `x.0` occurs here
LL | let y = x;
- | ^ move out of `x` occurs here
+ | ^ move out of `x` occurs here
+LL | r.use_ref();
+ | - borrow later used here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
- --> $DIR/borrow-tuple-fields.rs:33:18
+ --> $DIR/borrow-tuple-fields.rs:33:13
|
LL | let a = &x.0;
- | --- immutable borrow occurs here
+ | ---- immutable borrow occurs here
LL | let b = &mut x.0;
- | ^^^ mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
+ | ^^^^^^^^ mutable borrow occurs here
+LL | a.use_ref();
+ | - immutable borrow later used here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
- --> $DIR/borrow-tuple-fields.rs:38:18
+ --> $DIR/borrow-tuple-fields.rs:38:13
|
LL | let a = &mut x.0;
- | --- first mutable borrow occurs here
+ | -------- first mutable borrow occurs here
LL | let b = &mut x.0;
- | ^^^ second mutable borrow occurs here
+ | ^^^^^^^^ second mutable borrow occurs here
LL | a.use_mut();
-LL | }
- | - first borrow ends here
+ | - first borrow later used here
error: aborting due to 6 previous errors
diff --git a/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr b/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr
deleted file mode 100644
index 12f9ad8..0000000
--- a/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr
+++ /dev/null
@@ -1,53 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-access-permissions.rs:12:19
- |
-LL | let x = 1;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | let _y1 = &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow immutable static item `static_x` as mutable
- --> $DIR/borrowck-access-permissions.rs:18:19
- |
-LL | let _y1 = &mut static_x;
- | ^^^^^^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable
- --> $DIR/borrowck-access-permissions.rs:27:19
- |
-LL | let box_x = Box::new(1);
- | ----- help: consider changing this to be mutable: `mut box_x`
-...
-LL | let _y1 = &mut *box_x;
- | ^^^^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-access-permissions.rs:36:19
- |
-LL | let ref_x = &x;
- | -- help: consider changing this to be a mutable reference: `&mut x`
-...
-LL | let _y1 = &mut *ref_x;
- | ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer
- --> $DIR/borrowck-access-permissions.rs:46:23
- |
-LL | let ptr_x : *const _ = &x;
- | -- help: consider changing this to be a mutable pointer: `&mut x`
-...
-LL | let _y1 = &mut *ptr_x;
- | ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-access-permissions.rs:56:18
- |
-LL | let foo_ref = &foo;
- | ---- help: consider changing this to be a mutable reference: `&mut foo`
-LL | let _y = &mut *foo_ref.f;
- | ^^^^^^^^^^^^^^^ `foo_ref` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr b/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr
deleted file mode 100644
index 10f8d5f..0000000
--- a/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr
+++ /dev/null
@@ -1,46 +0,0 @@
-error[E0596]: cannot borrow immutable local variable `x` as mutable
- --> $DIR/borrowck-access-permissions.rs:12:24
- |
-LL | let x = 1;
- | - help: make this binding mutable: `mut x`
-...
-LL | let _y1 = &mut x;
- | ^ cannot borrow mutably
-
-error[E0596]: cannot borrow immutable static item as mutable
- --> $DIR/borrowck-access-permissions.rs:18:24
- |
-LL | let _y1 = &mut static_x;
- | ^^^^^^^^
-
-error[E0596]: cannot borrow immutable `Box` content `*box_x` as mutable
- --> $DIR/borrowck-access-permissions.rs:27:24
- |
-LL | let box_x = Box::new(1);
- | ----- help: make this binding mutable: `mut box_x`
-...
-LL | let _y1 = &mut *box_x;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow immutable borrowed content `*ref_x` as mutable
- --> $DIR/borrowck-access-permissions.rs:36:24
- |
-LL | let _y1 = &mut *ref_x;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow immutable dereference of raw pointer `*ptr_x` as mutable
- --> $DIR/borrowck-access-permissions.rs:46:28
- |
-LL | let _y1 = &mut *ptr_x;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0389]: cannot borrow data mutably in a `&` reference
- --> $DIR/borrowck-access-permissions.rs:56:23
- |
-LL | let _y = &mut *foo_ref.f;
- | ^^^^^^^^^^ assignment into an immutable reference
-
-error: aborting due to 6 previous errors
-
-Some errors have detailed explanations: E0389, E0596.
-For more information about an error, try `rustc --explain E0389`.
diff --git a/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr b/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr
deleted file mode 100644
index 12f9ad8..0000000
--- a/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr
+++ /dev/null
@@ -1,53 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-access-permissions.rs:12:19
- |
-LL | let x = 1;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | let _y1 = &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow immutable static item `static_x` as mutable
- --> $DIR/borrowck-access-permissions.rs:18:19
- |
-LL | let _y1 = &mut static_x;
- | ^^^^^^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable
- --> $DIR/borrowck-access-permissions.rs:27:19
- |
-LL | let box_x = Box::new(1);
- | ----- help: consider changing this to be mutable: `mut box_x`
-...
-LL | let _y1 = &mut *box_x;
- | ^^^^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-access-permissions.rs:36:19
- |
-LL | let ref_x = &x;
- | -- help: consider changing this to be a mutable reference: `&mut x`
-...
-LL | let _y1 = &mut *ref_x;
- | ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer
- --> $DIR/borrowck-access-permissions.rs:46:23
- |
-LL | let ptr_x : *const _ = &x;
- | -- help: consider changing this to be a mutable pointer: `&mut x`
-...
-LL | let _y1 = &mut *ptr_x;
- | ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-access-permissions.rs:56:18
- |
-LL | let foo_ref = &foo;
- | ---- help: consider changing this to be a mutable reference: `&mut foo`
-LL | let _y = &mut *foo_ref.f;
- | ^^^^^^^^^^^^^^^ `foo_ref` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-access-permissions.rs b/src/test/ui/borrowck/borrowck-access-permissions.rs
index 993742f..469ad50 100644
--- a/src/test/ui/borrowck/borrowck-access-permissions.rs
+++ b/src/test/ui/borrowck/borrowck-access-permissions.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
static static_x : i32 = 1;
static mut static_x_mut : i32 = 1;
@@ -9,14 +6,12 @@
let mut x_mut = 1;
{ // borrow of local
- let _y1 = &mut x; //[ast]~ ERROR [E0596]
- //[mir]~^ ERROR [E0596]
+ let _y1 = &mut x; //~ ERROR [E0596]
let _y2 = &mut x_mut; // No error
}
{ // borrow of static
- let _y1 = &mut static_x; //[ast]~ ERROR [E0596]
- //[mir]~^ ERROR [E0596]
+ let _y1 = &mut static_x; //~ ERROR [E0596]
unsafe { let _y2 = &mut static_x_mut; } // No error
}
@@ -24,8 +19,7 @@
let box_x = Box::new(1);
let mut box_x_mut = Box::new(1);
- let _y1 = &mut *box_x; //[ast]~ ERROR [E0596]
- //[mir]~^ ERROR [E0596]
+ let _y1 = &mut *box_x; //~ ERROR [E0596]
let _y2 = &mut *box_x_mut; // No error
}
@@ -33,8 +27,7 @@
let ref_x = &x;
let ref_x_mut = &mut x_mut;
- let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596]
- //[mir]~^ ERROR [E0596]
+ let _y1 = &mut *ref_x; //~ ERROR [E0596]
let _y2 = &mut *ref_x_mut; // No error
}
@@ -43,8 +36,7 @@
let ptr_mut_x : *mut _ = &mut x_mut;
unsafe {
- let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596]
- //[mir]~^ ERROR [E0596]
+ let _y1 = &mut *ptr_x; //~ ERROR [E0596]
let _y2 = &mut *ptr_mut_x; // No error
}
}
@@ -53,8 +45,6 @@
struct Foo<'a> { f: &'a mut i32, g: &'a i32 };
let mut foo = Foo { f: &mut x_mut, g: &x };
let foo_ref = &foo;
- let _y = &mut *foo_ref.f; //[ast]~ ERROR [E0389]
- //[mir]~^ ERROR [E0596]
- // FIXME: Wrong error in MIR
+ let _y = &mut *foo_ref.f; //~ ERROR [E0596]
}
}
diff --git a/src/test/ui/borrowck/borrowck-access-permissions.stderr b/src/test/ui/borrowck/borrowck-access-permissions.stderr
new file mode 100644
index 0000000..e3a35c3
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-access-permissions.stderr
@@ -0,0 +1,53 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-access-permissions.rs:9:19
+ |
+LL | let x = 1;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | let _y1 = &mut x;
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable static item `static_x` as mutable
+ --> $DIR/borrowck-access-permissions.rs:14:19
+ |
+LL | let _y1 = &mut static_x;
+ | ^^^^^^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable
+ --> $DIR/borrowck-access-permissions.rs:22:19
+ |
+LL | let box_x = Box::new(1);
+ | ----- help: consider changing this to be mutable: `mut box_x`
+...
+LL | let _y1 = &mut *box_x;
+ | ^^^^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-access-permissions.rs:30:19
+ |
+LL | let ref_x = &x;
+ | -- help: consider changing this to be a mutable reference: `&mut x`
+...
+LL | let _y1 = &mut *ref_x;
+ | ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer
+ --> $DIR/borrowck-access-permissions.rs:39:23
+ |
+LL | let ptr_x : *const _ = &x;
+ | -- help: consider changing this to be a mutable pointer: `&mut x`
+...
+LL | let _y1 = &mut *ptr_x;
+ | ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
+
+error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-access-permissions.rs:48:18
+ |
+LL | let foo_ref = &foo;
+ | ---- help: consider changing this to be a mutable reference: `&mut foo`
+LL | let _y = &mut *foo_ref.f;
+ | ^^^^^^^^^^^^^^^ `foo_ref` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-and-init.nll.stderr b/src/test/ui/borrowck/borrowck-and-init.nll.stderr
deleted file mode 100644
index 2db0751..0000000
--- a/src/test/ui/borrowck/borrowck-and-init.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `i`
- --> $DIR/borrowck-and-init.rs:5:20
- |
-LL | println!("{}", i);
- | ^ use of possibly uninitialized `i`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-and-init.rs b/src/test/ui/borrowck/borrowck-and-init.rs
index ff076c5..4427e25 100644
--- a/src/test/ui/borrowck/borrowck-and-init.rs
+++ b/src/test/ui/borrowck/borrowck-and-init.rs
@@ -2,5 +2,5 @@
let i: isize;
println!("{}", false && { i = 5; true });
- println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
+ println!("{}", i); //~ ERROR borrow of possibly uninitialized variable: `i`
}
diff --git a/src/test/ui/borrowck/borrowck-and-init.stderr b/src/test/ui/borrowck/borrowck-and-init.stderr
index 13696ac..2db0751 100644
--- a/src/test/ui/borrowck/borrowck-and-init.stderr
+++ b/src/test/ui/borrowck/borrowck-and-init.stderr
@@ -1,4 +1,4 @@
-error[E0381]: use of possibly uninitialized variable: `i`
+error[E0381]: borrow of possibly uninitialized variable: `i`
--> $DIR/borrowck-and-init.rs:5:20
|
LL | println!("{}", i);
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr
deleted file mode 100644
index 7a959fb..0000000
--- a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0499]: cannot borrow `y.0` as mutable more than once at a time
- --> $DIR/borrowck-anon-fields-struct.rs:29:11
- |
-LL | Y(ref mut a, _) => a
- | --------- first mutable borrow occurs here
-...
-LL | Y(ref mut b, _) => b
- | ^^^^^^^^^ second mutable borrow occurs here
-...
-LL | *a += 1;
- | ------- first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr
index efe94de..7a959fb 100644
--- a/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr
+++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr
@@ -7,8 +7,8 @@
LL | Y(ref mut b, _) => b
| ^^^^^^^^^ second mutable borrow occurs here
...
-LL | }
- | - first borrow ends here
+LL | *a += 1;
+ | ------- first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr
deleted file mode 100644
index 88a8867..0000000
--- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0499]: cannot borrow `y.0` as mutable more than once at a time
- --> $DIR/borrowck-anon-fields-tuple.rs:27:10
- |
-LL | (ref mut a, _) => a
- | --------- first mutable borrow occurs here
-...
-LL | (ref mut b, _) => b
- | ^^^^^^^^^ second mutable borrow occurs here
-...
-LL | *a += 1;
- | ------- first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr
index 40f96cb..88a8867 100644
--- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr
+++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr
@@ -7,8 +7,8 @@
LL | (ref mut b, _) => b
| ^^^^^^^^^ second mutable borrow occurs here
...
-LL | }
- | - first borrow ends here
+LL | *a += 1;
+ | ------- first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr
deleted file mode 100644
index 649fe3e..0000000
--- a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-warning[E0503]: cannot use `y` because it was mutably borrowed
- --> $DIR/borrowck-anon-fields-variant.rs:17:7
- |
-LL | Foo::Y(ref mut a, _) => a,
- | --------- borrow of `y.0` occurs here
-...
-LL | Foo::Y(_, ref mut b) => b,
- | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
-...
-LL | *a += 1;
- | ------- borrow later used here
- |
- = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
- = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
-error[E0503]: cannot use `y` because it was mutably borrowed
- --> $DIR/borrowck-anon-fields-variant.rs:34:7
- |
-LL | Foo::Y(ref mut a, _) => a,
- | --------- borrow of `y.0` occurs here
-...
-LL | Foo::Y(ref mut b, _) => b,
- | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
-...
-LL | *a += 1;
- | ------- borrow later used here
-
-error[E0499]: cannot borrow `y.0` as mutable more than once at a time
- --> $DIR/borrowck-anon-fields-variant.rs:34:14
- |
-LL | Foo::Y(ref mut a, _) => a,
- | --------- first mutable borrow occurs here
-...
-LL | Foo::Y(ref mut b, _) => b,
- | ^^^^^^^^^ second mutable borrow occurs here
-...
-LL | *a += 1;
- | ------- first borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0499, E0503.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.rs b/src/test/ui/borrowck/borrowck-anon-fields-variant.rs
index c274356..695809f 100644
--- a/src/test/ui/borrowck/borrowck-anon-fields-variant.rs
+++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.rs
@@ -1,6 +1,3 @@
-// Tests that we are able to distinguish when loans borrow different
-// anonymous fields of an enum variant vs the same anonymous field.
-
enum Foo {
X, Y(usize, usize)
}
@@ -13,8 +10,14 @@
Foo::X => panic!()
};
+ // While `a` and `b` are disjoint, borrowck doesn't know that `a` is not
+ // also used for the discriminant of `Foo`, which it would be if `a` was a
+ // reference.
let b = match y {
Foo::Y(_, ref mut b) => b,
+ //~^ WARNING cannot use `y`
+ //~| WARNING this error has been downgraded to a warning
+ //~| WARNING this warning will become a hard error in the future
Foo::X => panic!()
};
@@ -31,7 +34,8 @@
};
let b = match y {
- Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow
+ Foo::Y(ref mut b, _) => b, //~ ERROR cannot use `y`
+ //~| ERROR cannot borrow `y.0` as mutable
Foo::X => panic!()
};
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr
index 2835cab..5e86dcb 100644
--- a/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr
+++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr
@@ -1,5 +1,32 @@
+warning[E0503]: cannot use `y` because it was mutably borrowed
+ --> $DIR/borrowck-anon-fields-variant.rs:17:7
+ |
+LL | Foo::Y(ref mut a, _) => a,
+ | --------- borrow of `y.0` occurs here
+...
+LL | Foo::Y(_, ref mut b) => b,
+ | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
+...
+LL | *a += 1;
+ | ------- borrow later used here
+ |
+ = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+ = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+error[E0503]: cannot use `y` because it was mutably borrowed
+ --> $DIR/borrowck-anon-fields-variant.rs:37:7
+ |
+LL | Foo::Y(ref mut a, _) => a,
+ | --------- borrow of `y.0` occurs here
+...
+LL | Foo::Y(ref mut b, _) => b,
+ | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
error[E0499]: cannot borrow `y.0` as mutable more than once at a time
- --> $DIR/borrowck-anon-fields-variant.rs:34:14
+ --> $DIR/borrowck-anon-fields-variant.rs:37:14
|
LL | Foo::Y(ref mut a, _) => a,
| --------- first mutable borrow occurs here
@@ -7,9 +34,10 @@
LL | Foo::Y(ref mut b, _) => b,
| ^^^^^^^^^ second mutable borrow occurs here
...
-LL | }
- | - first borrow ends here
+LL | *a += 1;
+ | ------- first borrow later used here
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0499`.
+Some errors have detailed explanations: E0499, E0503.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-argument.nll.stderr b/src/test/ui/borrowck/borrowck-argument.nll.stderr
deleted file mode 100644
index cf15833..0000000
--- a/src/test/ui/borrowck/borrowck-argument.nll.stderr
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-argument.rs:10:5
- |
-LL | fn func(arg: S) {
- | --- help: consider changing this to be mutable: `mut arg`
-LL | arg.mutate();
- | ^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-argument.rs:15:9
- |
-LL | fn method(&self, arg: S) {
- | --- help: consider changing this to be mutable: `mut arg`
-LL | arg.mutate();
- | ^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-argument.rs:21:9
- |
-LL | fn default(&self, arg: S) {
- | --- help: consider changing this to be mutable: `mut arg`
-LL | arg.mutate();
- | ^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-argument.rs:32:17
- |
-LL | (|arg: S| { arg.mutate() })(s);
- | --- ^^^ cannot borrow as mutable
- | |
- | help: consider changing this to be mutable: `mut arg`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-argument.rs b/src/test/ui/borrowck/borrowck-argument.rs
index e1f1ade..5d776d4 100644
--- a/src/test/ui/borrowck/borrowck-argument.rs
+++ b/src/test/ui/borrowck/borrowck-argument.rs
@@ -7,18 +7,18 @@
}
fn func(arg: S) {
- arg.mutate(); //~ ERROR: cannot borrow immutable argument
+ arg.mutate(); //~ ERROR: cannot borrow `arg` as mutable, as it is not declared as mutable
}
impl S {
fn method(&self, arg: S) {
- arg.mutate(); //~ ERROR: cannot borrow immutable argument
+ arg.mutate(); //~ ERROR: cannot borrow `arg` as mutable, as it is not declared as mutable
}
}
trait T {
fn default(&self, arg: S) {
- arg.mutate(); //~ ERROR: cannot borrow immutable argument
+ arg.mutate(); //~ ERROR: cannot borrow `arg` as mutable, as it is not declared as mutable
}
}
@@ -29,5 +29,6 @@
func(s);
s.method(s);
s.default(s);
- (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument
+ (|arg: S| { arg.mutate() })(s);
+ //~^ ERROR: cannot borrow `arg` as mutable, as it is not declared as mutable
}
diff --git a/src/test/ui/borrowck/borrowck-argument.stderr b/src/test/ui/borrowck/borrowck-argument.stderr
index 6c9c411..cf15833 100644
--- a/src/test/ui/borrowck/borrowck-argument.stderr
+++ b/src/test/ui/borrowck/borrowck-argument.stderr
@@ -1,34 +1,34 @@
-error[E0596]: cannot borrow immutable argument `arg` as mutable
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:10:5
|
LL | fn func(arg: S) {
- | --- help: make this binding mutable: `mut arg`
+ | --- help: consider changing this to be mutable: `mut arg`
LL | arg.mutate();
- | ^^^ cannot borrow mutably
+ | ^^^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable argument `arg` as mutable
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:15:9
|
LL | fn method(&self, arg: S) {
- | --- help: make this binding mutable: `mut arg`
+ | --- help: consider changing this to be mutable: `mut arg`
LL | arg.mutate();
- | ^^^ cannot borrow mutably
+ | ^^^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable argument `arg` as mutable
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:21:9
|
LL | fn default(&self, arg: S) {
- | --- help: make this binding mutable: `mut arg`
+ | --- help: consider changing this to be mutable: `mut arg`
LL | arg.mutate();
- | ^^^ cannot borrow mutably
+ | ^^^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable argument `arg` as mutable
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:32:17
|
LL | (|arg: S| { arg.mutate() })(s);
- | --- ^^^ cannot borrow mutably
+ | --- ^^^ cannot borrow as mutable
| |
- | help: make this binding mutable: `mut arg`
+ | help: consider changing this to be mutable: `mut arg`
error: aborting due to 4 previous errors
diff --git a/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr b/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr
deleted file mode 100644
index 3fb1c9b..0000000
--- a/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-asm.rs:27:17
- |
-LL | let x = &mut 0isize;
- | - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
-LL | unsafe {
-LL | asm!("nop" : : "r"(x));
- | - value moved here
-LL | }
-LL | let z = x;
- | ^ value used here after move
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-asm.rs:35:32
- |
-LL | let y = &mut x;
- | ------ borrow of `x` occurs here
-LL | unsafe {
-LL | asm!("nop" : : "r"(x));
- | ^ use of borrowed `x`
-...
-LL | let z = y;
- | - borrow later used here
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:44:31
- |
-LL | let x = 3;
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | unsafe {
-LL | asm!("nop" : "=r"(x));
- | ^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:60:31
- |
-LL | let x = 3;
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | unsafe {
-LL | asm!("nop" : "+r"(x));
- | ^ cannot assign twice to immutable variable
-
-error[E0381]: use of possibly uninitialized variable: `x`
- --> $DIR/borrowck-asm.rs:68:32
- |
-LL | asm!("nop" : "=*r"(x));
- | ^ use of possibly uninitialized `x`
-
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-asm.rs:77:31
- |
-LL | let y = &*x;
- | --- borrow of `x` occurs here
-LL | unsafe {
-LL | asm!("nop" : "+r"(x));
- | ^ assignment to borrowed `x` occurs here
-...
-LL | let z = y;
- | - borrow later used here
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-asm.rs:86:40
- |
-LL | let x = &mut 2;
- | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
-LL | unsafe {
-LL | asm!("nop" : : "r"(x), "r"(x) );
- | - ^ value used here after move
- | |
- | value moved here
-
-error: aborting due to 7 previous errors
-
-Some errors have detailed explanations: E0381, E0382, E0384, E0503, E0506.
-For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-asm.ast.stderr b/src/test/ui/borrowck/borrowck-asm.ast.stderr
deleted file mode 100644
index 6d56806..0000000
--- a/src/test/ui/borrowck/borrowck-asm.ast.stderr
+++ /dev/null
@@ -1,76 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-asm.rs:27:13
- |
-LL | asm!("nop" : : "r"(x));
- | - value moved here
-LL | }
-LL | let z = x;
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-asm.rs:35:32
- |
-LL | let y = &mut x;
- | - borrow of `x` occurs here
-LL | unsafe {
-LL | asm!("nop" : : "r"(x));
- | ^ use of borrowed `x`
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:44:31
- |
-LL | let x = 3;
- | - first assignment to `x`
-LL | unsafe {
-LL | asm!("nop" : "=r"(x));
- | ^ cannot assign twice to immutable variable
-
-error[E0506]: cannot assign to `a` because it is borrowed
- --> $DIR/borrowck-asm.rs:50:31
- |
-LL | let b = &*a;
- | -- borrow of `a` occurs here
-LL | unsafe {
-LL | asm!("nop" : "=r"(a));
- | ^ assignment to borrowed `a` occurs here
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:60:31
- |
-LL | let x = 3;
- | - first assignment to `x`
-LL | unsafe {
-LL | asm!("nop" : "+r"(x));
- | ^ cannot assign twice to immutable variable
-
-error[E0381]: use of possibly uninitialized variable: `x`
- --> $DIR/borrowck-asm.rs:68:32
- |
-LL | asm!("nop" : "=*r"(x));
- | ^ use of possibly uninitialized `x`
-
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-asm.rs:77:31
- |
-LL | let y = &*x;
- | -- borrow of `x` occurs here
-LL | unsafe {
-LL | asm!("nop" : "+r"(x));
- | ^ assignment to borrowed `x` occurs here
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-asm.rs:86:40
- |
-LL | asm!("nop" : : "r"(x), "r"(x) );
- | - ^ value used here after move
- | |
- | value moved here
- |
- = note: move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0381, E0382, E0384, E0503, E0506.
-For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-asm.mir.stderr b/src/test/ui/borrowck/borrowck-asm.mir.stderr
deleted file mode 100644
index 3fb1c9b..0000000
--- a/src/test/ui/borrowck/borrowck-asm.mir.stderr
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-asm.rs:27:17
- |
-LL | let x = &mut 0isize;
- | - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
-LL | unsafe {
-LL | asm!("nop" : : "r"(x));
- | - value moved here
-LL | }
-LL | let z = x;
- | ^ value used here after move
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-asm.rs:35:32
- |
-LL | let y = &mut x;
- | ------ borrow of `x` occurs here
-LL | unsafe {
-LL | asm!("nop" : : "r"(x));
- | ^ use of borrowed `x`
-...
-LL | let z = y;
- | - borrow later used here
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:44:31
- |
-LL | let x = 3;
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | unsafe {
-LL | asm!("nop" : "=r"(x));
- | ^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:60:31
- |
-LL | let x = 3;
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | unsafe {
-LL | asm!("nop" : "+r"(x));
- | ^ cannot assign twice to immutable variable
-
-error[E0381]: use of possibly uninitialized variable: `x`
- --> $DIR/borrowck-asm.rs:68:32
- |
-LL | asm!("nop" : "=*r"(x));
- | ^ use of possibly uninitialized `x`
-
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-asm.rs:77:31
- |
-LL | let y = &*x;
- | --- borrow of `x` occurs here
-LL | unsafe {
-LL | asm!("nop" : "+r"(x));
- | ^ assignment to borrowed `x` occurs here
-...
-LL | let z = y;
- | - borrow later used here
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-asm.rs:86:40
- |
-LL | let x = &mut 2;
- | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
-LL | unsafe {
-LL | asm!("nop" : : "r"(x), "r"(x) );
- | - ^ value used here after move
- | |
- | value moved here
-
-error: aborting due to 7 previous errors
-
-Some errors have detailed explanations: E0381, E0382, E0384, E0503, E0506.
-For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-asm.rs b/src/test/ui/borrowck/borrowck-asm.rs
index 560c87c..9c9cc04 100644
--- a/src/test/ui/borrowck/borrowck-asm.rs
+++ b/src/test/ui/borrowck/borrowck-asm.rs
@@ -6,9 +6,6 @@
// ignore-sparc
// ignore-sparc64
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(asm)]
#[cfg(any(target_arch = "x86",
@@ -24,16 +21,14 @@
unsafe {
asm!("nop" : : "r"(x));
}
- let z = x; //[ast]~ ERROR use of moved value: `x`
- //[mir]~^ ERROR use of moved value: `x`
+ let z = x; //~ ERROR use of moved value: `x`
}
fn in_is_read() {
let mut x = 3;
let y = &mut x;
unsafe {
- asm!("nop" : : "r"(x)); //[ast]~ ERROR cannot use
- //[mir]~^ ERROR cannot use
+ asm!("nop" : : "r"(x)); //~ ERROR cannot use
}
let z = y;
}
@@ -41,14 +36,12 @@
fn out_is_assign() {
let x = 3;
unsafe {
- asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice
- //[mir]~^ ERROR cannot assign twice
+ asm!("nop" : "=r"(x)); //~ ERROR cannot assign twice
}
let mut a = &mut 3;
let b = &*a;
unsafe {
- asm!("nop" : "=r"(a)); //[ast]~ ERROR cannot assign to `a` because it is borrowed
- // No MIR error, this is a shallow write.
+ asm!("nop" : "=r"(a)); // OK, Shallow write to `a`
}
let c = b;
let d = *a;
@@ -57,16 +50,14 @@
fn rw_is_assign() {
let x = 3;
unsafe {
- asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice
- //[mir]~^ ERROR cannot assign twice
+ asm!("nop" : "+r"(x)); //~ ERROR cannot assign twice
}
}
fn indirect_is_not_init() {
let x: i32;
unsafe {
- asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable
- //[mir]~^ ERROR use of possibly uninitialized variable
+ asm!("nop" : "=*r"(x)); //~ ERROR use of possibly uninitialized variable
}
}
@@ -74,8 +65,7 @@
let mut x = &mut 3;
let y = &*x;
unsafe {
- asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed
- //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+ asm!("nop" : "+r"(x)); //~ ERROR cannot assign to `x` because it is borrowed
}
let z = y;
}
@@ -83,8 +73,7 @@
fn two_moves() {
let x = &mut 2;
unsafe {
- asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value
- //[mir]~^ ERROR use of moved value
+ asm!("nop" : : "r"(x), "r"(x) ); //~ ERROR use of moved value
}
}
}
diff --git a/src/test/ui/borrowck/borrowck-asm.stderr b/src/test/ui/borrowck/borrowck-asm.stderr
new file mode 100644
index 0000000..c771373
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-asm.stderr
@@ -0,0 +1,81 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-asm.rs:24:17
+ |
+LL | let x = &mut 0isize;
+ | - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
+LL | unsafe {
+LL | asm!("nop" : : "r"(x));
+ | - value moved here
+LL | }
+LL | let z = x;
+ | ^ value used here after move
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-asm.rs:31:32
+ |
+LL | let y = &mut x;
+ | ------ borrow of `x` occurs here
+LL | unsafe {
+LL | asm!("nop" : : "r"(x));
+ | ^ use of borrowed `x`
+LL | }
+LL | let z = y;
+ | - borrow later used here
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-asm.rs:39:31
+ |
+LL | let x = 3;
+ | -
+ | |
+ | first assignment to `x`
+ | help: make this binding mutable: `mut x`
+LL | unsafe {
+LL | asm!("nop" : "=r"(x));
+ | ^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-asm.rs:53:31
+ |
+LL | let x = 3;
+ | -
+ | |
+ | first assignment to `x`
+ | help: make this binding mutable: `mut x`
+LL | unsafe {
+LL | asm!("nop" : "+r"(x));
+ | ^ cannot assign twice to immutable variable
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-asm.rs:60:32
+ |
+LL | asm!("nop" : "=*r"(x));
+ | ^ use of possibly uninitialized `x`
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-asm.rs:68:31
+ |
+LL | let y = &*x;
+ | --- borrow of `x` occurs here
+LL | unsafe {
+LL | asm!("nop" : "+r"(x));
+ | ^ assignment to borrowed `x` occurs here
+LL | }
+LL | let z = y;
+ | - borrow later used here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-asm.rs:76:40
+ |
+LL | let x = &mut 2;
+ | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
+LL | unsafe {
+LL | asm!("nop" : : "r"(x), "r"(x) );
+ | - ^ value used here after move
+ | |
+ | value moved here
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0381, E0382, E0384, E0503, E0506.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr
deleted file mode 100644
index 93f1d8c..0000000
--- a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-assign-comp-idx.rs:12:5
- |
-LL | let q: &isize = &p[0];
- | - immutable borrow occurs here
-LL |
-LL | p[0] = 5;
- | ^ mutable borrow occurs here
-LL |
-LL | println!("{}", *q);
- | -- immutable borrow later used here
-
-error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-assign-comp-idx.rs:27:9
- |
-LL | borrow(
- | ------ immutable borrow later used by call
-LL | &p,
- | -- immutable borrow occurs here
-LL | || p[0] = 5);
- | ^^ - second borrow occurs due to use of `p` in closure
- | |
- | mutable borrow occurs here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr
index 0d092e6..93f1d8c 100644
--- a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr
+++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr
@@ -6,19 +6,20 @@
LL |
LL | p[0] = 5;
| ^ mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
+LL |
+LL | println!("{}", *q);
+ | -- immutable borrow later used here
error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-assign-comp-idx.rs:27:9
|
+LL | borrow(
+ | ------ immutable borrow later used by call
LL | &p,
- | - immutable borrow occurs here
+ | -- immutable borrow occurs here
LL | || p[0] = 5);
- | ^^ - - immutable borrow ends here
- | | |
- | | borrow occurs due to use of `p` in closure
+ | ^^ - second borrow occurs due to use of `p` in closure
+ | |
| mutable borrow occurs here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr b/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr
deleted file mode 100644
index 53af41c..0000000
--- a/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0506]: cannot assign to `p.x` because it is borrowed
- --> $DIR/borrowck-assign-comp.rs:13:5
- |
-LL | let q = &p;
- | -- borrow of `p.x` occurs here
-...
-LL | p.x = 5;
- | ^^^^^^^ assignment to borrowed `p.x` occurs here
-LL |
-LL | q.x;
- | --- borrow later used here
-
-error[E0506]: cannot assign to `p` because it is borrowed
- --> $DIR/borrowck-assign-comp.rs:24:5
- |
-LL | let q = &p.y;
- | ---- borrow of `p` occurs here
-LL | p = Point {x: 5, y: 7};
- | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
-...
-LL | *q; // stretch loan
- | -- borrow later used here
-
-error[E0506]: cannot assign to `p.y` because it is borrowed
- --> $DIR/borrowck-assign-comp.rs:36:5
- |
-LL | let q = &p.y;
- | ---- borrow of `p.y` occurs here
-LL | p.y = 5;
- | ^^^^^^^ assignment to borrowed `p.y` occurs here
-LL |
-LL | *q;
- | -- borrow later used here
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr b/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr
deleted file mode 100644
index 4adb19c..0000000
--- a/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0506]: cannot assign to `p.x` because it is borrowed
- --> $DIR/borrowck-assign-comp.rs:13:5
- |
-LL | let q = &p;
- | - borrow of `p.x` occurs here
-...
-LL | p.x = 5;
- | ^^^^^^^ assignment to borrowed `p.x` occurs here
-
-error[E0506]: cannot assign to `p` because it is borrowed
- --> $DIR/borrowck-assign-comp.rs:24:5
- |
-LL | let q = &p.y;
- | --- borrow of `p` occurs here
-LL | p = Point {x: 5, y: 7};
- | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
-
-error[E0506]: cannot assign to `p.y` because it is borrowed
- --> $DIR/borrowck-assign-comp.rs:36:5
- |
-LL | let q = &p.y;
- | --- borrow of `p.y` occurs here
-LL | p.y = 5;
- | ^^^^^^^ assignment to borrowed `p.y` occurs here
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr b/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr
deleted file mode 100644
index 53af41c..0000000
--- a/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0506]: cannot assign to `p.x` because it is borrowed
- --> $DIR/borrowck-assign-comp.rs:13:5
- |
-LL | let q = &p;
- | -- borrow of `p.x` occurs here
-...
-LL | p.x = 5;
- | ^^^^^^^ assignment to borrowed `p.x` occurs here
-LL |
-LL | q.x;
- | --- borrow later used here
-
-error[E0506]: cannot assign to `p` because it is borrowed
- --> $DIR/borrowck-assign-comp.rs:24:5
- |
-LL | let q = &p.y;
- | ---- borrow of `p` occurs here
-LL | p = Point {x: 5, y: 7};
- | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
-...
-LL | *q; // stretch loan
- | -- borrow later used here
-
-error[E0506]: cannot assign to `p.y` because it is borrowed
- --> $DIR/borrowck-assign-comp.rs:36:5
- |
-LL | let q = &p.y;
- | ---- borrow of `p.y` occurs here
-LL | p.y = 5;
- | ^^^^^^^ assignment to borrowed `p.y` occurs here
-LL |
-LL | *q;
- | -- borrow later used here
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-assign-comp.rs b/src/test/ui/borrowck/borrowck-assign-comp.rs
index 0cacc38..98bb2d8 100644
--- a/src/test/ui/borrowck/borrowck-assign-comp.rs
+++ b/src/test/ui/borrowck/borrowck-assign-comp.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
struct Point { x: isize, y: isize }
fn a() {
@@ -10,8 +7,7 @@
// This assignment is illegal because the field x is not
// inherently mutable; since `p` was made immutable, `p.x` is now
// immutable. Otherwise the type of &_q.x (&isize) would be wrong.
- p.x = 5; //[ast]~ ERROR cannot assign to `p.x`
- //[mir]~^ ERROR cannot assign to `p.x` because it is borrowed
+ p.x = 5; //~ ERROR cannot assign to `p.x` because it is borrowed
q.x;
}
@@ -21,8 +17,7 @@
let mut p = Point {x: 3, y: 4};
let q = &p.y;
- p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
- //[mir]~^ ERROR cannot assign to `p` because it is borrowed
+ p = Point {x: 5, y: 7};//~ ERROR cannot assign to `p` because it is borrowed
p.x; // silence warning
*q; // stretch loan
}
@@ -33,8 +28,7 @@
let mut p = Point {x: 3, y: 4};
let q = &p.y;
- p.y = 5; //[ast]~ ERROR cannot assign to `p.y`
- //[mir]~^ ERROR cannot assign to `p.y` because it is borrowed
+ p.y = 5; //~ ERROR cannot assign to `p.y` because it is borrowed
*q;
}
diff --git a/src/test/ui/borrowck/borrowck-assign-comp.stderr b/src/test/ui/borrowck/borrowck-assign-comp.stderr
new file mode 100644
index 0000000..2b7cef7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-comp.stderr
@@ -0,0 +1,35 @@
+error[E0506]: cannot assign to `p.x` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:10:5
+ |
+LL | let q = &p;
+ | -- borrow of `p.x` occurs here
+...
+LL | p.x = 5;
+ | ^^^^^^^ assignment to borrowed `p.x` occurs here
+LL | q.x;
+ | --- borrow later used here
+
+error[E0506]: cannot assign to `p` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:20:5
+ |
+LL | let q = &p.y;
+ | ---- borrow of `p` occurs here
+LL | p = Point {x: 5, y: 7};
+ | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
+LL | p.x; // silence warning
+LL | *q; // stretch loan
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `p.y` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:31:5
+ |
+LL | let q = &p.y;
+ | ---- borrow of `p.y` occurs here
+LL | p.y = 5;
+ | ^^^^^^^ assignment to borrowed `p.y` occurs here
+LL | *q;
+ | -- borrow later used here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr
deleted file mode 100644
index 38fcfbf..0000000
--- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference
- --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:9:5
- |
-LL | fn a(s: &S) {
- | -- help: consider changing this to be a mutable reference: `&mut S<'_>`
-LL | *s.pointer += 1;
- | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference
- --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:17:5
- |
-LL | fn c(s: & &mut S) {
- | -------- help: consider changing this to be a mutable reference: `&mut &mut S<'_>`
-LL | *s.pointer += 1;
- | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr
index 5ec1ff2..38fcfbf 100644
--- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr
+++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr
@@ -1,19 +1,18 @@
-error[E0389]: cannot assign to data in a `&` reference
+error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference
--> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:9:5
|
LL | fn a(s: &S) {
- | -- use `&mut S` here to make mutable
+ | -- help: consider changing this to be a mutable reference: `&mut S<'_>`
LL | *s.pointer += 1;
- | ^^^^^^^^^^^^^^^ assignment into an immutable reference
+ | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
-error[E0389]: cannot assign to data in a `&` reference
+error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference
--> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:17:5
|
LL | fn c(s: & &mut S) {
- | -------- use `&mut &mut S` here to make mutable
+ | -------- help: consider changing this to be a mutable reference: `&mut &mut S<'_>`
LL | *s.pointer += 1;
- | ^^^^^^^^^^^^^^^ assignment into an immutable reference
+ | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0389`.
diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr
deleted file mode 100644
index d6bd32a..0000000
--- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
- --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
- |
-LL | let z = copy_borrowed_ptr(&mut y);
- | ------ borrow of `y` occurs here
-LL | *y.pointer += 1;
- | ^^^^^^^^^^^^^^^ use of borrowed `y`
-LL | *z.pointer += 1;
- | --------------- borrow later used here
-
-error[E0506]: cannot assign to `*y.pointer` because it is borrowed
- --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
- |
-LL | let z = copy_borrowed_ptr(&mut y);
- | ------ borrow of `*y.pointer` occurs here
-LL | *y.pointer += 1;
- | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
-LL | *z.pointer += 1;
- | --------------- borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0503, E0506.
-For more information about an error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs
index 98080d4..f7aee2b 100644
--- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs
+++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs
@@ -15,7 +15,9 @@
{
let mut y = S { pointer: &mut x };
let z = copy_borrowed_ptr(&mut y);
- *y.pointer += 1; //~ ERROR cannot assign
+ *y.pointer += 1;
+ //~^ ERROR cannot use `*y.pointer`
+ //~| ERROR cannot assign to `*y.pointer`
*z.pointer += 1;
}
}
diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr
index 10d6ac5..0b21d11 100644
--- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr
+++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr
@@ -1,11 +1,26 @@
+error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
+ --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
+ |
+LL | let z = copy_borrowed_ptr(&mut y);
+ | ------ borrow of `y` occurs here
+LL | *y.pointer += 1;
+ | ^^^^^^^^^^^^^^^ use of borrowed `y`
+...
+LL | *z.pointer += 1;
+ | --------------- borrow later used here
+
error[E0506]: cannot assign to `*y.pointer` because it is borrowed
--> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9
|
LL | let z = copy_borrowed_ptr(&mut y);
- | - borrow of `*y.pointer` occurs here
+ | ------ borrow of `*y.pointer` occurs here
LL | *y.pointer += 1;
| ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
+...
+LL | *z.pointer += 1;
+ | --------------- borrow later used here
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0506`.
+Some errors have detailed explanations: E0503, E0506.
+For more information about an error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr
deleted file mode 100644
index 703a922..0000000
--- a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error[E0594]: cannot assign to immutable static item `foo`
- --> $DIR/borrowck-assign-to-constants.rs:8:5
- |
-LL | foo = 6;
- | ^^^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr
deleted file mode 100644
index 98ff53e..0000000
--- a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error[E0594]: cannot assign to immutable static item
- --> $DIR/borrowck-assign-to-constants.rs:8:5
- |
-LL | foo = 6;
- | ^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr
deleted file mode 100644
index 703a922..0000000
--- a/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error[E0594]: cannot assign to immutable static item `foo`
- --> $DIR/borrowck-assign-to-constants.rs:8:5
- |
-LL | foo = 6;
- | ^^^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.rs b/src/test/ui/borrowck/borrowck-assign-to-constants.rs
index 768b2a5..5881dcc 100644
--- a/src/test/ui/borrowck/borrowck-assign-to-constants.rs
+++ b/src/test/ui/borrowck/borrowck-assign-to-constants.rs
@@ -1,10 +1,6 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
static foo: isize = 5;
fn main() {
// assigning to various global constants
- foo = 6; //[ast]~ ERROR cannot assign to immutable static item
- //[mir]~^ ERROR cannot assign to immutable static item `foo`
+ foo = 6; //~ ERROR cannot assign to immutable static item `foo`
}
diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.stderr
new file mode 100644
index 0000000..800003c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-to-constants.stderr
@@ -0,0 +1,8 @@
+error[E0594]: cannot assign to immutable static item `foo`
+ --> $DIR/borrowck-assign-to-constants.rs:5:5
+ |
+LL | foo = 6;
+ | ^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr
deleted file mode 100644
index 3ed76c1..0000000
--- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:15:5
- |
-LL | let x = Foo { x: 3 };
- | - help: consider changing this to be mutable: `mut x`
-LL | x.printme();
- | ^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
index 759b778..3ed76c1 100644
--- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
+++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
@@ -1,10 +1,10 @@
-error[E0596]: cannot borrow immutable local variable `x` as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:15:5
|
LL | let x = Foo { x: 3 };
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | x.printme();
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr
deleted file mode 100644
index c2dfb68..0000000
--- a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-autoref-3261.rs:15:9
- |
-LL | (&mut x).with(
- | -------- ---- first borrow later used by call
- | |
- | first mutable borrow occurs here
-LL | |opt| {
- | ^^^^^ second mutable borrow occurs here
-...
-LL | x = X(Either::Left((0, 0)));
- | - second borrow occurs due to use of `x` in closure
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.stderr
index 280704a..c2dfb68 100644
--- a/src/test/ui/borrowck/borrowck-autoref-3261.stderr
+++ b/src/test/ui/borrowck/borrowck-autoref-3261.stderr
@@ -2,15 +2,14 @@
--> $DIR/borrowck-autoref-3261.rs:15:9
|
LL | (&mut x).with(
- | - first mutable borrow occurs here
+ | -------- ---- first borrow later used by call
+ | |
+ | first mutable borrow occurs here
LL | |opt| {
| ^^^^^ second mutable borrow occurs here
...
LL | x = X(Either::Left((0, 0)));
- | - borrow occurs due to use of `x` in closure
-...
-LL | })
- | - first borrow ends here
+ | - second borrow occurs due to use of `x` in closure
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr
deleted file mode 100644
index e273a77..0000000
--- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-bad-nested-calls-free.rs:25:17
- |
-LL | add(
- | --- immutable borrow later used by call
-LL | &*a,
- | --- immutable borrow occurs here
-LL | rewrite(&mut a));
- | ^^^^^^ mutable borrow occurs here
-
-error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-bad-nested-calls-free.rs:32:17
- |
-LL | add(
- | --- immutable borrow later used by call
-LL | &*a,
- | --- immutable borrow occurs here
-LL | rewrite(&mut a));
- | ^^^^^^ mutable borrow occurs here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr
index 06ec2bd..e273a77 100644
--- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr
+++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr
@@ -1,22 +1,22 @@
-error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immutable
- --> $DIR/borrowck-bad-nested-calls-free.rs:25:22
+error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-bad-nested-calls-free.rs:25:17
|
+LL | add(
+ | --- immutable borrow later used by call
LL | &*a,
- | -- immutable borrow occurs here
+ | --- immutable borrow occurs here
LL | rewrite(&mut a));
- | ^ - immutable borrow ends here
- | |
- | mutable borrow occurs here
+ | ^^^^^^ mutable borrow occurs here
-error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immutable
- --> $DIR/borrowck-bad-nested-calls-free.rs:32:22
+error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-bad-nested-calls-free.rs:32:17
|
+LL | add(
+ | --- immutable borrow later used by call
LL | &*a,
- | -- immutable borrow occurs here
+ | --- immutable borrow occurs here
LL | rewrite(&mut a));
- | ^ - immutable borrow ends here
- | |
- | mutable borrow occurs here
+ | ^^^^^^ mutable borrow occurs here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr
deleted file mode 100644
index 371bcf2..0000000
--- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error[E0505]: cannot move out of `a` because it is borrowed
- --> $DIR/borrowck-bad-nested-calls-move.rs:25:9
- |
-LL | add(
- | --- borrow later used by call
-LL | &*a,
- | --- borrow of `*a` occurs here
-LL | a);
- | ^ move out of `a` occurs here
-
-error[E0505]: cannot move out of `a` because it is borrowed
- --> $DIR/borrowck-bad-nested-calls-move.rs:32:9
- |
-LL | add(
- | --- borrow later used by call
-LL | &*a,
- | --- borrow of `*a` occurs here
-LL | a);
- | ^ move out of `a` occurs here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr
index 3b34a61..371bcf2 100644
--- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr
+++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr
@@ -1,16 +1,20 @@
error[E0505]: cannot move out of `a` because it is borrowed
--> $DIR/borrowck-bad-nested-calls-move.rs:25:9
|
+LL | add(
+ | --- borrow later used by call
LL | &*a,
- | -- borrow of `*a` occurs here
+ | --- borrow of `*a` occurs here
LL | a);
| ^ move out of `a` occurs here
error[E0505]: cannot move out of `a` because it is borrowed
--> $DIR/borrowck-bad-nested-calls-move.rs:32:9
|
+LL | add(
+ | --- borrow later used by call
LL | &*a,
- | -- borrow of `*a` occurs here
+ | --- borrow of `*a` occurs here
LL | a);
| ^ move out of `a` occurs here
diff --git a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr
deleted file mode 100644
index d2a4996..0000000
--- a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-block-unint.rs:4:11
- |
-LL | force(|| {
- | ^^ use of possibly uninitialized `x`
-LL | println!("{}", x);
- | - borrow occurs due to use in closure
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-block-unint.rs b/src/test/ui/borrowck/borrowck-block-unint.rs
index 3c6e9cb..1fed2d5 100644
--- a/src/test/ui/borrowck/borrowck-block-unint.rs
+++ b/src/test/ui/borrowck/borrowck-block-unint.rs
@@ -1,7 +1,7 @@
fn force<F>(f: F) where F: FnOnce() { f(); }
fn main() {
let x: isize;
- force(|| { //~ ERROR capture of possibly uninitialized variable: `x`
+ force(|| { //~ ERROR borrow of possibly uninitialized variable: `x`
println!("{}", x);
});
}
diff --git a/src/test/ui/borrowck/borrowck-block-unint.stderr b/src/test/ui/borrowck/borrowck-block-unint.stderr
index ab55d79..d2a4996 100644
--- a/src/test/ui/borrowck/borrowck-block-unint.stderr
+++ b/src/test/ui/borrowck/borrowck-block-unint.stderr
@@ -1,8 +1,10 @@
-error[E0381]: capture of possibly uninitialized variable: `x`
+error[E0381]: borrow of possibly uninitialized variable: `x`
--> $DIR/borrowck-block-unint.rs:4:11
|
LL | force(|| {
| ^^ use of possibly uninitialized `x`
+LL | println!("{}", x);
+ | - borrow occurs due to use in closure
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr
deleted file mode 100644
index 134f510..0000000
--- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr
+++ /dev/null
@@ -1,116 +0,0 @@
-error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:18:17
- |
-LL | let bar1 = &mut foo.bar1;
- | ------------- first mutable borrow occurs here
-LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ second mutable borrow occurs here
-LL | *bar1;
- | ----- first borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:25:17
- |
-LL | let bar1 = &mut foo.bar1;
- | ------------- mutable borrow occurs here
-LL | let _bar2 = &foo.bar1;
- | ^^^^^^^^^ immutable borrow occurs here
-LL | *bar1;
- | ----- mutable borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:32:17
- |
-LL | let bar1 = &foo.bar1;
- | --------- immutable borrow occurs here
-LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ mutable borrow occurs here
-LL | *bar1;
- | ----- immutable borrow later used here
-
-error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:62:21
- |
-LL | let bar1 = &mut foo.bar1;
- | ------------- first mutable borrow occurs here
-LL | match *foo {
-LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
- | ^^^^^^^^^^^^^ second mutable borrow occurs here
-...
-LL | *bar1;
- | ----- first borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:71:17
- |
-LL | let bar1 = &mut foo.bar1.int1;
- | ------------------ mutable borrow occurs here
-LL | let _foo1 = &foo.bar1;
- | ^^^^^^^^^ immutable borrow occurs here
-LL | let _foo2 = &*foo;
-LL | *bar1;
- | ----- mutable borrow later used here
-
-error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:72:17
- |
-LL | let bar1 = &mut foo.bar1.int1;
- | ------------------ mutable borrow occurs here
-LL | let _foo1 = &foo.bar1;
-LL | let _foo2 = &*foo;
- | ^^^^^ immutable borrow occurs here
-LL | *bar1;
- | ----- mutable borrow later used here
-
-error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:79:17
- |
-LL | let bar1 = &mut foo.bar1.int1;
- | ------------------ first mutable borrow occurs here
-LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ second mutable borrow occurs here
-LL | *bar1;
- | ----- first borrow later used here
-
-error[E0499]: cannot borrow `*foo` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:86:17
- |
-LL | let bar1 = &mut foo.bar1.int1;
- | ------------------ first mutable borrow occurs here
-LL | let _foo2 = &mut *foo;
- | ^^^^^^^^^ second mutable borrow occurs here
-LL | *bar1;
- | ----- first borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:93:17
- |
-LL | let bar1 = &foo.bar1.int1;
- | -------------- immutable borrow occurs here
-LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ mutable borrow occurs here
-LL | *bar1;
- | ----- immutable borrow later used here
-
-error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:100:17
- |
-LL | let bar1 = &foo.bar1.int1;
- | -------------- immutable borrow occurs here
-LL | let _foo2 = &mut *foo;
- | ^^^^^^^^^ mutable borrow occurs here
-LL | *bar1;
- | ----- immutable borrow later used here
-
-error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:121:16
- |
-LL | let foo = make_foo();
- | --- help: consider changing this to be mutable: `mut foo`
-LL | let bar1 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ cannot borrow as mutable
-
-error: aborting due to 11 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0596.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs
index 1435837..353e4e9 100644
--- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs
+++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs
@@ -43,15 +43,17 @@
fn borrow_both_fields_mut() {
let mut foo = make_foo();
let bar1 = &mut foo.bar1;
- let _bar2 = &mut foo.bar2; //~ ERROR cannot borrow
+ let _bar2 = &mut foo.bar2;
*bar1;
}
fn borrow_both_mut_pattern() {
let mut foo = make_foo();
match *foo {
- Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {}
- //~^ ERROR cannot borrow
+ Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {
+ *_bar1;
+ *_bar2;
+ }
}
}
@@ -112,8 +114,7 @@
fn borrow_mut_and_imm() {
let mut foo = make_foo();
let bar1 = &mut foo.bar1;
- let _foo1 = &foo.bar2; //~ ERROR cannot borrow
- *bar1;
+ let _foo1 = &foo.bar2;
}
fn borrow_mut_from_imm() {
@@ -125,7 +126,7 @@
fn borrow_long_path_both_mut() {
let mut foo = make_foo();
let bar1 = &mut foo.bar1.int1;
- let foo1 = &mut foo.bar2.int2; //~ ERROR cannot borrow
+ let foo1 = &mut foo.bar2.int2;
*bar1;
*foo1;
}
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
index 95f6f03..e00d69f 100644
--- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
+++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
@@ -1,168 +1,116 @@
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:18:22
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:18:17
|
LL | let bar1 = &mut foo.bar1;
- | -------- first mutable borrow occurs here
+ | ------------- first mutable borrow occurs here
LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^ second mutable borrow occurs here
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
LL | *bar1;
-LL | }
- | - first borrow ends here
+ | ----- first borrow later used here
error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:25:18
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:25:17
|
LL | let bar1 = &mut foo.bar1;
- | -------- mutable borrow occurs here
+ | ------------- mutable borrow occurs here
LL | let _bar2 = &foo.bar1;
- | ^^^^^^^^ immutable borrow occurs here
+ | ^^^^^^^^^ immutable borrow occurs here
LL | *bar1;
-LL | }
- | - mutable borrow ends here
+ | ----- mutable borrow later used here
error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:32:22
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:32:17
|
LL | let bar1 = &foo.bar1;
- | -------- immutable borrow occurs here
+ | --------- immutable borrow occurs here
LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
LL | *bar1;
-LL | }
- | - immutable borrow ends here
-
-error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:46:22
- |
-LL | let bar1 = &mut foo.bar1;
- | -------- first mutable borrow occurs here (via `foo.bar1`)
-LL | let _bar2 = &mut foo.bar2;
- | ^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`)
-LL | *bar1;
-LL | }
- | - first borrow ends here
-
-error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:53:42
- |
-LL | Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {}
- | ------------- ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`)
- | |
- | first mutable borrow occurs here (via `foo.bar1`)
-LL |
-LL | }
- | - first borrow ends here
+ | ----- immutable borrow later used here
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:62:21
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:64:21
|
LL | let bar1 = &mut foo.bar1;
- | -------- first mutable borrow occurs here
+ | ------------- first mutable borrow occurs here
LL | match *foo {
LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
| ^^^^^^^^^^^^^ second mutable borrow occurs here
...
-LL | }
- | - first borrow ends here
+LL | *bar1;
+ | ----- first borrow later used here
-error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:71:18
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:73:17
|
LL | let bar1 = &mut foo.bar1.int1;
- | ------------- mutable borrow occurs here
+ | ------------------ mutable borrow occurs here
LL | let _foo1 = &foo.bar1;
- | ^^^^^^^^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
+ | ^^^^^^^^^ immutable borrow occurs here
+LL | let _foo2 = &*foo;
+LL | *bar1;
+ | ----- mutable borrow later used here
-error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:72:18
+error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:74:17
|
LL | let bar1 = &mut foo.bar1.int1;
- | ------------- mutable borrow occurs here
+ | ------------------ mutable borrow occurs here
LL | let _foo1 = &foo.bar1;
LL | let _foo2 = &*foo;
- | ^^^^ immutable borrow occurs here
+ | ^^^^^ immutable borrow occurs here
LL | *bar1;
-LL | }
- | - mutable borrow ends here
+ | ----- mutable borrow later used here
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:79:22
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:81:17
|
LL | let bar1 = &mut foo.bar1.int1;
- | ------------- first mutable borrow occurs here
+ | ------------------ first mutable borrow occurs here
LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^ second mutable borrow occurs here
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
LL | *bar1;
-LL | }
- | - first borrow ends here
+ | ----- first borrow later used here
error[E0499]: cannot borrow `*foo` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:86:22
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:88:17
|
LL | let bar1 = &mut foo.bar1.int1;
- | ------------- first mutable borrow occurs here
+ | ------------------ first mutable borrow occurs here
LL | let _foo2 = &mut *foo;
- | ^^^^ second mutable borrow occurs here
+ | ^^^^^^^^^ second mutable borrow occurs here
LL | *bar1;
-LL | }
- | - first borrow ends here
+ | ----- first borrow later used here
-error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:93:22
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:95:17
|
LL | let bar1 = &foo.bar1.int1;
- | ------------- immutable borrow occurs here
+ | -------------- immutable borrow occurs here
LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
LL | *bar1;
-LL | }
- | - immutable borrow ends here
+ | ----- immutable borrow later used here
-error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:100:22
+error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:102:17
|
LL | let bar1 = &foo.bar1.int1;
- | ------------- immutable borrow occurs here
+ | -------------- immutable borrow occurs here
LL | let _foo2 = &mut *foo;
- | ^^^^ mutable borrow occurs here
+ | ^^^^^^^^^ mutable borrow occurs here
LL | *bar1;
-LL | }
- | - immutable borrow ends here
+ | ----- immutable borrow later used here
-error[E0502]: cannot borrow `foo` (via `foo.bar2`) as immutable because `foo` is also borrowed as mutable (via `foo.bar1`)
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:115:18
- |
-LL | let bar1 = &mut foo.bar1;
- | -------- mutable borrow occurs here (via `foo.bar1`)
-LL | let _foo1 = &foo.bar2;
- | ^^^^^^^^ immutable borrow of `foo.bar2` -- which overlaps with `foo.bar1` -- occurs here
-LL | *bar1;
-LL | }
- | - mutable borrow ends here
-
-error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:121:21
+error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:122:16
|
LL | let foo = make_foo();
- | --- help: make this binding mutable: `mut foo`
+ | --- help: consider changing this to be mutable: `mut foo`
LL | let bar1 = &mut foo.bar1;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^^ cannot borrow as mutable
-error[E0499]: cannot borrow `foo` (via `foo.bar2.int2`) as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-owned-ptr.rs:128:21
- |
-LL | let bar1 = &mut foo.bar1.int1;
- | ------------- first mutable borrow occurs here (via `foo.bar1.int1`)
-LL | let foo1 = &mut foo.bar2.int2;
- | ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2.int2`)
-...
-LL | }
- | - first borrow ends here
-
-error: aborting due to 15 previous errors
+error: aborting due to 11 previous errors
Some errors have detailed explanations: E0499, E0502, E0596.
For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr
deleted file mode 100644
index ce5ce56..0000000
--- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr
+++ /dev/null
@@ -1,116 +0,0 @@
-error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-stack-variable.rs:18:17
- |
-LL | let bar1 = &mut foo.bar1;
- | ------------- first mutable borrow occurs here
-LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ second mutable borrow occurs here
-LL | *bar1;
- | ----- first borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:25:17
- |
-LL | let bar1 = &mut foo.bar1;
- | ------------- mutable borrow occurs here
-LL | let _bar2 = &foo.bar1;
- | ^^^^^^^^^ immutable borrow occurs here
-LL | *bar1;
- | ----- mutable borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:32:17
- |
-LL | let bar1 = &foo.bar1;
- | --------- immutable borrow occurs here
-LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ mutable borrow occurs here
-LL | *bar1;
- | ----- immutable borrow later used here
-
-error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-stack-variable.rs:61:21
- |
-LL | let bar1 = &mut foo.bar1;
- | ------------- first mutable borrow occurs here
-LL | match foo {
-LL | Foo { bar1: ref mut _bar1, bar2: _ } => {} //
- | ^^^^^^^^^^^^^ second mutable borrow occurs here
-...
-LL | *bar1;
- | ----- first borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:70:17
- |
-LL | let bar1 = &mut foo.bar1.int1;
- | ------------------ mutable borrow occurs here
-LL | let _foo1 = &foo.bar1;
- | ^^^^^^^^^ immutable borrow occurs here
-LL | let _foo2 = &foo;
-LL | *bar1;
- | ----- mutable borrow later used here
-
-error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:71:17
- |
-LL | let bar1 = &mut foo.bar1.int1;
- | ------------------ mutable borrow occurs here
-LL | let _foo1 = &foo.bar1;
-LL | let _foo2 = &foo;
- | ^^^^ immutable borrow occurs here
-LL | *bar1;
- | ----- mutable borrow later used here
-
-error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-stack-variable.rs:78:17
- |
-LL | let bar1 = &mut foo.bar1.int1;
- | ------------------ first mutable borrow occurs here
-LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ second mutable borrow occurs here
-LL | *bar1;
- | ----- first borrow later used here
-
-error[E0499]: cannot borrow `foo` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-stack-variable.rs:85:17
- |
-LL | let bar1 = &mut foo.bar1.int1;
- | ------------------ first mutable borrow occurs here
-LL | let _foo2 = &mut foo;
- | ^^^^^^^^ second mutable borrow occurs here
-LL | *bar1;
- | ----- first borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:92:17
- |
-LL | let bar1 = &foo.bar1.int1;
- | -------------- immutable borrow occurs here
-LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ mutable borrow occurs here
-LL | *bar1;
- | ----- immutable borrow later used here
-
-error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:99:17
- |
-LL | let bar1 = &foo.bar1.int1;
- | -------------- immutable borrow occurs here
-LL | let _foo2 = &mut foo;
- | ^^^^^^^^ mutable borrow occurs here
-LL | *bar1;
- | ----- immutable borrow later used here
-
-error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:120:16
- |
-LL | let foo = make_foo();
- | --- help: consider changing this to be mutable: `mut foo`
-LL | let bar1 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ cannot borrow as mutable
-
-error: aborting due to 11 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0596.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr
index 845aaa2..ce5ce56 100644
--- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr
+++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr
@@ -1,122 +1,114 @@
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-stack-variable.rs:18:22
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:18:17
|
LL | let bar1 = &mut foo.bar1;
- | -------- first mutable borrow occurs here
+ | ------------- first mutable borrow occurs here
LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^ second mutable borrow occurs here
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
LL | *bar1;
-LL | }
- | - first borrow ends here
+ | ----- first borrow later used here
error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:25:18
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:25:17
|
LL | let bar1 = &mut foo.bar1;
- | -------- mutable borrow occurs here
+ | ------------- mutable borrow occurs here
LL | let _bar2 = &foo.bar1;
- | ^^^^^^^^ immutable borrow occurs here
+ | ^^^^^^^^^ immutable borrow occurs here
LL | *bar1;
-LL | }
- | - mutable borrow ends here
+ | ----- mutable borrow later used here
error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:32:22
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:32:17
|
LL | let bar1 = &foo.bar1;
- | -------- immutable borrow occurs here
+ | --------- immutable borrow occurs here
LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
LL | *bar1;
-LL | }
- | - immutable borrow ends here
+ | ----- immutable borrow later used here
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
--> $DIR/borrowck-borrow-from-stack-variable.rs:61:21
|
LL | let bar1 = &mut foo.bar1;
- | -------- first mutable borrow occurs here
+ | ------------- first mutable borrow occurs here
LL | match foo {
LL | Foo { bar1: ref mut _bar1, bar2: _ } => {} //
| ^^^^^^^^^^^^^ second mutable borrow occurs here
...
-LL | }
- | - first borrow ends here
+LL | *bar1;
+ | ----- first borrow later used here
-error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:70:18
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:70:17
|
LL | let bar1 = &mut foo.bar1.int1;
- | ------------- mutable borrow occurs here
+ | ------------------ mutable borrow occurs here
LL | let _foo1 = &foo.bar1;
- | ^^^^^^^^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
+ | ^^^^^^^^^ immutable borrow occurs here
+LL | let _foo2 = &foo;
+LL | *bar1;
+ | ----- mutable borrow later used here
-error[E0502]: cannot borrow `foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:71:18
+error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:71:17
|
LL | let bar1 = &mut foo.bar1.int1;
- | ------------- mutable borrow occurs here
+ | ------------------ mutable borrow occurs here
LL | let _foo1 = &foo.bar1;
LL | let _foo2 = &foo;
- | ^^^ immutable borrow occurs here
+ | ^^^^ immutable borrow occurs here
LL | *bar1;
-LL | }
- | - mutable borrow ends here
+ | ----- mutable borrow later used here
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-stack-variable.rs:78:22
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:78:17
|
LL | let bar1 = &mut foo.bar1.int1;
- | ------------- first mutable borrow occurs here
+ | ------------------ first mutable borrow occurs here
LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^ second mutable borrow occurs here
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
LL | *bar1;
-LL | }
- | - first borrow ends here
+ | ----- first borrow later used here
error[E0499]: cannot borrow `foo` as mutable more than once at a time
- --> $DIR/borrowck-borrow-from-stack-variable.rs:85:22
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:85:17
|
LL | let bar1 = &mut foo.bar1.int1;
- | ------------- first mutable borrow occurs here
+ | ------------------ first mutable borrow occurs here
LL | let _foo2 = &mut foo;
- | ^^^ second mutable borrow occurs here
+ | ^^^^^^^^ second mutable borrow occurs here
LL | *bar1;
-LL | }
- | - first borrow ends here
+ | ----- first borrow later used here
-error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:92:22
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:92:17
|
LL | let bar1 = &foo.bar1.int1;
- | ------------- immutable borrow occurs here
+ | -------------- immutable borrow occurs here
LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
LL | *bar1;
-LL | }
- | - immutable borrow ends here
+ | ----- immutable borrow later used here
-error[E0502]: cannot borrow `foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:99:22
+error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:99:17
|
LL | let bar1 = &foo.bar1.int1;
- | ------------- immutable borrow occurs here
+ | -------------- immutable borrow occurs here
LL | let _foo2 = &mut foo;
- | ^^^ mutable borrow occurs here
+ | ^^^^^^^^ mutable borrow occurs here
LL | *bar1;
-LL | }
- | - immutable borrow ends here
+ | ----- immutable borrow later used here
-error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
- --> $DIR/borrowck-borrow-from-stack-variable.rs:120:21
+error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:120:16
|
LL | let foo = make_foo();
- | --- help: make this binding mutable: `mut foo`
+ | --- help: consider changing this to be mutable: `mut foo`
LL | let bar1 = &mut foo.bar1;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^^ cannot borrow as mutable
error: aborting due to 11 previous errors
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr
deleted file mode 100644
index 71bf052..0000000
--- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/borrowck-borrow-from-temporary.rs:10:5
- |
-LL | let &Foo(ref x) = &id(Foo(3));
- | ---------- temporary value created here
-LL | x
- | ^ returns a value referencing data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.rs b/src/test/ui/borrowck/borrowck-borrow-from-temporary.rs
index e7ca1a9..92f3ffd 100644
--- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.rs
+++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.rs
@@ -6,8 +6,8 @@
struct Foo(isize);
fn foo<'a>() -> &'a isize {
- let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough
- x
+ let &Foo(ref x) = &id(Foo(3));
+ x //~ ERROR cannot return value referencing temporary value
}
pub fn main() {
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr
index 6f101f6..71bf052 100644
--- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr
+++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr
@@ -1,18 +1,11 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/borrowck-borrow-from-temporary.rs:9:24
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/borrowck-borrow-from-temporary.rs:10:5
|
LL | let &Foo(ref x) = &id(Foo(3));
- | ^^^^^^^^^^ temporary value does not live long enough
+ | ---------- temporary value created here
LL | x
-LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 8:8...
- --> $DIR/borrowck-borrow-from-temporary.rs:8:8
- |
-LL | fn foo<'a>() -> &'a isize {
- | ^^
+ | ^ returns a value referencing data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr
deleted file mode 100644
index 7d7e305..0000000
--- a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `*a` as mutable, as `a` is not declared as mutable
- --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:12:5
- |
-LL | let a: Box<_> = box A;
- | - help: consider changing this to be mutable: `mut a`
-LL | a.foo();
- | ^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs
index 8d52818..bc820ee 100644
--- a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs
+++ b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs
@@ -10,5 +10,5 @@
pub fn main() {
let a: Box<_> = box A;
a.foo();
- //~^ ERROR cannot borrow immutable `Box` content `*a` as mutable
+ //~^ ERROR cannot borrow `*a` as mutable, as `a` is not declared as mutable [E0596]
}
diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
index 2c989b2..7d7e305 100644
--- a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
+++ b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
@@ -1,8 +1,8 @@
-error[E0596]: cannot borrow immutable `Box` content `*a` as mutable
+error[E0596]: cannot borrow `*a` as mutable, as `a` is not declared as mutable
--> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:12:5
|
LL | let a: Box<_> = box A;
- | - help: make this binding mutable: `mut a`
+ | - help: consider changing this to be mutable: `mut a`
LL | a.foo();
| ^ cannot borrow as mutable
diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr
deleted file mode 100644
index 8115e31..0000000
--- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0594]: cannot assign to `**t1` which is behind a `&` reference
- --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5
- |
-LL | let t1 = t0;
- | -- help: consider changing this to be a mutable reference: `&mut &mut isize`
-LL | let p: &isize = &**t0;
-LL | **t1 = 22;
- | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written
-
-error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:21
- |
-LL | let t1 = &mut *t0;
- | -------- mutable borrow occurs here
-LL | let p: &isize = &**t0;
- | ^^^^^ immutable borrow occurs here
-LL | **t1 = 22;
- | --------- mutable borrow later used here
-
-error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:26
- |
-LL | fn foo4(t0: & &mut isize) {
- | ------------ help: consider changing this to be a mutable reference: `&mut &mut isize`
-LL | let x: &mut isize = &mut **t0;
- | ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0502, E0596.
-For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
index e2e5fb6..8115e31 100644
--- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
+++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
@@ -1,29 +1,31 @@
-error[E0389]: cannot assign to data in a `&` reference
+error[E0594]: cannot assign to `**t1` which is behind a `&` reference
--> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5
|
+LL | let t1 = t0;
+ | -- help: consider changing this to be a mutable reference: `&mut &mut isize`
+LL | let p: &isize = &**t0;
LL | **t1 = 22;
- | ^^^^^^^^^ assignment into an immutable reference
+ | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written
-error[E0502]: cannot borrow `**t0` as immutable because `*t0` is also borrowed as mutable
- --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:22
+error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:21
|
LL | let t1 = &mut *t0;
- | --- mutable borrow occurs here
+ | -------- mutable borrow occurs here
LL | let p: &isize = &**t0;
- | ^^^^ immutable borrow occurs here
+ | ^^^^^ immutable borrow occurs here
LL | **t1 = 22;
-LL | }
- | - mutable borrow ends here
+ | --------- mutable borrow later used here
-error[E0389]: cannot borrow data mutably in a `&` reference
- --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:31
+error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:26
|
LL | fn foo4(t0: & &mut isize) {
- | ------------ use `&mut &mut isize` here to make mutable
+ | ------------ help: consider changing this to be a mutable reference: `&mut &mut isize`
LL | let x: &mut isize = &mut **t0;
- | ^^^^ assignment into an immutable reference
+ | ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0389, E0502.
-For more information about an error, try `rustc --explain E0389`.
+Some errors have detailed explanations: E0502, E0596.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr
deleted file mode 100644
index fa0ae31..0000000
--- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/borrowck-borrow-mut-object-twice.rs:13:5
- |
-LL | let y = x.f1();
- | - first mutable borrow occurs here
-LL | x.f2();
- | ^ second mutable borrow occurs here
-LL | y.use_ref();
- | - first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
index 1b64ad5..fa0ae31 100644
--- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
+++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
@@ -6,8 +6,7 @@
LL | x.f2();
| ^ second mutable borrow occurs here
LL | y.use_ref();
-LL | }
- | - first borrow ends here
+ | - first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr
deleted file mode 100644
index dc52685..0000000
--- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr
+++ /dev/null
@@ -1,87 +0,0 @@
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:19
- |
-LL | let __isize = &mut x.y;
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:19
- |
-LL | let __isize = &mut x.y;
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:5
- |
-LL | &mut x.y
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:5
- |
-LL | &mut x.y
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:67:5
- |
-LL | x.y = 3;
- | ^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:71:5
- |
-LL | x.y = 3;
- | ^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:75:5
- |
-LL | x.y = 3;
- | ^^^^^^^ cannot assign
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:83:5
- |
-LL | x.set(0, 0);
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:87:5
- |
-LL | x.set(0, 0);
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:95:5
- |
-LL | x.y_mut()
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:99:5
- |
-LL | x.y_mut()
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:103:6
- |
-LL | *x.y_mut() = 3;
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:107:6
- |
-LL | *x.y_mut() = 3;
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:111:6
- |
-LL | *x.y_mut() = 3;
- | ^ cannot borrow as mutable
-
-error: aborting due to 14 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
index ba799b1..dc52685 100644
--- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
+++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
@@ -1,82 +1,82 @@
-error[E0596]: cannot borrow field of immutable binding as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:24
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:19
|
LL | let __isize = &mut x.y;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow field of immutable binding as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:24
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:19
|
LL | let __isize = &mut x.y;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow field of immutable binding as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:10
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:5
|
LL | &mut x.y
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow field of immutable binding as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:10
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:5
|
LL | &mut x.y
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0594]: cannot assign to field of immutable binding
+error[E0594]: cannot assign to data in a `&` reference
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:67:5
|
LL | x.y = 3;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ cannot assign
-error[E0594]: cannot assign to field of immutable binding
+error[E0594]: cannot assign to data in a `&` reference
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:71:5
|
LL | x.y = 3;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ cannot assign
-error[E0594]: cannot assign to field of immutable binding
+error[E0594]: cannot assign to data in a `&` reference
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:75:5
|
LL | x.y = 3;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ cannot assign
-error[E0596]: cannot borrow immutable borrowed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:83:5
|
LL | x.set(0, 0);
| ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:87:5
|
LL | x.set(0, 0);
| ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:95:5
|
LL | x.y_mut()
| ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:99:5
|
LL | x.y_mut()
| ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:103:6
|
LL | *x.y_mut() = 3;
| ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:107:6
|
LL | *x.y_mut() = 3;
| ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:111:6
|
LL | *x.y_mut() = 3;
diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr
deleted file mode 100644
index 1755b22..0000000
--- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr
+++ /dev/null
@@ -1,45 +0,0 @@
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-deref.rs:23:19
- |
-LL | let __isize = &mut *x;
- | ^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-deref.rs:27:19
- |
-LL | let __isize = &mut *x;
- | ^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-deref.rs:35:5
- |
-LL | &mut **x
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/borrowck-borrow-overloaded-deref.rs:39:5
- |
-LL | &mut **x
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/borrowck-borrow-overloaded-deref.rs:43:5
- |
-LL | *x = 3;
- | ^^^^^^ cannot assign
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/borrowck-borrow-overloaded-deref.rs:47:5
- |
-LL | **x = 3;
- | ^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/borrowck-borrow-overloaded-deref.rs:51:5
- |
-LL | **x = 3;
- | ^^^^^^^ cannot assign
-
-error: aborting due to 7 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr
index c44327d..1755b22 100644
--- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr
+++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr
@@ -1,44 +1,44 @@
-error[E0596]: cannot borrow immutable borrowed content as mutable
- --> $DIR/borrowck-borrow-overloaded-deref.rs:23:24
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:23:19
|
LL | let __isize = &mut *x;
- | ^^ cannot borrow as mutable
+ | ^^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content as mutable
- --> $DIR/borrowck-borrow-overloaded-deref.rs:27:24
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:27:19
|
LL | let __isize = &mut *x;
- | ^^ cannot borrow as mutable
+ | ^^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content as mutable
- --> $DIR/borrowck-borrow-overloaded-deref.rs:35:10
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:35:5
|
LL | &mut **x
- | ^^^ cannot borrow as mutable
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content as mutable
- --> $DIR/borrowck-borrow-overloaded-deref.rs:39:10
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:39:5
|
LL | &mut **x
- | ^^^ cannot borrow as mutable
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0594]: cannot assign to immutable borrowed content
+error[E0594]: cannot assign to data in a `&` reference
--> $DIR/borrowck-borrow-overloaded-deref.rs:43:5
|
LL | *x = 3;
- | ^^^^^^ cannot borrow as mutable
+ | ^^^^^^ cannot assign
-error[E0594]: cannot assign to immutable borrowed content
+error[E0594]: cannot assign to data in a `&` reference
--> $DIR/borrowck-borrow-overloaded-deref.rs:47:5
|
LL | **x = 3;
- | ^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^ cannot assign
-error[E0594]: cannot assign to immutable borrowed content
+error[E0594]: cannot assign to data in a `&` reference
--> $DIR/borrowck-borrow-overloaded-deref.rs:51:5
|
LL | **x = 3;
- | ^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^ cannot assign
error: aborting due to 7 previous errors
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr
deleted file mode 100644
index 1dd18c1..0000000
--- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:20:20
- |
-LL | let x = defer(&vec!["Goodbye", "world!"]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary which is freed while still in use
-LL | x.x[0];
- | ------ borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
- = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs
index 6e943ff..e384aac 100644
--- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs
+++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs
@@ -17,6 +17,6 @@
}
fn main() {
- let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough
+ let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR temporary value dropped while borrowed
x.x[0];
}
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
index d17cf8a..1dd18c1 100644
--- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
+++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
@@ -1,17 +1,16 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:20:20
|
LL | let x = defer(&vec!["Goodbye", "world!"]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
+ | creates a temporary which is freed while still in use
LL | x.x[0];
-LL | }
- | - temporary value needs to live until here
+ | ------ borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr
deleted file mode 100644
index c91a437..0000000
--- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:28
- |
-LL | buggy_map.insert(42, &*Box::new(1));
- | ^^^^^^^^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary which is freed while still in use
-...
-LL | buggy_map.insert(43, &*tmp);
- | --------- borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs
index 88bd106..a78c66f 100644
--- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs
+++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs
@@ -7,7 +7,7 @@
fn main() {
let tmp: Box<_>;
let mut buggy_map: HashMap<usize, &usize> = HashMap::new();
- buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough
+ buggy_map.insert(42, &*Box::new(1)); //~ ERROR temporary value dropped while borrowed
// but it is ok if we use a temporary
tmp = box 2;
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
index 32a8656..c91a437 100644
--- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
+++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
@@ -1,16 +1,16 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:27
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:28
|
LL | buggy_map.insert(42, &*Box::new(1));
- | ^^^^^^^^^^^^ - borrowed value dropped here while still borrowed
- | |
- | borrowed value does not live long enough
+ | ^^^^^^^^^^^ - temporary value is freed at the end of this statement
+ | |
+ | creates a temporary which is freed while still in use
...
-LL | }
- | - borrowed value needs to live until here
+LL | buggy_map.insert(43, &*tmp);
+ | --------- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/borrowck/borrowck-box-insensitivity.ast.stderr b/src/test/ui/borrowck/borrowck-box-insensitivity.ast.stderr
deleted file mode 100644
index 6e6bc72..0000000
--- a/src/test/ui/borrowck/borrowck-box-insensitivity.ast.stderr
+++ /dev/null
@@ -1,165 +0,0 @@
-error[E0382]: use of moved value: `a`
- --> $DIR/borrowck-box-insensitivity.rs:37:9
- |
-LL | let _x = a.x;
- | -- value moved here
-LL |
-LL | let _y = a.y;
- | ^^ value used here after move
- |
- = note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `a`
- --> $DIR/borrowck-box-insensitivity.rs:46:9
- |
-LL | let _x = a.x;
- | -- value moved here
-LL |
-LL | let _y = a.y;
- | ^^ value used here after move
- |
- = note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `a`
- --> $DIR/borrowck-box-insensitivity.rs:55:15
- |
-LL | let _x = a.x;
- | -- value moved here
-LL |
-LL | let _y = &a.y;
- | ^^^ value used here after move
- |
- = note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0505]: cannot move out of `a.y` because it is borrowed
- --> $DIR/borrowck-box-insensitivity.rs:63:9
- |
-LL | let _x = &a.x;
- | --- borrow of `a.x` occurs here
-LL | let _y = a.y;
- | ^^ move out of `a.y` occurs here
-
-error[E0503]: cannot use `a.y` because it was mutably borrowed
- --> $DIR/borrowck-box-insensitivity.rs:71:9
- |
-LL | let _x = &mut a.x;
- | --- borrow of `a.x` occurs here
-LL | let _y = a.y;
- | ^^ use of borrowed `a.x`
-
-error[E0505]: cannot move out of `a.y` because it is borrowed
- --> $DIR/borrowck-box-insensitivity.rs:77:9
- |
-LL | let _x = &mut a.x;
- | --- borrow of `a.x` occurs here
-LL | let _y = a.y;
- | ^^ move out of `a.y` occurs here
-
-error[E0502]: cannot borrow `a` (via `a.y`) as immutable because `a` is also borrowed as mutable (via `a.x`)
- --> $DIR/borrowck-box-insensitivity.rs:85:15
- |
-LL | let _x = &mut a.x;
- | --- mutable borrow occurs here (via `a.x`)
-LL | let _y = &a.y;
- | ^^^ immutable borrow of `a.y` -- which overlaps with `a.x` -- occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `a` (via `a.y`) as mutable because `a` is also borrowed as immutable (via `a.x`)
- --> $DIR/borrowck-box-insensitivity.rs:92:19
- |
-LL | let _x = &a.x;
- | --- immutable borrow occurs here (via `a.x`)
-LL | let _y = &mut a.y;
- | ^^^ mutable borrow of `a.y` -- which overlaps with `a.x` -- occurs here
-...
-LL | }
- | - immutable borrow ends here
-
-error[E0382]: use of collaterally moved value: `a.y`
- --> $DIR/borrowck-box-insensitivity.rs:100:9
- |
-LL | let _x = a.x.x;
- | -- value moved here
-LL |
-LL | let _y = a.y;
- | ^^ value used here after move
- |
- = note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: use of collaterally moved value: `a.y`
- --> $DIR/borrowck-box-insensitivity.rs:108:9
- |
-LL | let _x = a.x.x;
- | -- value moved here
-LL |
-LL | let _y = a.y;
- | ^^ value used here after move
- |
- = note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: use of collaterally moved value: `a.y`
- --> $DIR/borrowck-box-insensitivity.rs:116:15
- |
-LL | let _x = a.x.x;
- | -- value moved here
-LL |
-LL | let _y = &a.y;
- | ^^^ value used here after move
- |
- = note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0505]: cannot move out of `a.y` because it is borrowed
- --> $DIR/borrowck-box-insensitivity.rs:124:9
- |
-LL | let _x = &a.x.x;
- | ----- borrow of `a.x.x` occurs here
-LL |
-LL | let _y = a.y;
- | ^^ move out of `a.y` occurs here
-
-error[E0503]: cannot use `a.y` because it was mutably borrowed
- --> $DIR/borrowck-box-insensitivity.rs:132:9
- |
-LL | let _x = &mut a.x.x;
- | ----- borrow of `a.x.x` occurs here
-LL | let _y = a.y;
- | ^^ use of borrowed `a.x.x`
-
-error[E0505]: cannot move out of `a.y` because it is borrowed
- --> $DIR/borrowck-box-insensitivity.rs:138:9
- |
-LL | let _x = &mut a.x.x;
- | ----- borrow of `a.x.x` occurs here
-LL | let _y = a.y;
- | ^^ move out of `a.y` occurs here
-
-error[E0502]: cannot borrow `a.y` as immutable because `a.x.x` is also borrowed as mutable
- --> $DIR/borrowck-box-insensitivity.rs:147:15
- |
-LL | let _x = &mut a.x.x;
- | ----- mutable borrow occurs here
-LL |
-LL | let _y = &a.y;
- | ^^^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `a.y` as mutable because `a.x.x` is also borrowed as immutable
- --> $DIR/borrowck-box-insensitivity.rs:155:19
- |
-LL | let _x = &a.x.x;
- | ----- immutable borrow occurs here
-LL |
-LL | let _y = &mut a.y;
- | ^^^ mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
-
-error: aborting due to 16 previous errors
-
-Some errors have detailed explanations: E0382, E0502, E0503, E0505.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-box-insensitivity.mir.stderr b/src/test/ui/borrowck/borrowck-box-insensitivity.mir.stderr
deleted file mode 100644
index 0e380e9..0000000
--- a/src/test/ui/borrowck/borrowck-box-insensitivity.mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: compilation successful
- --> $DIR/borrowck-box-insensitivity.rs:160:1
- |
-LL | / fn main() {
-LL | | copy_after_move();
-LL | | move_after_move();
-LL | | borrow_after_move();
-... |
-LL | | mut_borrow_after_borrow_nested();
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/borrowck/borrowck-box-insensitivity.nll.stderr b/src/test/ui/borrowck/borrowck-box-insensitivity.nll.stderr
deleted file mode 100644
index 0e380e9..0000000
--- a/src/test/ui/borrowck/borrowck-box-insensitivity.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: compilation successful
- --> $DIR/borrowck-box-insensitivity.rs:160:1
- |
-LL | / fn main() {
-LL | | copy_after_move();
-LL | | move_after_move();
-LL | | borrow_after_move();
-... |
-LL | | mut_borrow_after_borrow_nested();
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/borrowck/borrowck-box-insensitivity.rs b/src/test/ui/borrowck/borrowck-box-insensitivity.rs
deleted file mode 100644
index e72048d..0000000
--- a/src/test/ui/borrowck/borrowck-box-insensitivity.rs
+++ /dev/null
@@ -1,185 +0,0 @@
-// This test is an artifact of the old policy that `Box<T>` should not
-// be treated specially by the AST-borrowck.
-//
-// NLL goes back to treating `Box<T>` specially (namely, knowing that
-// it uniquely owns the data it holds). See rust-lang/rfcs#130.
-
-// revisions: ast mir
-//[ast] compile-flags: -Z borrowck=ast
-//[mir] compile-flags: -Z borrowck=mir
-// ignore-compare-mode-nll
-#![feature(box_syntax, rustc_attrs)]
-
-struct A {
- x: Box<isize>,
- y: isize,
-}
-
-struct B {
- x: Box<isize>,
- y: Box<isize>,
-}
-
-struct C {
- x: Box<A>,
- y: isize,
-}
-
-struct D {
- x: Box<A>,
- y: Box<isize>,
-}
-
-fn copy_after_move() {
- let a: Box<_> = box A { x: box 0, y: 1 };
- let _x = a.x;
- //[ast]~^ value moved here
- let _y = a.y; //[ast]~ ERROR use of moved
- //[ast]~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
- //[ast]~| value used here after move
-}
-
-fn move_after_move() {
- let a: Box<_> = box B { x: box 0, y: box 1 };
- let _x = a.x;
- //[ast]~^ value moved here
- let _y = a.y; //[ast]~ ERROR use of moved
- //[ast]~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
- //[ast]~| value used here after move
-}
-
-fn borrow_after_move() {
- let a: Box<_> = box A { x: box 0, y: 1 };
- let _x = a.x;
- //[ast]~^ value moved here
- let _y = &a.y; //[ast]~ ERROR use of moved
- //[ast]~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
- //[ast]~| value used here after move
-}
-
-fn move_after_borrow() {
- let a: Box<_> = box B { x: box 0, y: box 1 };
- let _x = &a.x;
- let _y = a.y;
- //[ast]~^ ERROR cannot move
- //[ast]~| move out of
- use_imm(_x);
-}
-fn copy_after_mut_borrow() {
- let mut a: Box<_> = box A { x: box 0, y: 1 };
- let _x = &mut a.x;
- let _y = a.y; //[ast]~ ERROR cannot use
- use_mut(_x);
-}
-fn move_after_mut_borrow() {
- let mut a: Box<_> = box B { x: box 0, y: box 1 };
- let _x = &mut a.x;
- let _y = a.y;
- //[ast]~^ ERROR cannot move
- //[ast]~| move out of
- use_mut(_x);
-}
-fn borrow_after_mut_borrow() {
- let mut a: Box<_> = box A { x: box 0, y: 1 };
- let _x = &mut a.x;
- let _y = &a.y; //[ast]~ ERROR cannot borrow
- //[ast]~^ immutable borrow of `a.y` -- which overlaps with `a.x` -- occurs here
- use_mut(_x);
-}
-fn mut_borrow_after_borrow() {
- let mut a: Box<_> = box A { x: box 0, y: 1 };
- let _x = &a.x;
- let _y = &mut a.y; //[ast]~ ERROR cannot borrow
- //[ast]~^ mutable borrow of `a.y` -- which overlaps with `a.x` -- occurs here
- use_imm(_x);
-}
-fn copy_after_move_nested() {
- let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
- let _x = a.x.x;
- //[ast]~^ value moved here
- let _y = a.y; //[ast]~ ERROR use of collaterally moved
- //[ast]~| value used here after move
-}
-
-fn move_after_move_nested() {
- let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
- let _x = a.x.x;
- //[ast]~^ value moved here
- let _y = a.y; //[ast]~ ERROR use of collaterally moved
- //[ast]~| value used here after move
-}
-
-fn borrow_after_move_nested() {
- let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
- let _x = a.x.x;
- //[ast]~^ value moved here
- let _y = &a.y; //[ast]~ ERROR use of collaterally moved
- //[ast]~| value used here after move
-}
-
-fn move_after_borrow_nested() {
- let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
- let _x = &a.x.x;
- //[ast]~^ borrow of `a.x.x` occurs here
- let _y = a.y;
- //[ast]~^ ERROR cannot move
- //[ast]~| move out of
- use_imm(_x);
-}
-fn copy_after_mut_borrow_nested() {
- let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
- let _x = &mut a.x.x;
- let _y = a.y; //[ast]~ ERROR cannot use
- use_mut(_x);
-}
-fn move_after_mut_borrow_nested() {
- let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
- let _x = &mut a.x.x;
- let _y = a.y;
- //[ast]~^ ERROR cannot move
- //[ast]~| move out of
- use_mut(_x);
-}
-fn borrow_after_mut_borrow_nested() {
- let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
- let _x = &mut a.x.x;
- //[ast]~^ mutable borrow occurs here
- let _y = &a.y; //[ast]~ ERROR cannot borrow
- //[ast]~^ immutable borrow occurs here
- use_mut(_x);
-}
-fn mut_borrow_after_borrow_nested() {
- let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
- let _x = &a.x.x;
- //[ast]~^ immutable borrow occurs here
- let _y = &mut a.y; //[ast]~ ERROR cannot borrow
- //[ast]~^ mutable borrow occurs here
- use_imm(_x);
-}
-#[rustc_error]
-fn main() { //[mir]~ ERROR compilation successful
- copy_after_move();
- move_after_move();
- borrow_after_move();
-
- move_after_borrow();
-
- copy_after_mut_borrow();
- move_after_mut_borrow();
- borrow_after_mut_borrow();
- mut_borrow_after_borrow();
-
- copy_after_move_nested();
- move_after_move_nested();
- borrow_after_move_nested();
-
- move_after_borrow_nested();
-
- copy_after_mut_borrow_nested();
- move_after_mut_borrow_nested();
- borrow_after_mut_borrow_nested();
- mut_borrow_after_borrow_nested();
-}
-
-fn use_mut<T>(_: &mut T) { }
-fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/borrowck/borrowck-box-sensitivity.rs b/src/test/ui/borrowck/borrowck-box-sensitivity.rs
new file mode 100644
index 0000000..e5591f5
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-box-sensitivity.rs
@@ -0,0 +1,150 @@
+// Test that `Box<T>` is treated specially by borrow checking. This is the case
+// because NLL reverted the deicision in rust-lang/rfcs#130.
+
+// run-pass
+
+#![feature(box_syntax)]
+
+struct A {
+ x: Box<isize>,
+ y: isize,
+}
+
+struct B {
+ x: Box<isize>,
+ y: Box<isize>,
+}
+
+struct C {
+ x: Box<A>,
+ y: isize,
+}
+
+struct D {
+ x: Box<A>,
+ y: Box<isize>,
+}
+
+fn copy_after_move() {
+ let a: Box<_> = box A { x: box 0, y: 1 };
+ let _x = a.x;
+ let _y = a.y;
+}
+
+fn move_after_move() {
+ let a: Box<_> = box B { x: box 0, y: box 1 };
+ let _x = a.x;
+ let _y = a.y;
+}
+
+fn borrow_after_move() {
+ let a: Box<_> = box A { x: box 0, y: 1 };
+ let _x = a.x;
+ let _y = &a.y;
+}
+
+fn move_after_borrow() {
+ let a: Box<_> = box B { x: box 0, y: box 1 };
+ let _x = &a.x;
+ let _y = a.y;
+ use_imm(_x);
+}
+fn copy_after_mut_borrow() {
+ let mut a: Box<_> = box A { x: box 0, y: 1 };
+ let _x = &mut a.x;
+ let _y = a.y;
+ use_mut(_x);
+}
+fn move_after_mut_borrow() {
+ let mut a: Box<_> = box B { x: box 0, y: box 1 };
+ let _x = &mut a.x;
+ let _y = a.y;
+ use_mut(_x);
+}
+fn borrow_after_mut_borrow() {
+ let mut a: Box<_> = box A { x: box 0, y: 1 };
+ let _x = &mut a.x;
+ let _y = &a.y;
+ use_mut(_x);
+}
+fn mut_borrow_after_borrow() {
+ let mut a: Box<_> = box A { x: box 0, y: 1 };
+ let _x = &a.x;
+ let _y = &mut a.y;
+ use_imm(_x);
+}
+fn copy_after_move_nested() {
+ let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
+ let _x = a.x.x;
+ let _y = a.y;
+}
+
+fn move_after_move_nested() {
+ let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
+ let _x = a.x.x;
+ let _y = a.y;
+}
+
+fn borrow_after_move_nested() {
+ let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
+ let _x = a.x.x;
+ let _y = &a.y;
+}
+
+fn move_after_borrow_nested() {
+ let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
+ let _x = &a.x.x;
+ let _y = a.y;
+ use_imm(_x);
+}
+fn copy_after_mut_borrow_nested() {
+ let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
+ let _x = &mut a.x.x;
+ let _y = a.y;
+ use_mut(_x);
+}
+fn move_after_mut_borrow_nested() {
+ let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
+ let _x = &mut a.x.x;
+ let _y = a.y;
+ use_mut(_x);
+}
+fn borrow_after_mut_borrow_nested() {
+ let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
+ let _x = &mut a.x.x;
+ let _y = &a.y;
+ use_mut(_x);
+}
+fn mut_borrow_after_borrow_nested() {
+ let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
+ let _x = &a.x.x;
+ let _y = &mut a.y;
+ use_imm(_x);
+}
+
+fn main() {
+ copy_after_move();
+ move_after_move();
+ borrow_after_move();
+
+ move_after_borrow();
+
+ copy_after_mut_borrow();
+ move_after_mut_borrow();
+ borrow_after_mut_borrow();
+ mut_borrow_after_borrow();
+
+ copy_after_move_nested();
+ move_after_move_nested();
+ borrow_after_move_nested();
+
+ move_after_borrow_nested();
+
+ copy_after_mut_borrow_nested();
+ move_after_mut_borrow_nested();
+ borrow_after_mut_borrow_nested();
+ mut_borrow_after_borrow_nested();
+}
+
+fn use_mut<T>(_: &mut T) { }
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr
deleted file mode 100644
index e40d8d9..0000000
--- a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-break-uninit-2.rs:9:20
- |
-LL | println!("{}", x);
- | ^ use of possibly uninitialized `x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.rs b/src/test/ui/borrowck/borrowck-break-uninit-2.rs
index 95ccb2e..dad5325 100644
--- a/src/test/ui/borrowck/borrowck-break-uninit-2.rs
+++ b/src/test/ui/borrowck/borrowck-break-uninit-2.rs
@@ -6,7 +6,7 @@
x = 0;
}
- println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ println!("{}", x); //~ ERROR borrow of possibly uninitialized variable: `x`
return 17;
}
diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr
index a6c3dfe..e40d8d9 100644
--- a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr
+++ b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr
@@ -1,4 +1,4 @@
-error[E0381]: use of possibly uninitialized variable: `x`
+error[E0381]: borrow of possibly uninitialized variable: `x`
--> $DIR/borrowck-break-uninit-2.rs:9:20
|
LL | println!("{}", x);
diff --git a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr
deleted file mode 100644
index bbf9b9f..0000000
--- a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-break-uninit.rs:9:20
- |
-LL | println!("{}", x);
- | ^ use of possibly uninitialized `x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-break-uninit.rs b/src/test/ui/borrowck/borrowck-break-uninit.rs
index 827637c..9af02b3 100644
--- a/src/test/ui/borrowck/borrowck-break-uninit.rs
+++ b/src/test/ui/borrowck/borrowck-break-uninit.rs
@@ -6,7 +6,7 @@
x = 0;
}
- println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ println!("{}", x); //~ ERROR borrow of possibly uninitialized variable: `x`
return 17;
}
diff --git a/src/test/ui/borrowck/borrowck-break-uninit.stderr b/src/test/ui/borrowck/borrowck-break-uninit.stderr
index dcb024a..bbf9b9f 100644
--- a/src/test/ui/borrowck/borrowck-break-uninit.stderr
+++ b/src/test/ui/borrowck/borrowck-break-uninit.stderr
@@ -1,4 +1,4 @@
-error[E0381]: use of possibly uninitialized variable: `x`
+error[E0381]: borrow of possibly uninitialized variable: `x`
--> $DIR/borrowck-break-uninit.rs:9:20
|
LL | println!("{}", x);
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr
deleted file mode 100644
index a41738f..0000000
--- a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr
+++ /dev/null
@@ -1,116 +0,0 @@
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:21:14
- |
-LL | let c1 = || x = 4;
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL | let c2 = || x * 5;
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-LL |
-LL | drop(c1);
- | -- mutable borrow later used here
-
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:29:14
- |
-LL | let c1 = || set(&mut x);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL | let c2 = || get(&x);
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-LL |
-LL | drop(c1);
- | -- mutable borrow later used here
-
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:37:14
- |
-LL | let c1 = || set(&mut x);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL | let c2 = || x * 5;
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-LL |
-LL | drop(c1);
- | -- mutable borrow later used here
-
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:45:5
- |
-LL | let c2 = || x * 5;
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `x` occurs here
-LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
-LL |
-LL | drop(c2);
- | -- borrow later used here
-
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:53:5
- |
-LL | let c1 = || get(&x);
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `x` occurs here
-LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
-LL |
-LL | drop(c1);
- | -- borrow later used here
-
-error[E0506]: cannot assign to `*x` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:61:5
- |
-LL | let c1 = || get(&*x);
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `*x` occurs here
-LL | *x = 5;
- | ^^^^^^ assignment to borrowed `*x` occurs here
-LL |
-LL | drop(c1);
- | -- borrow later used here
-
-error[E0506]: cannot assign to `*x.f` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:73:5
- |
-LL | let c1 = || get(&*x.f);
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `*x.f` occurs here
-LL | *x.f = 5;
- | ^^^^^^^^ assignment to borrowed `*x.f` occurs here
-LL |
-LL | drop(c1);
- | -- borrow later used here
-
-error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:85:14
- |
-LL | let c1 = || get(&*x.f);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-LL | let c2 = || *x.f = 5;
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL |
-LL | drop(c1);
- | -- immutable borrow later used here
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0502, E0506.
-For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr
deleted file mode 100644
index d506599..0000000
--- a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr
+++ /dev/null
@@ -1,96 +0,0 @@
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:21:14
- |
-LL | let c1 = || x = 4;
- | -- - previous borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL | let c2 = || x * 5;
- | ^^ - borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:29:14
- |
-LL | let c1 = || set(&mut x);
- | -- - previous borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL | let c2 = || get(&x);
- | ^^ - borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:37:14
- |
-LL | let c1 = || set(&mut x);
- | -- - previous borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL | let c2 = || x * 5;
- | ^^ - borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:45:5
- |
-LL | let c2 = || x * 5;
- | -- borrow of `x` occurs here
-LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
-
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:53:5
- |
-LL | let c1 = || get(&x);
- | -- borrow of `x` occurs here
-LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
-
-error[E0506]: cannot assign to `*x` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:61:5
- |
-LL | let c1 = || get(&*x);
- | -- borrow of `*x` occurs here
-LL | *x = 5;
- | ^^^^^^ assignment to borrowed `*x` occurs here
-
-error[E0506]: cannot assign to `*x.f` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:73:5
- |
-LL | let c1 = || get(&*x.f);
- | -- borrow of `*x.f` occurs here
-LL | *x.f = 5;
- | ^^^^^^^^ assignment to borrowed `*x.f` occurs here
-
-error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:85:14
- |
-LL | let c1 = || get(&*x.f);
- | -- - previous borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-LL | let c2 = || *x.f = 5;
- | ^^ - borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0502, E0506.
-For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr
deleted file mode 100644
index a41738f..0000000
--- a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr
+++ /dev/null
@@ -1,116 +0,0 @@
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:21:14
- |
-LL | let c1 = || x = 4;
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL | let c2 = || x * 5;
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-LL |
-LL | drop(c1);
- | -- mutable borrow later used here
-
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:29:14
- |
-LL | let c1 = || set(&mut x);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL | let c2 = || get(&x);
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-LL |
-LL | drop(c1);
- | -- mutable borrow later used here
-
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:37:14
- |
-LL | let c1 = || set(&mut x);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL | let c2 = || x * 5;
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-LL |
-LL | drop(c1);
- | -- mutable borrow later used here
-
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:45:5
- |
-LL | let c2 = || x * 5;
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `x` occurs here
-LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
-LL |
-LL | drop(c2);
- | -- borrow later used here
-
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:53:5
- |
-LL | let c1 = || get(&x);
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `x` occurs here
-LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
-LL |
-LL | drop(c1);
- | -- borrow later used here
-
-error[E0506]: cannot assign to `*x` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:61:5
- |
-LL | let c1 = || get(&*x);
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `*x` occurs here
-LL | *x = 5;
- | ^^^^^^ assignment to borrowed `*x` occurs here
-LL |
-LL | drop(c1);
- | -- borrow later used here
-
-error[E0506]: cannot assign to `*x.f` because it is borrowed
- --> $DIR/borrowck-closures-mut-and-imm.rs:73:5
- |
-LL | let c1 = || get(&*x.f);
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `*x.f` occurs here
-LL | *x.f = 5;
- | ^^^^^^^^ assignment to borrowed `*x.f` occurs here
-LL |
-LL | drop(c1);
- | -- borrow later used here
-
-error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-closures-mut-and-imm.rs:85:14
- |
-LL | let c1 = || get(&*x.f);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | immutable borrow occurs here
-LL | let c2 = || *x.f = 5;
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | mutable borrow occurs here
-LL |
-LL | drop(c1);
- | -- immutable borrow later used here
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0502, E0506.
-For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs
index 3a802bc..2dc405f 100644
--- a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs
+++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs
@@ -1,10 +1,6 @@
// Tests that two closures cannot simultaneously have mutable
// and immutable access to the variable. Issue #6801.
-// ignore-tidy-linelength
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(box_syntax)]
fn get(x: &isize) -> isize {
@@ -18,48 +14,48 @@
fn a() {
let mut x = 3;
let c1 = || x = 4;
- let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
- //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+ let c2 = || x * 5;
+ //~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
drop(c1);
}
fn b() {
let mut x = 3;
let c1 = || set(&mut x);
- let c2 = || get(&x); //[ast]~ ERROR cannot borrow `x`
- //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+ let c2 = || get(&x);
+ //~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
drop(c1);
}
fn c() {
let mut x = 3;
let c1 = || set(&mut x);
- let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
- //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+ let c2 = || x * 5;
+ //~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
drop(c1);
}
fn d() {
let mut x = 3;
let c2 = || x * 5;
- x = 5; //[ast]~ ERROR cannot assign
- //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+ x = 5;
+ //~^ ERROR cannot assign to `x` because it is borrowed
drop(c2);
}
fn e() {
let mut x = 3;
let c1 = || get(&x);
- x = 5; //[ast]~ ERROR cannot assign
- //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+ x = 5;
+ //~^ ERROR cannot assign to `x` because it is borrowed
drop(c1);
}
fn f() {
let mut x: Box<_> = box 3;
let c1 = || get(&*x);
- *x = 5; //[ast]~ ERROR cannot assign to `*x`
- //[mir]~^ ERROR cannot assign to `*x` because it is borrowed
+ *x = 5;
+ //~^ ERROR cannot assign to `*x` because it is borrowed
drop(c1);
}
@@ -70,8 +66,8 @@
let mut x: Box<_> = box Foo { f: box 3 };
let c1 = || get(&*x.f);
- *x.f = 5; //[ast]~ ERROR cannot assign to `*x.f`
- //[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed
+ *x.f = 5;
+ //~^ ERROR cannot assign to `*x.f` because it is borrowed
drop(c1);
}
@@ -82,8 +78,8 @@
let mut x: Box<_> = box Foo { f: box 3 };
let c1 = || get(&*x.f);
- let c2 = || *x.f = 5; //[ast]~ ERROR cannot borrow `x` as mutable
- //[mir]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
+ let c2 = || *x.f = 5;
+ //~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
drop(c1);
}
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.stderr
new file mode 100644
index 0000000..edeb21c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.stderr
@@ -0,0 +1,116 @@
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:17:14
+ |
+LL | let c1 = || x = 4;
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || x * 5;
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL |
+LL | drop(c1);
+ | -- mutable borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:25:14
+ |
+LL | let c1 = || set(&mut x);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || get(&x);
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL |
+LL | drop(c1);
+ | -- mutable borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:33:14
+ |
+LL | let c1 = || set(&mut x);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || x * 5;
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL |
+LL | drop(c1);
+ | -- mutable borrow later used here
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:41:5
+ |
+LL | let c2 = || x * 5;
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `x` occurs here
+LL | x = 5;
+ | ^^^^^ assignment to borrowed `x` occurs here
+LL |
+LL | drop(c2);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:49:5
+ |
+LL | let c1 = || get(&x);
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `x` occurs here
+LL | x = 5;
+ | ^^^^^ assignment to borrowed `x` occurs here
+LL |
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `*x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:57:5
+ |
+LL | let c1 = || get(&*x);
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `*x` occurs here
+LL | *x = 5;
+ | ^^^^^^ assignment to borrowed `*x` occurs here
+LL |
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `*x.f` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:69:5
+ |
+LL | let c1 = || get(&*x.f);
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `*x.f` occurs here
+LL | *x.f = 5;
+ | ^^^^^^^^ assignment to borrowed `*x.f` occurs here
+LL |
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:81:14
+ |
+LL | let c1 = || get(&*x.f);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | let c2 = || *x.f = 5;
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL |
+LL | drop(c1);
+ | -- immutable borrow later used here
+
+error: aborting due to 8 previous errors
+
+Some errors have detailed explanations: E0502, E0506.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr
deleted file mode 100644
index 3be7d72..0000000
--- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-closures-mut-of-imm.rs:13:25
- |
-LL | let mut c1 = || set(&mut *x);
- | ^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-closures-mut-of-imm.rs:15:25
- |
-LL | let mut c2 = || set(&mut *x);
- | ^^^^^^^ cannot borrow as mutable
-
-error[E0524]: two closures require unique access to `x` at the same time
- --> $DIR/borrowck-closures-mut-of-imm.rs:15:18
- |
-LL | let mut c1 = || set(&mut *x);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | first closure is constructed here
-LL |
-LL | let mut c2 = || set(&mut *x);
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | second closure is constructed here
-...
-LL | c2(); c1();
- | -- first borrow later used here
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr
index 9890c04..3be7d72 100644
--- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr
@@ -1,30 +1,30 @@
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-closures-mut-of-imm.rs:13:25
+ |
+LL | let mut c1 = || set(&mut *x);
+ | ^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-closures-mut-of-imm.rs:15:25
+ |
+LL | let mut c2 = || set(&mut *x);
+ | ^^^^^^^ cannot borrow as mutable
+
error[E0524]: two closures require unique access to `x` at the same time
--> $DIR/borrowck-closures-mut-of-imm.rs:15:18
|
LL | let mut c1 = || set(&mut *x);
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| first closure is constructed here
LL |
LL | let mut c2 = || set(&mut *x);
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| second closure is constructed here
...
-LL | }
- | - borrow from first closure ends here
-
-error[E0596]: cannot borrow immutable borrowed content `***x` as mutable
- --> $DIR/borrowck-closures-mut-of-imm.rs:13:30
- |
-LL | let mut c1 = || set(&mut *x);
- | ^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow immutable borrowed content `***x` as mutable
- --> $DIR/borrowck-closures-mut-of-imm.rs:15:30
- |
-LL | let mut c2 = || set(&mut *x);
- | ^^ cannot borrow as mutable
+LL | c2(); c1();
+ | -- first borrow later used here
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr
deleted file mode 100644
index a174388..0000000
--- a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0524]: two closures require unique access to `x` at the same time
- --> $DIR/borrowck-closures-mut-of-mut.rs:14:18
- |
-LL | let mut c1 = || set(&mut *x);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | first closure is constructed here
-LL | let mut c2 = || set(&mut *x);
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | second closure is constructed here
-LL |
-LL | c2(); c1();
- | -- first borrow later used here
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr
index efdcedb..a174388 100644
--- a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr
@@ -2,16 +2,16 @@
--> $DIR/borrowck-closures-mut-of-mut.rs:14:18
|
LL | let mut c1 = || set(&mut *x);
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| first closure is constructed here
LL | let mut c2 = || set(&mut *x);
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| second closure is constructed here
-...
-LL | }
- | - borrow from first closure ends here
+LL |
+LL | c2(); c1();
+ | -- first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr
deleted file mode 100644
index 07f477d..0000000
--- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr
+++ /dev/null
@@ -1,75 +0,0 @@
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-closures-two-mut-fail.rs:16:24
- |
-LL | let c1 = to_fn_mut(|| x = 4);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | first mutable borrow occurs here
-LL | let c2 = to_fn_mut(|| x = 5);
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | second mutable borrow occurs here
-LL | c1;
- | -- first borrow later used here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-closures-two-mut-fail.rs:27:24
- |
-LL | let c1 = to_fn_mut(|| set(&mut x));
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | first mutable borrow occurs here
-LL | let c2 = to_fn_mut(|| set(&mut x));
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | second mutable borrow occurs here
-LL | c1;
- | -- first borrow later used here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-closures-two-mut-fail.rs:34:24
- |
-LL | let c1 = to_fn_mut(|| x = 5);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | first mutable borrow occurs here
-LL | let c2 = to_fn_mut(|| set(&mut x));
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | second mutable borrow occurs here
-LL | c1;
- | -- first borrow later used here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-closures-two-mut-fail.rs:41:24
- |
-LL | let c1 = to_fn_mut(|| x = 5);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | first mutable borrow occurs here
-LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | second mutable borrow occurs here
-LL |
-LL | c1;
- | -- first borrow later used here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-closures-two-mut-fail.rs:53:24
- |
-LL | let c1 = to_fn_mut(|| set(&mut *x.f));
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | first mutable borrow occurs here
-LL | let c2 = to_fn_mut(|| set(&mut *x.f));
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | second mutable borrow occurs here
-LL |
-LL | c1;
- | -- first borrow later used here
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr
index 7399f83..07f477d 100644
--- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr
+++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr
@@ -2,76 +2,73 @@
--> $DIR/borrowck-closures-two-mut-fail.rs:16:24
|
LL | let c1 = to_fn_mut(|| x = 4);
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
LL | let c2 = to_fn_mut(|| x = 5);
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
LL | c1;
-LL | }
- | - first borrow ends here
+ | -- first borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut-fail.rs:27:24
|
LL | let c1 = to_fn_mut(|| set(&mut x));
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
LL | let c2 = to_fn_mut(|| set(&mut x));
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
LL | c1;
-LL | }
- | - first borrow ends here
+ | -- first borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut-fail.rs:34:24
|
LL | let c1 = to_fn_mut(|| x = 5);
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
LL | let c2 = to_fn_mut(|| set(&mut x));
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
LL | c1;
-LL | }
- | - first borrow ends here
+ | -- first borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut-fail.rs:41:24
|
LL | let c1 = to_fn_mut(|| x = 5);
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+LL |
+LL | c1;
+ | -- first borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut-fail.rs:53:24
|
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
LL | let c2 = to_fn_mut(|| set(&mut *x.f));
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+LL |
+LL | c1;
+ | -- first borrow later used here
error: aborting due to 5 previous errors
diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr
deleted file mode 100644
index b8bbb31..0000000
--- a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-closures-unique-imm.rs:11:9
- |
-LL | let p = &this.x;
- | ------- immutable borrow occurs here
-LL | &mut this.x;
- | ^^^^^^^^^^^ mutable borrow occurs here
-LL | p.use_ref();
- | - immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr
index 3cdc9b9..b8bbb31 100644
--- a/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr
+++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr
@@ -1,13 +1,12 @@
error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-closures-unique-imm.rs:11:14
+ --> $DIR/borrowck-closures-unique-imm.rs:11:9
|
LL | let p = &this.x;
- | ------ immutable borrow occurs here
+ | ------- immutable borrow occurs here
LL | &mut this.x;
- | ^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^ mutable borrow occurs here
LL | p.use_ref();
-LL | };
- | - immutable borrow ends here
+ | - immutable borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr
deleted file mode 100644
index ea5250a..0000000
--- a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr
+++ /dev/null
@@ -1,53 +0,0 @@
-error[E0500]: closure requires unique access to `x` but it is already borrowed
- --> $DIR/borrowck-closures-unique.rs:26:14
- |
-LL | let c1 = || get(x);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | borrow occurs here
-LL | let c2 = || set(x);
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | closure construction occurs here
-LL | c1;
- | -- first borrow later used here
-
-error[E0500]: closure requires unique access to `x` but it is already borrowed
- --> $DIR/borrowck-closures-unique.rs:32:14
- |
-LL | let c1 = || get(x);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | borrow occurs here
-LL | let c2 = || { get(x); set(x); };
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | closure construction occurs here
-LL | c1;
- | -- first borrow later used here
-
-error[E0524]: two closures require unique access to `x` at the same time
- --> $DIR/borrowck-closures-unique.rs:38:14
- |
-LL | let c1 = || set(x);
- | -- - first borrow occurs due to use of `x` in closure
- | |
- | first closure is constructed here
-LL | let c2 = || set(x);
- | ^^ - second borrow occurs due to use of `x` in closure
- | |
- | second closure is constructed here
-LL | c1;
- | -- first borrow later used here
-
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/borrowck-closures-unique.rs:47:38
- |
-LL | fn e(x: &'static mut isize) {
- | - help: consider changing this to be mutable: `mut x`
-LL | let c1 = |y: &'static mut isize| x = y;
- | ^^^^^ cannot assign
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0500`.
diff --git a/src/test/ui/borrowck/borrowck-closures-unique.rs b/src/test/ui/borrowck/borrowck-closures-unique.rs
index a4655eb..67f91df 100644
--- a/src/test/ui/borrowck/borrowck-closures-unique.rs
+++ b/src/test/ui/borrowck/borrowck-closures-unique.rs
@@ -39,17 +39,14 @@
c1;
}
-// This test was originally encoded in the form shown as `fn f` below.
-// However, since MIR-borrowck and thus NLL takes more control-flow information
-// into account, it was necessary to change the test in order to witness the
-// same (expected) error under both AST-borrowck and NLL.
fn e(x: &'static mut isize) {
- let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument
+ let c1 = |y: &'static mut isize| x = y;
+ //~^ ERROR cannot assign to `x`, as it is not declared as mutable
c1;
}
fn f(x: &'static mut isize) {
- let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument
+ let c1 = || x = panic!(); // OK assignment is unreachable.
c1;
}
diff --git a/src/test/ui/borrowck/borrowck-closures-unique.stderr b/src/test/ui/borrowck/borrowck-closures-unique.stderr
index 09dcb2c..9b53af4 100644
--- a/src/test/ui/borrowck/borrowck-closures-unique.stderr
+++ b/src/test/ui/borrowck/borrowck-closures-unique.stderr
@@ -2,68 +2,52 @@
--> $DIR/borrowck-closures-unique.rs:26:14
|
LL | let c1 = || get(x);
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| borrow occurs here
LL | let c2 = || set(x);
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| closure construction occurs here
LL | c1;
-LL | }
- | - borrow ends here
+ | -- first borrow later used here
error[E0500]: closure requires unique access to `x` but it is already borrowed
--> $DIR/borrowck-closures-unique.rs:32:14
|
LL | let c1 = || get(x);
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| borrow occurs here
LL | let c2 = || { get(x); set(x); };
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| closure construction occurs here
LL | c1;
-LL | }
- | - borrow ends here
+ | -- first borrow later used here
error[E0524]: two closures require unique access to `x` at the same time
--> $DIR/borrowck-closures-unique.rs:38:14
|
LL | let c1 = || set(x);
- | -- - previous borrow occurs due to use of `x` in closure
+ | -- - first borrow occurs due to use of `x` in closure
| |
| first closure is constructed here
LL | let c2 = || set(x);
- | ^^ - borrow occurs due to use of `x` in closure
+ | ^^ - second borrow occurs due to use of `x` in closure
| |
| second closure is constructed here
LL | c1;
-LL | }
- | - borrow from first closure ends here
+ | -- first borrow later used here
-error[E0595]: closure cannot assign to immutable argument `x`
- --> $DIR/borrowck-closures-unique.rs:47:14
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/borrowck-closures-unique.rs:43:38
|
+LL | fn e(x: &'static mut isize) {
+ | - help: consider changing this to be mutable: `mut x`
LL | let c1 = |y: &'static mut isize| x = y;
- | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably
-help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
- |
-LL | x
- | ^
+ | ^^^^^ cannot assign
-error[E0595]: closure cannot assign to immutable argument `x`
- --> $DIR/borrowck-closures-unique.rs:52:14
- |
-LL | let c1 = || x = panic!();
- | ^^ cannot borrow mutably
-help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
- |
-LL | x
- | ^
+error: aborting due to 4 previous errors
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0500, E0595.
-For more information about an error, try `rustc --explain E0500`.
+For more information about this error, try `rustc --explain E0500`.
diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr
deleted file mode 100644
index a6dbcf3..0000000
--- a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-closures-use-after-free.rs:22:8
- |
-LL | let mut test = |foo: &Foo| {
- | ----------- mutable borrow occurs here
-LL | ptr = box Foo { x: ptr.x + 1 };
- | --- first borrow occurs due to use of `ptr` in closure
-LL | };
-LL | test(&*ptr);
- | ---- ^^^^^ immutable borrow occurs here
- | |
- | mutable borrow later used by call
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr
index 9e77d8c..a6dbcf3 100644
--- a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr
+++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr
@@ -1,15 +1,15 @@
-error[E0502]: cannot borrow `*ptr` as immutable because `ptr` is also borrowed as mutable
- --> $DIR/borrowck-closures-use-after-free.rs:22:9
+error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-use-after-free.rs:22:8
|
LL | let mut test = |foo: &Foo| {
| ----------- mutable borrow occurs here
LL | ptr = box Foo { x: ptr.x + 1 };
- | --- previous borrow occurs due to use of `ptr` in closure
+ | --- first borrow occurs due to use of `ptr` in closure
LL | };
LL | test(&*ptr);
- | ^^^^ immutable borrow occurs here
-LL | }
- | - mutable borrow ends here
+ | ---- ^^^^^ immutable borrow occurs here
+ | |
+ | mutable borrow later used by call
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr
deleted file mode 100644
index c69237f..0000000
--- a/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: use of moved value: `b`
- --> $DIR/borrowck-consume-unsize-vec.rs:8:13
- |
-LL | fn foo(b: Box<[i32;5]>) {
- | - move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait
-LL | consume(b);
- | - value moved here
-LL | consume(b);
- | ^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr
index 02644b8..c69237f 100644
--- a/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr
+++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr
@@ -1,12 +1,12 @@
error[E0382]: use of moved value: `b`
--> $DIR/borrowck-consume-unsize-vec.rs:8:13
|
+LL | fn foo(b: Box<[i32;5]>) {
+ | - move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait
LL | consume(b);
| - value moved here
LL | consume(b);
| ^ value used here after move
- |
- = note: move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr
deleted file mode 100644
index e8194ad..0000000
--- a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: use of moved value: `b`
- --> $DIR/borrowck-consume-upcast-box.rs:10:13
- |
-LL | fn foo(b: Box<Foo+Send>) {
- | - move occurs because `b` has type `std::boxed::Box<dyn Foo + std::marker::Send>`, which does not implement the `Copy` trait
-LL | consume(b);
- | - value moved here
-LL | consume(b);
- | ^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr
index 7267a99..e8194ad 100644
--- a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr
+++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr
@@ -1,12 +1,12 @@
error[E0382]: use of moved value: `b`
--> $DIR/borrowck-consume-upcast-box.rs:10:13
|
+LL | fn foo(b: Box<Foo+Send>) {
+ | - move occurs because `b` has type `std::boxed::Box<dyn Foo + std::marker::Send>`, which does not implement the `Copy` trait
LL | consume(b);
| - value moved here
LL | consume(b);
| ^ value used here after move
- |
- = note: move occurs because `b` has type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr
deleted file mode 100644
index 1883da5..0000000
--- a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr
+++ /dev/null
@@ -1,383 +0,0 @@
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-describe-lvalue.rs:285:13
- |
-LL | let y = &mut x;
- | ------ first mutable borrow occurs here
-LL | &mut x;
- | ^^^^^^ second mutable borrow occurs here
-LL |
-LL | *y = 1;
- | ------ first borrow later used here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-describe-lvalue.rs:296:20
- |
-LL | let y = &mut x;
- | ------ first mutable borrow occurs here
-LL | &mut x;
- | ^^^^^^ second mutable borrow occurs here
-LL |
-LL | *y = 1;
- | ------ first borrow later used here
-
-error: captured variable cannot escape `FnMut` closure body
- --> $DIR/borrowck-describe-lvalue.rs:294:16
- |
-LL | || {
- | - inferred to be a `FnMut` closure
-LL | / || {
-LL | | let y = &mut x;
-LL | | &mut x;
-LL | |
-LL | | *y = 1;
-LL | | drop(y);
-LL | | }
- | |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
- |
- = note: `FnMut` closures only have access to their captured variables while they are executing...
- = note: ...therefore, they cannot allow references to captured variables to escape
-
-error[E0503]: cannot use `f.x` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:43:9
- |
-LL | let x = f.x();
- | - borrow of `f` occurs here
-LL | f.x;
- | ^^^ use of borrowed `f`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `g.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:51:9
- |
-LL | let x = g.x();
- | - borrow of `g` occurs here
-LL | g.0;
- | ^^^ use of borrowed `g`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `h.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:59:9
- |
-LL | let x = &mut h.0;
- | -------- borrow of `h.0` occurs here
-LL | h.0;
- | ^^^ use of borrowed `h.0`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `e.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:68:20
- |
-LL | let x = e.x();
- | - borrow of `e` occurs here
-LL | match e {
-LL | Baz::X(value) => value
- | ^^^^^ use of borrowed `e`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `u.a` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:78:9
- |
-LL | let x = &mut u.a;
- | -------- borrow of `u.a` occurs here
-LL | u.a;
- | ^^^ use of borrowed `u.a`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `f.x` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:86:9
- |
-LL | let x = f.x();
- | - borrow of `*f` occurs here
-LL | f.x;
- | ^^^ use of borrowed `*f`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `g.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:94:9
- |
-LL | let x = g.x();
- | - borrow of `*g` occurs here
-LL | g.0;
- | ^^^ use of borrowed `*g`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `h.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:102:9
- |
-LL | let x = &mut h.0;
- | -------- borrow of `h.0` occurs here
-LL | h.0;
- | ^^^ use of borrowed `h.0`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `e.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:111:20
- |
-LL | let x = e.x();
- | - borrow of `*e` occurs here
-LL | match *e {
-LL | Baz::X(value) => value
- | ^^^^^ use of borrowed `*e`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `u.a` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:121:9
- |
-LL | let x = &mut u.a;
- | -------- borrow of `u.a` occurs here
-LL | u.a;
- | ^^^ use of borrowed `u.a`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:130:15
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-LL | match v {
-LL | &[x, _, .., _, _] => println!("{}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:136:18
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, x, .., _, _] => println!("{}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:142:25
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, _, .., x, _] => println!("{}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:148:28
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, _, .., _, x] => println!("{}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:160:15
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-LL | match v {
-LL | &[x..] => println!("{:?}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:166:18
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, x..] => println!("{:?}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:172:15
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[x.., _] => println!("{:?}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:178:18
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, x.., _] => println!("{:?}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `e` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:192:13
- |
-LL | let x = &mut e;
- | ------ borrow of `e` occurs here
-LL | match e {
-LL | E::A(ref ax) =>
- | ^^^^^^^^^^^^ use of borrowed `e`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:192:18
- |
-LL | let x = &mut e;
- | ------ mutable borrow occurs here
-LL | match e {
-LL | E::A(ref ax) =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:197:23
- |
-LL | let x = &mut e;
- | ------ mutable borrow occurs here
-...
-LL | E::B { x: ref bx } =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:211:22
- |
-LL | let x = &mut s;
- | ------ mutable borrow occurs here
-LL | match s {
-LL | S { y: (ref y0, _), .. } =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:218:28
- |
-LL | let x = &mut s;
- | ------ mutable borrow occurs here
-...
-LL | S { x: F { y: ref x0, .. }, .. } =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0503]: cannot use `*v` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:261:9
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-LL | v[0].y;
- | ^^^^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[_].y` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:261:9
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-LL | v[0].y;
- | ^^^^^^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:273:24
- |
-LL | let x = &mut v;
- | ------ mutable borrow occurs here
-LL | match v {
-LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:235:29
- |
-LL | let x = &mut block;
- | ---------- mutable borrow occurs here
-LL | let p: &'a u8 = &*block.current;
- | ^^^^^^^^^^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
- |
- = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
- = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
-warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:250:33
- |
-LL | let x = &mut block;
- | ---------- mutable borrow occurs here
-LL | let p : *const u8 = &*(*block).current;
- | ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
- |
- = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
- = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-describe-lvalue.rs:307:22
- |
-LL | drop(x);
- | - value moved here
-LL | drop(x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
-
-error: aborting due to 30 previous errors
-
-Some errors have detailed explanations: E0382, E0499, E0502, E0503.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr
deleted file mode 100644
index beb009d..0000000
--- a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr
+++ /dev/null
@@ -1,246 +0,0 @@
-error[E0503]: cannot use `f.x` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:43:9
- |
-LL | let x = f.x();
- | - borrow of `f` occurs here
-LL | f.x;
- | ^^^ use of borrowed `f`
-
-error[E0503]: cannot use `g.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:51:9
- |
-LL | let x = g.x();
- | - borrow of `g` occurs here
-LL | g.0;
- | ^^^ use of borrowed `g`
-
-error[E0503]: cannot use `h.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:59:9
- |
-LL | let x = &mut h.0;
- | --- borrow of `h.0` occurs here
-LL | h.0;
- | ^^^ use of borrowed `h.0`
-
-error[E0503]: cannot use `e.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:68:20
- |
-LL | let x = e.x();
- | - borrow of `e` occurs here
-LL | match e {
-LL | Baz::X(value) => value
- | ^^^^^ use of borrowed `e`
-
-error[E0503]: cannot use `u.a` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:78:9
- |
-LL | let x = &mut u.a;
- | --- borrow of `u.a` occurs here
-LL | u.a;
- | ^^^ use of borrowed `u.a`
-
-error[E0503]: cannot use `f.x` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:86:9
- |
-LL | let x = f.x();
- | - borrow of `*f` occurs here
-LL | f.x;
- | ^^^ use of borrowed `*f`
-
-error[E0503]: cannot use `g.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:94:9
- |
-LL | let x = g.x();
- | - borrow of `*g` occurs here
-LL | g.0;
- | ^^^ use of borrowed `*g`
-
-error[E0503]: cannot use `h.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:102:9
- |
-LL | let x = &mut h.0;
- | --- borrow of `h.0` occurs here
-LL | h.0;
- | ^^^ use of borrowed `h.0`
-
-error[E0503]: cannot use `e.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:111:20
- |
-LL | let x = e.x();
- | - borrow of `*e` occurs here
-LL | match *e {
-LL | Baz::X(value) => value
- | ^^^^^ use of borrowed `*e`
-
-error[E0503]: cannot use `u.a` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:121:9
- |
-LL | let x = &mut u.a;
- | --- borrow of `u.a` occurs here
-LL | u.a;
- | ^^^ use of borrowed `u.a`
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:130:15
- |
-LL | let x = &mut v;
- | - borrow of `v` occurs here
-LL | match v {
-LL | &[x, _, .., _, _] => println!("{}", x),
- | ^ use of borrowed `v`
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:136:18
- |
-LL | let x = &mut v;
- | - borrow of `v` occurs here
-...
-LL | &[_, x, .., _, _] => println!("{}", x),
- | ^ use of borrowed `v`
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:142:25
- |
-LL | let x = &mut v;
- | - borrow of `v` occurs here
-...
-LL | &[_, _, .., x, _] => println!("{}", x),
- | ^ use of borrowed `v`
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:148:28
- |
-LL | let x = &mut v;
- | - borrow of `v` occurs here
-...
-LL | &[_, _, .., _, x] => println!("{}", x),
- | ^ use of borrowed `v`
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:160:15
- |
-LL | let x = &mut v;
- | - borrow of `v` occurs here
-LL | match v {
-LL | &[x..] => println!("{:?}", x),
- | ^ use of borrowed `v`
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:166:18
- |
-LL | let x = &mut v;
- | - borrow of `v` occurs here
-...
-LL | &[_, x..] => println!("{:?}", x),
- | ^ use of borrowed `v`
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:172:15
- |
-LL | let x = &mut v;
- | - borrow of `v` occurs here
-...
-LL | &[x.., _] => println!("{:?}", x),
- | ^ use of borrowed `v`
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:178:18
- |
-LL | let x = &mut v;
- | - borrow of `v` occurs here
-...
-LL | &[_, x.., _] => println!("{:?}", x),
- | ^ use of borrowed `v`
-
-error[E0502]: cannot borrow `e.0` as immutable because `e` is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:192:18
- |
-LL | let x = &mut e;
- | - mutable borrow occurs here
-LL | match e {
-LL | E::A(ref ax) =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `e.x` as immutable because `e` is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:197:23
- |
-LL | let x = &mut e;
- | - mutable borrow occurs here
-...
-LL | E::B { x: ref bx } =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:211:22
- |
-LL | let x = &mut s;
- | - mutable borrow occurs here
-LL | match s {
-LL | S { y: (ref y0, _), .. } =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `s.x.y` as immutable because `s` is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:218:28
- |
-LL | let x = &mut s;
- | - mutable borrow occurs here
-...
-LL | S { x: F { y: ref x0, .. }, .. } =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0503]: cannot use `v[..].y` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:261:9
- |
-LL | let x = &mut v;
- | - borrow of `v` occurs here
-LL | v[0].y;
- | ^^^^^^ use of borrowed `v`
-
-error[E0499]: cannot borrow `**x` as mutable more than once at a time
- --> $DIR/borrowck-describe-lvalue.rs:285:18
- |
-LL | let y = &mut x;
- | - first mutable borrow occurs here
-LL | &mut x;
- | ^ second mutable borrow occurs here
-...
-LL | };
- | - first borrow ends here
-
-error[E0499]: cannot borrow `**x` as mutable more than once at a time
- --> $DIR/borrowck-describe-lvalue.rs:296:25
- |
-LL | let y = &mut x;
- | - first mutable borrow occurs here
-LL | &mut x;
- | ^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-describe-lvalue.rs:307:22
- |
-LL | drop(x);
- | - value moved here
-LL | drop(x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
-
-error: aborting due to 26 previous errors
-
-Some errors have detailed explanations: E0382, E0499, E0502, E0503.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr
deleted file mode 100644
index 595c3f6..0000000
--- a/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr
+++ /dev/null
@@ -1,377 +0,0 @@
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-describe-lvalue.rs:285:13
- |
-LL | let y = &mut x;
- | ------ first mutable borrow occurs here
-LL | &mut x;
- | ^^^^^^ second mutable borrow occurs here
-LL |
-LL | *y = 1;
- | ------ first borrow later used here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-describe-lvalue.rs:296:20
- |
-LL | let y = &mut x;
- | ------ first mutable borrow occurs here
-LL | &mut x;
- | ^^^^^^ second mutable borrow occurs here
-LL |
-LL | *y = 1;
- | ------ first borrow later used here
-
-error: captured variable cannot escape `FnMut` closure body
- --> $DIR/borrowck-describe-lvalue.rs:294:16
- |
-LL | || {
- | - inferred to be a `FnMut` closure
-LL | / || {
-LL | | let y = &mut x;
-LL | | &mut x;
-LL | |
-LL | | *y = 1;
-LL | | drop(y);
-LL | | }
- | |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
- |
- = note: `FnMut` closures only have access to their captured variables while they are executing...
- = note: ...therefore, they cannot allow references to captured variables to escape
-
-error[E0503]: cannot use `f.x` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:43:9
- |
-LL | let x = f.x();
- | - borrow of `f` occurs here
-LL | f.x;
- | ^^^ use of borrowed `f`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `g.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:51:9
- |
-LL | let x = g.x();
- | - borrow of `g` occurs here
-LL | g.0;
- | ^^^ use of borrowed `g`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `h.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:59:9
- |
-LL | let x = &mut h.0;
- | -------- borrow of `h.0` occurs here
-LL | h.0;
- | ^^^ use of borrowed `h.0`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `e.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:68:20
- |
-LL | let x = e.x();
- | - borrow of `e` occurs here
-LL | match e {
-LL | Baz::X(value) => value
- | ^^^^^ use of borrowed `e`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `u.a` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:78:9
- |
-LL | let x = &mut u.a;
- | -------- borrow of `u.a` occurs here
-LL | u.a;
- | ^^^ use of borrowed `u.a`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `f.x` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:86:9
- |
-LL | let x = f.x();
- | - borrow of `*f` occurs here
-LL | f.x;
- | ^^^ use of borrowed `*f`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `g.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:94:9
- |
-LL | let x = g.x();
- | - borrow of `*g` occurs here
-LL | g.0;
- | ^^^ use of borrowed `*g`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `h.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:102:9
- |
-LL | let x = &mut h.0;
- | -------- borrow of `h.0` occurs here
-LL | h.0;
- | ^^^ use of borrowed `h.0`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `e.0` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:111:20
- |
-LL | let x = e.x();
- | - borrow of `*e` occurs here
-LL | match *e {
-LL | Baz::X(value) => value
- | ^^^^^ use of borrowed `*e`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `u.a` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:121:9
- |
-LL | let x = &mut u.a;
- | -------- borrow of `u.a` occurs here
-LL | u.a;
- | ^^^ use of borrowed `u.a`
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:130:15
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-LL | match v {
-LL | &[x, _, .., _, _] => println!("{}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:136:18
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, x, .., _, _] => println!("{}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:142:25
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, _, .., x, _] => println!("{}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:148:28
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, _, .., _, x] => println!("{}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:160:15
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-LL | match v {
-LL | &[x..] => println!("{:?}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:166:18
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, x..] => println!("{:?}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:172:15
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[x.., _] => println!("{:?}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[..]` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:178:18
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-...
-LL | &[_, x.., _] => println!("{:?}", x),
- | ^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `e` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:192:13
- |
-LL | let x = &mut e;
- | ------ borrow of `e` occurs here
-LL | match e {
-LL | E::A(ref ax) =>
- | ^^^^^^^^^^^^ use of borrowed `e`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:192:18
- |
-LL | let x = &mut e;
- | ------ mutable borrow occurs here
-LL | match e {
-LL | E::A(ref ax) =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:197:23
- |
-LL | let x = &mut e;
- | ------ mutable borrow occurs here
-...
-LL | E::B { x: ref bx } =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:211:22
- |
-LL | let x = &mut s;
- | ------ mutable borrow occurs here
-LL | match s {
-LL | S { y: (ref y0, _), .. } =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:218:28
- |
-LL | let x = &mut s;
- | ------ mutable borrow occurs here
-...
-LL | S { x: F { y: ref x0, .. }, .. } =>
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0503]: cannot use `*v` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:261:9
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-LL | v[0].y;
- | ^^^^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0503]: cannot use `v[_].y` because it was mutably borrowed
- --> $DIR/borrowck-describe-lvalue.rs:261:9
- |
-LL | let x = &mut v;
- | ------ borrow of `v` occurs here
-LL | v[0].y;
- | ^^^^^^ use of borrowed `v`
-...
-LL | drop(x);
- | - borrow later used here
-
-error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:273:24
- |
-LL | let x = &mut v;
- | ------ mutable borrow occurs here
-LL | match v {
-LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
- | ^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:235:29
- |
-LL | let x = &mut block;
- | ---------- mutable borrow occurs here
-LL | let p: &'a u8 = &*block.current;
- | ^^^^^^^^^^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-describe-lvalue.rs:250:33
- |
-LL | let x = &mut block;
- | ---------- mutable borrow occurs here
-LL | let p : *const u8 = &*(*block).current;
- | ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
-...
-LL | drop(x);
- | - mutable borrow later used here
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-describe-lvalue.rs:307:22
- |
-LL | drop(x);
- | - value moved here
-LL | drop(x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
-
-error: aborting due to 32 previous errors
-
-Some errors have detailed explanations: E0382, E0499, E0502, E0503.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.rs b/src/test/ui/borrowck/borrowck-describe-lvalue.rs
index eb622ac..c8dbf4e 100644
--- a/src/test/ui/borrowck/borrowck-describe-lvalue.rs
+++ b/src/test/ui/borrowck/borrowck-describe-lvalue.rs
@@ -1,6 +1,4 @@
// ignore-tidy-linelength
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
#![feature(slice_patterns)]
@@ -40,24 +38,21 @@
{
let mut f = Foo { x: 22 };
let x = f.x();
- f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
- //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed
+ f.x; //~ ERROR cannot use `f.x` because it was mutably borrowed
drop(x);
}
// Local and field from tuple-struct
{
let mut g = Bar(22);
let x = g.x();
- g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
- //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed
+ g.0; //~ ERROR cannot use `g.0` because it was mutably borrowed
drop(x);
}
// Local and field from tuple
{
let mut h = (22, 23);
let x = &mut h.0;
- h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
- //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed
+ h.0; //~ ERROR cannot use `h.0` because it was mutably borrowed
drop(x);
}
// Local and field from enum
@@ -65,9 +60,7 @@
let mut e = Baz::X(2);
let x = e.x();
match e {
- Baz::X(value) => value
- //[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
+ Baz::X(value) => value //~ ERROR cannot use `e.0` because it was mutably borrowed
};
drop(x);
}
@@ -75,32 +68,28 @@
unsafe {
let mut u = U { b: 0 };
let x = &mut u.a;
- u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
- //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+ u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed
drop(x);
}
// Deref and field from struct
{
let mut f = Box::new(Foo { x: 22 });
let x = f.x();
- f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
- //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed
+ f.x; //~ ERROR cannot use `f.x` because it was mutably borrowed
drop(x);
}
// Deref and field from tuple-struct
{
let mut g = Box::new(Bar(22));
let x = g.x();
- g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
- //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed
+ g.0; //~ ERROR cannot use `g.0` because it was mutably borrowed
drop(x);
}
// Deref and field from tuple
{
let mut h = Box::new((22, 23));
let x = &mut h.0;
- h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
- //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed
+ h.0; //~ ERROR cannot use `h.0` because it was mutably borrowed
drop(x);
}
// Deref and field from enum
@@ -109,8 +98,7 @@
let x = e.x();
match *e {
Baz::X(value) => value
- //[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
+ //~^ ERROR cannot use `e.0` because it was mutably borrowed
};
drop(x);
}
@@ -118,8 +106,7 @@
unsafe {
let mut u = Box::new(U { b: 0 });
let x = &mut u.a;
- u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
- //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+ u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed
drop(x);
}
// Constant index
@@ -128,26 +115,22 @@
let x = &mut v;
match v {
&[x, _, .., _, _] => println!("{}", x),
- //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
+ //~^ ERROR cannot use `v[..]` because it was mutably borrowed
_ => panic!("other case"),
}
match v {
&[_, x, .., _, _] => println!("{}", x),
- //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
+ //~^ ERROR cannot use `v[..]` because it was mutably borrowed
_ => panic!("other case"),
}
match v {
&[_, _, .., x, _] => println!("{}", x),
- //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
+ //~^ ERROR cannot use `v[..]` because it was mutably borrowed
_ => panic!("other case"),
}
match v {
&[_, _, .., _, x] => println!("{}", x),
- //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
+ //~^ ERROR cannot use `v[..]` because it was mutably borrowed
_ => panic!("other case"),
}
drop(x);
@@ -158,26 +141,22 @@
let x = &mut v;
match v {
&[x..] => println!("{:?}", x),
- //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
+ //~^ ERROR cannot use `v[..]` because it was mutably borrowed
_ => panic!("other case"),
}
match v {
&[_, x..] => println!("{:?}", x),
- //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
+ //~^ ERROR cannot use `v[..]` because it was mutably borrowed
_ => panic!("other case"),
}
match v {
&[x.., _] => println!("{:?}", x),
- //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
+ //~^ ERROR cannot use `v[..]` because it was mutably borrowed
_ => panic!("other case"),
}
match v {
&[_, x.., _] => println!("{:?}", x),
- //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
+ //~^ ERROR cannot use `v[..]` because it was mutably borrowed
_ => panic!("other case"),
}
drop(x);
@@ -190,13 +169,11 @@
let x = &mut e;
match e {
E::A(ref ax) =>
- //[ast]~^ ERROR cannot borrow `e.0` as immutable because `e` is also borrowed as mutable
- //[mir]~^^ ERROR cannot borrow `e.0` as immutable because it is also borrowed as mutable
- //[mir]~| ERROR cannot use `e` because it was mutably borrowed
+ //~^ ERROR cannot borrow `e.0` as immutable because it is also borrowed as mutable
+ //~| ERROR cannot use `e` because it was mutably borrowed
println!("e.ax: {:?}", ax),
E::B { x: ref bx } =>
- //[ast]~^ ERROR cannot borrow `e.x` as immutable because `e` is also borrowed as mutable
- //[mir]~^^ ERROR cannot borrow `e.x` as immutable because it is also borrowed as mutable
+ //~^ ERROR cannot borrow `e.x` as immutable because it is also borrowed as mutable
println!("e.bx: {:?}", bx),
}
drop(x);
@@ -209,15 +186,13 @@
let x = &mut s;
match s {
S { y: (ref y0, _), .. } =>
- //[ast]~^ ERROR cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable
- //[mir]~^^ ERROR cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
+ //~^ ERROR cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
println!("y0: {:?}", y0),
_ => panic!("other case"),
}
match s {
S { x: F { y: ref x0, .. }, .. } =>
- //[ast]~^ ERROR cannot borrow `s.x.y` as immutable because `s` is also borrowed as mutable
- //[mir]~^^ ERROR cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
+ //~^ ERROR cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
println!("x0: {:?}", x0),
_ => panic!("other case"),
}
@@ -233,8 +208,10 @@
fn bump<'a>(mut block: &mut Block<'a>) {
let x = &mut block;
let p: &'a u8 = &*block.current;
- //[mir]~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
- // No errors in AST because of issue rust#38899
+ //~^ WARNING cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ //~| this error has been downgraded
+ //~| this warning will become a hard error in the future
+ // Warning because of issue rust#38899
drop(x);
}
}
@@ -248,8 +225,10 @@
unsafe fn bump2(mut block: *mut Block2) {
let x = &mut block;
let p : *const u8 = &*(*block).current;
- //[mir]~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
- // No errors in AST because of issue rust#38899
+ //~^ WARNING cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ //~| this error has been downgraded
+ //~| this warning will become a hard error in the future
+ // Warning because of issue rust#38899
drop(x);
}
}
@@ -259,9 +238,8 @@
let mut v = &[F{x: 1, y: 2}, F{x: 3, y: 4}];
let x = &mut v;
v[0].y;
- //[ast]~^ ERROR cannot use `v[..].y` because it was mutably borrowed
- //[mir]~^^ ERROR cannot use `v[_].y` because it was mutably borrowed
- //[mir]~| ERROR cannot use `*v` because it was mutably borrowed
+ //~^ ERROR cannot use `v[_].y` because it was mutably borrowed
+ //~| ERROR cannot use `*v` because it was mutably borrowed
drop(x);
}
// Field of constant index
@@ -271,8 +249,7 @@
let x = &mut v;
match v {
&[_, F {x: ref xf, ..}] => println!("{}", xf),
- //[mir]~^ ERROR cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
- // No errors in AST
+ //~^ ERROR cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
_ => panic!("other case")
}
drop(x);
@@ -282,8 +259,7 @@
let mut x = 0;
|| {
let y = &mut x;
- &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
- //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
+ &mut x; //~ ERROR cannot borrow `x` as mutable more than once at a time
*y = 1;
};
}
@@ -291,10 +267,9 @@
{
let mut x = 0;
|| {
- || { //[mir]~ ERROR captured variable cannot escape `FnMut` closure body
+ || { //~ ERROR captured variable cannot escape `FnMut` closure body
let y = &mut x;
- &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
- //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
+ &mut x; //~ ERROR cannot borrow `x` as mutable more than once at a time
*y = 1;
drop(y);
}
@@ -304,8 +279,7 @@
fn foo(x: Vec<i32>) {
let c = || {
drop(x);
- drop(x); //[ast]~ ERROR use of moved value: `x`
- //[mir]~^ ERROR use of moved value: `x`
+ drop(x); //~ ERROR use of moved value: `x`
};
c();
}
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr
new file mode 100644
index 0000000..fb42e5f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr
@@ -0,0 +1,372 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-describe-lvalue.rs:262:13
+ |
+LL | let y = &mut x;
+ | ------ first mutable borrow occurs here
+LL | &mut x;
+ | ^^^^^^ second mutable borrow occurs here
+LL | *y = 1;
+ | ------ first borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-describe-lvalue.rs:272:20
+ |
+LL | let y = &mut x;
+ | ------ first mutable borrow occurs here
+LL | &mut x;
+ | ^^^^^^ second mutable borrow occurs here
+LL | *y = 1;
+ | ------ first borrow later used here
+
+error: captured variable cannot escape `FnMut` closure body
+ --> $DIR/borrowck-describe-lvalue.rs:270:16
+ |
+LL | || {
+ | - inferred to be a `FnMut` closure
+LL | / || {
+LL | | let y = &mut x;
+LL | | &mut x;
+LL | | *y = 1;
+LL | | drop(y);
+LL | | }
+ | |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+ |
+ = note: `FnMut` closures only have access to their captured variables while they are executing...
+ = note: ...therefore, they cannot allow references to captured variables to escape
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:41:9
+ |
+LL | let x = f.x();
+ | - borrow of `f` occurs here
+LL | f.x;
+ | ^^^ use of borrowed `f`
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:48:9
+ |
+LL | let x = g.x();
+ | - borrow of `g` occurs here
+LL | g.0;
+ | ^^^ use of borrowed `g`
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:55:9
+ |
+LL | let x = &mut h.0;
+ | -------- borrow of `h.0` occurs here
+LL | h.0;
+ | ^^^ use of borrowed `h.0`
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:63:20
+ |
+LL | let x = e.x();
+ | - borrow of `e` occurs here
+LL | match e {
+LL | Baz::X(value) => value
+ | ^^^^^ use of borrowed `e`
+LL | };
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:71:9
+ |
+LL | let x = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | u.a;
+ | ^^^ use of borrowed `u.a`
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:78:9
+ |
+LL | let x = f.x();
+ | - borrow of `*f` occurs here
+LL | f.x;
+ | ^^^ use of borrowed `*f`
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:85:9
+ |
+LL | let x = g.x();
+ | - borrow of `*g` occurs here
+LL | g.0;
+ | ^^^ use of borrowed `*g`
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:92:9
+ |
+LL | let x = &mut h.0;
+ | -------- borrow of `h.0` occurs here
+LL | h.0;
+ | ^^^ use of borrowed `h.0`
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:100:20
+ |
+LL | let x = e.x();
+ | - borrow of `*e` occurs here
+LL | match *e {
+LL | Baz::X(value) => value
+ | ^^^^^ use of borrowed `*e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:109:9
+ |
+LL | let x = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | u.a;
+ | ^^^ use of borrowed `u.a`
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:117:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v {
+LL | &[x, _, .., _, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:122:18
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, x, .., _, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:127:25
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, _, .., x, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:132:28
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, _, .., _, x] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:143:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v {
+LL | &[x..] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:148:18
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, x..] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:153:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[x.., _] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:158:18
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, x.., _] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:171:13
+ |
+LL | let x = &mut e;
+ | ------ borrow of `e` occurs here
+LL | match e {
+LL | E::A(ref ax) =>
+ | ^^^^^^^^^^^^ use of borrowed `e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:171:18
+ |
+LL | let x = &mut e;
+ | ------ mutable borrow occurs here
+LL | match e {
+LL | E::A(ref ax) =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - mutable borrow later used here
+
+error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:175:23
+ |
+LL | let x = &mut e;
+ | ------ mutable borrow occurs here
+...
+LL | E::B { x: ref bx } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - mutable borrow later used here
+
+error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:188:22
+ |
+LL | let x = &mut s;
+ | ------ mutable borrow occurs here
+LL | match s {
+LL | S { y: (ref y0, _), .. } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - mutable borrow later used here
+
+error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:194:28
+ |
+LL | let x = &mut s;
+ | ------ mutable borrow occurs here
+...
+LL | S { x: F { y: ref x0, .. }, .. } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - mutable borrow later used here
+
+error[E0503]: cannot use `*v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:240:9
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | v[0].y;
+ | ^^^^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[_].y` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:240:9
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | v[0].y;
+ | ^^^^^^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:251:24
+ |
+LL | let x = &mut v;
+ | ------ mutable borrow occurs here
+LL | match v {
+LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - mutable borrow later used here
+
+warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:210:29
+ |
+LL | let x = &mut block;
+ | ---------- mutable borrow occurs here
+LL | let p: &'a u8 = &*block.current;
+ | ^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - mutable borrow later used here
+ |
+ = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+ = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:227:33
+ |
+LL | let x = &mut block;
+ | ---------- mutable borrow occurs here
+LL | let p : *const u8 = &*(*block).current;
+ | ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - mutable borrow later used here
+ |
+ = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+ = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-describe-lvalue.rs:282:22
+ |
+LL | drop(x);
+ | - value moved here
+LL | drop(x);
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 30 previous errors
+
+Some errors have detailed explanations: E0382, E0499, E0502, E0503.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.nll.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.nll.stderr
deleted file mode 100644
index 3195120..0000000
--- a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function
- --> $DIR/borrowck-escaping-closure-error-1.rs:13:11
- |
-LL | spawn(|| books.push(4));
- | ^^ ----- `books` is borrowed here
- | |
- | may outlive borrowed value `books`
- |
-note: function requires argument type to outlive `'static`
- --> $DIR/borrowck-escaping-closure-error-1.rs:13:5
- |
-LL | spawn(|| books.push(4));
- | ^^^^^^^^^^^^^^^^^^^^^^^
-help: to force the closure to take ownership of `books` (and any other referenced variables), use the `move` keyword
- |
-LL | spawn(move || books.push(4));
- | ^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0373`.
diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr
index 16ba61d..3195120 100644
--- a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr
+++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr
@@ -5,6 +5,12 @@
| ^^ ----- `books` is borrowed here
| |
| may outlive borrowed value `books`
+ |
+note: function requires argument type to outlive `'static`
+ --> $DIR/borrowck-escaping-closure-error-1.rs:13:5
+ |
+LL | spawn(|| books.push(4));
+ | ^^^^^^^^^^^^^^^^^^^^^^^
help: to force the closure to take ownership of `books` (and any other referenced variables), use the `move` keyword
|
LL | spawn(move || books.push(4));
diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.nll.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.nll.stderr
deleted file mode 100644
index 3227aa9b..0000000
--- a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function
- --> $DIR/borrowck-escaping-closure-error-2.rs:11:14
- |
-LL | Box::new(|| books.push(4))
- | ^^ ----- `books` is borrowed here
- | |
- | may outlive borrowed value `books`
- |
-note: closure is returned here
- --> $DIR/borrowck-escaping-closure-error-2.rs:11:5
- |
-LL | Box::new(|| books.push(4))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: to force the closure to take ownership of `books` (and any other referenced variables), use the `move` keyword
- |
-LL | Box::new(move || books.push(4))
- | ^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0373`.
diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr
index 960f65d..3227aa9b 100644
--- a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr
+++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr
@@ -5,6 +5,12 @@
| ^^ ----- `books` is borrowed here
| |
| may outlive borrowed value `books`
+ |
+note: closure is returned here
+ --> $DIR/borrowck-escaping-closure-error-2.rs:11:5
+ |
+LL | Box::new(|| books.push(4))
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to force the closure to take ownership of `books` (and any other referenced variables), use the `move` keyword
|
LL | Box::new(move || books.push(4))
diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr
deleted file mode 100644
index 8952323..0000000
--- a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr
+++ /dev/null
@@ -1,132 +0,0 @@
-error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:8:10
- |
-LL | drop(x.b);
- | --- value moved here
-LL | drop(*x.b);
- | ^^^^ value used here after move
- |
- = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:14:10
- |
-LL | let y = A { a: 3, .. x };
- | ---------------- value moved here
-LL | drop(*x.b);
- | ^^^^ value used here after move
- |
- = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: borrow of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:20:13
- |
-LL | drop(x.b);
- | --- value moved here
-LL | let p = &x.b;
- | ^^^^ value borrowed here after move
- |
- = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: borrow of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:27:13
- |
-LL | let _y = A { a: 3, .. x };
- | ---------------- value moved here
-LL | let p = &x.b;
- | ^^^^ value borrowed here after move
- |
- = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0505]: cannot move out of `x.b` because it is borrowed
- --> $DIR/borrowck-field-sensitivity.rs:34:10
- |
-LL | let p = &x.b;
- | ---- borrow of `x.b` occurs here
-LL | drop(x.b);
- | ^^^ move out of `x.b` occurs here
-LL | drop(**p);
- | --- borrow later used here
-
-error[E0505]: cannot move out of `x.b` because it is borrowed
- --> $DIR/borrowck-field-sensitivity.rs:41:14
- |
-LL | let p = &x.b;
- | ---- borrow of `x.b` occurs here
-LL | let _y = A { a: 3, .. x };
- | ^^^^^^^^^^^^^^^^ move out of `x.b` occurs here
-LL | drop(**p);
- | --- borrow later used here
-
-error[E0499]: cannot borrow `x.a` as mutable more than once at a time
- --> $DIR/borrowck-field-sensitivity.rs:48:13
- |
-LL | let p = &mut x.a;
- | -------- first mutable borrow occurs here
-LL | let q = &mut x.a;
- | ^^^^^^^^ second mutable borrow occurs here
-LL | drop(*p);
- | -- first borrow later used here
-
-error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:56:10
- |
-LL | drop(x.b);
- | --- value moved here
-LL | drop(x.b);
- | ^^^ value used here after move
- |
- = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:62:10
- |
-LL | let _y = A { a: 3, .. x };
- | ---------------- value moved here
-LL | drop(x.b);
- | ^^^ value used here after move
- |
- = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:68:14
- |
-LL | drop(x.b);
- | --- value moved here
-LL | let _z = A { a: 3, .. x };
- | ^^^^^^^^^^^^^^^^ value used here after move
- |
- = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:74:14
- |
-LL | let _y = A { a: 3, .. x };
- | ---------------- value moved here
-LL | let _z = A { a: 4, .. x };
- | ^^^^^^^^^^^^^^^^ value used here after move
- |
- = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error[E0381]: assign to part of possibly uninitialized variable: `x`
- --> $DIR/borrowck-field-sensitivity.rs:81:5
- |
-LL | x.a = 1;
- | ^^^^^^^ use of possibly uninitialized `x`
-
-error[E0381]: assign to part of possibly uninitialized variable: `x`
- --> $DIR/borrowck-field-sensitivity.rs:87:5
- |
-LL | x.a = 1;
- | ^^^^^^^ use of possibly uninitialized `x`
-
-error[E0381]: assign to part of possibly uninitialized variable: `x`
- --> $DIR/borrowck-field-sensitivity.rs:94:5
- |
-LL | x.b = box 1;
- | ^^^ use of possibly uninitialized `x`
-
-error: aborting due to 14 previous errors
-
-Some errors have detailed explanations: E0381, E0382, E0499, E0505.
-For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.rs b/src/test/ui/borrowck/borrowck-field-sensitivity.rs
index 1e9e6d6..88f74d1 100644
--- a/src/test/ui/borrowck/borrowck-field-sensitivity.rs
+++ b/src/test/ui/borrowck/borrowck-field-sensitivity.rs
@@ -5,26 +5,26 @@
fn deref_after_move() {
let x = A { a: 1, b: box 2 };
drop(x.b);
- drop(*x.b); //~ ERROR use of moved value: `*x.b`
+ drop(*x.b); //~ ERROR use of moved value: `x.b`
}
fn deref_after_fu_move() {
let x = A { a: 1, b: box 2 };
let y = A { a: 3, .. x };
- drop(*x.b); //~ ERROR use of moved value: `*x.b`
+ drop(*x.b); //~ ERROR use of moved value: `x.b`
}
fn borrow_after_move() {
let x = A { a: 1, b: box 2 };
drop(x.b);
- let p = &x.b; //~ ERROR use of moved value: `x.b`
+ let p = &x.b; //~ ERROR borrow of moved value: `x.b`
drop(**p);
}
fn borrow_after_fu_move() {
let x = A { a: 1, b: box 2 };
let _y = A { a: 3, .. x };
- let p = &x.b; //~ ERROR use of moved value: `x.b`
+ let p = &x.b; //~ ERROR borrow of moved value: `x.b`
drop(**p);
}
@@ -78,21 +78,21 @@
fn copy_after_field_assign_after_uninit() {
let mut x: A;
- x.a = 1;
- drop(x.a); //~ ERROR use of possibly uninitialized variable: `x.a`
+ x.a = 1; //~ ERROR assign to part of possibly uninitialized variable: `x`
+ drop(x.a);
}
fn borrow_after_field_assign_after_uninit() {
let mut x: A;
- x.a = 1;
- let p = &x.a; //~ ERROR use of possibly uninitialized variable: `x.a`
+ x.a = 1; //~ ERROR assign to part of possibly uninitialized variable: `x`
+ let p = &x.a;
drop(*p);
}
fn move_after_field_assign_after_uninit() {
let mut x: A;
- x.b = box 1;
- drop(x.b); //~ ERROR use of possibly uninitialized variable: `x.b`
+ x.b = box 1; //~ ERROR assign to part of possibly uninitialized variable: `x`
+ drop(x.b);
}
fn main() {
diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr
index d345d0a..8952323 100644
--- a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr
+++ b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr
@@ -1,4 +1,4 @@
-error[E0382]: use of moved value: `*x.b`
+error[E0382]: use of moved value: `x.b`
--> $DIR/borrowck-field-sensitivity.rs:8:10
|
LL | drop(x.b);
@@ -8,33 +8,33 @@
|
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-error[E0382]: use of moved value: `*x.b`
+error[E0382]: use of moved value: `x.b`
--> $DIR/borrowck-field-sensitivity.rs:14:10
|
LL | let y = A { a: 3, .. x };
- | - value moved here
+ | ---------------- value moved here
LL | drop(*x.b);
| ^^^^ value used here after move
|
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:20:14
+error[E0382]: borrow of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:20:13
|
LL | drop(x.b);
| --- value moved here
LL | let p = &x.b;
- | ^^^ value used here after move
+ | ^^^^ value borrowed here after move
|
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:27:14
+error[E0382]: borrow of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:27:13
|
LL | let _y = A { a: 3, .. x };
- | - value moved here
+ | ---------------- value moved here
LL | let p = &x.b;
- | ^^^ value used here after move
+ | ^^^^ value borrowed here after move
|
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
@@ -42,28 +42,31 @@
--> $DIR/borrowck-field-sensitivity.rs:34:10
|
LL | let p = &x.b;
- | --- borrow of `x.b` occurs here
+ | ---- borrow of `x.b` occurs here
LL | drop(x.b);
| ^^^ move out of `x.b` occurs here
+LL | drop(**p);
+ | --- borrow later used here
error[E0505]: cannot move out of `x.b` because it is borrowed
- --> $DIR/borrowck-field-sensitivity.rs:41:27
+ --> $DIR/borrowck-field-sensitivity.rs:41:14
|
LL | let p = &x.b;
- | --- borrow of `x.b` occurs here
+ | ---- borrow of `x.b` occurs here
LL | let _y = A { a: 3, .. x };
- | ^ move out of `x.b` occurs here
+ | ^^^^^^^^^^^^^^^^ move out of `x.b` occurs here
+LL | drop(**p);
+ | --- borrow later used here
error[E0499]: cannot borrow `x.a` as mutable more than once at a time
- --> $DIR/borrowck-field-sensitivity.rs:48:18
+ --> $DIR/borrowck-field-sensitivity.rs:48:13
|
LL | let p = &mut x.a;
- | --- first mutable borrow occurs here
+ | -------- first mutable borrow occurs here
LL | let q = &mut x.a;
- | ^^^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | drop(*p);
+ | -- first borrow later used here
error[E0382]: use of moved value: `x.b`
--> $DIR/borrowck-field-sensitivity.rs:56:10
@@ -79,49 +82,49 @@
--> $DIR/borrowck-field-sensitivity.rs:62:10
|
LL | let _y = A { a: 3, .. x };
- | - value moved here
+ | ---------------- value moved here
LL | drop(x.b);
| ^^^ value used here after move
|
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:68:27
+ --> $DIR/borrowck-field-sensitivity.rs:68:14
|
LL | drop(x.b);
| --- value moved here
LL | let _z = A { a: 3, .. x };
- | ^ value used here after move
+ | ^^^^^^^^^^^^^^^^ value used here after move
|
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:74:27
+ --> $DIR/borrowck-field-sensitivity.rs:74:14
|
LL | let _y = A { a: 3, .. x };
- | - value moved here
+ | ---------------- value moved here
LL | let _z = A { a: 4, .. x };
- | ^ value used here after move
+ | ^^^^^^^^^^^^^^^^ value used here after move
|
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-error[E0381]: use of possibly uninitialized variable: `x.a`
- --> $DIR/borrowck-field-sensitivity.rs:82:10
+error[E0381]: assign to part of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-field-sensitivity.rs:81:5
|
-LL | drop(x.a);
- | ^^^ use of possibly uninitialized `x.a`
+LL | x.a = 1;
+ | ^^^^^^^ use of possibly uninitialized `x`
-error[E0381]: use of possibly uninitialized variable: `x.a`
- --> $DIR/borrowck-field-sensitivity.rs:88:14
+error[E0381]: assign to part of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-field-sensitivity.rs:87:5
|
-LL | let p = &x.a;
- | ^^^ use of possibly uninitialized `x.a`
+LL | x.a = 1;
+ | ^^^^^^^ use of possibly uninitialized `x`
-error[E0381]: use of possibly uninitialized variable: `x.b`
- --> $DIR/borrowck-field-sensitivity.rs:95:10
+error[E0381]: assign to part of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-field-sensitivity.rs:94:5
|
-LL | drop(x.b);
- | ^^^ use of possibly uninitialized `x.b`
+LL | x.b = box 1;
+ | ^^^ use of possibly uninitialized `x`
error: aborting due to 14 previous errors
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr
deleted file mode 100644
index 16c62fc..0000000
--- a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-fn-in-const-a.rs:9:16
- |
-LL | return *x
- | ^^ cannot move out of borrowed content
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr
deleted file mode 100644
index 16c62fc..0000000
--- a/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-fn-in-const-a.rs:9:16
- |
-LL | return *x
- | ^^ cannot move out of borrowed content
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.rs b/src/test/ui/borrowck/borrowck-fn-in-const-a.rs
index 17663a3..faa56cc7 100644
--- a/src/test/ui/borrowck/borrowck-fn-in-const-a.rs
+++ b/src/test/ui/borrowck/borrowck-fn-in-const-a.rs
@@ -1,13 +1,9 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
// Check that we check fns appearing in constant declarations.
// Issue #22382.
const MOVE: fn(&String) -> String = {
fn broken(x: &String) -> String {
- return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
- //[mir]~^ ERROR [E0507]
+ return *x //~ ERROR cannot move out of borrowed content [E0507]
}
broken
};
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.stderr
new file mode 100644
index 0000000..fff2835
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-fn-in-const-a.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-fn-in-const-a.rs:6:16
+ |
+LL | return *x
+ | ^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr
deleted file mode 100644
index d48866dc..0000000
--- a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0713]: borrow may still be in use when destructor runs
- --> $DIR/borrowck-fn-in-const-c.rs:17:16
- |
-LL | return &local.inner;
- | ^^^^^^^^^^^^ returning this value requires that `local.inner` is borrowed for `'static`
-LL | }
- | - here, drop of `local` needs exclusive access to `local.inner`, because the type `DropString` implements the `Drop` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0713`.
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.rs b/src/test/ui/borrowck/borrowck-fn-in-const-c.rs
index d0a2e5b..c638cd0 100644
--- a/src/test/ui/borrowck/borrowck-fn-in-const-c.rs
+++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.rs
@@ -14,7 +14,7 @@
const LOCAL_REF: fn() -> &'static str = {
fn broken() -> &'static str {
let local = DropString { inner: format!("Some local string") };
- return &local.inner; //~ ERROR does not live long enough
+ return &local.inner; //~ borrow may still be in use when destructor runs
}
broken
};
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr
index d2ddf80..d48866dc 100644
--- a/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr
+++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr
@@ -1,13 +1,11 @@
-error[E0597]: `local.inner` does not live long enough
- --> $DIR/borrowck-fn-in-const-c.rs:17:17
+error[E0713]: borrow may still be in use when destructor runs
+ --> $DIR/borrowck-fn-in-const-c.rs:17:16
|
LL | return &local.inner;
- | ^^^^^^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^^^^^^ returning this value requires that `local.inner` is borrowed for `'static`
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - here, drop of `local` needs exclusive access to `local.inner`, because the type `DropString` implements the `Drop` trait
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0713`.
diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr
deleted file mode 100644
index 08cafa7..0000000
--- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr
+++ /dev/null
@@ -1,48 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:15
- |
-LL | for &a in x.iter() {
- | -- ^^^^^^^^ cannot move out of borrowed content
- | ||
- | |data moved here
- | help: consider removing the `&`: `a`
- |
-note: move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait
- --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:10
- |
-LL | for &a in x.iter() {
- | ^
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:15
- |
-LL | for &a in &f.a {
- | -- ^^^^ cannot move out of borrowed content
- | ||
- | |data moved here
- | help: consider removing the `&`: `a`
- |
-note: move occurs because `a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
- --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:10
- |
-LL | for &a in &f.a {
- | ^
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15
- |
-LL | for &a in x.iter() {
- | -- ^^^^^^^^ cannot move out of borrowed content
- | ||
- | |data moved here
- | help: consider removing the `&`: `a`
- |
-note: move occurs because `a` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
- --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10
- |
-LL | for &a in x.iter() {
- | ^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr
index fb53b13..08cafa7 100644
--- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr
+++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr
@@ -1,29 +1,47 @@
error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:9
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:15
|
LL | for &a in x.iter() {
- | ^-
+ | -- ^^^^^^^^ cannot move out of borrowed content
| ||
- | |hint: to prevent move, use `ref a` or `ref mut a`
- | cannot move out of borrowed content
+ | |data moved here
+ | help: consider removing the `&`: `a`
+ |
+note: move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:10
+ |
+LL | for &a in x.iter() {
+ | ^
error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:9
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:15
|
LL | for &a in &f.a {
- | ^-
+ | -- ^^^^ cannot move out of borrowed content
| ||
- | |hint: to prevent move, use `ref a` or `ref mut a`
- | cannot move out of borrowed content
+ | |data moved here
+ | help: consider removing the `&`: `a`
+ |
+note: move occurs because `a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:10
+ |
+LL | for &a in &f.a {
+ | ^
error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:9
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15
|
LL | for &a in x.iter() {
- | ^-
+ | -- ^^^^^^^^ cannot move out of borrowed content
| ||
- | |hint: to prevent move, use `ref a` or `ref mut a`
- | cannot move out of borrowed content
+ | |data moved here
+ | help: consider removing the `&`: `a`
+ |
+note: move occurs because `a` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10
+ |
+LL | for &a in x.iter() {
+ | ^
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr
deleted file mode 100644
index f47dce4..0000000
--- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr
+++ /dev/null
@@ -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`.
diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr
index a2d8908..f47dce4 100644
--- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr
+++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr
@@ -2,22 +2,22 @@
--> $DIR/borrowck-for-loop-head-linkage.rs:7:9
|
LL | for &x in &vector {
- | ------
- | | |
- | | immutable borrow ends here
- | immutable borrow occurs here
+ | -------
+ | |
+ | immutable borrow occurs here
+ | immutable borrow later used here
LL | let cap = vector.capacity();
LL | vector.extend(repeat(0));
- | ^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 ends here
- | immutable borrow occurs here
+ | -------
+ | |
+ | immutable borrow occurs here
+ | immutable borrow later used here
...
LL | vector[1] = 5;
| ^^^^^^ mutable borrow occurs here
diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr
deleted file mode 100644
index 88b43c1..0000000
--- a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0506]: cannot assign to `_a` because it is borrowed
- --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:9:9
- |
-LL | let b = &mut _a;
- | ------- borrow of `_a` occurs here
-...
-LL | _a = 4;
- | ^^^^^^ assignment to borrowed `_a` occurs here
-...
-LL | drop(b);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr
deleted file mode 100644
index 43c3c33..0000000
--- a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0506]: cannot assign to `_a` because it is borrowed
- --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:9:9
- |
-LL | let b = &mut _a;
- | -- borrow of `_a` occurs here
-...
-LL | _a = 4;
- | ^^^^^^ assignment to borrowed `_a` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr
deleted file mode 100644
index 88b43c1..0000000
--- a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0506]: cannot assign to `_a` because it is borrowed
- --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:9:9
- |
-LL | let b = &mut _a;
- | ------- borrow of `_a` occurs here
-...
-LL | _a = 4;
- | ^^^^^^ assignment to borrowed `_a` occurs here
-...
-LL | drop(b);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
index 334d2e0..97107c2 100644
--- a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
+++ b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
@@ -1,13 +1,9 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn main() {
let mut _a = 3;
let b = &mut _a;
{
let c = &*b;
- _a = 4; //[ast]~ ERROR cannot assign to `_a`
- //[mir]~^ ERROR cannot assign to `_a` because it is borrowed
+ _a = 4; //~ ERROR cannot assign to `_a` because it is borrowed
drop(c);
}
drop(b);
diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr
new file mode 100644
index 0000000..a66db05
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr
@@ -0,0 +1,15 @@
+error[E0506]: cannot assign to `_a` because it is borrowed
+ --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:6:9
+ |
+LL | let b = &mut _a;
+ | ------- borrow of `_a` occurs here
+...
+LL | _a = 4;
+ | ^^^^^^ assignment to borrowed `_a` occurs here
+...
+LL | drop(b);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-in-static.nll.stderr b/src/test/ui/borrowck/borrowck-in-static.nll.stderr
deleted file mode 100644
index da639a8..0000000
--- a/src/test/ui/borrowck/borrowck-in-static.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0507]: cannot move out of captured variable in an `Fn` closure
- --> $DIR/borrowck-in-static.rs:5:17
- |
-LL | let x = Box::new(0);
- | - captured outer variable
-LL | Box::new(|| x)
- | ^ cannot move out of captured variable in an `Fn` closure
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-in-static.rs b/src/test/ui/borrowck/borrowck-in-static.rs
index c08f413..43bb652 100644
--- a/src/test/ui/borrowck/borrowck-in-static.rs
+++ b/src/test/ui/borrowck/borrowck-in-static.rs
@@ -2,7 +2,7 @@
static FN : &'static (Fn() -> (Box<Fn()->Box<i32>>) + Sync) = &|| {
let x = Box::new(0);
- Box::new(|| x) //~ ERROR cannot move out of captured outer variable
+ Box::new(|| x) //~ ERROR cannot move out of captured variable in an `Fn` closure
};
fn main() {
diff --git a/src/test/ui/borrowck/borrowck-in-static.stderr b/src/test/ui/borrowck/borrowck-in-static.stderr
index 6eeaf42..da639a8 100644
--- a/src/test/ui/borrowck/borrowck-in-static.stderr
+++ b/src/test/ui/borrowck/borrowck-in-static.stderr
@@ -1,10 +1,10 @@
-error[E0507]: cannot move out of captured outer variable in an `Fn` closure
+error[E0507]: cannot move out of captured variable in an `Fn` closure
--> $DIR/borrowck-in-static.rs:5:17
|
LL | let x = Box::new(0);
| - captured outer variable
LL | Box::new(|| x)
- | ^ cannot move out of captured outer variable in an `Fn` closure
+ | ^ cannot move out of captured variable in an `Fn` closure
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr
deleted file mode 100644
index 35649b1..0000000
--- a/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `origin`
- --> $DIR/borrowck-init-in-fru.rs:12:5
- |
-LL | origin = Point { x: 10, ..origin };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr
deleted file mode 100644
index 3ba0109..0000000
--- a/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `origin.y`
- --> $DIR/borrowck-init-in-fru.rs:12:31
- |
-LL | origin = Point { x: 10, ..origin };
- | ^^^^^^ use of possibly uninitialized `origin.y`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr
deleted file mode 100644
index 35649b1..0000000
--- a/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `origin`
- --> $DIR/borrowck-init-in-fru.rs:12:5
- |
-LL | origin = Point { x: 10, ..origin };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.rs b/src/test/ui/borrowck/borrowck-init-in-fru.rs
index 9a06c7a..6da3098d 100644
--- a/src/test/ui/borrowck/borrowck-init-in-fru.rs
+++ b/src/test/ui/borrowck/borrowck-init-in-fru.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#[derive(Clone)]
struct Point {
x: isize,
@@ -10,7 +7,6 @@
fn main() {
let mut origin: Point;
origin = Point { x: 10, ..origin };
- //[ast]~^ ERROR use of possibly uninitialized variable: `origin.y` [E0381]
- //[mir]~^^ ERROR [E0381]
+ //~^ ERROR use of possibly uninitialized variable: `origin` [E0381]
origin.clone();
}
diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.stderr
new file mode 100644
index 0000000..fe55bc2
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-init-in-fru.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `origin`
+ --> $DIR/borrowck-init-in-fru.rs:9:5
+ |
+LL | origin = Point { x: 10, ..origin };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr
deleted file mode 100644
index 200ce8f..0000000
--- a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0501]: cannot borrow `*f` as mutable because previous closure requires unique access
- --> $DIR/borrowck-insert-during-each.rs:16:3
- |
-LL | f.foo(
- | ^ --- first borrow later used by call
- | ___|
- | |
-LL | | |a| {
- | | --- closure construction occurs here
-LL | | f.n.insert(*a);
- | | - first borrow occurs due to use of `f` in closure
-LL | | })
- | |__________^ second borrow occurs here
-
-error[E0500]: closure requires unique access to `f` but it is already borrowed
- --> $DIR/borrowck-insert-during-each.rs:17:9
- |
-LL | f.foo(
- | - --- first borrow later used by call
- | |
- | borrow occurs here
-LL | |a| {
- | ^^^ closure construction occurs here
-LL | f.n.insert(*a);
- | - second borrow occurs due to use of `f` in closure
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0500, E0501.
-For more information about an error, try `rustc --explain E0500`.
diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.rs b/src/test/ui/borrowck/borrowck-insert-during-each.rs
index 025da4d..df967e6 100644
--- a/src/test/ui/borrowck/borrowck-insert-during-each.rs
+++ b/src/test/ui/borrowck/borrowck-insert-during-each.rs
@@ -13,7 +13,8 @@
}
fn bar(f: &mut Foo) {
- f.foo(
+ f.foo(
+ //~^ ERROR cannot borrow `*f` as mutable
|a| { //~ ERROR closure requires unique access to `f`
f.n.insert(*a);
})
diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.stderr
index 3b63397..796390c 100644
--- a/src/test/ui/borrowck/borrowck-insert-during-each.stderr
+++ b/src/test/ui/borrowck/borrowck-insert-during-each.stderr
@@ -1,15 +1,32 @@
-error[E0500]: closure requires unique access to `f` but `*f` is already borrowed
- --> $DIR/borrowck-insert-during-each.rs:17:9
+error[E0501]: cannot borrow `*f` as mutable because previous closure requires unique access
+ --> $DIR/borrowck-insert-during-each.rs:16:5
|
-LL | f.foo(
- | - borrow occurs here
+LL | f.foo(
+ | ^ --- first borrow later used by call
+ | _____|
+ | |
+LL | |
+LL | | |a| {
+ | | --- closure construction occurs here
+LL | | f.n.insert(*a);
+ | | - first borrow occurs due to use of `f` in closure
+LL | | })
+ | |__________^ second borrow occurs here
+
+error[E0500]: closure requires unique access to `f` but it is already borrowed
+ --> $DIR/borrowck-insert-during-each.rs:18:9
+ |
+LL | f.foo(
+ | - --- first borrow later used by call
+ | |
+ | borrow occurs here
+LL |
LL | |a| {
| ^^^ closure construction occurs here
LL | f.n.insert(*a);
- | - borrow occurs due to use of `f` in closure
-LL | })
- | - borrow ends here
+ | - second borrow occurs due to use of `f` in closure
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0500`.
+Some errors have detailed explanations: E0500, E0501.
+For more information about an error, try `rustc --explain E0500`.
diff --git a/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr b/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr
deleted file mode 100644
index 59576a2..0000000
--- a/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr
+++ /dev/null
@@ -1,107 +0,0 @@
-error[E0594]: cannot assign to `***p` which is behind a `&` reference
- --> $DIR/borrowck-issue-14498.rs:19:5
- |
-LL | let p = &y;
- | -- help: consider changing this to be a mutable reference: `&mut y`
-LL | ***p = 2;
- | ^^^^^^^^ `p` is a `&` reference, so the data it refers to cannot be written
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:29:5
- |
-LL | let p = &y;
- | -- borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:40:5
- |
-LL | let p = &y;
- | -- borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:51:5
- |
-LL | let p = &y;
- | -- borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:62:5
- |
-LL | let p = &y;
- | -- borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:73:5
- |
-LL | let p = &y.a;
- | ---- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:84:5
- |
-LL | let p = &y.a;
- | ---- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:95:5
- |
-LL | let p = &y.a;
- | ---- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:106:5
- |
-LL | let p = &y.a;
- | ---- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr b/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr
deleted file mode 100644
index 18391cf..0000000
--- a/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr
+++ /dev/null
@@ -1,82 +0,0 @@
-error[E0389]: cannot assign to data in a `&` reference
- --> $DIR/borrowck-issue-14498.rs:19:5
- |
-LL | ***p = 2;
- | ^^^^^^^^ assignment into an immutable reference
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:29:5
- |
-LL | let p = &y;
- | - borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:40:5
- |
-LL | let p = &y;
- | - borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:51:5
- |
-LL | let p = &y;
- | - borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:62:5
- |
-LL | let p = &y;
- | - borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:73:5
- |
-LL | let p = &y.a;
- | --- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:84:5
- |
-LL | let p = &y.a;
- | --- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:95:5
- |
-LL | let p = &y.a;
- | --- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:106:5
- |
-LL | let p = &y.a;
- | --- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-
-error: aborting due to 9 previous errors
-
-Some errors have detailed explanations: E0389, E0506.
-For more information about an error, try `rustc --explain E0389`.
diff --git a/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr b/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr
deleted file mode 100644
index 59576a2..0000000
--- a/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr
+++ /dev/null
@@ -1,107 +0,0 @@
-error[E0594]: cannot assign to `***p` which is behind a `&` reference
- --> $DIR/borrowck-issue-14498.rs:19:5
- |
-LL | let p = &y;
- | -- help: consider changing this to be a mutable reference: `&mut y`
-LL | ***p = 2;
- | ^^^^^^^^ `p` is a `&` reference, so the data it refers to cannot be written
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:29:5
- |
-LL | let p = &y;
- | -- borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:40:5
- |
-LL | let p = &y;
- | -- borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:51:5
- |
-LL | let p = &y;
- | -- borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:62:5
- |
-LL | let p = &y;
- | -- borrow of `**y` occurs here
-LL | let q = &***p;
-LL | **y = 2;
- | ^^^^^^^ assignment to borrowed `**y` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:73:5
- |
-LL | let p = &y.a;
- | ---- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:84:5
- |
-LL | let p = &y.a;
- | ---- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:95:5
- |
-LL | let p = &y.a;
- | ---- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error[E0506]: cannot assign to `**y.a` because it is borrowed
- --> $DIR/borrowck-issue-14498.rs:106:5
- |
-LL | let p = &y.a;
- | ---- borrow of `**y.a` occurs here
-LL | let q = &***p;
-LL | **y.a = 2;
- | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
-LL |
-LL | drop(p);
- | - borrow later used here
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-issue-14498.rs b/src/test/ui/borrowck/borrowck-issue-14498.rs
index da62c5a..e8c9019 100644
--- a/src/test/ui/borrowck/borrowck-issue-14498.rs
+++ b/src/test/ui/borrowck/borrowck-issue-14498.rs
@@ -4,9 +4,6 @@
// Also includes tests of the errors reported when the Box in question
// is immutable (#14270).
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(box_syntax)]
struct A { a: isize }
@@ -16,8 +13,7 @@
let mut x: isize = 1;
let y: Box<_> = box &mut x;
let p = &y;
- ***p = 2; //[ast]~ ERROR cannot assign to data in a `&` reference
- //[mir]~^ ERROR cannot assign to `***p`
+ ***p = 2; //~ ERROR cannot assign to `***p`
drop(p);
}
@@ -26,8 +22,7 @@
let mut y: Box<_> = box &mut x;
let p = &y;
let q = &***p;
- **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
- //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+ **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
drop(p);
drop(q);
}
@@ -37,8 +32,7 @@
let y: Box<_> = box &mut x;
let p = &y;
let q = &***p;
- **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
- //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+ **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
drop(p);
drop(q);
}
@@ -48,8 +42,7 @@
let mut y: Box<_> = box &mut x.a;
let p = &y;
let q = &***p;
- **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
- //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+ **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
drop(p);
drop(q);
}
@@ -59,8 +52,7 @@
let y: Box<_> = box &mut x.a;
let p = &y;
let q = &***p;
- **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
- //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+ **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
drop(p);
drop(q);
}
@@ -70,8 +62,7 @@
let mut y = B { a: box &mut x };
let p = &y.a;
let q = &***p;
- **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
- //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+ **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
drop(p);
drop(q);
}
@@ -81,8 +72,7 @@
let y = B { a: box &mut x };
let p = &y.a;
let q = &***p;
- **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
- //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+ **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
drop(p);
drop(q);
}
@@ -92,8 +82,7 @@
let mut y = B { a: box &mut x.a };
let p = &y.a;
let q = &***p;
- **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
- //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+ **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
drop(p);
drop(q);
}
@@ -103,8 +92,7 @@
let y = B { a: box &mut x.a };
let p = &y.a;
let q = &***p;
- **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
- //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+ **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
drop(p);
drop(q);
}
diff --git a/src/test/ui/borrowck/borrowck-issue-14498.stderr b/src/test/ui/borrowck/borrowck-issue-14498.stderr
new file mode 100644
index 0000000..fec4c27
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-14498.stderr
@@ -0,0 +1,99 @@
+error[E0594]: cannot assign to `***p` which is behind a `&` reference
+ --> $DIR/borrowck-issue-14498.rs:16:5
+ |
+LL | let p = &y;
+ | -- help: consider changing this to be a mutable reference: `&mut y`
+LL | ***p = 2;
+ | ^^^^^^^^ `p` is a `&` reference, so the data it refers to cannot be written
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:25:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2;
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:35:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2;
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:45:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2;
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:55:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2;
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:65:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2;
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:75:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2;
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:85:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2;
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:95:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2;
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | drop(p);
+ | - borrow later used here
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr
deleted file mode 100644
index 4ea4eb8..0000000
--- a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrowck-issue-2657-1.rs:9:18
- |
-LL | Some(ref _y) => {
- | ------ borrow of `x.0` occurs here
-LL | let _a = x;
- | ^ move out of `x` occurs here
-LL | _y.use_ref();
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr
index d9ad86b..4ea4eb8 100644
--- a/src/test/ui/borrowck/borrowck-issue-2657-1.stderr
+++ b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr
@@ -1,10 +1,12 @@
error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrowck-issue-2657-1.rs:9:13
+ --> $DIR/borrowck-issue-2657-1.rs:9:18
|
LL | Some(ref _y) => {
| ------ borrow of `x.0` occurs here
LL | let _a = x;
- | ^^ move out of `x` occurs here
+ | ^ move out of `x` occurs here
+LL | _y.use_ref();
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr
deleted file mode 100644
index 4ef36df..0000000
--- a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-issue-2657-2.rs:7:18
- |
-LL | let _b = *y;
- | ^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `y`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr
index 1314b1a..4ef36df 100644
--- a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr
+++ b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr
@@ -5,7 +5,7 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&*y`
+ | help: consider removing the `*`: `y`
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr
deleted file mode 100644
index 68a82bd..0000000
--- a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-lend-flow-if.rs:29:16
- |
-LL | _w = &v;
- | -- immutable borrow occurs here
-LL | }
-LL | borrow_mut(&mut *v);
- | ^^^^^^^ mutable borrow occurs here
-LL | _w.use_ref();
- | -- immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr
index 1acd47c..68a82bd 100644
--- a/src/test/ui/borrowck/borrowck-lend-flow-if.stderr
+++ b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr
@@ -1,14 +1,13 @@
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
- --> $DIR/borrowck-lend-flow-if.rs:29:21
+error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-lend-flow-if.rs:29:16
|
LL | _w = &v;
- | - immutable borrow occurs here
+ | -- immutable borrow occurs here
LL | }
LL | borrow_mut(&mut *v);
- | ^^ mutable borrow occurs here
+ | ^^^^^^^ mutable borrow occurs here
LL | _w.use_ref();
-LL | }
- | - immutable borrow ends here
+ | -- immutable borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.ast.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.ast.stderr
deleted file mode 100644
index 83462ec..0000000
--- a/src/test/ui/borrowck/borrowck-lend-flow-loop.ast.stderr
+++ /dev/null
@@ -1,93 +0,0 @@
-error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
- --> $DIR/borrowck-lend-flow-loop.rs:35:17
- |
-LL | let mut x = &mut v;
- | - mutable borrow occurs here
-...
-LL | borrow(&*v);
- | ^^ immutable borrow occurs here
-LL | }
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
- --> $DIR/borrowck-lend-flow-loop.rs:45:17
- |
-LL | let mut x = &mut v;
- | - mutable borrow occurs here
-LL | for _ in 0..3 {
-LL | borrow(&*v);
- | ^^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
- --> $DIR/borrowck-lend-flow-loop.rs:57:25
- |
-LL | borrow_mut(&mut *v);
- | ^^ mutable borrow occurs here
-LL | _x = &v;
- | - immutable borrow occurs here
-LL | }
-LL | }
- | - immutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
- --> $DIR/borrowck-lend-flow-loop.rs:69:25
- |
-LL | borrow_mut(&mut *v);
- | ^^ mutable borrow occurs here
-LL | _x = &v;
- | - immutable borrow occurs here
-LL | }
-LL | }
- | - immutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
- --> $DIR/borrowck-lend-flow-loop.rs:86:21
- |
-LL | _x = &v;
- | - immutable borrow occurs here
-...
-LL | borrow_mut(&mut *v);
- | ^^ mutable borrow occurs here
-LL | }
- | - immutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
- --> $DIR/borrowck-lend-flow-loop.rs:100:21
- |
-LL | _x = &v;
- | - immutable borrow occurs here
-...
-LL | borrow_mut(&mut *v);
- | ^^ mutable borrow occurs here
-LL | }
- | - immutable borrow ends here
-
-error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
- --> $DIR/borrowck-lend-flow-loop.rs:109:17
- |
-LL | borrow(&*v);
- | ^^ immutable borrow occurs here
-...
-LL | x = &mut v;
- | - mutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0499]: cannot borrow `v` as mutable more than once at a time
- --> $DIR/borrowck-lend-flow-loop.rs:112:22
- |
-LL | x = &mut v;
- | ^ mutable borrow starts here in previous iteration of loop
-...
-LL | }
- | - mutable borrow ends here
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0499, E0502.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr
deleted file mode 100644
index 6dd6c1f..0000000
--- a/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-lend-flow-loop.rs:45:16
- |
-LL | let mut x = &mut v;
- | ------ mutable borrow occurs here
-LL | for _ in 0..3 {
-LL | borrow(&*v);
- | ^^^ immutable borrow occurs here
-...
-LL | *x = box 5;
- | -- mutable borrow later used here
-
-error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-lend-flow-loop.rs:109:16
- |
-LL | **x += 1;
- | -------- mutable borrow later used here
-LL | borrow(&*v);
- | ^^^ immutable borrow occurs here
-...
-LL | x = &mut v;
- | ------ mutable borrow occurs here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.rs b/src/test/ui/borrowck/borrowck-lend-flow-loop.rs
index 7008e5c..b650df9 100644
--- a/src/test/ui/borrowck/borrowck-lend-flow-loop.rs
+++ b/src/test/ui/borrowck/borrowck-lend-flow-loop.rs
@@ -1,19 +1,3 @@
-// revisions: ast nll
-
-// Since we are testing nll migration explicitly as a separate
-// revision, don't worry about the --compare-mode=nll on this test.
-
-// ignore-compare-mode-nll
-
-//[ast]compile-flags: -Z borrowck=ast
-//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-
-// Note: the borrowck analysis was originally a flow-insensitive pass
-// over the AST. Therefore, some of these (AST) errors are marked as
-// spurious and are corrected by the flow-sensitive (NLL) analysis.
-// The others are either genuine or would require more advanced
-// changes. The latter cases are noted.
-
#![feature(box_syntax)]
fn borrow(_v: &isize) {}
@@ -26,13 +10,13 @@
}
fn loop_overarching_alias_mut() {
- // In this instance, the borrow encompasses the entire loop.
+ // In this instance, the borrow ends on the line before the loop
let mut v: Box<_> = box 3;
let mut x = &mut v;
**x += 1;
loop {
- borrow(&*v); //[ast]~ ERROR cannot borrow
+ borrow(&*v); // OK
}
}
@@ -42,38 +26,37 @@
let mut v: Box<_> = box 3;
let mut x = &mut v;
for _ in 0..3 {
- borrow(&*v); //[ast]~ ERROR cannot borrow
- //[nll]~^ ERROR cannot borrow
+ borrow(&*v); //~ ERROR cannot borrow
}
*x = box 5;
}
fn loop_aliased_mut() {
- // In this instance, the borrow is carried through the loop.
+ // In this instance, the borrow ends right after each assignment to _x
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
let mut _x = &w;
loop {
- borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
+ borrow_mut(&mut *v); // OK
_x = &v;
}
}
fn while_aliased_mut() {
- // In this instance, the borrow is carried through the loop.
+ // In this instance, the borrow ends right after each assignment to _x
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
let mut _x = &w;
while cond() {
- borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
+ borrow_mut(&mut *v); // OK
_x = &v;
}
}
fn loop_aliased_mut_break() {
- // In this instance, the borrow is carried through the loop.
+ // In this instance, the borrow ends right after each assignment to _x
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
@@ -83,11 +66,11 @@
_x = &v;
break;
}
- borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
+ borrow_mut(&mut *v); // OK
}
fn while_aliased_mut_break() {
- // In this instance, the borrow is carried through the loop.
+ // In this instance, the borrow ends right after each assignment to _x
let mut v: Box<_> = box 3;
let mut w: Box<_> = box 4;
@@ -97,7 +80,7 @@
_x = &v;
break;
}
- borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
+ borrow_mut(&mut *v); // OK
}
fn while_aliased_mut_cond(cond: bool, cond2: bool) {
@@ -106,10 +89,9 @@
let mut x = &mut w;
while cond {
**x += 1;
- borrow(&*v); //[ast]~ ERROR cannot borrow
- //[nll]~^ ERROR cannot borrow
+ borrow(&*v); //~ ERROR cannot borrow
if cond2 {
- x = &mut v; //[ast]~ ERROR cannot borrow
+ x = &mut v; // OK
}
}
}
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr
new file mode 100644
index 0000000..f02c357
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr
@@ -0,0 +1,26 @@
+error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-lend-flow-loop.rs:29:16
+ |
+LL | let mut x = &mut v;
+ | ------ mutable borrow occurs here
+LL | for _ in 0..3 {
+LL | borrow(&*v);
+ | ^^^ immutable borrow occurs here
+LL | }
+LL | *x = box 5;
+ | -- mutable borrow later used here
+
+error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-lend-flow-loop.rs:92:16
+ |
+LL | **x += 1;
+ | -------- mutable borrow later used here
+LL | borrow(&*v);
+ | ^^^ immutable borrow occurs here
+LL | if cond2 {
+LL | x = &mut v; // OK
+ | ------ mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr
deleted file mode 100644
index 734f965..0000000
--- a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-lend-flow-match.rs:18:13
- |
-LL | Some(ref r) => {
- | ----- borrow of `x` occurs here
-LL | x = Some(1);
- | ^^^^^^^^^^^ assignment to borrowed `x` occurs here
-LL |
-LL | drop(r);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr
deleted file mode 100644
index 236bc11..0000000
--- a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-lend-flow-match.rs:18:13
- |
-LL | Some(ref r) => {
- | ----- borrow of `x` occurs here
-LL | x = Some(1);
- | ^^^^^^^^^^^ assignment to borrowed `x` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr
deleted file mode 100644
index 734f965..0000000
--- a/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-lend-flow-match.rs:18:13
- |
-LL | Some(ref r) => {
- | ----- borrow of `x` occurs here
-LL | x = Some(1);
- | ^^^^^^^^^^^ assignment to borrowed `x` occurs here
-LL |
-LL | drop(r);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.rs b/src/test/ui/borrowck/borrowck-lend-flow-match.rs
index 4cd2a23..9737bc7 100644
--- a/src/test/ui/borrowck/borrowck-lend-flow-match.rs
+++ b/src/test/ui/borrowck/borrowck-lend-flow-match.rs
@@ -1,11 +1,5 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
-#![allow(unused_variables)]
-#![allow(unused_assignments)]
-
fn separate_arms() {
- // Here both arms perform assignments, but only is illegal.
+ // Here both arms perform assignments, but only one is illegal.
let mut x = None;
match x {
@@ -15,12 +9,10 @@
x = Some(0);
}
Some(ref r) => {
- x = Some(1); //[ast]~ ERROR cannot assign
- //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+ x = Some(1); //~ ERROR cannot assign to `x` because it is borrowed
drop(r);
}
}
- x.clone(); // just to prevent liveness warnings
}
fn main() {}
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.stderr
new file mode 100644
index 0000000..66f1cd9
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow-match.stderr
@@ -0,0 +1,13 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-lend-flow-match.rs:12:13
+ |
+LL | Some(ref r) => {
+ | ----- borrow of `x` occurs here
+LL | x = Some(1);
+ | ^^^^^^^^^^^ assignment to borrowed `x` occurs here
+LL | drop(r);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr
deleted file mode 100644
index 07b11b3..0000000
--- a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-lend-flow.rs:24:16
- |
-LL | let _w = &v;
- | -- immutable borrow occurs here
-LL | borrow_mut(&mut *v);
- | ^^^^^^^ mutable borrow occurs here
-LL | _w.use_ref();
- | -- immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow.stderr b/src/test/ui/borrowck/borrowck-lend-flow.stderr
index e39fb6c..07b11b3 100644
--- a/src/test/ui/borrowck/borrowck-lend-flow.stderr
+++ b/src/test/ui/borrowck/borrowck-lend-flow.stderr
@@ -1,13 +1,12 @@
-error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
- --> $DIR/borrowck-lend-flow.rs:24:21
+error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-lend-flow.rs:24:16
|
LL | let _w = &v;
- | - immutable borrow occurs here
+ | -- immutable borrow occurs here
LL | borrow_mut(&mut *v);
- | ^^ mutable borrow occurs here
+ | ^^^^^^^ mutable borrow occurs here
LL | _w.use_ref();
-LL | }
- | - immutable borrow ends here
+ | -- immutable borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr
deleted file mode 100644
index 4497cfb..0000000
--- a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error[E0505]: cannot move out of `v` because it is borrowed
- --> $DIR/borrowck-loan-blocks-move-cc.rs:14:19
- |
-LL | let w = &v;
- | -- borrow of `v` occurs here
-LL | thread::spawn(move|| {
- | ^^^^^^ move out of `v` occurs here
-LL | println!("v={}", *v);
- | - move occurs due to use in closure
-...
-LL | w.use_ref();
- | - borrow later used here
-
-error[E0505]: cannot move out of `v` because it is borrowed
- --> $DIR/borrowck-loan-blocks-move-cc.rs:24:19
- |
-LL | let w = &v;
- | -- borrow of `v` occurs here
-LL | thread::spawn(move|| {
- | ^^^^^^ move out of `v` occurs here
-LL | println!("v={}", *v);
- | - move occurs due to use in closure
-...
-LL | w.use_ref();
- | - borrow later used here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs
index 29a2047..9fa4656 100644
--- a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs
@@ -12,8 +12,8 @@
let v: Box<_> = box 3;
let w = &v;
thread::spawn(move|| {
+ //~^ ERROR cannot move out of `v` because it is borrowed
println!("v={}", *v);
- //~^ ERROR cannot move `v` into closure
});
w.use_ref();
}
@@ -22,8 +22,8 @@
let v: Box<_> = box 3;
let w = &v;
thread::spawn(move|| {
+ //~^ ERROR cannot move
println!("v={}", *v);
- //~^ ERROR cannot move
});
w.use_ref();
}
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
index b170635..2acbcd9 100644
--- a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
@@ -1,21 +1,31 @@
-error[E0504]: cannot move `v` into closure because it is borrowed
- --> $DIR/borrowck-loan-blocks-move-cc.rs:15:27
+error[E0505]: cannot move out of `v` because it is borrowed
+ --> $DIR/borrowck-loan-blocks-move-cc.rs:14:19
|
LL | let w = &v;
- | - borrow of `v` occurs here
+ | -- borrow of `v` occurs here
LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `v` occurs here
+LL |
LL | println!("v={}", *v);
- | ^ move into closure occurs here
+ | - move occurs due to use in closure
+LL | });
+LL | w.use_ref();
+ | - borrow later used here
-error[E0504]: cannot move `v` into closure because it is borrowed
- --> $DIR/borrowck-loan-blocks-move-cc.rs:25:27
+error[E0505]: cannot move out of `v` because it is borrowed
+ --> $DIR/borrowck-loan-blocks-move-cc.rs:24:19
|
LL | let w = &v;
- | - borrow of `v` occurs here
+ | -- borrow of `v` occurs here
LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `v` occurs here
+LL |
LL | println!("v={}", *v);
- | ^ move into closure occurs here
+ | - move occurs due to use in closure
+LL | });
+LL | w.use_ref();
+ | - borrow later used here
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0504`.
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr
deleted file mode 100644
index 615660f..0000000
--- a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0505]: cannot move out of `v` because it is borrowed
- --> $DIR/borrowck-loan-blocks-move.rs:11:10
- |
-LL | let w = &v;
- | -- borrow of `v` occurs here
-LL | take(v);
- | ^ move out of `v` occurs here
-LL | w.use_ref();
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr
index e6f0a69..615660f 100644
--- a/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr
@@ -2,9 +2,11 @@
--> $DIR/borrowck-loan-blocks-move.rs:11:10
|
LL | let w = &v;
- | - borrow of `v` occurs here
+ | -- borrow of `v` occurs here
LL | take(v);
| ^ move out of `v` occurs here
+LL | w.use_ref();
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr
deleted file mode 100644
index 1d1522a..0000000
--- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-loan-blocks-mut-uniq.rs:10:12
- |
-LL | borrow(&*v,
- | ------ --- immutable borrow occurs here
- | |
- | immutable borrow later used by call
-LL | |w| {
- | ^^^ mutable borrow occurs here
-LL | v = box 4;
- | - second borrow occurs due to use of `v` in closure
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr
index c916b7e..1d1522a 100644
--- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr
@@ -1,15 +1,14 @@
-error[E0502]: cannot borrow `v` as mutable because `*v` is also borrowed as immutable
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-loan-blocks-mut-uniq.rs:10:12
|
LL | borrow(&*v,
- | -- immutable borrow occurs here
+ | ------ --- immutable borrow occurs here
+ | |
+ | immutable borrow later used by call
LL | |w| {
| ^^^ mutable borrow occurs here
LL | v = box 4;
- | - borrow occurs due to use of `v` in closure
-...
-LL | })
- | - immutable borrow ends here
+ | - second borrow occurs due to use of `v` in closure
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr
deleted file mode 100644
index 095ae7f..0000000
--- a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/borrowck-loan-in-overloaded-op.rs:21:20
- |
-LL | let x = Foo(box 3);
- | - 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
- | - ^ value borrowed here after move
- | |
- | value moved here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs
index 464f01c..1baa94ed 100644
--- a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs
+++ b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs
@@ -19,5 +19,5 @@
fn main() {
let x = Foo(box 3);
let _y = {x} + x.clone(); // the `{x}` forces a move to occur
- //~^ ERROR use of moved value: `x`
+ //~^ ERROR borrow of moved value: `x`
}
diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
index b6147aa..095ae7f 100644
--- a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
+++ b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
@@ -1,12 +1,12 @@
-error[E0382]: use of moved value: `x`
+error[E0382]: borrow of moved value: `x`
--> $DIR/borrowck-loan-in-overloaded-op.rs:21:20
|
+LL | let x = Foo(box 3);
+ | - 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
- | - ^ value used here after move
+ | - ^ value borrowed here after move
| |
| value moved here
- |
- = note: move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr
deleted file mode 100644
index 6994c83..0000000
--- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `*s` because it is borrowed
- --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:16:5
- |
-LL | let alias: &'static mut String = s;
- | ------------------- - borrow of `*s` occurs here
- | |
- | type annotation requires that `*s` is borrowed for `'static`
-...
-LL | *s = String::new();
- | ^^ assignment to borrowed `*s` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr
index c9d36a7..6994c83 100644
--- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr
+++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr
@@ -2,10 +2,12 @@
--> $DIR/borrowck-loan-of-static-data-issue-27616.rs:16:5
|
LL | let alias: &'static mut String = s;
- | - borrow of `*s` occurs here
+ | ------------------- - borrow of `*s` occurs here
+ | |
+ | type annotation requires that `*s` is borrowed for `'static`
...
LL | *s = String::new();
- | ^^^^^^^^^^^^^^^^^^ assignment to borrowed `*s` occurs here
+ | ^^ assignment to borrowed `*s` occurs here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr
deleted file mode 100644
index aa874c3..0000000
--- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0503]: cannot use `p` because it was mutably borrowed
- --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:38:5
- |
-LL | let q = &mut p;
- | ------ borrow of `p` occurs here
-LL |
-LL | p + 3;
- | ^ use of borrowed `p`
-...
-LL | *q + 3; // OK to use the new alias `q`
- | -- borrow later used here
-
-error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:39:5
- |
-LL | let q = &mut p;
- | ------ mutable borrow occurs here
-...
-LL | p.times(3);
- | ^ immutable borrow occurs here
-LL |
-LL | *q + 3; // OK to use the new alias `q`
- | -- mutable borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0502, E0503.
-For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
index fee3c79..aa874c3 100644
--- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
+++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
@@ -2,22 +2,25 @@
--> $DIR/borrowck-loan-rcvr-overloaded-op.rs:38:5
|
LL | let q = &mut p;
- | - borrow of `p` occurs here
+ | ------ borrow of `p` occurs here
LL |
LL | p + 3;
| ^ use of borrowed `p`
+...
+LL | *q + 3; // OK to use the new alias `q`
+ | -- borrow later used here
error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-loan-rcvr-overloaded-op.rs:39:5
|
LL | let q = &mut p;
- | - mutable borrow occurs here
+ | ------ mutable borrow occurs here
...
LL | p.times(3);
| ^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
+LL |
+LL | *q + 3; // OK to use the new alias `q`
+ | -- mutable borrow later used here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr
deleted file mode 100644
index ec3edc8..0000000
--- a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-loan-rcvr.rs:23:14
- |
-LL | p.blockm(|| {
- | - ------ ^^ mutable borrow occurs here
- | | |
- | | immutable borrow later used by call
- | immutable borrow occurs here
-LL | p.x = 10;
- | - second borrow occurs due to use of `p` in closure
-
-error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-loan-rcvr.rs:34:5
- |
-LL | let l = &mut p;
- | ------ mutable borrow occurs here
-LL | p.impurem();
- | ^ immutable borrow occurs here
-LL |
-LL | l.x += 1;
- | -------- mutable borrow later used here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr
index 56d33ef..ec3edc8 100644
--- a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr
+++ b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr
@@ -2,24 +2,23 @@
--> $DIR/borrowck-loan-rcvr.rs:23:14
|
LL | p.blockm(|| {
- | - ^^ mutable borrow occurs here
- | |
+ | - ------ ^^ mutable borrow occurs here
+ | | |
+ | | immutable borrow later used by call
| immutable borrow occurs here
LL | p.x = 10;
- | - borrow occurs due to use of `p` in closure
-LL | })
- | - immutable borrow ends here
+ | - second borrow occurs due to use of `p` in closure
error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-loan-rcvr.rs:34:5
|
LL | let l = &mut p;
- | - mutable borrow occurs here
+ | ------ mutable borrow occurs here
LL | p.impurem();
| ^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
+LL |
+LL | l.x += 1;
+ | -------- mutable borrow later used here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr
deleted file mode 100644
index 6691a23..0000000
--- a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-loan-vec-content.rs:18:9
- |
-LL | takes_imm_elt(
- | ------------- immutable borrow later used by call
-LL | &v[0],
- | - immutable borrow occurs here
-LL | || {
- | ^^ mutable borrow occurs here
-LL | v[1] = 4;
- | - second borrow occurs due to use of `v` in closure
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr
index eea6a09..6691a23 100644
--- a/src/test/ui/borrowck/borrowck-loan-vec-content.stderr
+++ b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr
@@ -1,14 +1,14 @@
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-loan-vec-content.rs:18:9
|
+LL | takes_imm_elt(
+ | ------------- immutable borrow later used by call
LL | &v[0],
| - immutable borrow occurs here
LL | || {
| ^^ mutable borrow occurs here
LL | v[1] = 4;
- | - borrow occurs due to use of `v` in closure
-LL | })
- | - immutable borrow ends here
+ | - second borrow occurs due to use of `v` in closure
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr
deleted file mode 100644
index df89e85..0000000
--- a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0515]: cannot return reference to function parameter `x`
- --> $DIR/borrowck-local-borrow-outlives-fn.rs:5:5
- |
-LL | &x
- | ^^ returns a reference to data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr
deleted file mode 100644
index 6eda8a4..0000000
--- a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/borrowck-local-borrow-outlives-fn.rs:5:6
- |
-LL | &x
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr
deleted file mode 100644
index df89e85..0000000
--- a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0515]: cannot return reference to function parameter `x`
- --> $DIR/borrowck-local-borrow-outlives-fn.rs:5:5
- |
-LL | &x
- | ^^ returns a reference to data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs
index 6137ac9..b6eebd4 100644
--- a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs
+++ b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs
@@ -1,10 +1,6 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn cplusplus_mode(x: isize) -> &'static isize {
&x
- //[ast]~^ ERROR `x` does not live long enough [E0597]
- //[mir]~^^ ERROR cannot return reference to function parameter `x` [E0515]
+ //~^ ERROR cannot return reference to function parameter `x` [E0515]
}
fn main() {}
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.stderr
new file mode 100644
index 0000000..9d19de2
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.stderr
@@ -0,0 +1,9 @@
+error[E0515]: cannot return reference to function parameter `x`
+ --> $DIR/borrowck-local-borrow-outlives-fn.rs:2:5
+ |
+LL | &x
+ | ^^ returns a reference to data owned by the current function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr
deleted file mode 100644
index ac9e73f..0000000
--- a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0597]: `z.1` does not live long enough
- --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:6:15
- |
-LL | *x = Some(&mut z.1);
- | ----------^^^^^^^^-
- | | |
- | | borrowed value does not live long enough
- | assignment requires that `z.1` is borrowed for `'static`
-...
-LL | }
- | - `z.1` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr
deleted file mode 100644
index 89a0e6c..0000000
--- a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `z.1` does not live long enough
- --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:6:20
- |
-LL | *x = Some(&mut z.1);
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr
deleted file mode 100644
index ac9e73f..0000000
--- a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0597]: `z.1` does not live long enough
- --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:6:15
- |
-LL | *x = Some(&mut z.1);
- | ----------^^^^^^^^-
- | | |
- | | borrowed value does not live long enough
- | assignment requires that `z.1` is borrowed for `'static`
-...
-LL | }
- | - `z.1` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs
index 9ead465..ffb2da2 100644
--- a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs
+++ b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs
@@ -1,11 +1,7 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn cplusplus_mode_exceptionally_unsafe(x: &mut Option<&'static mut isize>) {
let mut z = (0, 0);
*x = Some(&mut z.1);
- //[ast]~^ ERROR `z.1` does not live long enough [E0597]
- //[mir]~^^ ERROR `z.1` does not live long enough [E0597]
+ //~^ ERROR `z.1` does not live long enough [E0597]
panic!("catch me for a dangling pointer!")
}
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr
new file mode 100644
index 0000000..6ea6951
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr
@@ -0,0 +1,15 @@
+error[E0597]: `z.1` does not live long enough
+ --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:3:15
+ |
+LL | *x = Some(&mut z.1);
+ | ----------^^^^^^^^-
+ | | |
+ | | borrowed value does not live long enough
+ | assignment requires that `z.1` is borrowed for `'static`
+...
+LL | }
+ | - `z.1` dropped here while still borrowed
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr
deleted file mode 100644
index ecbfeec..0000000
--- a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr
+++ /dev/null
@@ -1,51 +0,0 @@
-error[E0503]: cannot use `foo` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:13:9
- |
-LL | let p = &mut foo;
- | -------- borrow of `foo` occurs here
-LL | let _ = match foo {
-LL | Foo::B => 1,
- | ^^^^^^ use of borrowed `foo`
-...
-LL | drop(p);
- | - borrow later used here
-
-error[E0503]: cannot use `foo.0` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:15:16
- |
-LL | let p = &mut foo;
- | -------- borrow of `foo` occurs here
-...
-LL | Foo::A(x) => x
- | ^ use of borrowed `foo`
-...
-LL | drop(p);
- | - borrow later used here
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:26:9
- |
-LL | let r = &mut x;
- | ------ borrow of `x` occurs here
-LL | let _ = match x {
-LL | x => x + 1,
- | ^ use of borrowed `x`
-...
-LL | drop(r);
- | - borrow later used here
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:28:9
- |
-LL | let r = &mut x;
- | ------ borrow of `x` occurs here
-...
-LL | y => y + 2,
- | ^ use of borrowed `x`
-...
-LL | drop(r);
- | - borrow later used here
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr
deleted file mode 100644
index a5da1fc..0000000
--- a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0503]: cannot use `(foo as Foo::A).0` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:15:16
- |
-LL | let p = &mut foo;
- | --- borrow of `foo` occurs here
-...
-LL | Foo::A(x) => x
- | ^ use of borrowed `foo`
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:26:9
- |
-LL | let r = &mut x;
- | - borrow of `x` occurs here
-LL | let _ = match x {
-LL | x => x + 1,
- | ^ use of borrowed `x`
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:28:9
- |
-LL | let r = &mut x;
- | - borrow of `x` occurs here
-...
-LL | y => y + 2,
- | ^ use of borrowed `x`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr
deleted file mode 100644
index ecbfeec..0000000
--- a/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr
+++ /dev/null
@@ -1,51 +0,0 @@
-error[E0503]: cannot use `foo` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:13:9
- |
-LL | let p = &mut foo;
- | -------- borrow of `foo` occurs here
-LL | let _ = match foo {
-LL | Foo::B => 1,
- | ^^^^^^ use of borrowed `foo`
-...
-LL | drop(p);
- | - borrow later used here
-
-error[E0503]: cannot use `foo.0` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:15:16
- |
-LL | let p = &mut foo;
- | -------- borrow of `foo` occurs here
-...
-LL | Foo::A(x) => x
- | ^ use of borrowed `foo`
-...
-LL | drop(p);
- | - borrow later used here
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:26:9
- |
-LL | let r = &mut x;
- | ------ borrow of `x` occurs here
-LL | let _ = match x {
-LL | x => x + 1,
- | ^ use of borrowed `x`
-...
-LL | drop(r);
- | - borrow later used here
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-match-already-borrowed.rs:28:9
- |
-LL | let r = &mut x;
- | ------ borrow of `x` occurs here
-...
-LL | y => y + 2,
- | ^ use of borrowed `x`
-...
-LL | drop(r);
- | - borrow later used here
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.rs b/src/test/ui/borrowck/borrowck-match-already-borrowed.rs
index 7f4cdbd..c766e6c 100644
--- a/src/test/ui/borrowck/borrowck-match-already-borrowed.rs
+++ b/src/test/ui/borrowck/borrowck-match-already-borrowed.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
enum Foo {
A(i32),
B
@@ -10,10 +7,9 @@
let mut foo = Foo::B;
let p = &mut foo;
let _ = match foo {
- Foo::B => 1, //[mir]~ ERROR [E0503]
+ Foo::B => 1, //~ ERROR [E0503]
_ => 2,
- Foo::A(x) => x //[ast]~ ERROR [E0503]
- //[mir]~^ ERROR [E0503]
+ Foo::A(x) => x //~ ERROR [E0503]
};
drop(p);
}
@@ -23,10 +19,8 @@
let mut x = 1;
let r = &mut x;
let _ = match x {
- x => x + 1, //[ast]~ ERROR [E0503]
- //[mir]~^ ERROR [E0503]
- y => y + 2, //[ast]~ ERROR [E0503]
- //[mir]~^ ERROR [E0503]
+ x => x + 1, //~ ERROR [E0503]
+ y => y + 2, //~ ERROR [E0503]
};
drop(r);
}
diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.stderr
new file mode 100644
index 0000000..286a925
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-match-already-borrowed.stderr
@@ -0,0 +1,51 @@
+error[E0503]: cannot use `foo` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:10:9
+ |
+LL | let p = &mut foo;
+ | -------- borrow of `foo` occurs here
+LL | let _ = match foo {
+LL | Foo::B => 1,
+ | ^^^^^^ use of borrowed `foo`
+...
+LL | drop(p);
+ | - borrow later used here
+
+error[E0503]: cannot use `foo.0` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:12:16
+ |
+LL | let p = &mut foo;
+ | -------- borrow of `foo` occurs here
+...
+LL | Foo::A(x) => x
+ | ^ use of borrowed `foo`
+LL | };
+LL | drop(p);
+ | - borrow later used here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:22:9
+ |
+LL | let r = &mut x;
+ | ------ borrow of `x` occurs here
+LL | let _ = match x {
+LL | x => x + 1,
+ | ^ use of borrowed `x`
+...
+LL | drop(r);
+ | - borrow later used here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:23:9
+ |
+LL | let r = &mut x;
+ | ------ borrow of `x` occurs here
+...
+LL | y => y + 2,
+ | ^ use of borrowed `x`
+LL | };
+LL | drop(r);
+ | - borrow later used here
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr
deleted file mode 100644
index 2ac0539..0000000
--- a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr
+++ /dev/null
@@ -1,58 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:17:13
- |
-LL | x => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:24:13
- |
-LL | E::Foo(x) => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:31:13
- |
-LL | S { bar: x } => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:38:13
- |
-LL | (x,) => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:45:13
- |
-LL | [x,_,_] => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr
deleted file mode 100644
index 5f43302..0000000
--- a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:17:13
- |
-LL | x => {
- | - first assignment to `x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:24:13
- |
-LL | E::Foo(x) => {
- | - first assignment to `x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:31:13
- |
-LL | S { bar: x } => {
- | - first assignment to `x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:38:13
- |
-LL | (x,) => {
- | - first assignment to `x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:45:13
- |
-LL | [x,_,_] => {
- | - first assignment to `x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr
deleted file mode 100644
index 2ac0539..0000000
--- a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr
+++ /dev/null
@@ -1,58 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:17:13
- |
-LL | x => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:24:13
- |
-LL | E::Foo(x) => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:31:13
- |
-LL | S { bar: x } => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:38:13
- |
-LL | (x,) => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-match-binding-is-assignment.rs:45:13
- |
-LL | [x,_,_] => {
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs
index 2c9c41c..064bf69 100644
--- a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs
+++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
// Test that immutable pattern bindings cannot be reassigned.
enum E {
@@ -14,36 +11,31 @@
pub fn main() {
match 1 {
x => {
- x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
- //[mir]~^ ERROR [E0384]
+ x += 1; //~ ERROR [E0384]
}
}
match E::Foo(1) {
E::Foo(x) => {
- x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
- //[mir]~^ ERROR [E0384]
+ x += 1; //~ ERROR [E0384]
}
}
match (S { bar: 1 }) {
S { bar: x } => {
- x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
- //[mir]~^ ERROR [E0384]
+ x += 1; //~ ERROR [E0384]
}
}
match (1,) {
(x,) => {
- x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
- //[mir]~^ ERROR [E0384]
+ x += 1; //~ ERROR [E0384]
}
}
match [1,2,3] {
[x,_,_] => {
- x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
- //[mir]~^ ERROR [E0384]
+ x += 1; //~ ERROR [E0384]
}
}
}
diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.stderr
new file mode 100644
index 0000000..5661ca5
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.stderr
@@ -0,0 +1,58 @@
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:14:13
+ |
+LL | x => {
+ | -
+ | |
+ | first assignment to `x`
+ | help: make this binding mutable: `mut x`
+LL | x += 1;
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:20:13
+ |
+LL | E::Foo(x) => {
+ | -
+ | |
+ | first assignment to `x`
+ | help: make this binding mutable: `mut x`
+LL | x += 1;
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:26:13
+ |
+LL | S { bar: x } => {
+ | -
+ | |
+ | first assignment to `x`
+ | help: make this binding mutable: `mut x`
+LL | x += 1;
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:32:13
+ |
+LL | (x,) => {
+ | -
+ | |
+ | first assignment to `x`
+ | help: make this binding mutable: `mut x`
+LL | x += 1;
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:38:13
+ |
+LL | [x,_,_] => {
+ | -
+ | |
+ | first assignment to `x`
+ | help: make this binding mutable: `mut x`
+LL | x += 1;
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr
deleted file mode 100644
index 38f6ca7..0000000
--- a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of captured variable in an `FnMut` closure
- --> $DIR/borrowck-move-by-capture.rs:9:29
- |
-LL | let bar: Box<_> = box 3;
- | --- captured outer variable
-LL | let _g = to_fn_mut(|| {
-LL | let _h = to_fn_once(move || -> isize { *bar });
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of captured variable in an `FnMut` closure
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.stderr
index d845a57..38f6ca7 100644
--- a/src/test/ui/borrowck/borrowck-move-by-capture.stderr
+++ b/src/test/ui/borrowck/borrowck-move-by-capture.stderr
@@ -1,11 +1,11 @@
-error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
--> $DIR/borrowck-move-by-capture.rs:9:29
|
LL | let bar: Box<_> = box 3;
| --- captured outer variable
LL | let _g = to_fn_mut(|| {
LL | let _h = to_fn_once(move || -> isize { *bar });
- | ^^^^^^^^^^^^^^^^ cannot move out of captured outer variable in an `FnMut` closure
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of captured variable in an `FnMut` closure
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr
deleted file mode 100644
index de75210..0000000
--- a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr
+++ /dev/null
@@ -1,67 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-error-with-note.rs:11:11
- |
-LL | match *f {
- | ^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `f`
-LL |
-LL | Foo::Foo1(num1,
- | ---- data moved here
-LL | num2) => (),
- | ---- ...and here
-LL | Foo::Foo2(num) => (),
- | --- ...and here
- |
-note: move occurs because these variables have types that don't implement the `Copy` trait
- --> $DIR/borrowck-move-error-with-note.rs:13:19
- |
-LL | Foo::Foo1(num1,
- | ^^^^
-LL | num2) => (),
- | ^^^^
-LL | Foo::Foo2(num) => (),
- | ^^^
-
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-error-with-note.rs:29:11
- |
-LL | match (S {f: "foo".to_string(), g: "bar".to_string()}) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
-...
-LL | f: _s,
- | -- data moved here
-LL | g: _t
- | -- ...and here
- |
-note: move occurs because these variables have types that don't implement the `Copy` trait
- --> $DIR/borrowck-move-error-with-note.rs:32:16
- |
-LL | f: _s,
- | ^^
-LL | g: _t
- | ^^
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-error-with-note.rs:47:11
- |
-LL | match a.a {
- | ^^^
- | |
- | cannot move out of borrowed content
- | help: consider borrowing here: `&a.a`
-LL |
-LL | n => {
- | - data moved here
- |
-note: move occurs because `n` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-error-with-note.rs:49:9
- |
-LL | n => {
- | ^
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0507, E0509.
-For more information about an error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.rs b/src/test/ui/borrowck/borrowck-move-error-with-note.rs
index d2dab2e..b21f13a 100644
--- a/src/test/ui/borrowck/borrowck-move-error-with-note.rs
+++ b/src/test/ui/borrowck/borrowck-move-error-with-note.rs
@@ -27,8 +27,9 @@
fn move_in_match() {
match (S {f: "foo".to_string(), g: "bar".to_string()}) {
- S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait
+ //~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
//~| cannot move out of here
+ S {
f: _s,
g: _t
} => {}
diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr
index 55edb79..8438320 100644
--- a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr
+++ b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr
@@ -2,35 +2,64 @@
--> $DIR/borrowck-move-error-with-note.rs:11:11
|
LL | match *f {
- | ^^ cannot move out of borrowed content
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `f`
LL |
LL | Foo::Foo1(num1,
- | ---- hint: to prevent move, use `ref num1` or `ref mut num1`
+ | ---- data moved here
LL | num2) => (),
- | ---- ...and here (use `ref num2` or `ref mut num2`)
+ | ---- ...and here
LL | Foo::Foo2(num) => (),
- | --- ...and here (use `ref num` or `ref mut num`)
+ | --- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/borrowck-move-error-with-note.rs:13:19
+ |
+LL | Foo::Foo1(num1,
+ | ^^^^
+LL | num2) => (),
+ | ^^^^
+LL | Foo::Foo2(num) => (),
+ | ^^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-error-with-note.rs:30:9
+ --> $DIR/borrowck-move-error-with-note.rs:29:11
|
-LL | / S {
-LL | |
-LL | | f: _s,
- | | -- hint: to prevent move, use `ref _s` or `ref mut _s`
-LL | | g: _t
- | | -- ...and here (use `ref _t` or `ref mut _t`)
-LL | | } => {}
- | |_________^ cannot move out of here
+LL | match (S {f: "foo".to_string(), g: "bar".to_string()}) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+...
+LL | f: _s,
+ | -- data moved here
+LL | g: _t
+ | -- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/borrowck-move-error-with-note.rs:33:16
+ |
+LL | f: _s,
+ | ^^
+LL | g: _t
+ | ^^
error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-error-with-note.rs:47:11
+ --> $DIR/borrowck-move-error-with-note.rs:48:11
|
LL | match a.a {
- | ^ cannot move out of borrowed content
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&a.a`
LL |
LL | n => {
- | - hint: to prevent move, use `ref n` or `ref mut n`
+ | - data moved here
+ |
+note: move occurs because `n` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-error-with-note.rs:50:9
+ |
+LL | n => {
+ | ^
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr
deleted file mode 100644
index e4840fb..0000000
--- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0505]: cannot move out of `*a` because it is borrowed
- --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:12:13
- |
-LL | let b = &a;
- | -- borrow of `a` occurs here
-LL |
-LL | let z = *a;
- | ^^ move out of `*a` occurs here
-LL | b.use_ref();
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
index 5e2428e..e4840fb 100644
--- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
+++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
@@ -1,11 +1,13 @@
error[E0505]: cannot move out of `*a` because it is borrowed
- --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:12:9
+ --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:12:13
|
LL | let b = &a;
- | - borrow of `a` occurs here
+ | -- borrow of `a` occurs here
LL |
LL | let z = *a;
- | ^ move out of `*a` occurs here
+ | ^^ move out of `*a` occurs here
+LL | b.use_ref();
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr
deleted file mode 100644
index 615e3fd..0000000
--- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of dereference of raw pointer
- --> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13
- |
-LL | let y = *x;
- | ^^
- | |
- | cannot move out of dereference of raw pointer
- | help: consider removing the `*`: `x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr
index c23c5bb..615e3fd 100644
--- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr
+++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr
@@ -5,7 +5,7 @@
| ^^
| |
| cannot move out of dereference of raw pointer
- | help: consider using a reference instead: `&*x`
+ | help: consider removing the `*`: `x`
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr
deleted file mode 100644
index c18fce9..0000000
--- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr
+++ /dev/null
@@ -1,50 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-in-irrefut-pat.rs:6:13
- |
-LL | fn arg_item(&_x: &String) {}
- | ^--
- | ||
- | |data moved here
- | cannot move out of borrowed content
- | help: consider removing the `&`: `_x`
- |
-note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-in-irrefut-pat.rs:6:14
- |
-LL | fn arg_item(&_x: &String) {}
- | ^^
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-in-irrefut-pat.rs:11:11
- |
-LL | with(|&_x| ())
- | ^--
- | ||
- | |data moved here
- | cannot move out of borrowed content
- | help: consider removing the `&`: `_x`
- |
-note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-in-irrefut-pat.rs:11:12
- |
-LL | with(|&_x| ())
- | ^^
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-in-irrefut-pat.rs:17:15
- |
-LL | let &_x = &"hi".to_string();
- | --- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
- | ||
- | |data moved here
- | help: consider removing the `&`: `_x`
- |
-note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-in-irrefut-pat.rs:17:10
- |
-LL | let &_x = &"hi".to_string();
- | ^^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr
deleted file mode 100644
index 019ed96..0000000
--- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-in-irrefut-pat.rs:6:13
- |
-LL | fn arg_item(&_x: &String) {}
- | ^--
- | ||
- | |hint: to prevent move, use `ref _x` or `ref mut _x`
- | cannot move out of borrowed content
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-in-irrefut-pat.rs:11:11
- |
-LL | with(|&_x| ())
- | ^--
- | ||
- | |hint: to prevent move, use `ref _x` or `ref mut _x`
- | cannot move out of borrowed content
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-in-irrefut-pat.rs:17:9
- |
-LL | let &_x = &"hi".to_string();
- | ^--
- | ||
- | |hint: to prevent move, use `ref _x` or `ref mut _x`
- | cannot move out of borrowed content
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr
deleted file mode 100644
index c18fce9..0000000
--- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr
+++ /dev/null
@@ -1,50 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-in-irrefut-pat.rs:6:13
- |
-LL | fn arg_item(&_x: &String) {}
- | ^--
- | ||
- | |data moved here
- | cannot move out of borrowed content
- | help: consider removing the `&`: `_x`
- |
-note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-in-irrefut-pat.rs:6:14
- |
-LL | fn arg_item(&_x: &String) {}
- | ^^
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-in-irrefut-pat.rs:11:11
- |
-LL | with(|&_x| ())
- | ^--
- | ||
- | |data moved here
- | cannot move out of borrowed content
- | help: consider removing the `&`: `_x`
- |
-note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-in-irrefut-pat.rs:11:12
- |
-LL | with(|&_x| ())
- | ^^
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-in-irrefut-pat.rs:17:15
- |
-LL | let &_x = &"hi".to_string();
- | --- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
- | ||
- | |data moved here
- | help: consider removing the `&`: `_x`
- |
-note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-in-irrefut-pat.rs:17:10
- |
-LL | let &_x = &"hi".to_string();
- | ^^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs
index c63f4f6..f4f402d 100644
--- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs
+++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs
@@ -1,22 +1,16 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn with<F>(f: F) where F: FnOnce(&String) {}
fn arg_item(&_x: &String) {}
- //[ast]~^ ERROR cannot move out of borrowed content [E0507]
- //[mir]~^^ ERROR [E0507]
+ //~^ ERROR [E0507]
fn arg_closure() {
with(|&_x| ())
- //[ast]~^ ERROR cannot move out of borrowed content [E0507]
- //[mir]~^^ ERROR [E0507]
+ //~^ ERROR [E0507]
}
fn let_pat() {
let &_x = &"hi".to_string();
- //[ast]~^ ERROR cannot move out of borrowed content [E0507]
- //[mir]~^^ ERROR [E0507]
+ //~^ ERROR [E0507]
}
pub fn main() {}
diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.stderr
new file mode 100644
index 0000000..d38c05c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.stderr
@@ -0,0 +1,50 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:3:13
+ |
+LL | fn arg_item(&_x: &String) {}
+ | ^--
+ | ||
+ | |data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:3:14
+ |
+LL | fn arg_item(&_x: &String) {}
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:7:11
+ |
+LL | with(|&_x| ())
+ | ^--
+ | ||
+ | |data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:7:12
+ |
+LL | with(|&_x| ())
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:12:15
+ |
+LL | let &_x = &"hi".to_string();
+ | --- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:12:10
+ |
+LL | let &_x = &"hi".to_string();
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr
deleted file mode 100644
index 874c38c..0000000
--- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0382]: use of moved value: `t`
- --> $DIR/borrowck-move-moved-value-into-closure.rs:14:12
- |
-LL | let t: Box<_> = box 3;
- | - move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-LL |
-LL | call_f(move|| { *t + 1 });
- | ------ - variable moved due to use in closure
- | |
- | value moved into closure here
-LL | call_f(move|| { *t + 1 });
- | ^^^^^^ - use occurs due to use in closure
- | |
- | value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr
deleted file mode 100644
index 48651ee..0000000
--- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: capture of moved value: `t`
- --> $DIR/borrowck-move-moved-value-into-closure.rs:14:22
- |
-LL | call_f(move|| { *t + 1 });
- | ------ value moved (into closure) here
-LL | call_f(move|| { *t + 1 });
- | ^ value captured here after move
- |
- = note: move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr
deleted file mode 100644
index 874c38c..0000000
--- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0382]: use of moved value: `t`
- --> $DIR/borrowck-move-moved-value-into-closure.rs:14:12
- |
-LL | let t: Box<_> = box 3;
- | - move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-LL |
-LL | call_f(move|| { *t + 1 });
- | ------ - variable moved due to use in closure
- | |
- | value moved into closure here
-LL | call_f(move|| { *t + 1 });
- | ^^^^^^ - use occurs due to use in closure
- | |
- | value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs
index 2715533..233d0a7 100644
--- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs
+++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(box_syntax)]
fn call_f<F:FnOnce() -> isize>(f: F) -> isize {
@@ -11,6 +8,5 @@
let t: Box<_> = box 3;
call_f(move|| { *t + 1 });
- call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value
- //[mir]~^ ERROR use of moved value
+ call_f(move|| { *t + 1 }); //~ ERROR use of moved value
}
diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr
new file mode 100644
index 0000000..557e27a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr
@@ -0,0 +1,18 @@
+error[E0382]: use of moved value: `t`
+ --> $DIR/borrowck-move-moved-value-into-closure.rs:11:12
+ |
+LL | let t: Box<_> = box 3;
+ | - move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+LL |
+LL | call_f(move|| { *t + 1 });
+ | ------ - variable moved due to use in closure
+ | |
+ | value moved into closure here
+LL | call_f(move|| { *t + 1 });
+ | ^^^^^^ - use occurs due to use in closure
+ | |
+ | value used here after move
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr
deleted file mode 100644
index 77f5b72..0000000
--- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0505]: cannot move out of `t0` because it is borrowed
- --> $DIR/borrowck-move-mut-base-ptr.rs:10:14
- |
-LL | let p: &isize = &*t0; // Freezes `*t0`
- | ---- borrow of `*t0` occurs here
-LL | let t1 = t0;
- | ^^ move out of `t0` occurs here
-LL | *t1 = 22;
-LL | p.use_ref();
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr
index d385383..77f5b72 100644
--- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr
+++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr
@@ -1,10 +1,13 @@
error[E0505]: cannot move out of `t0` because it is borrowed
- --> $DIR/borrowck-move-mut-base-ptr.rs:10:9
+ --> $DIR/borrowck-move-mut-base-ptr.rs:10:14
|
LL | let p: &isize = &*t0; // Freezes `*t0`
- | --- borrow of `*t0` occurs here
+ | ---- borrow of `*t0` occurs here
LL | let t1 = t0;
- | ^^ move out of `t0` occurs here
+ | ^^ move out of `t0` occurs here
+LL | *t1 = 22;
+LL | p.use_ref();
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr
deleted file mode 100644
index 88a1ab2..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error[E0382]: use of moved value: `a[..]`
- --> $DIR/borrowck-move-out-from-array.rs:10:14
- |
-LL | let [_, _x] = a;
- | -- value moved here
-LL | let [.., _y] = a;
- | ^^ value used here after move
- |
- = note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `a[..]`
- --> $DIR/borrowck-move-out-from-array.rs:17:10
- |
-LL | let [_x, _] = a;
- | -- value moved here
-LL | let [_y..] = a;
- | ^^ value used here after move
- |
- = note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr
deleted file mode 100644
index 88a1ab2..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error[E0382]: use of moved value: `a[..]`
- --> $DIR/borrowck-move-out-from-array.rs:10:14
- |
-LL | let [_, _x] = a;
- | -- value moved here
-LL | let [.., _y] = a;
- | ^^ value used here after move
- |
- = note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `a[..]`
- --> $DIR/borrowck-move-out-from-array.rs:17:10
- |
-LL | let [_x, _] = a;
- | -- value moved here
-LL | let [_y..] = a;
- | ^^ value used here after move
- |
- = note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.rs b/src/test/ui/borrowck/borrowck-move-out-from-array.rs
index 503e7b9..856b03e 100644
--- a/src/test/ui/borrowck/borrowck-move-out-from-array.rs
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array.rs
@@ -1,21 +1,16 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(box_syntax)]
#![feature(slice_patterns)]
fn move_out_from_begin_and_end() {
let a = [box 1, box 2];
let [_, _x] = a;
- let [.., _y] = a; //[ast]~ ERROR [E0382]
- //[mir]~^ ERROR [E0382]
+ let [.., _y] = a; //~ ERROR [E0382]
}
fn move_out_by_const_index_and_subslice() {
let a = [box 1, box 2];
let [_x, _] = a;
- let [_y..] = a; //[ast]~ ERROR [E0382]
- //[mir]~^ ERROR [E0382]
+ let [_y..] = a; //~ ERROR [E0382]
}
fn main() {}
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr
new file mode 100644
index 0000000..16722a4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr
@@ -0,0 +1,23 @@
+error[E0382]: use of moved value: `a[..]`
+ --> $DIR/borrowck-move-out-from-array.rs:7:14
+ |
+LL | let [_, _x] = a;
+ | -- value moved here
+LL | let [.., _y] = a;
+ | ^^ value used here after move
+ |
+ = note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `a[..]`
+ --> $DIR/borrowck-move-out-from-array.rs:13:10
+ |
+LL | let [_x, _] = a;
+ | -- value moved here
+LL | let [_y..] = a;
+ | ^^ value used here after move
+ |
+ = note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr
deleted file mode 100644
index 81afb10..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0507]: cannot move out of an `Rc`
- --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:7:14
- |
-LL | let _x = Rc::new(vec![1, 2]).into_iter();
- | ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr
deleted file mode 100644
index e55898a..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:7:14
- |
-LL | let _x = Rc::new(vec![1, 2]).into_iter();
- | ^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr
deleted file mode 100644
index 81afb10..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0507]: cannot move out of an `Rc`
- --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:7:14
- |
-LL | let _x = Rc::new(vec![1, 2]).into_iter();
- | ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs
index 5ced894..0b9e710 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs
+++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs
@@ -1,10 +1,6 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
use std::rc::Rc;
pub fn main() {
let _x = Rc::new(vec![1, 2]).into_iter();
- //[ast]~^ ERROR cannot move out of borrowed content [E0507]
- //[mir]~^^ ERROR [E0507]
+ //~^ ERROR [E0507]
}
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr
new file mode 100644
index 0000000..7dc8e17
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of an `Rc`
+ --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:4:14
+ |
+LL | let _x = Rc::new(vec![1, 2]).into_iter();
+ | ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr
deleted file mode 100644
index e6af992..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of an `Rc`
- --> $DIR/borrowck-move-out-of-overloaded-deref.rs:4:14
- |
-LL | let _x = *Rc::new("hi".to_string());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | cannot move out of an `Rc`
- | help: consider removing the `*`: `Rc::new("hi".to_string())`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs
index d5b6013..ecb135f 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs
+++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs
@@ -2,5 +2,5 @@
pub fn main() {
let _x = *Rc::new("hi".to_string());
- //~^ ERROR cannot move out of borrowed content
+ //~^ ERROR cannot move out of an `Rc`
}
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr
index cd8d146..e6af992 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr
@@ -1,11 +1,11 @@
-error[E0507]: cannot move out of borrowed content
+error[E0507]: cannot move out of an `Rc`
--> $DIR/borrowck-move-out-of-overloaded-deref.rs:4:14
|
LL | let _x = *Rc::new("hi".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
- | cannot move out of borrowed content
- | help: consider using a reference instead: `&*Rc::new("hi".to_string())`
+ | cannot move out of an `Rc`
+ | help: consider removing the `*`: `Rc::new("hi".to_string())`
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr
deleted file mode 100644
index 26d06c0..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0507]: cannot move out of static item
- --> $DIR/borrowck-move-out-of-static-item.rs:18:10
- |
-LL | test(BAR);
- | ^^^ cannot move out of static item
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr
deleted file mode 100644
index 26d06c0..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0507]: cannot move out of static item
- --> $DIR/borrowck-move-out-of-static-item.rs:18:10
- |
-LL | test(BAR);
- | ^^^ cannot move out of static item
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.rs b/src/test/ui/borrowck/borrowck-move-out-of-static-item.rs
index d68d5de..8bb48a1 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-static-item.rs
+++ b/src/test/ui/borrowck/borrowck-move-out-of-static-item.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
// Ensure that moves out of static items is forbidden
struct Foo {
@@ -15,6 +12,5 @@
}
fn main() {
- test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
- //[mir]~^ ERROR [E0507]
+ test(BAR); //~ ERROR cannot move out of static item [E0507]
}
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.stderr
new file mode 100644
index 0000000..5b38c1e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-static-item.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of static item
+ --> $DIR/borrowck-move-out-of-static-item.rs:15:10
+ |
+LL | test(BAR);
+ | ^^^ cannot move out of static item
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr
deleted file mode 100644
index c1c04ca..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr
+++ /dev/null
@@ -1,47 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:10:11
- |
-LL | match (S {f:"foo".to_string()}) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
-LL |
-LL | S {f:_s} => {}
- | -- data moved here
- |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:12:14
- |
-LL | S {f:_s} => {}
- | ^^
-
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:20
- |
-LL | let S {f:_s} = S {f:"foo".to_string()};
- | -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
- | |
- | data moved here
- |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:14
- |
-LL | let S {f:_s} = S {f:"foo".to_string()};
- | ^^
-
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:19
- |
-LL | fn move_in_fn_arg(S {f:_s}: S) {
- | ^^^^^--^
- | | |
- | | data moved here
- | cannot move out of here
- |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:24
- |
-LL | fn move_in_fn_arg(S {f:_s}: S) {
- | ^^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr
deleted file mode 100644
index 0b025fa..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:12:9
- |
-LL | S {f:_s} => {}
- | ^^^^^--^
- | | |
- | | hint: to prevent move, use `ref _s` or `ref mut _s`
- | cannot move out of here
-
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:9
- |
-LL | let S {f:_s} = S {f:"foo".to_string()};
- | ^^^^^--^
- | | |
- | | hint: to prevent move, use `ref _s` or `ref mut _s`
- | cannot move out of here
-
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:19
- |
-LL | fn move_in_fn_arg(S {f:_s}: S) {
- | ^^^^^--^
- | | |
- | | hint: to prevent move, use `ref _s` or `ref mut _s`
- | cannot move out of here
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr
deleted file mode 100644
index c1c04ca..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr
+++ /dev/null
@@ -1,47 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:10:11
- |
-LL | match (S {f:"foo".to_string()}) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
-LL |
-LL | S {f:_s} => {}
- | -- data moved here
- |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:12:14
- |
-LL | S {f:_s} => {}
- | ^^
-
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:20
- |
-LL | let S {f:_s} = S {f:"foo".to_string()};
- | -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
- | |
- | data moved here
- |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:14
- |
-LL | let S {f:_s} = S {f:"foo".to_string()};
- | ^^
-
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:19
- |
-LL | fn move_in_fn_arg(S {f:_s}: S) {
- | ^^^^^--^
- | | |
- | | data moved here
- | cannot move out of here
- |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:24
- |
-LL | fn move_in_fn_arg(S {f:_s}: S) {
- | ^^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs
index cdd71d8..a429f4b 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs
+++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
struct S {f:String}
impl Drop for S {
fn drop(&mut self) { println!("{}", self.f); }
@@ -8,21 +5,18 @@
fn move_in_match() {
match (S {f:"foo".to_string()}) {
- //[mir]~^ ERROR [E0509]
+ //~^ ERROR [E0509]
S {f:_s} => {}
- //[ast]~^ ERROR cannot move out of type `S`, which implements the `Drop` trait [E0509]
}
}
fn move_in_let() {
let S {f:_s} = S {f:"foo".to_string()};
- //[ast]~^ ERROR cannot move out of type `S`, which implements the `Drop` trait [E0509]
- //[mir]~^^ ERROR [E0509]
+ //~^ ERROR [E0509]
}
fn move_in_fn_arg(S {f:_s}: S) {
- //[ast]~^ ERROR cannot move out of type `S`, which implements the `Drop` trait [E0509]
- //[mir]~^^ ERROR [E0509]
+ //~^ ERROR [E0509]
}
fn main() {}
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.stderr
new file mode 100644
index 0000000..059aa30
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.stderr
@@ -0,0 +1,47 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:7:11
+ |
+LL | match (S {f:"foo".to_string()}) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+LL |
+LL | S {f:_s} => {}
+ | -- data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:9:14
+ |
+LL | S {f:_s} => {}
+ | ^^
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:14:20
+ |
+LL | let S {f:_s} = S {f:"foo".to_string()};
+ | -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+ | |
+ | data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:14:14
+ |
+LL | let S {f:_s} = S {f:"foo".to_string()};
+ | ^^
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:19
+ |
+LL | fn move_in_fn_arg(S {f:_s}: S) {
+ | ^^^^^--^
+ | | |
+ | | data moved here
+ | cannot move out of here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:24
+ |
+LL | fn move_in_fn_arg(S {f:_s}: S) {
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr
deleted file mode 100644
index cecba15..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr
+++ /dev/null
@@ -1,46 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:7:11
- |
-LL | match S("foo".to_string()) {
- | ^^^^^^^^^^^^^^^^^^^^ cannot move out of here
-LL | S(_s) => {}
- | -- data moved here
- |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:8:11
- |
-LL | S(_s) => {}
- | ^^
-
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:14:17
- |
-LL | let S(_s) = S("foo".to_string());
- | -- ^^^^^^^^^^^^^^^^^^^^ cannot move out of here
- | |
- | data moved here
- |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:14:11
- |
-LL | let S(_s) = S("foo".to_string());
- | ^^
-
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:19
- |
-LL | fn move_in_fn_arg(S(_s): S) {
- | ^^--^
- | | |
- | | data moved here
- | cannot move out of here
- |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:21
- |
-LL | fn move_in_fn_arg(S(_s): S) {
- | ^^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs
index bb29411..5bd32f8 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs
+++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs
@@ -5,8 +5,8 @@
fn move_in_match() {
match S("foo".to_string()) {
- S(_s) => {}
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
+ S(_s) => {}
}
}
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr
index 134b5e3..a11bda0 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr
@@ -1,20 +1,31 @@
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:8:9
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:7:11
+ |
+LL | match S("foo".to_string()) {
+ | ^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+LL |
+LL | S(_s) => {}
+ | -- data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:9:11
|
LL | S(_s) => {}
- | ^^--^
- | | |
- | | hint: to prevent move, use `ref _s` or `ref mut _s`
- | cannot move out of here
+ | ^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:14:9
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:14:17
|
LL | let S(_s) = S("foo".to_string());
- | ^^--^
- | | |
- | | hint: to prevent move, use `ref _s` or `ref mut _s`
- | cannot move out of here
+ | -- ^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+ | |
+ | data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:14:11
+ |
+LL | let S(_s) = S("foo".to_string());
+ | ^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
--> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:19
@@ -22,8 +33,14 @@
LL | fn move_in_fn_arg(S(_s): S) {
| ^^--^
| | |
- | | hint: to prevent move, use `ref _s` or `ref mut _s`
+ | | data moved here
| cannot move out of here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:21
+ |
+LL | fn move_in_fn_arg(S(_s): S) {
+ | ^^
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr
deleted file mode 100644
index 51caf60..0000000
--- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0508]: cannot move out of type `[Foo]`, a non-copy slice
- --> $DIR/borrowck-move-out-of-vec-tail.rs:19:19
- |
-LL | match tail {
- | ^^^^ cannot move out of here
-LL | &[Foo { string: a },
- | - data moved here
-...
-LL | Foo { string: b }] => {
- | - ...and here
- |
-note: move occurs because these variables have types that don't implement the `Copy` trait
- --> $DIR/borrowck-move-out-of-vec-tail.rs:20:33
- |
-LL | &[Foo { string: a },
- | ^
-...
-LL | Foo { string: b }] => {
- | ^
-help: consider removing the `&`
- |
-LL | [Foo { string: a },
-LL |
-LL |
-LL |
-LL | Foo { string: b }] => {
- |
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs
index 5f6e01f..cc524c1 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs
+++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs
@@ -17,10 +17,8 @@
match *x {
[_, ref tail..] => {
match tail {
+ //~^ ERROR cannot move out of type `[Foo]`
&[Foo { string: a },
- //~^ ERROR cannot move out of type `[Foo]`
- //~| cannot move out
- //~| to prevent move
Foo { string: b }] => {
}
_ => {
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr
index 5ec0dab..9f0670c 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr
@@ -1,17 +1,26 @@
error[E0508]: cannot move out of type `[Foo]`, a non-copy slice
- --> $DIR/borrowck-move-out-of-vec-tail.rs:20:18
+ --> $DIR/borrowck-move-out-of-vec-tail.rs:19:19
|
-LL | &[Foo { string: a },
- | ^ - hint: to prevent move, use `ref a` or `ref mut a`
- | __________________|
- | |
-LL | |
-LL | |
-LL | |
-LL | | Foo { string: b }] => {
- | |_________________________________-__^ cannot move out of here
- | |
- | ...and here (use `ref b` or `ref mut b`)
+LL | match tail {
+ | ^^^^ cannot move out of here
+LL |
+LL | &[Foo { string: a },
+ | - data moved here
+LL | Foo { string: b }] => {
+ | - ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-vec-tail.rs:21:33
+ |
+LL | &[Foo { string: a },
+ | ^
+LL | Foo { string: b }] => {
+ | ^
+help: consider removing the `&`
+ |
+LL | [Foo { string: a },
+LL | Foo { string: b }] => {
+ |
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr
deleted file mode 100644
index 8c9083f..0000000
--- a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0505]: cannot move out of `a.x` because it is borrowed
- --> $DIR/borrowck-move-subcomponent.rs:15:14
- |
-LL | let pb = &a;
- | -- borrow of `a` occurs here
-LL | let S { x: ax } = a;
- | ^^ move out of `a.x` occurs here
-LL | f(pb);
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr
index fd3deef..8c9083f 100644
--- a/src/test/ui/borrowck/borrowck-move-subcomponent.stderr
+++ b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr
@@ -2,9 +2,11 @@
--> $DIR/borrowck-move-subcomponent.rs:15:14
|
LL | let pb = &a;
- | - borrow of `a` occurs here
+ | -- borrow of `a` occurs here
LL | let S { x: ax } = a;
| ^^ move out of `a.x` occurs here
+LL | f(pb);
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr
deleted file mode 100644
index b6b46e4..0000000
--- a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr
+++ /dev/null
@@ -1,103 +0,0 @@
-error[E0505]: cannot move out of `x1` because it is borrowed
- --> $DIR/borrowck-multiple-captures.rs:12:19
- |
-LL | let p1 = &x1;
- | --- borrow of `x1` occurs here
-...
-LL | thread::spawn(move|| {
- | ^^^^^^ move out of `x1` occurs here
-LL | drop(x1);
- | -- move occurs due to use in closure
-...
-LL | borrow(&*p1);
- | ---- borrow later used here
-
-error[E0505]: cannot move out of `x2` because it is borrowed
- --> $DIR/borrowck-multiple-captures.rs:12:19
- |
-LL | let p2 = &x2;
- | --- borrow of `x2` occurs here
-LL | thread::spawn(move|| {
- | ^^^^^^ move out of `x2` occurs here
-LL | drop(x1);
-LL | drop(x2);
- | -- move occurs due to use in closure
-...
-LL | borrow(&*p2);
- | ---- borrow later used here
-
-error[E0382]: use of moved value: `x1`
- --> $DIR/borrowck-multiple-captures.rs:25:19
- |
-LL | let x1: Box<_> = box 1;
- | -- move occurs because `x1` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-LL | drop(x1);
- | -- value moved here
-...
-LL | thread::spawn(move|| {
- | ^^^^^^ value used here after move
-LL | drop(x1);
- | -- use occurs due to use in closure
-
-error[E0382]: use of moved value: `x2`
- --> $DIR/borrowck-multiple-captures.rs:25:19
- |
-LL | let x2: Box<_> = box 2;
- | -- move occurs because `x2` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-LL | drop(x2);
- | -- value moved here
-LL | thread::spawn(move|| {
- | ^^^^^^ value used here after move
-LL | drop(x1);
-LL | drop(x2);
- | -- use occurs due to use in closure
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-multiple-captures.rs:36:14
- |
-LL | drop(x);
- | - value moved here
-LL | drop(x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrowck-multiple-captures.rs:34:19
- |
-LL | let p = &x;
- | -- borrow of `x` occurs here
-LL | thread::spawn(move|| {
- | ^^^^^^ move out of `x` occurs here
-LL | drop(x);
- | - move occurs due to use in closure
-...
-LL | borrow(&*p);
- | --- borrow later used here
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-multiple-captures.rs:46:14
- |
-LL | drop(x);
- | - value moved here
-LL | drop(x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-multiple-captures.rs:44:19
- |
-LL | let x: Box<_> = box 1;
- | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-LL | drop(x);
- | - value moved here
-LL | thread::spawn(move|| {
- | ^^^^^^ value used here after move
-LL | drop(x);
- | - use occurs due to use in closure
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0382, E0505.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.rs b/src/test/ui/borrowck/borrowck-multiple-captures.rs
index ad75378..9f09f84 100644
--- a/src/test/ui/borrowck/borrowck-multiple-captures.rs
+++ b/src/test/ui/borrowck/borrowck-multiple-captures.rs
@@ -10,8 +10,10 @@
let x2: Box<_> = box 2;
let p2 = &x2;
thread::spawn(move|| {
- drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
- drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed
+ //~^ ERROR cannot move out of `x1` because it is borrowed
+ //~| ERROR cannot move out of `x2` because it is borrowed
+ drop(x1);
+ drop(x2);
});
borrow(&*p1);
borrow(&*p2);
@@ -23,8 +25,10 @@
let x2: Box<_> = box 2;
drop(x2);
thread::spawn(move|| {
- drop(x1); //~ ERROR capture of moved value: `x1`
- drop(x2); //~ ERROR capture of moved value: `x2`
+ //~^ ERROR use of moved value: `x1`
+ //~| ERROR use of moved value: `x2`
+ drop(x1);
+ drop(x2);
});
}
@@ -32,7 +36,8 @@
let x: Box<_> = box 1;
let p = &x;
thread::spawn(move|| {
- drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
+ //~^ ERROR cannot move out of `x` because it is borrowed
+ drop(x);
drop(x); //~ ERROR use of moved value: `x`
});
borrow(&*p);
@@ -42,7 +47,8 @@
let x: Box<_> = box 1;
drop(x);
thread::spawn(move|| {
- drop(x); //~ ERROR capture of moved value: `x`
+ //~^ ERROR use of moved value: `x`
+ drop(x);
drop(x); //~ ERROR use of moved value: `x`
});
}
diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.stderr
index fba4201..298482b 100644
--- a/src/test/ui/borrowck/borrowck-multiple-captures.stderr
+++ b/src/test/ui/borrowck/borrowck-multiple-captures.stderr
@@ -1,54 +1,61 @@
-error[E0504]: cannot move `x1` into closure because it is borrowed
- --> $DIR/borrowck-multiple-captures.rs:13:14
+error[E0505]: cannot move out of `x1` because it is borrowed
+ --> $DIR/borrowck-multiple-captures.rs:12:19
|
LL | let p1 = &x1;
- | -- borrow of `x1` occurs here
+ | --- borrow of `x1` occurs here
+...
+LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `x1` occurs here
...
LL | drop(x1);
- | ^^ move into closure occurs here
+ | -- move occurs due to use in closure
+...
+LL | borrow(&*p1);
+ | ---- borrow later used here
-error[E0504]: cannot move `x2` into closure because it is borrowed
- --> $DIR/borrowck-multiple-captures.rs:14:14
+error[E0505]: cannot move out of `x2` because it is borrowed
+ --> $DIR/borrowck-multiple-captures.rs:12:19
|
LL | let p2 = &x2;
- | -- borrow of `x2` occurs here
+ | --- borrow of `x2` occurs here
+LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `x2` occurs here
...
LL | drop(x2);
- | ^^ move into closure occurs here
+ | -- move occurs due to use in closure
+...
+LL | borrow(&*p2);
+ | ---- borrow later used here
-error[E0382]: capture of moved value: `x1`
- --> $DIR/borrowck-multiple-captures.rs:26:14
+error[E0382]: use of moved value: `x1`
+ --> $DIR/borrowck-multiple-captures.rs:27:19
|
+LL | let x1: Box<_> = box 1;
+ | -- move occurs because `x1` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | drop(x1);
| -- value moved here
...
+LL | thread::spawn(move|| {
+ | ^^^^^^ value used here after move
+...
LL | drop(x1);
- | ^^ value captured here after move
- |
- = note: move occurs because `x1` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+ | -- use occurs due to use in closure
-error[E0382]: capture of moved value: `x2`
- --> $DIR/borrowck-multiple-captures.rs:27:14
+error[E0382]: use of moved value: `x2`
+ --> $DIR/borrowck-multiple-captures.rs:27:19
|
+LL | let x2: Box<_> = box 2;
+ | -- move occurs because `x2` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | drop(x2);
| -- value moved here
+LL | thread::spawn(move|| {
+ | ^^^^^^ value used here after move
...
LL | drop(x2);
- | ^^ value captured here after move
- |
- = note: move occurs because `x2` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error[E0504]: cannot move `x` into closure because it is borrowed
- --> $DIR/borrowck-multiple-captures.rs:35:14
- |
-LL | let p = &x;
- | - borrow of `x` occurs here
-LL | thread::spawn(move|| {
-LL | drop(x);
- | ^ move into closure occurs here
+ | -- use occurs due to use in closure
error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-multiple-captures.rs:36:14
+ --> $DIR/borrowck-multiple-captures.rs:41:14
|
LL | drop(x);
| - value moved here
@@ -57,28 +64,44 @@
|
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-error[E0382]: capture of moved value: `x`
- --> $DIR/borrowck-multiple-captures.rs:45:14
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-multiple-captures.rs:38:19
|
+LL | let p = &x;
+ | -- borrow of `x` occurs here
+LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `x` occurs here
+LL |
+LL | drop(x);
+ | - move occurs due to use in closure
+...
+LL | borrow(&*p);
+ | --- borrow later used here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-multiple-captures.rs:52:14
+ |
+LL | drop(x);
+ | - value moved here
+LL | drop(x);
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-multiple-captures.rs:49:19
+ |
+LL | let x: Box<_> = box 1;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | drop(x);
| - value moved here
LL | thread::spawn(move|| {
+ | ^^^^^^ value used here after move
+LL |
LL | drop(x);
- | ^ value captured here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `x`
- --> $DIR/borrowck-multiple-captures.rs:46:14
- |
-LL | drop(x);
- | - value moved here
-LL | drop(x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+ | - use occurs due to use in closure
error: aborting due to 8 previous errors
-Some errors have detailed explanations: E0382, E0504.
+Some errors have detailed explanations: E0382, E0505.
For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr
deleted file mode 100644
index d58548f..0000000
--- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-mut-addr-of-imm-var.rs:3:25
- |
-LL | let x: isize = 3;
- | - help: consider changing this to be mutable: `mut x`
-LL | let y: &mut isize = &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr
index aa3b39c..d58548f 100644
--- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr
+++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr
@@ -1,10 +1,10 @@
-error[E0596]: cannot borrow immutable local variable `x` as mutable
- --> $DIR/borrowck-mut-addr-of-imm-var.rs:3:30
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-mut-addr-of-imm-var.rs:3:25
|
LL | let x: isize = 3;
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | let y: &mut isize = &mut x;
- | ^ cannot borrow mutably
+ | ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr
deleted file mode 100644
index a6e7d74..0000000
--- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-linear-errors.rs:13:30
- |
-LL | 1 => { addr.push(&mut x); }
- | ---- ^^^^^^ second mutable borrow occurs here
- | |
- | first borrow later used here
-...
-LL | _ => { addr.push(&mut x); }
- | ------ first mutable borrow occurs here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-linear-errors.rs:15:30
- |
-LL | 1 => { addr.push(&mut x); }
- | ---- first borrow later used here
-LL |
-LL | 2 => { addr.push(&mut x); }
- | ^^^^^^ second mutable borrow occurs here
-LL |
-LL | _ => { addr.push(&mut x); }
- | ------ first mutable borrow occurs here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-linear-errors.rs:17:30
- |
-LL | _ => { addr.push(&mut x); }
- | ^^^^^^ mutable borrow starts here in previous iteration of loop
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr
deleted file mode 100644
index cee61db..0000000
--- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-linear-errors.rs:13:35
- |
-LL | 1 => { addr.push(&mut x); }
- | ^ mutable borrow starts here in previous iteration of loop
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-linear-errors.rs:15:35
- |
-LL | 1 => { addr.push(&mut x); }
- | - first mutable borrow occurs here
-LL |
-LL | 2 => { addr.push(&mut x); }
- | ^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-linear-errors.rs:17:35
- |
-LL | 1 => { addr.push(&mut x); }
- | - first mutable borrow occurs here
-...
-LL | _ => { addr.push(&mut x); }
- | ^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr
deleted file mode 100644
index a6e7d74..0000000
--- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-linear-errors.rs:13:30
- |
-LL | 1 => { addr.push(&mut x); }
- | ---- ^^^^^^ second mutable borrow occurs here
- | |
- | first borrow later used here
-...
-LL | _ => { addr.push(&mut x); }
- | ------ first mutable borrow occurs here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-linear-errors.rs:15:30
- |
-LL | 1 => { addr.push(&mut x); }
- | ---- first borrow later used here
-LL |
-LL | 2 => { addr.push(&mut x); }
- | ^^^^^^ second mutable borrow occurs here
-LL |
-LL | _ => { addr.push(&mut x); }
- | ------ first mutable borrow occurs here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-linear-errors.rs:17:30
- |
-LL | _ => { addr.push(&mut x); }
- | ^^^^^^ mutable borrow starts here in previous iteration of loop
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs
index bb0b26e..e3d7639 100644
--- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs
@@ -2,20 +2,14 @@
// conflicts with a new loan, as opposed to every issued loan. This keeps us
// down to O(n) errors (for n problem lines), instead of O(n^2) errors.
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn main() {
let mut x = 1;
let mut addr = vec![];
loop {
match 1 {
- 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
- //[mir]~^ ERROR [E0499]
- 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
- //[mir]~^ ERROR [E0499]
- _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
- //[mir]~^ ERROR [E0499]
+ 1 => { addr.push(&mut x); } //~ ERROR [E0499]
+ 2 => { addr.push(&mut x); } //~ ERROR [E0499]
+ _ => { addr.push(&mut x); } //~ ERROR [E0499]
}
}
}
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
new file mode 100644
index 0000000..a8d00d1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
@@ -0,0 +1,30 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:10:30
+ |
+LL | 1 => { addr.push(&mut x); }
+ | ---- ^^^^^^ second mutable borrow occurs here
+ | |
+ | first borrow later used here
+LL | 2 => { addr.push(&mut x); }
+LL | _ => { addr.push(&mut x); }
+ | ------ first mutable borrow occurs here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:11:30
+ |
+LL | 1 => { addr.push(&mut x); }
+ | ---- first borrow later used here
+LL | 2 => { addr.push(&mut x); }
+ | ^^^^^^ second mutable borrow occurs here
+LL | _ => { addr.push(&mut x); }
+ | ------ first mutable borrow occurs here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:12:30
+ |
+LL | _ => { addr.push(&mut x); }
+ | ^^^^^^ mutable borrow starts here in previous iteration of loop
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr
deleted file mode 100644
index f2baee0..0000000
--- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:11:18
- |
-LL | let p: &isize = &*t0; // Freezes `*t0`
- | ---- immutable borrow occurs here
-LL | let mut t2 = &mut t0;
- | ^^^^^^^ mutable borrow occurs here
-LL | **t2 += 1; // Mutates `*t0`
-LL | p.use_ref();
- | - immutable borrow later used here
-
-error[E0499]: cannot borrow `t0` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:18
- |
-LL | let p: &mut isize = &mut *t0; // Claims `*t0`
- | -------- first mutable borrow occurs here
-LL | let mut t2 = &mut t0;
- | ^^^^^^^ second mutable borrow occurs here
-LL | **t2 += 1; // Mutates `*t0` but not through `*p`
-LL | p.use_mut();
- | - first borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0499, E0502.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
index 96fa571..f2baee0 100644
--- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
@@ -1,24 +1,24 @@
-error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable
- --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:11:23
+error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:11:18
|
LL | let p: &isize = &*t0; // Freezes `*t0`
- | --- immutable borrow occurs here
+ | ---- immutable borrow occurs here
LL | let mut t2 = &mut t0;
- | ^^ mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
+ | ^^^^^^^ mutable borrow occurs here
+LL | **t2 += 1; // Mutates `*t0`
+LL | p.use_ref();
+ | - immutable borrow later used here
error[E0499]: cannot borrow `t0` as mutable more than once at a time
- --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:23
+ --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:18
|
LL | let p: &mut isize = &mut *t0; // Claims `*t0`
- | --- first mutable borrow occurs here
+ | -------- first mutable borrow occurs here
LL | let mut t2 = &mut t0;
- | ^^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+ | ^^^^^^^ second mutable borrow occurs here
+LL | **t2 += 1; // Mutates `*t0` but not through `*p`
+LL | p.use_mut();
+ | - first borrow later used here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr
deleted file mode 100644
index 8e7ffdc..0000000
--- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-mut-slice-of-imm-vec.rs:7:11
- |
-LL | let v = vec![1, 2, 3];
- | - help: consider changing this to be mutable: `mut v`
-LL | write(&mut v);
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr
index 4160919..8e7ffdc 100644
--- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr
+++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr
@@ -1,10 +1,10 @@
-error[E0596]: cannot borrow immutable local variable `v` as mutable
- --> $DIR/borrowck-mut-slice-of-imm-vec.rs:7:16
+error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-mut-slice-of-imm-vec.rs:7:11
|
LL | let v = vec![1, 2, 3];
- | - help: make this binding mutable: `mut v`
+ | - help: consider changing this to be mutable: `mut v`
LL | write(&mut v);
- | ^ cannot borrow mutably
+ | ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr b/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr
deleted file mode 100644
index f44c765..0000000
--- a/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0302]: cannot assign in a pattern guard
- --> $DIR/borrowck-mutate-in-guard.rs:10:25
- |
-LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
- | ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
-
-error[E0301]: cannot mutably borrow in a pattern guard
- --> $DIR/borrowck-mutate-in-guard.rs:12:38
- |
-LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
- | ^ borrowed mutably in pattern guard
- |
- = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
-
-error[E0302]: cannot assign in a pattern guard
- --> $DIR/borrowck-mutate-in-guard.rs:12:41
- |
-LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
- | ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0301, E0302.
-For more information about an error, try `rustc --explain E0301`.
diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr b/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
index b475116..f44c765 100644
--- a/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
+++ b/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
@@ -9,6 +9,8 @@
|
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
| ^ borrowed mutably in pattern guard
+ |
+ = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
error[E0302]: cannot assign in a pattern guard
--> $DIR/borrowck-mutate-in-guard.rs:12:41
diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr
deleted file mode 100644
index 3462b76..0000000
--- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrowck-no-cycle-in-exchange-heap.rs:16:15
- |
-LL | Cycle::Node(ref mut y) => {
- | --------- borrow of `x.0` occurs here
-LL | y.a = x;
- | --- ^ move out of `x` occurs here
- | |
- | borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr
index 5fc1694..3462b76 100644
--- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr
+++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr
@@ -4,7 +4,9 @@
LL | Cycle::Node(ref mut y) => {
| --------- borrow of `x.0` occurs here
LL | y.a = x;
- | ^ move out of `x` occurs here
+ | --- ^ move out of `x` occurs here
+ | |
+ | borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr
deleted file mode 100644
index cf94c74..0000000
--- a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr
+++ /dev/null
@@ -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`.
diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.stderr
index 8f6c8e0..cf94c74 100644
--- a/src/test/ui/borrowck/borrowck-object-lifetime.stderr
+++ b/src/test/ui/borrowck/borrowck-object-lifetime.stderr
@@ -4,21 +4,19 @@
LL | let y = x.borrowed();
| - immutable borrow occurs here
LL | let z = x.mut_borrowed();
- | ^ mutable borrow occurs here
+ | ^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | y.use_ref();
-LL | }
- | - immutable borrow ends here
+ | - immutable borrow later used here
-error[E0502]: cannot borrow `x` as mutable because `*x` is also borrowed as immutable
- --> $DIR/borrowck-object-lifetime.rs:26:18
+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
+ | ^^^^^^ mutable borrow occurs here
LL | y.use_ref();
-LL | }
- | - immutable borrow ends here
+ | - immutable borrow later used here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-or-init.nll.stderr b/src/test/ui/borrowck/borrowck-or-init.nll.stderr
deleted file mode 100644
index 122f519..0000000
--- a/src/test/ui/borrowck/borrowck-or-init.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `i`
- --> $DIR/borrowck-or-init.rs:5:20
- |
-LL | println!("{}", i);
- | ^ use of possibly uninitialized `i`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-or-init.rs b/src/test/ui/borrowck/borrowck-or-init.rs
index 5b14878..c0d6c9c 100644
--- a/src/test/ui/borrowck/borrowck-or-init.rs
+++ b/src/test/ui/borrowck/borrowck-or-init.rs
@@ -2,5 +2,5 @@
let i: isize;
println!("{}", false || { i = 5; true });
- println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
+ println!("{}", i); //~ ERROR borrow of possibly uninitialized variable: `i`
}
diff --git a/src/test/ui/borrowck/borrowck-or-init.stderr b/src/test/ui/borrowck/borrowck-or-init.stderr
index a2b69b1..122f519 100644
--- a/src/test/ui/borrowck/borrowck-or-init.stderr
+++ b/src/test/ui/borrowck/borrowck-or-init.stderr
@@ -1,4 +1,4 @@
-error[E0381]: use of possibly uninitialized variable: `i`
+error[E0381]: borrow of possibly uninitialized variable: `i`
--> $DIR/borrowck-or-init.rs:5:20
|
LL | println!("{}", i);
diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr
deleted file mode 100644
index ddb63b5..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-overloaded-call.rs:59:5
- |
-LL | let sp = &mut s;
- | ------ mutable borrow occurs here
-LL | s(3);
- | ^ immutable borrow occurs here
-LL | use_mut(sp);
- | -- mutable borrow later used here
-
-error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-overloaded-call.rs:67:5
- |
-LL | let s = SFnMut {
- | - help: consider changing this to be mutable: `mut s`
-...
-LL | s(3);
- | ^ cannot borrow as mutable
-
-error[E0382]: use of moved value: `s`
- --> $DIR/borrowck-overloaded-call.rs:75:5
- |
-LL | let s = SFnOnce {
- | - move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait
-...
-LL | s(" world".to_string());
- | - value moved here
-LL | s(" world".to_string());
- | ^ value used here after move
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0382, E0502, E0596.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.rs b/src/test/ui/borrowck/borrowck-overloaded-call.rs
index 8601449..7b16bf6 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-call.rs
+++ b/src/test/ui/borrowck/borrowck-overloaded-call.rs
@@ -64,7 +64,7 @@
x: 1,
y: 2,
};
- s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable
+ s(3); //~ ERROR cannot borrow `s` as mutable, as it is not declared as mutable
}
fn h() {
diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.stderr
index 1a32c55..ddb63b5 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-call.stderr
+++ b/src/test/ui/borrowck/borrowck-overloaded-call.stderr
@@ -2,31 +2,31 @@
--> $DIR/borrowck-overloaded-call.rs:59:5
|
LL | let sp = &mut s;
- | - mutable borrow occurs here
+ | ------ mutable borrow occurs here
LL | s(3);
| ^ immutable borrow occurs here
LL | use_mut(sp);
-LL | }
- | - mutable borrow ends here
+ | -- mutable borrow later used here
-error[E0596]: cannot borrow immutable local variable `s` as mutable
+error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
--> $DIR/borrowck-overloaded-call.rs:67:5
|
LL | let s = SFnMut {
- | - help: make this binding mutable: `mut s`
+ | - help: consider changing this to be mutable: `mut s`
...
LL | s(3);
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
error[E0382]: use of moved value: `s`
--> $DIR/borrowck-overloaded-call.rs:75:5
|
+LL | let s = SFnOnce {
+ | - move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait
+...
LL | s(" world".to_string());
| - value moved here
LL | s(" world".to_string());
| ^ value used here after move
- |
- = note: move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr
deleted file mode 100644
index f33fb55..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `v` because it is borrowed
- --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:34:5
- |
-LL | let i = &v[0].f;
- | - borrow of `v` occurs here
-LL | v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `v` occurs here
-...
-LL | read(*i);
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr
deleted file mode 100644
index 59841ee..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0506]: cannot assign to `v` because it is borrowed
- --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:34:5
- |
-LL | let i = &v[0].f;
- | - borrow of `v` occurs here
-LL | v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `v` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr
deleted file mode 100644
index f33fb55..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `v` because it is borrowed
- --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:34:5
- |
-LL | let i = &v[0].f;
- | - borrow of `v` occurs here
-LL | v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `v` occurs here
-...
-LL | read(*i);
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs
index 348d99f..0e3e01a 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs
@@ -3,9 +3,6 @@
// operator. The accounting of the all the implicit things going on
// here is rather subtle. Issue #20232.
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
use std::ops::{Deref, Index};
struct MyVec<T> { x: T }
@@ -32,8 +29,7 @@
let mut v = MyVec { x: MyPtr { x: Foo { f: 22 } } };
let i = &v[0].f;
v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
- //[ast]~^ ERROR cannot assign to `v`
- //[mir]~^^ ERROR cannot assign to `v` because it is borrowed
+ //~^ ERROR cannot assign to `v` because it is borrowed
read(*i);
}
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr
new file mode 100644
index 0000000..5d52e49
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `v` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:31:5
+ |
+LL | let i = &v[0].f;
+ | - borrow of `v` occurs here
+LL | v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `v` occurs here
+LL |
+LL | read(*i);
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr
deleted file mode 100644
index 978e129..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr
+++ /dev/null
@@ -1,84 +0,0 @@
-error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-overloaded-index-autoderef.rs:37:14
- |
-LL | let p = &mut f[&s];
- | - mutable borrow occurs here
-LL | let q = &f[&s];
- | ^ immutable borrow occurs here
-LL | p.use_mut();
- | - mutable borrow later used here
-
-error[E0499]: cannot borrow `*f` as mutable more than once at a time
- --> $DIR/borrowck-overloaded-index-autoderef.rs:43:18
- |
-LL | let p = &mut f[&s];
- | - first mutable borrow occurs here
-LL | let q = &mut f[&s];
- | ^ second mutable borrow occurs here
-LL | p.use_mut();
- | - first borrow later used here
-
-error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
- --> $DIR/borrowck-overloaded-index-autoderef.rs:53:18
- |
-LL | let p = &mut f.foo[&s];
- | ----- first mutable borrow occurs here
-LL | let q = &mut f.foo[&s];
- | ^^^^^ second mutable borrow occurs here
-LL | p.use_mut();
- | - first borrow later used here
-
-error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-overloaded-index-autoderef.rs:65:18
- |
-LL | let p = &f.foo[&s];
- | ----- immutable borrow occurs here
-LL | let q = &mut f.foo[&s];
- | ^^^^^ mutable borrow occurs here
-LL | p.use_ref();
- | - immutable borrow later used here
-
-error[E0506]: cannot assign to `f.foo` because it is borrowed
- --> $DIR/borrowck-overloaded-index-autoderef.rs:71:5
- |
-LL | let p = &f.foo[&s];
- | ----- borrow of `f.foo` occurs here
-LL | f.foo = g;
- | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
-LL | p.use_ref();
- | - borrow later used here
-
-error[E0506]: cannot assign to `*f` because it is borrowed
- --> $DIR/borrowck-overloaded-index-autoderef.rs:77:5
- |
-LL | let p = &f.foo[&s];
- | ----- borrow of `*f` occurs here
-LL | *f = g;
- | ^^^^^^ assignment to borrowed `*f` occurs here
-LL | p.use_ref();
- | - borrow later used here
-
-error[E0506]: cannot assign to `f.foo` because it is borrowed
- --> $DIR/borrowck-overloaded-index-autoderef.rs:83:5
- |
-LL | let p = &mut f.foo[&s];
- | ----- borrow of `f.foo` occurs here
-LL | f.foo = g;
- | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
-LL | p.use_mut();
- | - borrow later used here
-
-error[E0506]: cannot assign to `*f` because it is borrowed
- --> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
- |
-LL | let p = &mut f.foo[&s];
- | ----- borrow of `*f` occurs here
-LL | *f = g;
- | ^^^^^^ assignment to borrowed `*f` occurs here
-LL | p.use_mut();
- | - borrow later used here
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0506.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
index ae763be..978e129 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
@@ -6,8 +6,7 @@
LL | let q = &f[&s];
| ^ immutable borrow occurs here
LL | p.use_mut();
-LL | }
- | - mutable borrow ends here
+ | - mutable borrow later used here
error[E0499]: cannot borrow `*f` as mutable more than once at a time
--> $DIR/borrowck-overloaded-index-autoderef.rs:43:18
@@ -17,8 +16,7 @@
LL | let q = &mut f[&s];
| ^ second mutable borrow occurs here
LL | p.use_mut();
-LL | }
- | - first borrow ends here
+ | - first borrow later used here
error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
--> $DIR/borrowck-overloaded-index-autoderef.rs:53:18
@@ -28,8 +26,7 @@
LL | let q = &mut f.foo[&s];
| ^^^^^ second mutable borrow occurs here
LL | p.use_mut();
-LL | }
- | - first borrow ends here
+ | - first borrow later used here
error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-overloaded-index-autoderef.rs:65:18
@@ -39,8 +36,7 @@
LL | let q = &mut f.foo[&s];
| ^^^^^ mutable borrow occurs here
LL | p.use_ref();
-LL | }
- | - immutable borrow ends here
+ | - immutable borrow later used here
error[E0506]: cannot assign to `f.foo` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:71:5
@@ -49,6 +45,8 @@
| ----- borrow of `f.foo` occurs here
LL | f.foo = g;
| ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
+LL | p.use_ref();
+ | - borrow later used here
error[E0506]: cannot assign to `*f` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:77:5
@@ -57,6 +55,8 @@
| ----- borrow of `*f` occurs here
LL | *f = g;
| ^^^^^^ assignment to borrowed `*f` occurs here
+LL | p.use_ref();
+ | - borrow later used here
error[E0506]: cannot assign to `f.foo` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:83:5
@@ -65,6 +65,8 @@
| ----- borrow of `f.foo` occurs here
LL | f.foo = g;
| ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
+LL | p.use_mut();
+ | - borrow later used here
error[E0506]: cannot assign to `*f` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
@@ -73,6 +75,8 @@
| ----- borrow of `*f` occurs here
LL | *f = g;
| ^^^^^^ assignment to borrowed `*f` occurs here
+LL | p.use_mut();
+ | - borrow later used here
error: aborting due to 8 previous errors
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr
deleted file mode 100644
index dbd805f..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/borrowck-overloaded-index-move-from-vec.rs:20:15
- |
-LL | let bad = v[0];
- | ^^^^
- | |
- | cannot move out of borrowed content
- | help: consider borrowing here: `&v[0]`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs
index 76dd97e..b306082 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs
@@ -18,5 +18,5 @@
let v = MyVec::<Box<_>> { data: vec![box 1, box 2, box 3] };
let good = &v[0]; // Shouldn't fail here
let bad = v[0];
- //~^ ERROR cannot move out of indexed content
+ //~^ ERROR cannot move out of borrowed content
}
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr
index fe655dc..dbd805f 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr
@@ -1,11 +1,11 @@
-error[E0507]: cannot move out of indexed content
+error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-overloaded-index-move-from-vec.rs:20:15
|
LL | let bad = v[0];
| ^^^^
| |
- | cannot move out of indexed content
- | help: consider using a reference instead: `&v[0]`
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&v[0]`
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr
deleted file mode 100644
index 5414b01..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr
+++ /dev/null
@@ -1,40 +0,0 @@
-error[E0505]: cannot move out of `s` because it is borrowed
- --> $DIR/borrowck-overloaded-index-move-index.rs:50:22
- |
-LL | let rs = &mut s;
- | ------ borrow of `s` occurs here
-LL |
-LL | println!("{}", f[s]);
- | ^ move out of `s` occurs here
-...
-LL | use_mut(rs);
- | -- borrow later used here
-
-error[E0505]: cannot move out of `s` because it is borrowed
- --> $DIR/borrowck-overloaded-index-move-index.rs:53:7
- |
-LL | let rs = &mut s;
- | ------ borrow of `s` occurs here
-...
-LL | f[s] = 10;
- | ^ move out of `s` occurs here
-...
-LL | use_mut(rs);
- | -- borrow later used here
-
-error[E0382]: use of moved value: `s`
- --> $DIR/borrowck-overloaded-index-move-index.rs:53:7
- |
-LL | let mut s = "hello".to_string();
- | ----- move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
-...
-LL | println!("{}", f[s]);
- | - value moved here
-...
-LL | f[s] = 10;
- | ^ value used here after move
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0382, E0505.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr
index e84cbca..5414b01 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr
@@ -2,30 +2,37 @@
--> $DIR/borrowck-overloaded-index-move-index.rs:50:22
|
LL | let rs = &mut s;
- | - borrow of `s` occurs here
+ | ------ borrow of `s` occurs here
LL |
LL | println!("{}", f[s]);
| ^ move out of `s` occurs here
+...
+LL | use_mut(rs);
+ | -- borrow later used here
error[E0505]: cannot move out of `s` because it is borrowed
--> $DIR/borrowck-overloaded-index-move-index.rs:53:7
|
LL | let rs = &mut s;
- | - borrow of `s` occurs here
+ | ------ borrow of `s` occurs here
...
LL | f[s] = 10;
| ^ move out of `s` occurs here
+...
+LL | use_mut(rs);
+ | -- borrow later used here
error[E0382]: use of moved value: `s`
--> $DIR/borrowck-overloaded-index-move-index.rs:53:7
|
+LL | let mut s = "hello".to_string();
+ | ----- move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | println!("{}", f[s]);
| - value moved here
...
LL | f[s] = 10;
| ^ value used here after move
- |
- = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr
deleted file mode 100644
index d09ce5d..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-overloaded-index-ref-index.rs:52:22
- |
-LL | let rs = &mut s;
- | ------ mutable borrow occurs here
-LL | println!("{}", f[&s]);
- | ^^ immutable borrow occurs here
-...
-LL | drop(rs);
- | -- mutable borrow later used here
-
-error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-overloaded-index-ref-index.rs:55:7
- |
-LL | let rs = &mut s;
- | ------ mutable borrow occurs here
-...
-LL | f[&s] = 10;
- | ^^ immutable borrow occurs here
-...
-LL | drop(rs);
- | -- mutable borrow later used here
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/borrowck-overloaded-index-ref-index.rs:61:5
- |
-LL | s[2] = 20;
- | ^^^^^^^^^ cannot assign
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr
deleted file mode 100644
index 251b5cd..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0594]: cannot assign to immutable indexed content
- --> $DIR/borrowck-overloaded-index-ref-index.rs:61:5
- |
-LL | s[2] = 20;
- | ^^^^^^^^^ cannot borrow as mutable
- |
- = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Bar`
-
-error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-overloaded-index-ref-index.rs:52:23
- |
-LL | let rs = &mut s;
- | - mutable borrow occurs here
-LL | println!("{}", f[&s]);
- | ^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-overloaded-index-ref-index.rs:55:8
- |
-LL | let rs = &mut s;
- | - mutable borrow occurs here
-...
-LL | f[&s] = 10;
- | ^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr
deleted file mode 100644
index d09ce5d..0000000
--- a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-overloaded-index-ref-index.rs:52:22
- |
-LL | let rs = &mut s;
- | ------ mutable borrow occurs here
-LL | println!("{}", f[&s]);
- | ^^ immutable borrow occurs here
-...
-LL | drop(rs);
- | -- mutable borrow later used here
-
-error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-overloaded-index-ref-index.rs:55:7
- |
-LL | let rs = &mut s;
- | ------ mutable borrow occurs here
-...
-LL | f[&s] = 10;
- | ^^ immutable borrow occurs here
-...
-LL | drop(rs);
- | -- mutable borrow later used here
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/borrowck-overloaded-index-ref-index.rs:61:5
- |
-LL | s[2] = 20;
- | ^^^^^^^^^ cannot assign
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs
index 53cab52..cb20873 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
use std::ops::{Index, IndexMut};
struct Foo {
@@ -50,16 +47,13 @@
let mut s = "hello".to_string();
let rs = &mut s;
println!("{}", f[&s]);
- //[ast]~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
- //[mir]~^^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
+ //~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
f[&s] = 10;
- //[ast]~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
- //[mir]~^^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
+ //~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
let s = Bar {
x: 1,
};
s[2] = 20;
- //[ast]~^ ERROR cannot assign to immutable indexed content
- //[mir]~^^ ERROR cannot assign to data in a `&` reference
+ //~^ ERROR cannot assign to data in a `&` reference
drop(rs);
}
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.stderr
new file mode 100644
index 0000000..fcbfe72
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.stderr
@@ -0,0 +1,32 @@
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:49:22
+ |
+LL | let rs = &mut s;
+ | ------ mutable borrow occurs here
+LL | println!("{}", f[&s]);
+ | ^^ immutable borrow occurs here
+...
+LL | drop(rs);
+ | -- mutable borrow later used here
+
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:51:7
+ |
+LL | let rs = &mut s;
+ | ------ mutable borrow occurs here
+...
+LL | f[&s] = 10;
+ | ^^ immutable borrow occurs here
+...
+LL | drop(rs);
+ | -- mutable borrow later used here
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:56:5
+ |
+LL | s[2] = 20;
+ | ^^^^^^^^^ cannot assign
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr
deleted file mode 100644
index 65f2bd6..0000000
--- a/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0382]: assign of moved value: `t`
- --> $DIR/borrowck-partial-reinit-1.rs:27:5
- |
-LL | let mut t = Test2 { b: None };
- | ----- move occurs because `t` has type `Test2`, which does not implement the `Copy` trait
-LL | let u = Test;
-LL | drop(t);
- | - value moved here
-LL | t.b = Some(u);
- | ^^^ value assigned here after move
-
-error[E0382]: assign of moved value: `t`
- --> $DIR/borrowck-partial-reinit-1.rs:33:5
- |
-LL | let mut t = Test3(None);
- | ----- move occurs because `t` has type `Test3`, which does not implement the `Copy` trait
-LL | let u = Test;
-LL | drop(t);
- | - value moved here
-LL | t.0 = Some(u);
- | ^^^ value assigned here after move
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-1.rs b/src/test/ui/borrowck/borrowck-partial-reinit-1.rs
index f763759..4e69515 100644
--- a/src/test/ui/borrowck/borrowck-partial-reinit-1.rs
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-1.rs
@@ -25,13 +25,13 @@
let u = Test;
drop(t);
t.b = Some(u);
- //~^ ERROR partial reinitialization of uninitialized structure `t`
+ //~^ ERROR assign of moved value: `t`
let mut t = Test3(None);
let u = Test;
drop(t);
t.0 = Some(u);
- //~^ ERROR partial reinitialization of uninitialized structure `t`
+ //~^ ERROR assign of moved value: `t`
}
fn main() {
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr
index 23f5035..65f2bd6 100644
--- a/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr
@@ -1,15 +1,25 @@
-error[E0383]: partial reinitialization of uninitialized structure `t`
+error[E0382]: assign of moved value: `t`
--> $DIR/borrowck-partial-reinit-1.rs:27:5
|
+LL | let mut t = Test2 { b: None };
+ | ----- move occurs because `t` has type `Test2`, which does not implement the `Copy` trait
+LL | let u = Test;
+LL | drop(t);
+ | - value moved here
LL | t.b = Some(u);
- | ^^^^^^^^^^^^^
+ | ^^^ value assigned here after move
-error[E0383]: partial reinitialization of uninitialized structure `t`
+error[E0382]: assign of moved value: `t`
--> $DIR/borrowck-partial-reinit-1.rs:33:5
|
+LL | let mut t = Test3(None);
+ | ----- move occurs because `t` has type `Test3`, which does not implement the `Copy` trait
+LL | let u = Test;
+LL | drop(t);
+ | - value moved here
LL | t.0 = Some(u);
- | ^^^^^^^^^^^^^
+ | ^^^ value assigned here after move
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0383`.
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr
deleted file mode 100644
index 36a871f..0000000
--- a/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: assign of moved value: `t`
- --> $DIR/borrowck-partial-reinit-2.rs:15:5
- |
-LL | let mut t = Test { a: 1, b: None};
- | ----- move occurs because `t` has type `Test`, which does not implement the `Copy` trait
-LL | let mut u = Test { a: 2, b: Some(Box::new(t))};
- | - value moved here
-LL | t.b = Some(Box::new(u));
- | ^^^ value assigned here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-2.rs b/src/test/ui/borrowck/borrowck-partial-reinit-2.rs
index 986c20e..06cd322 100644
--- a/src/test/ui/borrowck/borrowck-partial-reinit-2.rs
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-2.rs
@@ -13,7 +13,7 @@
let mut t = Test { a: 1, b: None};
let mut u = Test { a: 2, b: Some(Box::new(t))};
t.b = Some(Box::new(u));
- //~^ ERROR partial reinitialization of uninitialized structure `t`
+ //~^ ERROR assign of moved value: `t`
println!("done");
}
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr
index 891f608..36a871f 100644
--- a/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr
@@ -1,9 +1,13 @@
-error[E0383]: partial reinitialization of uninitialized structure `t`
+error[E0382]: assign of moved value: `t`
--> $DIR/borrowck-partial-reinit-2.rs:15:5
|
+LL | let mut t = Test { a: 1, b: None};
+ | ----- move occurs because `t` has type `Test`, which does not implement the `Copy` trait
+LL | let mut u = Test { a: 2, b: Some(Box::new(t))};
+ | - value moved here
LL | t.b = Some(Box::new(u));
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^ value assigned here after move
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0383`.
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr
deleted file mode 100644
index 05f5411..0000000
--- a/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: assign of moved value: `x.0`
- --> $DIR/borrowck-partial-reinit-3.rs:11:5
- |
-LL | mem::drop(x.0);
- | --- value moved here
-LL | x.0.f = 3;
- | ^^^^^^^^^ value assigned here after move
- |
- = note: move occurs because `x.0` has type `Test`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-3.rs b/src/test/ui/borrowck/borrowck-partial-reinit-3.rs
index c7fbd7f..ca48431 100644
--- a/src/test/ui/borrowck/borrowck-partial-reinit-3.rs
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-3.rs
@@ -9,5 +9,5 @@
let mut x = (Test { f: 2 }, Test { f: 4 });
mem::drop(x.0);
x.0.f = 3;
- //~^ ERROR partial reinitialization of uninitialized structure `x.0`
+ //~^ ERROR assign of moved value: `x.0`
}
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr
index 2623174..05f5411 100644
--- a/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr
@@ -1,9 +1,13 @@
-error[E0383]: partial reinitialization of uninitialized structure `x.0`
+error[E0382]: assign of moved value: `x.0`
--> $DIR/borrowck-partial-reinit-3.rs:11:5
|
+LL | mem::drop(x.0);
+ | --- value moved here
LL | x.0.f = 3;
- | ^^^^^^^^^
+ | ^^^^^^^^^ value assigned here after move
+ |
+ = note: move occurs because `x.0` has type `Test`, which does not implement the `Copy` trait
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0383`.
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr
deleted file mode 100644
index f0a9a7d..0000000
--- a/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: assign of possibly uninitialized variable: `x.0`
- --> $DIR/borrowck-partial-reinit-4.rs:17:5
- |
-LL | (x.0).0 = Some(Test);
- | ^^^^^^^ use of possibly uninitialized `x.0`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-4.rs b/src/test/ui/borrowck/borrowck-partial-reinit-4.rs
index ffa6b11..0fb955d 100644
--- a/src/test/ui/borrowck/borrowck-partial-reinit-4.rs
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-4.rs
@@ -15,7 +15,7 @@
fn stuff() {
let mut x : (Test2, Test2);
(x.0).0 = Some(Test);
- //~^ ERROR partial reinitialization of uninitialized structure `x.0`
+ //~^ ERROR assign of possibly uninitialized variable: `x.0`
}
fn main() {
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr
index 8ca8e7e..f0a9a7d 100644
--- a/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr
@@ -1,9 +1,9 @@
-error[E0383]: partial reinitialization of uninitialized structure `x.0`
+error[E0381]: assign of possibly uninitialized variable: `x.0`
--> $DIR/borrowck-partial-reinit-4.rs:17:5
|
LL | (x.0).0 = Some(Test);
- | ^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^ use of possibly uninitialized `x.0`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0383`.
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr
deleted file mode 100644
index f0e1683..0000000
--- a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-pat-reassign-binding.rs:13:11
- |
-LL | Some(ref i) => {
- | ----- borrow of `x` occurs here
-LL | // But on this branch, `i` is an outstanding borrow
-LL | x = Some(*i+1);
- | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
-LL |
-LL | drop(i);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr
deleted file mode 100644
index d7bce40..0000000
--- a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-pat-reassign-binding.rs:13:11
- |
-LL | Some(ref i) => {
- | ----- borrow of `x` occurs here
-LL | // But on this branch, `i` is an outstanding borrow
-LL | x = Some(*i+1);
- | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr
deleted file mode 100644
index f0e1683..0000000
--- a/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-pat-reassign-binding.rs:13:11
- |
-LL | Some(ref i) => {
- | ----- borrow of `x` occurs here
-LL | // But on this branch, `i` is an outstanding borrow
-LL | x = Some(*i+1);
- | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
-LL |
-LL | drop(i);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.rs b/src/test/ui/borrowck/borrowck-pat-reassign-binding.rs
index 9befa91..f02c46f 100644
--- a/src/test/ui/borrowck/borrowck-pat-reassign-binding.rs
+++ b/src/test/ui/borrowck/borrowck-pat-reassign-binding.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn main() {
let mut x: Option<isize> = None;
match x {
@@ -10,8 +7,7 @@
}
Some(ref i) => {
// But on this branch, `i` is an outstanding borrow
- x = Some(*i+1); //[ast]~ ERROR cannot assign to `x`
- //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+ x = Some(*i+1); //~ ERROR cannot assign to `x` because it is borrowed
drop(i);
}
}
diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.stderr
new file mode 100644
index 0000000..9e65ccf
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-pat-reassign-binding.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-pat-reassign-binding.rs:10:11
+ |
+LL | Some(ref i) => {
+ | ----- borrow of `x` occurs here
+LL | // But on this branch, `i` is an outstanding borrow
+LL | x = Some(*i+1);
+ | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+LL | drop(i);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr
deleted file mode 100644
index 284cab2..0000000
--- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr
+++ /dev/null
@@ -1,116 +0,0 @@
-error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-reborrow-from-mut.rs:13:17
- |
-LL | let _bar1 = &mut foo.bar1;
- | ------------- first mutable borrow occurs here
-LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ second mutable borrow occurs here
-LL | use_mut(_bar1);
- | ----- first borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-reborrow-from-mut.rs:18:17
- |
-LL | let _bar1 = &mut foo.bar1;
- | ------------- mutable borrow occurs here
-LL | let _bar2 = &foo.bar1;
- | ^^^^^^^^^ immutable borrow occurs here
-LL | use_mut(_bar1);
- | ----- mutable borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-reborrow-from-mut.rs:23:17
- |
-LL | let _bar1 = &foo.bar1;
- | --------- immutable borrow occurs here
-LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ mutable borrow occurs here
-LL | use_imm(_bar1);
- | ----- immutable borrow later used here
-
-error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-reborrow-from-mut.rs:45:21
- |
-LL | let _bar1 = &mut foo.bar1;
- | ------------- first mutable borrow occurs here
-LL | match *foo {
-LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
- | ^^^^^^^^^^^^^ second mutable borrow occurs here
-...
-LL | use_mut(_bar1);
- | ----- first borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-reborrow-from-mut.rs:52:17
- |
-LL | let _bar1 = &mut foo.bar1.int1;
- | ------------------ mutable borrow occurs here
-LL | let _foo1 = &foo.bar1;
- | ^^^^^^^^^ immutable borrow occurs here
-LL | let _foo2 = &*foo;
-LL | use_mut(_bar1);
- | ----- mutable borrow later used here
-
-error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-reborrow-from-mut.rs:53:17
- |
-LL | let _bar1 = &mut foo.bar1.int1;
- | ------------------ mutable borrow occurs here
-LL | let _foo1 = &foo.bar1;
-LL | let _foo2 = &*foo;
- | ^^^^^ immutable borrow occurs here
-LL | use_mut(_bar1);
- | ----- mutable borrow later used here
-
-error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-reborrow-from-mut.rs:58:17
- |
-LL | let _bar1 = &mut foo.bar1.int1;
- | ------------------ first mutable borrow occurs here
-LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ second mutable borrow occurs here
-LL | use_mut(_bar1);
- | ----- first borrow later used here
-
-error[E0499]: cannot borrow `*foo` as mutable more than once at a time
- --> $DIR/borrowck-reborrow-from-mut.rs:63:17
- |
-LL | let _bar1 = &mut foo.bar1.int1;
- | ------------------ first mutable borrow occurs here
-LL | let _foo2 = &mut *foo;
- | ^^^^^^^^^ second mutable borrow occurs here
-LL | use_mut(_bar1);
- | ----- first borrow later used here
-
-error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-reborrow-from-mut.rs:68:17
- |
-LL | let _bar1 = &foo.bar1.int1;
- | -------------- immutable borrow occurs here
-LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ mutable borrow occurs here
-LL | use_imm(_bar1);
- | ----- immutable borrow later used here
-
-error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-reborrow-from-mut.rs:73:17
- |
-LL | let _bar1 = &foo.bar1.int1;
- | -------------- immutable borrow occurs here
-LL | let _foo2 = &mut *foo;
- | ^^^^^^^^^ mutable borrow occurs here
-LL | use_imm(_bar1);
- | ----- immutable borrow later used here
-
-error[E0596]: cannot borrow `foo.bar1` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-reborrow-from-mut.rs:88:17
- |
-LL | fn borrow_mut_from_imm(foo: &Foo) {
- | ---- help: consider changing this to be a mutable reference: `&mut Foo`
-LL | let _bar1 = &mut foo.bar1;
- | ^^^^^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to 11 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0596.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr
index bcb2394..284cab2 100644
--- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr
+++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr
@@ -1,122 +1,114 @@
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-reborrow-from-mut.rs:13:22
+ --> $DIR/borrowck-reborrow-from-mut.rs:13:17
|
LL | let _bar1 = &mut foo.bar1;
- | -------- first mutable borrow occurs here
+ | ------------- first mutable borrow occurs here
LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^ second mutable borrow occurs here
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
LL | use_mut(_bar1);
-LL | }
- | - first borrow ends here
+ | ----- first borrow later used here
error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-reborrow-from-mut.rs:18:18
+ --> $DIR/borrowck-reborrow-from-mut.rs:18:17
|
LL | let _bar1 = &mut foo.bar1;
- | -------- mutable borrow occurs here
+ | ------------- mutable borrow occurs here
LL | let _bar2 = &foo.bar1;
- | ^^^^^^^^ immutable borrow occurs here
+ | ^^^^^^^^^ immutable borrow occurs here
LL | use_mut(_bar1);
-LL | }
- | - mutable borrow ends here
+ | ----- mutable borrow later used here
error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-reborrow-from-mut.rs:23:22
+ --> $DIR/borrowck-reborrow-from-mut.rs:23:17
|
LL | let _bar1 = &foo.bar1;
- | -------- immutable borrow occurs here
+ | --------- immutable borrow occurs here
LL | let _bar2 = &mut foo.bar1;
- | ^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
LL | use_imm(_bar1);
-LL | }
- | - immutable borrow ends here
+ | ----- immutable borrow later used here
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
--> $DIR/borrowck-reborrow-from-mut.rs:45:21
|
LL | let _bar1 = &mut foo.bar1;
- | -------- first mutable borrow occurs here
+ | ------------- first mutable borrow occurs here
LL | match *foo {
LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
| ^^^^^^^^^^^^^ second mutable borrow occurs here
...
-LL | }
- | - first borrow ends here
+LL | use_mut(_bar1);
+ | ----- first borrow later used here
-error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
- --> $DIR/borrowck-reborrow-from-mut.rs:52:18
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:52:17
|
LL | let _bar1 = &mut foo.bar1.int1;
- | ------------- mutable borrow occurs here
+ | ------------------ mutable borrow occurs here
LL | let _foo1 = &foo.bar1;
- | ^^^^^^^^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
+ | ^^^^^^^^^ immutable borrow occurs here
+LL | let _foo2 = &*foo;
+LL | use_mut(_bar1);
+ | ----- mutable borrow later used here
-error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
- --> $DIR/borrowck-reborrow-from-mut.rs:53:18
+error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:53:17
|
LL | let _bar1 = &mut foo.bar1.int1;
- | ------------- mutable borrow occurs here
+ | ------------------ mutable borrow occurs here
LL | let _foo1 = &foo.bar1;
LL | let _foo2 = &*foo;
- | ^^^^ immutable borrow occurs here
+ | ^^^^^ immutable borrow occurs here
LL | use_mut(_bar1);
-LL | }
- | - mutable borrow ends here
+ | ----- mutable borrow later used here
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
- --> $DIR/borrowck-reborrow-from-mut.rs:58:22
+ --> $DIR/borrowck-reborrow-from-mut.rs:58:17
|
LL | let _bar1 = &mut foo.bar1.int1;
- | ------------- first mutable borrow occurs here
+ | ------------------ first mutable borrow occurs here
LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^ second mutable borrow occurs here
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
LL | use_mut(_bar1);
-LL | }
- | - first borrow ends here
+ | ----- first borrow later used here
error[E0499]: cannot borrow `*foo` as mutable more than once at a time
- --> $DIR/borrowck-reborrow-from-mut.rs:63:22
+ --> $DIR/borrowck-reborrow-from-mut.rs:63:17
|
LL | let _bar1 = &mut foo.bar1.int1;
- | ------------- first mutable borrow occurs here
+ | ------------------ first mutable borrow occurs here
LL | let _foo2 = &mut *foo;
- | ^^^^ second mutable borrow occurs here
+ | ^^^^^^^^^ second mutable borrow occurs here
LL | use_mut(_bar1);
-LL | }
- | - first borrow ends here
+ | ----- first borrow later used here
-error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
- --> $DIR/borrowck-reborrow-from-mut.rs:68:22
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:68:17
|
LL | let _bar1 = &foo.bar1.int1;
- | ------------- immutable borrow occurs here
+ | -------------- immutable borrow occurs here
LL | let _foo1 = &mut foo.bar1;
- | ^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
LL | use_imm(_bar1);
-LL | }
- | - immutable borrow ends here
+ | ----- immutable borrow later used here
-error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
- --> $DIR/borrowck-reborrow-from-mut.rs:73:22
+error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:73:17
|
LL | let _bar1 = &foo.bar1.int1;
- | ------------- immutable borrow occurs here
+ | -------------- immutable borrow occurs here
LL | let _foo2 = &mut *foo;
- | ^^^^ mutable borrow occurs here
+ | ^^^^^^^^^ mutable borrow occurs here
LL | use_imm(_bar1);
-LL | }
- | - immutable borrow ends here
+ | ----- immutable borrow later used here
-error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
- --> $DIR/borrowck-reborrow-from-mut.rs:88:22
+error[E0596]: cannot borrow `foo.bar1` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-reborrow-from-mut.rs:88:17
|
LL | fn borrow_mut_from_imm(foo: &Foo) {
- | ---- use `&mut Foo` here to make mutable
+ | ---- help: consider changing this to be a mutable reference: `&mut Foo`
LL | let _bar1 = &mut foo.bar1;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to 11 previous errors
diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr
deleted file mode 100644
index e744fc6..0000000
--- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
- --> $DIR/borrowck-ref-mut-of-imm.rs:4:12
- |
-LL | fn destructure(x: Option<isize>) -> isize {
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | Some(ref mut v) => *v
- | ^^^^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr
index 6e0d2f6..e744fc6 100644
--- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr
+++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr
@@ -1,11 +1,11 @@
-error[E0596]: cannot borrow field `(x as std::prelude::v1::Some).0` of immutable binding as mutable
+error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
--> $DIR/borrowck-ref-mut-of-imm.rs:4:12
|
LL | fn destructure(x: Option<isize>) -> isize {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
...
LL | Some(ref mut v) => *v
- | ^^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr
deleted file mode 100644
index db73d4c..0000000
--- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr
+++ /dev/null
@@ -1,40 +0,0 @@
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-report-with-custom-diagnostic.rs:8:13
- |
-LL | let y = &mut x;
- | ------ mutable borrow occurs here
-LL |
-LL | let z = &x;
- | ^^ immutable borrow occurs here
-...
-LL | y.use_mut();
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21
- |
-LL | let y = &x;
- | -- immutable borrow occurs here
-LL |
-LL | let z = &mut x;
- | ^^^^^^ mutable borrow occurs here
-...
-LL | y.use_ref();
- | - immutable borrow later used here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17
- |
-LL | let y = &mut x;
- | ------ first mutable borrow occurs here
-LL |
-LL | let z = &mut x;
- | ^^^^^^ second mutable borrow occurs here
-...
-LL | y.use_mut();
- | - first borrow later used here
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0499, E0502.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
index a3e6682..db73d4c 100644
--- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
+++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
@@ -1,38 +1,38 @@
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-report-with-custom-diagnostic.rs:8:14
+ --> $DIR/borrowck-report-with-custom-diagnostic.rs:8:13
|
LL | let y = &mut x;
- | - mutable borrow occurs here
+ | ------ mutable borrow occurs here
LL |
LL | let z = &x;
- | ^ immutable borrow occurs here
+ | ^^ immutable borrow occurs here
...
-LL | }
- | - mutable borrow ends here
+LL | y.use_mut();
+ | - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-report-with-custom-diagnostic.rs:21:26
+ --> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21
|
LL | let y = &x;
- | - immutable borrow occurs here
+ | -- immutable borrow occurs here
LL |
LL | let z = &mut x;
- | ^ mutable borrow occurs here
+ | ^^^^^^ mutable borrow occurs here
...
-LL | }
- | - immutable borrow ends here
+LL | y.use_ref();
+ | - immutable borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/borrowck-report-with-custom-diagnostic.rs:36:22
+ --> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17
|
LL | let y = &mut x;
- | - first mutable borrow occurs here
+ | ------ first mutable borrow occurs here
LL |
LL | let z = &mut x;
- | ^ second mutable borrow occurs here
+ | ^^^^^^ second mutable borrow occurs here
...
-LL | };
- | - first borrow ends here
+LL | y.use_mut();
+ | - first borrow later used here
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr
deleted file mode 100644
index d54449a..0000000
--- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return value referencing function parameter `x`
- --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:5
- |
-LL | (&x).clone()
- | ----^^^^^^^^
- | |
- | returns a value referencing data owned by the current function
- | `x` is borrowed here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs
index f8cdc3e..75e5e7f 100644
--- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs
+++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs
@@ -4,7 +4,7 @@
// Issue #19261.
fn leak<'a, T>(x: T) -> &'a T {
- (&x).clone() //~ ERROR `x` does not live long enough
+ (&x).clone() //~ ERROR cannot return value referencing function parameter `x`
}
fn main() { }
diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr
index 4d4244b..d54449a 100644
--- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr
+++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr
@@ -1,17 +1,12 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:7
+error[E0515]: cannot return value referencing function parameter `x`
+ --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:5
|
LL | (&x).clone()
- | ^ borrowed value does not live long enough
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 6:9...
- --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:6:9
- |
-LL | fn leak<'a, T>(x: T) -> &'a T {
- | ^^
+ | ----^^^^^^^^
+ | |
+ | returns a value referencing data owned by the current function
+ | `x` is borrowed here
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr
deleted file mode 100644
index dbc9ece..0000000
--- a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-struct-update-with-dtor.rs:15:15
- |
-LL | let _s2 = S{a: 2, ..s0};
- | ^^^^^^^^^^^^^ cannot move out of here
-
-error[E0509]: cannot move out of type `T`, which implements the `Drop` trait
- --> $DIR/borrowck-struct-update-with-dtor.rs:21:15
- |
-LL | let _s2 = T{a: 2, ..s0};
- | ^^^^^^^^^^^^^ cannot move out of here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr
deleted file mode 100644
index bc0a954..0000000
--- a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-struct-update-with-dtor.rs:15:25
- |
-LL | let _s2 = S{a: 2, ..s0};
- | ^^ cannot move out of here
-
-error[E0509]: cannot move out of type `T`, which implements the `Drop` trait
- --> $DIR/borrowck-struct-update-with-dtor.rs:21:25
- |
-LL | let _s2 = T{a: 2, ..s0};
- | ^^ cannot move out of here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr
deleted file mode 100644
index dbc9ece..0000000
--- a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
- --> $DIR/borrowck-struct-update-with-dtor.rs:15:15
- |
-LL | let _s2 = S{a: 2, ..s0};
- | ^^^^^^^^^^^^^ cannot move out of here
-
-error[E0509]: cannot move out of type `T`, which implements the `Drop` trait
- --> $DIR/borrowck-struct-update-with-dtor.rs:21:15
- |
-LL | let _s2 = T{a: 2, ..s0};
- | ^^^^^^^^^^^^^ cannot move out of here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs
index da5bb63..1f6ed6d 100644
--- a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs
+++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
// Issue 4691: Ensure that functional-struct-update can only copy, not
// move, when the struct implements Drop.
@@ -13,14 +10,12 @@
fn f(s0:S) {
let _s2 = S{a: 2, ..s0};
- //[ast]~^ error: cannot move out of type `S`, which implements the `Drop` trait
- //[mir]~^^ ERROR [E0509]
+ //~^ ERROR [E0509]
}
fn g(s0:T) {
let _s2 = T{a: 2, ..s0};
- //[ast]~^ error: cannot move out of type `T`, which implements the `Drop` trait
- //[mir]~^^ ERROR [E0509]
+ //~^ ERROR [E0509]
}
fn main() { }
diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.stderr
new file mode 100644
index 0000000..ea16502
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.stderr
@@ -0,0 +1,15 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-struct-update-with-dtor.rs:12:15
+ |
+LL | let _s2 = S{a: 2, ..s0};
+ | ^^^^^^^^^^^^^ cannot move out of here
+
+error[E0509]: cannot move out of type `T`, which implements the `Drop` trait
+ --> $DIR/borrowck-struct-update-with-dtor.rs:17:15
+ |
+LL | let _s2 = T{a: 2, ..s0};
+ | ^^^^^^^^^^^^^ cannot move out of here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr
deleted file mode 100644
index 1c55953..0000000
--- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-swap-mut-base-ptr.rs:13:10
- |
-LL | let p: &isize = &*t0; // Freezes `*t0`
- | ---- immutable borrow occurs here
-LL | swap(&mut t0, &mut t1);
- | ^^^^^^^ mutable borrow occurs here
-LL | *t1 = 22;
-LL | p.use_ref();
- | - immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
index 9efd249..1c55953 100644
--- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
+++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
@@ -1,13 +1,13 @@
-error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable
- --> $DIR/borrowck-swap-mut-base-ptr.rs:13:15
+error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-swap-mut-base-ptr.rs:13:10
|
LL | let p: &isize = &*t0; // Freezes `*t0`
- | --- immutable borrow occurs here
+ | ---- immutable borrow occurs here
LL | swap(&mut t0, &mut t1);
- | ^^ mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
+ | ^^^^^^^ mutable borrow occurs here
+LL | *t1 = 22;
+LL | p.use_ref();
+ | - immutable borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr
deleted file mode 100644
index d2b6e06..0000000
--- a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0712]: thread-local variable borrowed past end of function
- --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:11:20
- |
-LL | assert_static(&FOO);
- | ^^^^ thread-local variables cannot be borrowed beyond the end of the function
-LL |
-LL | }
- | - end of enclosing function is here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr
deleted file mode 100644
index ce7b5e6..0000000
--- a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:11:21
- |
-LL | assert_static(&FOO);
- | ^^^ - borrowed value only lives until here
- | |
- | borrowed value does not live long enough
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr
deleted file mode 100644
index d2b6e06..0000000
--- a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0712]: thread-local variable borrowed past end of function
- --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:11:20
- |
-LL | assert_static(&FOO);
- | ^^^^ thread-local variables cannot be borrowed beyond the end of the function
-LL |
-LL | }
- | - end of enclosing function is here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs
index 6fd6acc..1cf8d18 100644
--- a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs
+++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(thread_local)]
#[thread_local]
@@ -8,6 +5,5 @@
fn assert_static(_t: &'static u8) {}
fn main() {
- assert_static(&FOO); //[ast]~ ERROR [E0597]
- //[mir]~^ ERROR [E0712]
+ assert_static(&FOO); //~ ERROR [E0712]
}
diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr
new file mode 100644
index 0000000..26453b4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr
@@ -0,0 +1,11 @@
+error[E0712]: thread-local variable borrowed past end of function
+ --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:8:20
+ |
+LL | assert_static(&FOO);
+ | ^^^^ thread-local variables cannot be borrowed beyond the end of the function
+LL | }
+ | - end of enclosing function is here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr b/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr
deleted file mode 100644
index c29ff53..0000000
--- a/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrowck-unary-move.rs:7:10
- |
-LL | let y = &*x;
- | --- borrow of `*x` occurs here
-LL | free(x);
- | ^ move out of `x` occurs here
-LL |
-LL | *y
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-unary-move.ast.stderr b/src/test/ui/borrowck/borrowck-unary-move.ast.stderr
deleted file mode 100644
index e05b110..0000000
--- a/src/test/ui/borrowck/borrowck-unary-move.ast.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrowck-unary-move.rs:7:10
- |
-LL | let y = &*x;
- | -- borrow of `*x` occurs here
-LL | free(x);
- | ^ move out of `x` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-unary-move.mir.stderr b/src/test/ui/borrowck/borrowck-unary-move.mir.stderr
deleted file mode 100644
index c29ff53..0000000
--- a/src/test/ui/borrowck/borrowck-unary-move.mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/borrowck-unary-move.rs:7:10
- |
-LL | let y = &*x;
- | --- borrow of `*x` occurs here
-LL | free(x);
- | ^ move out of `x` occurs here
-LL |
-LL | *y
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-unary-move.rs b/src/test/ui/borrowck/borrowck-unary-move.rs
index 4e023ac..3b4c073 100644
--- a/src/test/ui/borrowck/borrowck-unary-move.rs
+++ b/src/test/ui/borrowck/borrowck-unary-move.rs
@@ -1,11 +1,6 @@
-// ignore-tidy-linelength
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn foo(x: Box<isize>) -> isize {
let y = &*x;
- free(x); //[ast]~ ERROR cannot move out of `x` because it is borrowed
- //[mir]~^ ERROR cannot move out of `x` because it is borrowed
+ free(x); //~ ERROR cannot move out of `x` because it is borrowed
*y
}
diff --git a/src/test/ui/borrowck/borrowck-unary-move.stderr b/src/test/ui/borrowck/borrowck-unary-move.stderr
new file mode 100644
index 0000000..aab225e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-unary-move.stderr
@@ -0,0 +1,13 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-unary-move.rs:3:10
+ |
+LL | let y = &*x;
+ | --- borrow of `*x` occurs here
+LL | free(x);
+ | ^ move out of `x` occurs here
+LL | *y
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr
deleted file mode 100644
index 40b8e31..0000000
--- a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-unboxed-closures.rs:3:5
- |
-LL | let g = &mut f;
- | ------ mutable borrow occurs here
-LL | f(1, 2);
- | ^ immutable borrow occurs here
-LL | use_mut(g);
- | - mutable borrow later used here
-
-error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-unboxed-closures.rs:7:5
- |
-LL | fn b<F:FnMut(isize, isize) -> isize>(f: F) {
- | - help: consider changing this to be mutable: `mut f`
-LL | f(1, 2);
- | ^ cannot borrow as mutable
-
-error[E0382]: use of moved value: `f`
- --> $DIR/borrowck-unboxed-closures.rs:12:5
- |
-LL | fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
- | - - move occurs because `f` has type `F`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | f(1, 2);
- | - value moved here
-LL | f(1, 2);
- | ^ value used here after move
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0382, E0502, E0596.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.rs b/src/test/ui/borrowck/borrowck-unboxed-closures.rs
index bfd0fbb..f0048dd 100644
--- a/src/test/ui/borrowck/borrowck-unboxed-closures.rs
+++ b/src/test/ui/borrowck/borrowck-unboxed-closures.rs
@@ -4,7 +4,7 @@
use_mut(g);
}
fn b<F:FnMut(isize, isize) -> isize>(f: F) {
- f(1, 2); //~ ERROR cannot borrow immutable argument
+ f(1, 2); //~ ERROR cannot borrow `f` as mutable, as it is not declared as mutable
}
fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
index 0be9e5a..40b8e31 100644
--- a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
+++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
@@ -2,30 +2,31 @@
--> $DIR/borrowck-unboxed-closures.rs:3:5
|
LL | let g = &mut f;
- | - mutable borrow occurs here
+ | ------ mutable borrow occurs here
LL | f(1, 2);
| ^ immutable borrow occurs here
LL | use_mut(g);
-LL | }
- | - mutable borrow ends here
+ | - mutable borrow later used here
-error[E0596]: cannot borrow immutable argument `f` as mutable
+error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
--> $DIR/borrowck-unboxed-closures.rs:7:5
|
LL | fn b<F:FnMut(isize, isize) -> isize>(f: F) {
- | - help: make this binding mutable: `mut f`
+ | - help: consider changing this to be mutable: `mut f`
LL | f(1, 2);
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
error[E0382]: use of moved value: `f`
--> $DIR/borrowck-unboxed-closures.rs:12:5
|
+LL | fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
+ | - - move occurs because `f` has type `F`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | f(1, 2);
| - value moved here
LL | f(1, 2);
| ^ value used here after move
- |
- = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr
deleted file mode 100644
index da4d016..0000000
--- a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-field-access.rs:24:13
- |
-LL | let _ = a.x + 1;
- | ^^^ use of possibly uninitialized `a.x`
-
-error[E0382]: use of moved value: `line1.origin`
- --> $DIR/borrowck-uninit-field-access.rs:29:13
- |
-LL | let _moved = line1.origin;
- | ------------ value moved here
-LL | let _ = line1.origin.x + 1;
- | ^^^^^^^^^^^^^^ value used here after move
- |
- = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `line2`
- --> $DIR/borrowck-uninit-field-access.rs:34:5
- |
-LL | let _moved = (line2.origin, line2.middle);
- | ------------ value moved here
-LL | line2.consume();
- | ^^^^^ value used here after partial move
- |
- = note: move occurs because `line2.middle` has type `Point`, which does not implement the `Copy` trait
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0381, E0382.
-For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr
deleted file mode 100644
index 00cacfe..0000000
--- a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `a.x`
- --> $DIR/borrowck-uninit-field-access.rs:24:13
- |
-LL | let _ = a.x + 1;
- | ^^^ use of possibly uninitialized `a.x`
-
-error[E0382]: use of moved value: `line1.origin.x`
- --> $DIR/borrowck-uninit-field-access.rs:29:13
- |
-LL | let _moved = line1.origin;
- | ------ value moved here
-LL | let _ = line1.origin.x + 1;
- | ^^^^^^^^^^^^^^ value used here after move
- |
- = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait
-
-error[E0382]: use of partially moved value: `line2`
- --> $DIR/borrowck-uninit-field-access.rs:34:5
- |
-LL | let _moved = (line2.origin, line2.middle);
- | ------------ value moved here
-LL | line2.consume();
- | ^^^^^ value used here after move
- |
- = note: move occurs because `line2.origin` has type `Point`, which does not implement the `Copy` trait
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0381, E0382.
-For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr
deleted file mode 100644
index da4d016..0000000
--- a/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-field-access.rs:24:13
- |
-LL | let _ = a.x + 1;
- | ^^^ use of possibly uninitialized `a.x`
-
-error[E0382]: use of moved value: `line1.origin`
- --> $DIR/borrowck-uninit-field-access.rs:29:13
- |
-LL | let _moved = line1.origin;
- | ------------ value moved here
-LL | let _ = line1.origin.x + 1;
- | ^^^^^^^^^^^^^^ value used here after move
- |
- = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `line2`
- --> $DIR/borrowck-uninit-field-access.rs:34:5
- |
-LL | let _moved = (line2.origin, line2.middle);
- | ------------ value moved here
-LL | line2.consume();
- | ^^^^^ value used here after partial move
- |
- = note: move occurs because `line2.middle` has type `Point`, which does not implement the `Copy` trait
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0381, E0382.
-For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.rs b/src/test/ui/borrowck/borrowck-uninit-field-access.rs
index ab19b2d..bc931ee 100644
--- a/src/test/ui/borrowck/borrowck-uninit-field-access.rs
+++ b/src/test/ui/borrowck/borrowck-uninit-field-access.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
// Check that do not allow access to fields of uninitialized or moved
// structs.
@@ -21,16 +18,13 @@
fn main() {
let mut a: Point;
- let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x`
- //[mir]~^ ERROR [E0381]
+ let _ = a.x + 1; //~ ERROR [E0381]
let mut line1 = Line::default();
let _moved = line1.origin;
- let _ = line1.origin.x + 1; //[ast]~ ERROR use of moved value: `line1.origin.x`
- //[mir]~^ [E0382]
+ let _ = line1.origin.x + 1; //~ ERROR [E0382]
let mut line2 = Line::default();
let _moved = (line2.origin, line2.middle);
- line2.consume(); //[ast]~ ERROR use of partially moved value: `line2` [E0382]
- //[mir]~^ [E0382]
+ line2.consume(); //~ ERROR [E0382]
}
diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.stderr
new file mode 100644
index 0000000..aa214f9
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-field-access.stderr
@@ -0,0 +1,30 @@
+error[E0381]: use of possibly uninitialized variable: `a`
+ --> $DIR/borrowck-uninit-field-access.rs:21:13
+ |
+LL | let _ = a.x + 1;
+ | ^^^ use of possibly uninitialized `a.x`
+
+error[E0382]: use of moved value: `line1.origin`
+ --> $DIR/borrowck-uninit-field-access.rs:25:13
+ |
+LL | let _moved = line1.origin;
+ | ------------ value moved here
+LL | let _ = line1.origin.x + 1;
+ | ^^^^^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `line2`
+ --> $DIR/borrowck-uninit-field-access.rs:29:5
+ |
+LL | let _moved = (line2.origin, line2.middle);
+ | ------------ value moved here
+LL | line2.consume();
+ | ^^^^^ value used here after partial move
+ |
+ = note: move occurs because `line2.middle` has type `Point`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0381, E0382.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr
deleted file mode 100644
index a5cf59c..0000000
--- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr
+++ /dev/null
@@ -1,45 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-uninit-ref-chain.rs:11:14
- |
-LL | let _y = &**x;
- | ^^^^ use of possibly uninitialized `**x`
-
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-uninit-ref-chain.rs:15:14
- |
-LL | let _y = &**x;
- | ^^^^ use of possibly uninitialized `**x`
-
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-uninit-ref-chain.rs:19:14
- |
-LL | let _y = &**x;
- | ^^^^ use of possibly uninitialized `**x`
-
-error[E0381]: assign to part of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-ref-chain.rs:24:5
- |
-LL | a.x = 0;
- | ^^^^^^^ use of possibly uninitialized `a`
-
-error[E0381]: assign to part of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-ref-chain.rs:29:5
- |
-LL | a.x = &&0;
- | ^^^^^^^^^ use of possibly uninitialized `a`
-
-error[E0381]: assign to part of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-ref-chain.rs:35:5
- |
-LL | a.x = 0;
- | ^^^^^^^ use of possibly uninitialized `a`
-
-error[E0381]: assign to part of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-ref-chain.rs:40:5
- |
-LL | a.x = &&0;
- | ^^^^^^^^^ use of possibly uninitialized `a`
-
-error: aborting due to 7 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr
deleted file mode 100644
index 8cb3f3b..0000000
--- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr
+++ /dev/null
@@ -1,45 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `**x`
- --> $DIR/borrowck-uninit-ref-chain.rs:11:15
- |
-LL | let _y = &**x;
- | ^^^ use of possibly uninitialized `**x`
-
-error[E0381]: use of possibly uninitialized variable: `**x`
- --> $DIR/borrowck-uninit-ref-chain.rs:15:15
- |
-LL | let _y = &**x;
- | ^^^ use of possibly uninitialized `**x`
-
-error[E0381]: use of possibly uninitialized variable: `**x`
- --> $DIR/borrowck-uninit-ref-chain.rs:19:15
- |
-LL | let _y = &**x;
- | ^^^ use of possibly uninitialized `**x`
-
-error[E0381]: use of possibly uninitialized variable: `a.x`
- --> $DIR/borrowck-uninit-ref-chain.rs:25:15
- |
-LL | let _b = &a.x;
- | ^^^ use of possibly uninitialized `a.x`
-
-error[E0381]: use of possibly uninitialized variable: `**a.x`
- --> $DIR/borrowck-uninit-ref-chain.rs:30:15
- |
-LL | let _b = &**a.x;
- | ^^^^^ use of possibly uninitialized `**a.x`
-
-error[E0381]: use of possibly uninitialized variable: `a.y`
- --> $DIR/borrowck-uninit-ref-chain.rs:36:15
- |
-LL | let _b = &a.y;
- | ^^^ use of possibly uninitialized `a.y`
-
-error[E0381]: use of possibly uninitialized variable: `**a.y`
- --> $DIR/borrowck-uninit-ref-chain.rs:41:15
- |
-LL | let _b = &**a.y;
- | ^^^^^ use of possibly uninitialized `**a.y`
-
-error: aborting due to 7 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr
deleted file mode 100644
index a5cf59c..0000000
--- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr
+++ /dev/null
@@ -1,45 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-uninit-ref-chain.rs:11:14
- |
-LL | let _y = &**x;
- | ^^^^ use of possibly uninitialized `**x`
-
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-uninit-ref-chain.rs:15:14
- |
-LL | let _y = &**x;
- | ^^^^ use of possibly uninitialized `**x`
-
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-uninit-ref-chain.rs:19:14
- |
-LL | let _y = &**x;
- | ^^^^ use of possibly uninitialized `**x`
-
-error[E0381]: assign to part of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-ref-chain.rs:24:5
- |
-LL | a.x = 0;
- | ^^^^^^^ use of possibly uninitialized `a`
-
-error[E0381]: assign to part of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-ref-chain.rs:29:5
- |
-LL | a.x = &&0;
- | ^^^^^^^^^ use of possibly uninitialized `a`
-
-error[E0381]: assign to part of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-ref-chain.rs:35:5
- |
-LL | a.x = 0;
- | ^^^^^^^ use of possibly uninitialized `a`
-
-error[E0381]: assign to part of possibly uninitialized variable: `a`
- --> $DIR/borrowck-uninit-ref-chain.rs:40:5
- |
-LL | a.x = &&0;
- | ^^^^^^^^^ use of possibly uninitialized `a`
-
-error: aborting due to 7 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.rs b/src/test/ui/borrowck/borrowck-uninit-ref-chain.rs
index 562012a..fa9148f 100644
--- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.rs
+++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
struct S<X, Y> {
x: X,
y: Y,
@@ -8,36 +5,29 @@
fn main() {
let x: &&Box<i32>;
- let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
- //[mir]~^ [E0381]
+ let _y = &**x; //~ [E0381]
let x: &&S<i32, i32>;
- let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
- //[mir]~^ [E0381]
+ let _y = &**x; //~ [E0381]
let x: &&i32;
- let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
- //[mir]~^ [E0381]
+ let _y = &**x; //~ [E0381]
let mut a: S<i32, i32>;
- a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
- let _b = &a.x; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` [E0381]
-
+ a.x = 0; //~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
+ let _b = &a.x;
let mut a: S<&&i32, &&i32>;
- a.x = &&0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
- let _b = &**a.x; //[ast]~ ERROR use of possibly uninitialized variable: `**a.x` [E0381]
-
+ a.x = &&0; //~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
+ let _b = &**a.x;
let mut a: S<i32, i32>;
- a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
- let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381]
-
+ a.x = 0; //~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
+ let _b = &a.y;
let mut a: S<&&i32, &&i32>;
- a.x = &&0; //[mir]~ assign to part of possibly uninitialized variable: `a` [E0381]
- let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381]
-
+ a.x = &&0; //~ assign to part of possibly uninitialized variable: `a` [E0381]
+ let _b = &**a.y;
}
diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr
new file mode 100644
index 0000000..d87621f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr
@@ -0,0 +1,45 @@
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:8:14
+ |
+LL | let _y = &**x;
+ | ^^^^ use of possibly uninitialized `**x`
+
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:11:14
+ |
+LL | let _y = &**x;
+ | ^^^^ use of possibly uninitialized `**x`
+
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:14:14
+ |
+LL | let _y = &**x;
+ | ^^^^ use of possibly uninitialized `**x`
+
+error[E0381]: assign to part of possibly uninitialized variable: `a`
+ --> $DIR/borrowck-uninit-ref-chain.rs:18:5
+ |
+LL | a.x = 0;
+ | ^^^^^^^ use of possibly uninitialized `a`
+
+error[E0381]: assign to part of possibly uninitialized variable: `a`
+ --> $DIR/borrowck-uninit-ref-chain.rs:22:5
+ |
+LL | a.x = &&0;
+ | ^^^^^^^^^ use of possibly uninitialized `a`
+
+error[E0381]: assign to part of possibly uninitialized variable: `a`
+ --> $DIR/borrowck-uninit-ref-chain.rs:27:5
+ |
+LL | a.x = 0;
+ | ^^^^^^^ use of possibly uninitialized `a`
+
+error[E0381]: assign to part of possibly uninitialized variable: `a`
+ --> $DIR/borrowck-uninit-ref-chain.rs:31:5
+ |
+LL | a.x = &&0;
+ | ^^^^^^^^^ use of possibly uninitialized `a`
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr
deleted file mode 100644
index 61569b9..0000000
--- a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0503]: cannot use `u.c` because it was mutably borrowed
- --> $DIR/borrowck-union-borrow-nested.rs:24:21
- |
-LL | let ra = &mut u.s.a;
- | ---------- borrow of `u.s.a` occurs here
-LL | let b = u.c;
- | ^^^ use of borrowed `u.s.a`
-LL | ra.use_mut();
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr
index 71fae6f..61569b9 100644
--- a/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr
+++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr
@@ -1,10 +1,12 @@
error[E0503]: cannot use `u.c` because it was mutably borrowed
- --> $DIR/borrowck-union-borrow-nested.rs:24:17
+ --> $DIR/borrowck-union-borrow-nested.rs:24:21
|
LL | let ra = &mut u.s.a;
- | ----- borrow of `u.s.a` occurs here
+ | ---------- borrow of `u.s.a` occurs here
LL | let b = u.c;
- | ^ use of borrowed `u.s.a`
+ | ^^^ use of borrowed `u.s.a`
+LL | ra.use_mut();
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr
deleted file mode 100644
index ca10e29..0000000
--- a/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr
+++ /dev/null
@@ -1,131 +0,0 @@
-error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-union-borrow.rs:25:23
- |
-LL | let ra = &u.a;
- | ---- immutable borrow occurs here
-LL | let rma = &mut u.a;
- | ^^^^^^^^ mutable borrow occurs here
-LL | drop(ra);
- | -- immutable borrow later used here
-
-error[E0506]: cannot assign to `u.a` because it is borrowed
- --> $DIR/borrowck-union-borrow.rs:30:13
- |
-LL | let ra = &u.a;
- | ---- borrow of `u.a` occurs here
-LL | u.a = 1;
- | ^^^^^^^ assignment to borrowed `u.a` occurs here
-LL | drop(ra);
- | -- borrow later used here
-
-error[E0502]: cannot borrow `u` (via `u.b`) as mutable because it is also borrowed as immutable (via `u.a`)
- --> $DIR/borrowck-union-borrow.rs:46:23
- |
-LL | let ra = &u.a;
- | ---- immutable borrow occurs here (via `u.a`)
-LL | let rmb = &mut u.b;
- | ^^^^^^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here
-LL | drop(ra);
- | -- immutable borrow later used here
- |
- = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a`
-
-error[E0506]: cannot assign to `u.b` because it is borrowed
- --> $DIR/borrowck-union-borrow.rs:51:13
- |
-LL | let ra = &u.a;
- | ---- borrow of `u.b` occurs here
-LL | u.b = 1;
- | ^^^^^^^ assignment to borrowed `u.b` occurs here
-LL | drop(ra);
- | -- borrow later used here
-
-error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-union-borrow.rs:57:22
- |
-LL | let rma = &mut u.a;
- | -------- mutable borrow occurs here
-LL | let ra = &u.a;
- | ^^^^ immutable borrow occurs here
-LL | drop(rma);
- | --- mutable borrow later used here
-
-error[E0503]: cannot use `u.a` because it was mutably borrowed
- --> $DIR/borrowck-union-borrow.rs:62:21
- |
-LL | let ra = &mut u.a;
- | -------- borrow of `u.a` occurs here
-LL | let a = u.a;
- | ^^^ use of borrowed `u.a`
-LL | drop(ra);
- | -- borrow later used here
-
-error[E0499]: cannot borrow `u.a` as mutable more than once at a time
- --> $DIR/borrowck-union-borrow.rs:67:24
- |
-LL | let rma = &mut u.a;
- | -------- first mutable borrow occurs here
-LL | let rma2 = &mut u.a;
- | ^^^^^^^^ second mutable borrow occurs here
-LL | drop(rma);
- | --- first borrow later used here
-
-error[E0506]: cannot assign to `u.a` because it is borrowed
- --> $DIR/borrowck-union-borrow.rs:72:13
- |
-LL | let rma = &mut u.a;
- | -------- borrow of `u.a` occurs here
-LL | u.a = 1;
- | ^^^^^^^ assignment to borrowed `u.a` occurs here
-LL | drop(rma);
- | --- borrow later used here
-
-error[E0502]: cannot borrow `u` (via `u.b`) as immutable because it is also borrowed as mutable (via `u.a`)
- --> $DIR/borrowck-union-borrow.rs:78:22
- |
-LL | let rma = &mut u.a;
- | -------- mutable borrow occurs here (via `u.a`)
-LL | let rb = &u.b;
- | ^^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here
-LL | drop(rma);
- | --- mutable borrow later used here
- |
- = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a`
-
-error[E0503]: cannot use `u.b` because it was mutably borrowed
- --> $DIR/borrowck-union-borrow.rs:83:21
- |
-LL | let ra = &mut u.a;
- | -------- borrow of `u.a` occurs here
-LL | let b = u.b;
- | ^^^ use of borrowed `u.a`
-LL |
-LL | drop(ra);
- | -- borrow later used here
-
-error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time
- --> $DIR/borrowck-union-borrow.rs:89:24
- |
-LL | let rma = &mut u.a;
- | -------- first mutable borrow occurs here (via `u.a`)
-LL | let rmb2 = &mut u.b;
- | ^^^^^^^^ second mutable borrow occurs here (via `u.b`)
-LL | drop(rma);
- | --- first borrow later used here
- |
- = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a`
-
-error[E0506]: cannot assign to `u.b` because it is borrowed
- --> $DIR/borrowck-union-borrow.rs:94:13
- |
-LL | let rma = &mut u.a;
- | -------- borrow of `u.b` occurs here
-LL | u.b = 1;
- | ^^^^^^^ assignment to borrowed `u.b` occurs here
-LL | drop(rma);
- | --- borrow later used here
-
-error: aborting due to 12 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0503, E0506.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-union-borrow.rs b/src/test/ui/borrowck/borrowck-union-borrow.rs
index 8afc0be..6390168 100644
--- a/src/test/ui/borrowck/borrowck-union-borrow.rs
+++ b/src/test/ui/borrowck/borrowck-union-borrow.rs
@@ -43,7 +43,7 @@
}
{
let ra = &u.a;
- let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
+ let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because it is also borrowed as immutable (via `u.a`)
drop(ra);
}
{
@@ -75,7 +75,7 @@
// Mut borrow, other field
{
let rma = &mut u.a;
- let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
+ let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because it is also borrowed as mutable (via `u.a`)
drop(rma);
}
{
diff --git a/src/test/ui/borrowck/borrowck-union-borrow.stderr b/src/test/ui/borrowck/borrowck-union-borrow.stderr
index a8fd5ae..ca10e29 100644
--- a/src/test/ui/borrowck/borrowck-union-borrow.stderr
+++ b/src/test/ui/borrowck/borrowck-union-borrow.stderr
@@ -1,116 +1,129 @@
error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-union-borrow.rs:25:28
+ --> $DIR/borrowck-union-borrow.rs:25:23
|
LL | let ra = &u.a;
- | --- immutable borrow occurs here
+ | ---- immutable borrow occurs here
LL | let rma = &mut u.a;
- | ^^^ mutable borrow occurs here
+ | ^^^^^^^^ mutable borrow occurs here
LL | drop(ra);
-LL | }
- | - immutable borrow ends here
+ | -- immutable borrow later used here
error[E0506]: cannot assign to `u.a` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:30:13
|
LL | let ra = &u.a;
- | --- borrow of `u.a` occurs here
+ | ---- borrow of `u.a` occurs here
LL | u.a = 1;
| ^^^^^^^ assignment to borrowed `u.a` occurs here
+LL | drop(ra);
+ | -- borrow later used here
-error[E0502]: cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
- --> $DIR/borrowck-union-borrow.rs:46:28
+error[E0502]: cannot borrow `u` (via `u.b`) as mutable because it is also borrowed as immutable (via `u.a`)
+ --> $DIR/borrowck-union-borrow.rs:46:23
|
LL | let ra = &u.a;
- | --- immutable borrow occurs here (via `u.a`)
+ | ---- immutable borrow occurs here (via `u.a`)
LL | let rmb = &mut u.b;
- | ^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here
+ | ^^^^^^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here
LL | drop(ra);
-LL | }
- | - immutable borrow ends here
+ | -- immutable borrow later used here
+ |
+ = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a`
error[E0506]: cannot assign to `u.b` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:51:13
|
LL | let ra = &u.a;
- | --- borrow of `u.b` occurs here
+ | ---- borrow of `u.b` occurs here
LL | u.b = 1;
| ^^^^^^^ assignment to borrowed `u.b` occurs here
+LL | drop(ra);
+ | -- borrow later used here
error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-union-borrow.rs:57:23
+ --> $DIR/borrowck-union-borrow.rs:57:22
|
LL | let rma = &mut u.a;
- | --- mutable borrow occurs here
+ | -------- mutable borrow occurs here
LL | let ra = &u.a;
- | ^^^ immutable borrow occurs here
+ | ^^^^ immutable borrow occurs here
LL | drop(rma);
-LL | }
- | - mutable borrow ends here
+ | --- mutable borrow later used here
error[E0503]: cannot use `u.a` because it was mutably borrowed
- --> $DIR/borrowck-union-borrow.rs:62:17
+ --> $DIR/borrowck-union-borrow.rs:62:21
|
LL | let ra = &mut u.a;
- | --- borrow of `u.a` occurs here
+ | -------- borrow of `u.a` occurs here
LL | let a = u.a;
- | ^ use of borrowed `u.a`
+ | ^^^ use of borrowed `u.a`
+LL | drop(ra);
+ | -- borrow later used here
error[E0499]: cannot borrow `u.a` as mutable more than once at a time
- --> $DIR/borrowck-union-borrow.rs:67:29
+ --> $DIR/borrowck-union-borrow.rs:67:24
|
LL | let rma = &mut u.a;
- | --- first mutable borrow occurs here
+ | -------- first mutable borrow occurs here
LL | let rma2 = &mut u.a;
- | ^^^ second mutable borrow occurs here
+ | ^^^^^^^^ second mutable borrow occurs here
LL | drop(rma);
-LL | }
- | - first borrow ends here
+ | --- first borrow later used here
error[E0506]: cannot assign to `u.a` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:72:13
|
LL | let rma = &mut u.a;
- | --- borrow of `u.a` occurs here
+ | -------- borrow of `u.a` occurs here
LL | u.a = 1;
| ^^^^^^^ assignment to borrowed `u.a` occurs here
+LL | drop(rma);
+ | --- borrow later used here
-error[E0502]: cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
- --> $DIR/borrowck-union-borrow.rs:78:23
+error[E0502]: cannot borrow `u` (via `u.b`) as immutable because it is also borrowed as mutable (via `u.a`)
+ --> $DIR/borrowck-union-borrow.rs:78:22
|
LL | let rma = &mut u.a;
- | --- mutable borrow occurs here (via `u.a`)
+ | -------- mutable borrow occurs here (via `u.a`)
LL | let rb = &u.b;
- | ^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here
+ | ^^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here
LL | drop(rma);
-LL | }
- | - mutable borrow ends here
+ | --- mutable borrow later used here
+ |
+ = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a`
error[E0503]: cannot use `u.b` because it was mutably borrowed
- --> $DIR/borrowck-union-borrow.rs:83:17
+ --> $DIR/borrowck-union-borrow.rs:83:21
|
LL | let ra = &mut u.a;
- | --- borrow of `u.a` occurs here
+ | -------- borrow of `u.a` occurs here
LL | let b = u.b;
- | ^ use of borrowed `u.a`
+ | ^^^ use of borrowed `u.a`
+LL |
+LL | drop(ra);
+ | -- borrow later used here
error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time
- --> $DIR/borrowck-union-borrow.rs:89:29
+ --> $DIR/borrowck-union-borrow.rs:89:24
|
LL | let rma = &mut u.a;
- | --- first mutable borrow occurs here (via `u.a`)
+ | -------- first mutable borrow occurs here (via `u.a`)
LL | let rmb2 = &mut u.b;
- | ^^^ second mutable borrow occurs here (via `u.b`)
+ | ^^^^^^^^ second mutable borrow occurs here (via `u.b`)
LL | drop(rma);
-LL | }
- | - first borrow ends here
+ | --- first borrow later used here
+ |
+ = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a`
error[E0506]: cannot assign to `u.b` because it is borrowed
--> $DIR/borrowck-union-borrow.rs:94:13
|
LL | let rma = &mut u.a;
- | --- borrow of `u.b` occurs here
+ | -------- borrow of `u.b` occurs here
LL | u.b = 1;
| ^^^^^^^ assignment to borrowed `u.b` occurs here
+LL | drop(rma);
+ | --- borrow later used here
error: aborting due to 12 previous errors
diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr
deleted file mode 100644
index 0b1714f..0000000
--- a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: use of moved value: `u`
- --> $DIR/borrowck-union-move-assign.rs:17:21
- |
-LL | let mut u = U { a: A };
- | ----- move occurs because `u` has type `U`, which does not implement the `Copy` trait
-LL | let a = u.a;
- | --- value moved here
-LL | let a = u.a;
- | ^^^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.rs b/src/test/ui/borrowck/borrowck-union-move-assign.rs
index 1bb4325..a24f42d 100644
--- a/src/test/ui/borrowck/borrowck-union-move-assign.rs
+++ b/src/test/ui/borrowck/borrowck-union-move-assign.rs
@@ -14,7 +14,7 @@
{
let mut u = U { a: A };
let a = u.a;
- let a = u.a; //~ ERROR use of moved value: `u.a`
+ let a = u.a; //~ ERROR use of moved value: `u`
}
{
let mut u = U { a: A };
diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.stderr
index 04e67fc..0b1714f 100644
--- a/src/test/ui/borrowck/borrowck-union-move-assign.stderr
+++ b/src/test/ui/borrowck/borrowck-union-move-assign.stderr
@@ -1,12 +1,12 @@
-error[E0382]: use of moved value: `u.a`
- --> $DIR/borrowck-union-move-assign.rs:17:17
+error[E0382]: use of moved value: `u`
+ --> $DIR/borrowck-union-move-assign.rs:17:21
|
+LL | let mut u = U { a: A };
+ | ----- move occurs because `u` has type `U`, which does not implement the `Copy` trait
LL | let a = u.a;
- | - value moved here
+ | --- value moved here
LL | let a = u.a;
- | ^ value used here after move
- |
- = note: move occurs because `u.a` has type `A`, which does not implement the `Copy` trait
+ | ^^^ value used here after move
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-union-move.nll.stderr b/src/test/ui/borrowck/borrowck-union-move.nll.stderr
deleted file mode 100644
index abbb014..0000000
--- a/src/test/ui/borrowck/borrowck-union-move.nll.stderr
+++ /dev/null
@@ -1,63 +0,0 @@
-error[E0382]: use of moved value: `u`
- --> $DIR/borrowck-union-move.rs:26:21
- |
-LL | let mut u = Unn { n1: NonCopy };
- | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
-LL | let a = u.n1;
- | ---- value moved here
-LL | let a = u.n1;
- | ^^^^ value used here after move
-
-error[E0382]: use of moved value: `u`
- --> $DIR/borrowck-union-move.rs:31:21
- |
-LL | let mut u = Unn { n1: NonCopy };
- | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
-LL | let a = u.n1;
- | ---- value moved here
-LL | let a = u;
- | ^ value used here after move
-
-error[E0382]: use of moved value: `u`
- --> $DIR/borrowck-union-move.rs:36:21
- |
-LL | let mut u = Unn { n1: NonCopy };
- | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
-LL | let a = u.n1;
- | ---- value moved here
-LL | let a = u.n2;
- | ^^^^ value used here after move
-
-error[E0382]: use of moved value: `u`
- --> $DIR/borrowck-union-move.rs:63:21
- |
-LL | let mut u = Ucn { c: Copy };
- | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
-LL | let a = u.n;
- | --- value moved here
-LL | let a = u.n;
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `u`
- --> $DIR/borrowck-union-move.rs:68:21
- |
-LL | let mut u = Ucn { c: Copy };
- | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
-LL | let a = u.n;
- | --- value moved here
-LL | let a = u.c;
- | ^^^ value used here after move
-
-error[E0382]: use of moved value: `u`
- --> $DIR/borrowck-union-move.rs:83:21
- |
-LL | let mut u = Ucn { c: Copy };
- | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
-LL | let a = u.n;
- | --- value moved here
-LL | let a = u;
- | ^ value used here after move
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-union-move.rs b/src/test/ui/borrowck/borrowck-union-move.rs
index e248060..d0aa6df 100644
--- a/src/test/ui/borrowck/borrowck-union-move.rs
+++ b/src/test/ui/borrowck/borrowck-union-move.rs
@@ -23,17 +23,17 @@
{
let mut u = Unn { n1: NonCopy };
let a = u.n1;
- let a = u.n1; //~ ERROR use of moved value: `u.n1`
+ let a = u.n1; //~ ERROR use of moved value: `u`
}
{
let mut u = Unn { n1: NonCopy };
let a = u.n1;
- let a = u; //~ ERROR use of partially moved value: `u`
+ let a = u; //~ ERROR use of moved value: `u`
}
{
let mut u = Unn { n1: NonCopy };
let a = u.n1;
- let a = u.n2; //~ ERROR use of moved value: `u.n2`
+ let a = u.n2; //~ ERROR use of moved value: `u`
}
// 2 Copy
{
@@ -60,12 +60,12 @@
{
let mut u = Ucn { c: Copy };
let a = u.n;
- let a = u.n; //~ ERROR use of moved value: `u.n`
+ let a = u.n; //~ ERROR use of moved value: `u`
}
{
let mut u = Ucn { c: Copy };
let a = u.n;
- let a = u.c; //~ ERROR use of moved value: `u.c`
+ let a = u.c; //~ ERROR use of moved value: `u`
}
{
let mut u = Ucn { c: Copy };
@@ -80,7 +80,7 @@
{
let mut u = Ucn { c: Copy };
let a = u.n;
- let a = u; //~ ERROR use of partially moved value: `u`
+ let a = u; //~ ERROR use of moved value: `u`
}
}
}
diff --git a/src/test/ui/borrowck/borrowck-union-move.stderr b/src/test/ui/borrowck/borrowck-union-move.stderr
index 4ce372a..abbb014 100644
--- a/src/test/ui/borrowck/borrowck-union-move.stderr
+++ b/src/test/ui/borrowck/borrowck-union-move.stderr
@@ -1,62 +1,62 @@
-error[E0382]: use of moved value: `u.n1`
- --> $DIR/borrowck-union-move.rs:26:17
+error[E0382]: use of moved value: `u`
+ --> $DIR/borrowck-union-move.rs:26:21
|
+LL | let mut u = Unn { n1: NonCopy };
+ | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
LL | let a = u.n1;
- | - value moved here
+ | ---- value moved here
LL | let a = u.n1;
- | ^ value used here after move
- |
- = note: move occurs because `u.n1` has type `NonCopy`, which does not implement the `Copy` trait
+ | ^^^^ value used here after move
-error[E0382]: use of partially moved value: `u`
- --> $DIR/borrowck-union-move.rs:31:17
+error[E0382]: use of moved value: `u`
+ --> $DIR/borrowck-union-move.rs:31:21
|
+LL | let mut u = Unn { n1: NonCopy };
+ | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
LL | let a = u.n1;
- | - value moved here
+ | ---- value moved here
LL | let a = u;
- | ^ value used here after move
- |
- = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait
+ | ^ value used here after move
-error[E0382]: use of moved value: `u.n2`
- --> $DIR/borrowck-union-move.rs:36:17
+error[E0382]: use of moved value: `u`
+ --> $DIR/borrowck-union-move.rs:36:21
|
+LL | let mut u = Unn { n1: NonCopy };
+ | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
LL | let a = u.n1;
- | - value moved here
+ | ---- value moved here
LL | let a = u.n2;
- | ^ value used here after move
- |
- = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait
+ | ^^^^ value used here after move
-error[E0382]: use of moved value: `u.n`
- --> $DIR/borrowck-union-move.rs:63:17
+error[E0382]: use of moved value: `u`
+ --> $DIR/borrowck-union-move.rs:63:21
|
+LL | let mut u = Ucn { c: Copy };
+ | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
LL | let a = u.n;
- | - value moved here
+ | --- value moved here
LL | let a = u.n;
- | ^ value used here after move
- |
- = note: move occurs because `u.n` has type `NonCopy`, which does not implement the `Copy` trait
+ | ^^^ value used here after move
-error[E0382]: use of moved value: `u.c`
- --> $DIR/borrowck-union-move.rs:68:17
+error[E0382]: use of moved value: `u`
+ --> $DIR/borrowck-union-move.rs:68:21
|
+LL | let mut u = Ucn { c: Copy };
+ | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
LL | let a = u.n;
- | - value moved here
+ | --- value moved here
LL | let a = u.c;
- | ^ value used here after move
- |
- = note: move occurs because `u.c` has type `[type error]`, which does not implement the `Copy` trait
+ | ^^^ value used here after move
-error[E0382]: use of partially moved value: `u`
- --> $DIR/borrowck-union-move.rs:83:17
+error[E0382]: use of moved value: `u`
+ --> $DIR/borrowck-union-move.rs:83:21
|
+LL | let mut u = Ucn { c: Copy };
+ | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
LL | let a = u.n;
- | - value moved here
+ | --- value moved here
LL | let a = u;
- | ^ value used here after move
- |
- = note: move occurs because `u.c` has type `[type error]`, which does not implement the `Copy` trait
+ | ^ value used here after move
error: aborting due to 6 previous errors
diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr b/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr
deleted file mode 100644
index 06c884e..0000000
--- a/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0381]: assign to part of possibly uninitialized variable: `s`
- --> $DIR/borrowck-union-uninitialized.rs:13:9
- |
-LL | s.a = 0;
- | ^^^^^^^ use of possibly uninitialized `s`
-
-error[E0381]: assign to part of possibly uninitialized variable: `u`
- --> $DIR/borrowck-union-uninitialized.rs:14:9
- |
-LL | u.a = 0;
- | ^^^^^^^ use of possibly uninitialized `u`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.rs b/src/test/ui/borrowck/borrowck-union-uninitialized.rs
index e7d456e..9cab0b1 100644
--- a/src/test/ui/borrowck/borrowck-union-uninitialized.rs
+++ b/src/test/ui/borrowck/borrowck-union-uninitialized.rs
@@ -10,9 +10,9 @@
unsafe {
let mut s: S;
let mut u: U;
- s.a = 0;
- u.a = 0;
- let sa = s.a; //~ ERROR use of possibly uninitialized variable: `s.a`
- let ua = u.a; //~ ERROR use of possibly uninitialized variable: `u.a`
+ s.a = 0; //~ ERROR assign to part of possibly uninitialized variable: `s`
+ u.a = 0; //~ ERROR assign to part of possibly uninitialized variable: `u`
+ let sa = s.a;
+ let ua = u.a;
}
}
diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr
index 6a1401f..06c884e 100644
--- a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr
+++ b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr
@@ -1,14 +1,14 @@
-error[E0381]: use of possibly uninitialized variable: `s.a`
- --> $DIR/borrowck-union-uninitialized.rs:15:13
+error[E0381]: assign to part of possibly uninitialized variable: `s`
+ --> $DIR/borrowck-union-uninitialized.rs:13:9
|
-LL | let sa = s.a;
- | ^^ use of possibly uninitialized `s.a`
+LL | s.a = 0;
+ | ^^^^^^^ use of possibly uninitialized `s`
-error[E0381]: use of possibly uninitialized variable: `u.a`
- --> $DIR/borrowck-union-uninitialized.rs:16:13
+error[E0381]: assign to part of possibly uninitialized variable: `u`
+ --> $DIR/borrowck-union-uninitialized.rs:14:9
|
-LL | let ua = u.a;
- | ^^ use of possibly uninitialized `u.a`
+LL | u.a = 0;
+ | ^^^^^^^ use of possibly uninitialized `u`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr
deleted file mode 100644
index 923edc8..0000000
--- a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-uniq-via-lend.rs:36:12
- |
-LL | let w = &mut v;
- | ------ mutable borrow occurs here
-LL | borrow(&*v);
- | ^^^ immutable borrow occurs here
-LL | w.use_mut();
- | - mutable borrow later used here
-
-error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-uniq-via-lend.rs:53:12
- |
-LL | x = &mut v;
- | ------ mutable borrow occurs here
-LL | borrow(&*v);
- | ^^^ immutable borrow occurs here
-LL | x.use_mut();
- | - mutable borrow later used here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr
index 00fd77e..923edc8 100644
--- a/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr
+++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr
@@ -1,24 +1,22 @@
-error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
- --> $DIR/borrowck-uniq-via-lend.rs:36:13
+error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-uniq-via-lend.rs:36:12
|
LL | let w = &mut v;
- | - mutable borrow occurs here
+ | ------ mutable borrow occurs here
LL | borrow(&*v);
- | ^^ immutable borrow occurs here
+ | ^^^ immutable borrow occurs here
LL | w.use_mut();
-LL | }
- | - mutable borrow ends here
+ | - mutable borrow later used here
-error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
- --> $DIR/borrowck-uniq-via-lend.rs:53:13
+error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-uniq-via-lend.rs:53:12
|
LL | x = &mut v;
- | - mutable borrow occurs here
+ | ------ mutable borrow occurs here
LL | borrow(&*v);
- | ^^ immutable borrow occurs here
+ | ^^^ immutable borrow occurs here
LL | x.use_mut();
-LL | }
- | - mutable borrow ends here
+ | - mutable borrow later used here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr
deleted file mode 100644
index c5e4f89..0000000
--- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `w`
- --> $DIR/borrowck-use-in-index-lvalue.rs:6:5
- |
-LL | w[5] = 0;
- | ^^^^ use of possibly uninitialized `*w`
-
-error[E0381]: use of possibly uninitialized variable: `w`
- --> $DIR/borrowck-use-in-index-lvalue.rs:10:5
- |
-LL | w[5] = 0;
- | ^^^^ use of possibly uninitialized `*w`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr
deleted file mode 100644
index e235bdf..0000000
--- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `*w`
- --> $DIR/borrowck-use-in-index-lvalue.rs:6:5
- |
-LL | w[5] = 0;
- | ^^^^^^^^ use of possibly uninitialized `*w`
-
-error[E0381]: use of possibly uninitialized variable: `*w`
- --> $DIR/borrowck-use-in-index-lvalue.rs:10:5
- |
-LL | w[5] = 0;
- | ^^^^^^^^ use of possibly uninitialized `*w`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr
deleted file mode 100644
index c5e4f89..0000000
--- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `w`
- --> $DIR/borrowck-use-in-index-lvalue.rs:6:5
- |
-LL | w[5] = 0;
- | ^^^^ use of possibly uninitialized `*w`
-
-error[E0381]: use of possibly uninitialized variable: `w`
- --> $DIR/borrowck-use-in-index-lvalue.rs:10:5
- |
-LL | w[5] = 0;
- | ^^^^ use of possibly uninitialized `*w`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs
index f953dec..d30b1de 100644
--- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs
+++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs
@@ -1,14 +1,9 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn test() {
let w: &mut [isize];
- w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
- //[mir]~^ ERROR [E0381]
+ w[5] = 0; //~ ERROR [E0381]
let mut w: &mut [isize];
- w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
- //[mir]~^ ERROR [E0381]
+ w[5] = 0; //~ ERROR [E0381]
}
fn main() { test(); }
diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr
new file mode 100644
index 0000000..c03ef75
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr
@@ -0,0 +1,15 @@
+error[E0381]: use of possibly uninitialized variable: `w`
+ --> $DIR/borrowck-use-in-index-lvalue.rs:3:5
+ |
+LL | w[5] = 0;
+ | ^^^^ use of possibly uninitialized `*w`
+
+error[E0381]: use of possibly uninitialized variable: `w`
+ --> $DIR/borrowck-use-in-index-lvalue.rs:6:5
+ |
+LL | w[5] = 0;
+ | ^^^^ use of possibly uninitialized `*w`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr
deleted file mode 100644
index 91d69c5..0000000
--- a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr
+++ /dev/null
@@ -1,95 +0,0 @@
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:11:10
- |
-LL | let p = &mut x;
- | ------ borrow of `x` occurs here
-LL | drop(x);
- | ^ use of borrowed `x`
-LL | *p = 2;
- | ------ borrow later used here
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:18:10
- |
-LL | let p = &mut x.a;
- | -------- borrow of `x.a` occurs here
-LL | drop(x);
- | ^ use of borrowed `x.a`
-LL | *p = 3;
- | ------ borrow later used here
-
-error[E0503]: cannot use `x.a` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:25:10
- |
-LL | let p = &mut x;
- | ------ borrow of `x` occurs here
-LL | drop(x.a);
- | ^^^ use of borrowed `x`
-LL | p.a = 3;
- | ------- borrow later used here
-
-error[E0503]: cannot use `x.a` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:32:10
- |
-LL | let p = &mut x.a;
- | -------- borrow of `x.a` occurs here
-LL | drop(x.a);
- | ^^^ use of borrowed `x.a`
-LL | *p = 3;
- | ------ borrow later used here
-
-error[E0503]: cannot use `x.a` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:39:13
- |
-LL | let p = &mut x;
- | ------ borrow of `x` occurs here
-LL | let y = A { b: 3, .. x };
- | ^^^^^^^^^^^^^^^^ use of borrowed `x`
-LL | drop(y);
-LL | p.a = 4;
- | ------- borrow later used here
-
-error[E0503]: cannot use `x.a` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:47:13
- |
-LL | let p = &mut x.a;
- | -------- borrow of `x.a` occurs here
-LL | let y = A { b: 3, .. x };
- | ^^^^^^^^^^^^^^^^ use of borrowed `x.a`
-LL | drop(y);
-LL | *p = 4;
- | ------ borrow later used here
-
-error[E0503]: cannot use `*x` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:55:10
- |
-LL | let p = &mut x;
- | ------ borrow of `x` occurs here
-LL | drop(*x);
- | ^^ use of borrowed `x`
-LL | **p = 2;
- | ------- borrow later used here
-
-error[E0503]: cannot use `*x.b` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:62:10
- |
-LL | let p = &mut x;
- | ------ borrow of `x` occurs here
-LL | drop(*x.b);
- | ^^^^ use of borrowed `x`
-LL | p.a = 3;
- | ------- borrow later used here
-
-error[E0503]: cannot use `*x.b` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:69:10
- |
-LL | let p = &mut x.b;
- | -------- borrow of `x.b` occurs here
-LL | drop(*x.b);
- | ^^^^ use of borrowed `x.b`
-LL | **p = 3;
- | ------- borrow later used here
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr
index 5c1d726..91d69c5 100644
--- a/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr
+++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr
@@ -2,73 +2,93 @@
--> $DIR/borrowck-use-mut-borrow.rs:11:10
|
LL | let p = &mut x;
- | - borrow of `x` occurs here
+ | ------ borrow of `x` occurs here
LL | drop(x);
| ^ use of borrowed `x`
+LL | *p = 2;
+ | ------ borrow later used here
error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/borrowck-use-mut-borrow.rs:18:10
|
LL | let p = &mut x.a;
- | --- borrow of `x.a` occurs here
+ | -------- borrow of `x.a` occurs here
LL | drop(x);
| ^ use of borrowed `x.a`
+LL | *p = 3;
+ | ------ borrow later used here
error[E0503]: cannot use `x.a` because it was mutably borrowed
--> $DIR/borrowck-use-mut-borrow.rs:25:10
|
LL | let p = &mut x;
- | - borrow of `x` occurs here
+ | ------ borrow of `x` occurs here
LL | drop(x.a);
| ^^^ use of borrowed `x`
+LL | p.a = 3;
+ | ------- borrow later used here
error[E0503]: cannot use `x.a` because it was mutably borrowed
--> $DIR/borrowck-use-mut-borrow.rs:32:10
|
LL | let p = &mut x.a;
- | --- borrow of `x.a` occurs here
+ | -------- borrow of `x.a` occurs here
LL | drop(x.a);
| ^^^ use of borrowed `x.a`
+LL | *p = 3;
+ | ------ borrow later used here
error[E0503]: cannot use `x.a` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:39:26
+ --> $DIR/borrowck-use-mut-borrow.rs:39:13
|
LL | let p = &mut x;
- | - borrow of `x` occurs here
+ | ------ borrow of `x` occurs here
LL | let y = A { b: 3, .. x };
- | ^ use of borrowed `x`
+ | ^^^^^^^^^^^^^^^^ use of borrowed `x`
+LL | drop(y);
+LL | p.a = 4;
+ | ------- borrow later used here
error[E0503]: cannot use `x.a` because it was mutably borrowed
- --> $DIR/borrowck-use-mut-borrow.rs:47:26
+ --> $DIR/borrowck-use-mut-borrow.rs:47:13
|
LL | let p = &mut x.a;
- | --- borrow of `x.a` occurs here
+ | -------- borrow of `x.a` occurs here
LL | let y = A { b: 3, .. x };
- | ^ use of borrowed `x.a`
+ | ^^^^^^^^^^^^^^^^ use of borrowed `x.a`
+LL | drop(y);
+LL | *p = 4;
+ | ------ borrow later used here
error[E0503]: cannot use `*x` because it was mutably borrowed
--> $DIR/borrowck-use-mut-borrow.rs:55:10
|
LL | let p = &mut x;
- | - borrow of `x` occurs here
+ | ------ borrow of `x` occurs here
LL | drop(*x);
| ^^ use of borrowed `x`
+LL | **p = 2;
+ | ------- borrow later used here
error[E0503]: cannot use `*x.b` because it was mutably borrowed
--> $DIR/borrowck-use-mut-borrow.rs:62:10
|
LL | let p = &mut x;
- | - borrow of `x` occurs here
+ | ------ borrow of `x` occurs here
LL | drop(*x.b);
| ^^^^ use of borrowed `x`
+LL | p.a = 3;
+ | ------- borrow later used here
error[E0503]: cannot use `*x.b` because it was mutably borrowed
--> $DIR/borrowck-use-mut-borrow.rs:69:10
|
LL | let p = &mut x.b;
- | --- borrow of `x.b` occurs here
+ | -------- borrow of `x.b` occurs here
LL | drop(*x.b);
| ^^^^ use of borrowed `x.b`
+LL | **p = 3;
+ | ------- borrow later used here
error: aborting due to 9 previous errors
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr
deleted file mode 100644
index a208dc4..0000000
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:12:13
- |
-LL | let y = x as *const Foo;
- | ^ use of possibly uninitialized `*x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr
deleted file mode 100644
index 49a4300..0000000
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `*x`
- --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:12:13
- |
-LL | let y = x as *const Foo;
- | ^ use of possibly uninitialized `*x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr
deleted file mode 100644
index a208dc4..0000000
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:12:13
- |
-LL | let y = x as *const Foo;
- | ^ use of possibly uninitialized `*x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs
index 518228a..1e27237 100644
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
// Variation on `borrowck-use-uninitialized-in-cast` in which we do a
// trait cast from an uninitialized source. Issue #20791.
@@ -9,6 +6,5 @@
fn main() {
let x: &i32;
- let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x`
- //[mir]~^ ERROR [E0381]
+ let y = x as *const Foo; //~ ERROR [E0381]
}
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr
new file mode 100644
index 0000000..df610cb
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:9:13
+ |
+LL | let y = x as *const Foo;
+ | ^ use of possibly uninitialized `*x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr
deleted file mode 100644
index 0f62c3a..0000000
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-use-uninitialized-in-cast.rs:10:13
- |
-LL | let y = x as *const i32;
- | ^ use of possibly uninitialized `*x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr
deleted file mode 100644
index d813738..0000000
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `*x`
- --> $DIR/borrowck-use-uninitialized-in-cast.rs:10:13
- |
-LL | let y = x as *const i32;
- | ^ use of possibly uninitialized `*x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr
deleted file mode 100644
index 0f62c3a..0000000
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/borrowck-use-uninitialized-in-cast.rs:10:13
- |
-LL | let y = x as *const i32;
- | ^ use of possibly uninitialized `*x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs
index e15479b..a355a546 100644
--- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs
@@ -1,12 +1,8 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
// Check that we detect unused values that are cast to other things.
// The problem was specified to casting to `*`, as creating unsafe
// pointers was not being fully checked. Issue #20791.
fn main() {
let x: &i32;
- let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381]
- //[mir]~^ ERROR [E0381]
+ let y = x as *const i32; //~ ERROR [E0381]
}
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr
new file mode 100644
index 0000000..84e717a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-use-uninitialized-in-cast.rs:7:13
+ |
+LL | let y = x as *const i32;
+ | ^ use of possibly uninitialized `*x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr
deleted file mode 100644
index da6d929..0000000
--- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0515]: cannot return value referencing local variable `vec`
- --> $DIR/borrowck-vec-pattern-element-loan.rs:10:5
- |
-LL | let vec: &[isize] = &vec;
- | ---- `vec` is borrowed here
-...
-LL | tail
- | ^^^^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing local variable `vec`
- --> $DIR/borrowck-vec-pattern-element-loan.rs:20:5
- |
-LL | let vec: &[isize] = &vec;
- | ---- `vec` is borrowed here
-...
-LL | init
- | ^^^^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing local variable `vec`
- --> $DIR/borrowck-vec-pattern-element-loan.rs:30:5
- |
-LL | let vec: &[isize] = &vec;
- | ---- `vec` is borrowed here
-...
-LL | slice
- | ^^^^^ returns a value referencing data owned by the current function
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs
index 0de5132..100384d 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs
@@ -2,32 +2,32 @@
fn a<'a>() -> &'a [isize] {
let vec = vec![1, 2, 3, 4];
- let vec: &[isize] = &vec; //~ ERROR does not live long enough
+ let vec: &[isize] = &vec;
let tail = match vec {
&[_, ref tail..] => tail,
_ => panic!("a")
};
- tail
+ tail //~ ERROR cannot return value referencing local variable `vec`
}
fn b<'a>() -> &'a [isize] {
let vec = vec![1, 2, 3, 4];
- let vec: &[isize] = &vec; //~ ERROR does not live long enough
+ let vec: &[isize] = &vec;
let init = match vec {
&[ref init.., _] => init,
_ => panic!("b")
};
- init
+ init //~ ERROR cannot return value referencing local variable `vec`
}
fn c<'a>() -> &'a [isize] {
let vec = vec![1, 2, 3, 4];
- let vec: &[isize] = &vec; //~ ERROR does not live long enough
+ let vec: &[isize] = &vec;
let slice = match vec {
&[_, ref slice.., _] => slice,
_ => panic!("c")
};
- slice
+ slice //~ ERROR cannot return value referencing local variable `vec`
}
fn main() {}
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr
index b0eaee7..da6d929 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr
@@ -1,48 +1,30 @@
-error[E0597]: `vec` does not live long enough
- --> $DIR/borrowck-vec-pattern-element-loan.rs:5:26
+error[E0515]: cannot return value referencing local variable `vec`
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:10:5
|
LL | let vec: &[isize] = &vec;
- | ^^^ borrowed value does not live long enough
+ | ---- `vec` is borrowed here
...
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 3:6...
- --> $DIR/borrowck-vec-pattern-element-loan.rs:3:6
- |
-LL | fn a<'a>() -> &'a [isize] {
- | ^^
+LL | tail
+ | ^^^^ returns a value referencing data owned by the current function
-error[E0597]: `vec` does not live long enough
- --> $DIR/borrowck-vec-pattern-element-loan.rs:15:26
+error[E0515]: cannot return value referencing local variable `vec`
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:20:5
|
LL | let vec: &[isize] = &vec;
- | ^^^ borrowed value does not live long enough
+ | ---- `vec` is borrowed here
...
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:6...
- --> $DIR/borrowck-vec-pattern-element-loan.rs:13:6
- |
-LL | fn b<'a>() -> &'a [isize] {
- | ^^
+LL | init
+ | ^^^^ returns a value referencing data owned by the current function
-error[E0597]: `vec` does not live long enough
- --> $DIR/borrowck-vec-pattern-element-loan.rs:25:26
+error[E0515]: cannot return value referencing local variable `vec`
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:30:5
|
LL | let vec: &[isize] = &vec;
- | ^^^ borrowed value does not live long enough
+ | ---- `vec` is borrowed here
...
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:6...
- --> $DIR/borrowck-vec-pattern-element-loan.rs:23:6
- |
-LL | fn c<'a>() -> &'a [isize] {
- | ^^
+LL | slice
+ | ^^^^^ returns a value referencing data owned by the current function
error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr
deleted file mode 100644
index 251f445..0000000
--- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0499]: cannot borrow `v` as mutable more than once at a time
- --> $DIR/borrowck-vec-pattern-loan-from-mut.rs:8:13
- |
-LL | let vb: &mut [isize] = &mut v;
- | ------ first mutable borrow occurs here
-...
-LL | v.push(tail[0] + tail[1]);
- | ^ ------- first borrow later used here
- | |
- | second mutable borrow occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
index 1ce6a3b..251f445 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
@@ -2,13 +2,12 @@
--> $DIR/borrowck-vec-pattern-loan-from-mut.rs:8:13
|
LL | let vb: &mut [isize] = &mut v;
- | - first mutable borrow occurs here
+ | ------ first mutable borrow occurs here
...
LL | v.push(tail[0] + tail[1]);
- | ^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+ | ^ ------- first borrow later used here
+ | |
+ | second mutable borrow occurs here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr
deleted file mode 100644
index 7d0d888..0000000
--- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0506]: cannot assign to `a[_]` because it is borrowed
- --> $DIR/borrowck-vec-pattern-move-tail.rs:16:5
- |
-LL | [1, 2, ref tail..] => tail,
- | -------- borrow of `a[_]` occurs here
-...
-LL | a[2] = 0;
- | ^^^^^^^^ assignment to borrowed `a[_]` occurs here
-...
-LL | println!("t[0]: {}", t[0]);
- | ---- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr
deleted file mode 100644
index 1207d4a..0000000
--- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0506]: cannot assign to `a[..]` because it is borrowed
- --> $DIR/borrowck-vec-pattern-move-tail.rs:16:5
- |
-LL | [1, 2, ref tail..] => tail,
- | -------- borrow of `a[..]` occurs here
-...
-LL | a[2] = 0;
- | ^^^^^^^^ assignment to borrowed `a[..]` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr
deleted file mode 100644
index f764d5f..0000000
--- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0506]: cannot assign to `a[..]` because it is borrowed (Ast)
- --> $DIR/borrowck-vec-pattern-move-tail.rs:16:5
- |
-LL | [1, 2, ref tail..] => tail,
- | -------- borrow of `a[..]` occurs here
-...
-LL | a[2] = 0;
- | ^^^^^^^^ assignment to borrowed `a[..]` occurs here
-
-error[E0506]: cannot assign to `a[_]` because it is borrowed (Mir)
- --> $DIR/borrowck-vec-pattern-move-tail.rs:16:5
- |
-LL | [1, 2, ref tail..] => tail,
- | -------- borrow of `a[_]` occurs here
-...
-LL | a[2] = 0;
- | ^^^^^^^^ assignment to borrowed `a[_]` occurs here
-...
-LL | println!("t[0]: {}", t[0]);
- | ---- borrow later used here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs
index e14ecd9..efc5253 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs
@@ -1,8 +1,4 @@
// http://rust-lang.org/COPYRIGHT.
-//
-
-// revisions: ast cmp
-//[cmp]compile-flags: -Z borrowck=compare
#![feature(slice_patterns)]
@@ -13,9 +9,7 @@
_ => unreachable!()
};
println!("t[0]: {}", t[0]);
- a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
- //[cmp]~^ ERROR cannot assign to `a[..]` because it is borrowed (Ast)
- //[cmp]~| ERROR cannot assign to `a[_]` because it is borrowed (Mir)
+ a[2] = 0; //~ ERROR cannot assign to `a[_]` because it is borrowed
println!("t[0]: {}", t[0]);
t[0];
}
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr
new file mode 100644
index 0000000..b2f553b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `a[_]` because it is borrowed
+ --> $DIR/borrowck-vec-pattern-move-tail.rs:12:5
+ |
+LL | [1, 2, ref tail..] => tail,
+ | -------- borrow of `a[_]` occurs here
+...
+LL | a[2] = 0;
+ | ^^^^^^^^ assignment to borrowed `a[_]` occurs here
+LL | println!("t[0]: {}", t[0]);
+ | ---- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr
deleted file mode 100644
index d0bbe10..0000000
--- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr
+++ /dev/null
@@ -1,117 +0,0 @@
-error[E0506]: cannot assign to `vec[_]` because it is borrowed
- --> $DIR/borrowck-vec-pattern-nesting.rs:10:13
- |
-LL | [box ref _a, _, _] => {
- | ------ borrow of `vec[_]` occurs here
-LL |
-LL | vec[0] = box 4;
- | ^^^^^^ assignment to borrowed `vec[_]` occurs here
-LL |
-LL | _a.use_ref();
- | -- borrow later used here
-
-error[E0506]: cannot assign to `vec[_]` because it is borrowed
- --> $DIR/borrowck-vec-pattern-nesting.rs:23:13
- |
-LL | &mut [ref _b..] => {
- | ------ borrow of `vec[_]` occurs here
-LL |
-LL | vec[0] = box 4;
- | ^^^^^^ assignment to borrowed `vec[_]` occurs here
-LL |
-LL | _b.use_ref();
- | -- borrow later used here
-
-error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:33:11
- |
-LL | match vec {
- | ^^^ cannot move out of here
-LL | &mut [_a,
- | -- data moved here
- |
-note: move occurs because `_a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
- --> $DIR/borrowck-vec-pattern-nesting.rs:34:15
- |
-LL | &mut [_a,
- | ^^
-help: consider removing the `&mut`
- |
-LL | [_a,
-LL |
-LL |
-LL | ..
-LL | ] => {
- |
-
-error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:47:13
- |
-LL | let a = vec[0];
- | ^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&vec[0]`
-
-error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:54:11
- |
-LL | match vec {
- | ^^^ cannot move out of here
-...
-LL | _b] => {}
- | -- data moved here
- |
-note: move occurs because `_b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
- --> $DIR/borrowck-vec-pattern-nesting.rs:57:10
- |
-LL | _b] => {}
- | ^^
-help: consider removing the `&mut`
- |
-LL | [
-LL |
-LL | _b] => {}
- |
-
-error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:60:13
- |
-LL | let a = vec[0];
- | ^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&vec[0]`
-
-error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:67:11
- |
-LL | match vec {
- | ^^^ cannot move out of here
-LL | &mut [_a, _b, _c] => {}
- | -----------------
- | | | | |
- | | | | ...and here
- | | | ...and here
- | | data moved here
- | help: consider removing the `&mut`: `[_a, _b, _c]`
- |
-note: move occurs because these variables have types that don't implement the `Copy` trait
- --> $DIR/borrowck-vec-pattern-nesting.rs:68:15
- |
-LL | &mut [_a, _b, _c] => {}
- | ^^ ^^ ^^
-
-error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:72:13
- |
-LL | let a = vec[0];
- | ^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&vec[0]`
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0506, E0508.
-For more information about an error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs
index 46203b7..3e2935f 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs
@@ -6,10 +6,11 @@
let mut vec = [box 1, box 2, box 3];
match vec {
[box ref _a, _, _] => {
- //~^ borrow of `vec[..]` occurs here
+ //~^ NOTE borrow of `vec[_]` occurs here
vec[0] = box 4; //~ ERROR cannot assign
- //~^ assignment to borrowed `vec[..]` occurs here
+ //~^ NOTE assignment to borrowed `vec[_]` occurs here
_a.use_ref();
+ //~^ NOTE borrow later used here
}
}
}
@@ -19,10 +20,11 @@
let vec: &mut [Box<isize>] = &mut vec;
match vec {
&mut [ref _b..] => {
- //~^ borrow of `vec[..]` occurs here
+ //~^ borrow of `vec[_]` occurs here
vec[0] = box 4; //~ ERROR cannot assign
- //~^ assignment to borrowed `vec[..]` occurs here
+ //~^ NOTE assignment to borrowed `vec[_]` occurs here
_b.use_ref();
+ //~^ NOTE borrow later used here
}
}
}
@@ -31,46 +33,57 @@
let mut vec = vec![box 1, box 2, box 3];
let vec: &mut [Box<isize>] = &mut vec;
match vec {
- &mut [_a, //~ ERROR cannot move out
- //~| cannot move out
- //~| to prevent move
+ //~^ ERROR cannot move out
+ //~| NOTE cannot move out
+ &mut [_a,
+ //~^ NOTE data moved here
+ //~| NOTE move occurs because `_a` has type
+ //~| HELP consider removing the `&mut`
..
] => {
- // Note: `_a` is *moved* here, but `b` is borrowing,
- // hence illegal.
- //
- // See comment in middle/borrowck/gather_loans/mod.rs
- // in the case covering these sorts of vectors.
}
_ => {}
}
let a = vec[0]; //~ ERROR cannot move out
- //~| cannot move out of here
+ //~| NOTE cannot move out of here
+ //~| HELP consider borrowing here
}
fn d() {
let mut vec = vec![box 1, box 2, box 3];
let vec: &mut [Box<isize>] = &mut vec;
match vec {
- &mut [ //~ ERROR cannot move out
- //~^ cannot move out
+ //~^ ERROR cannot move out
+ //~| NOTE cannot move out
+ &mut [
+ //~^ HELP consider removing the `&mut`
_b] => {}
+ //~^ NOTE data moved here
+ //~| NOTE move occurs because `_b` has type
_ => {}
}
let a = vec[0]; //~ ERROR cannot move out
- //~| cannot move out of here
+ //~| NOTE cannot move out of here
+ //~| HELP consider borrowing here
}
fn e() {
let mut vec = vec![box 1, box 2, box 3];
let vec: &mut [Box<isize>] = &mut vec;
match vec {
- &mut [_a, _b, _c] => {} //~ ERROR cannot move out
- //~| cannot move out
+ //~^ ERROR cannot move out
+ //~| NOTE cannot move out
+ &mut [_a, _b, _c] => {}
+ //~^ NOTE data moved here
+ //~| NOTE and here
+ //~| NOTE and here
+ //~| HELP consider removing the `&mut`
+ //~| NOTE move occurs because these variables have types
_ => {}
}
let a = vec[0]; //~ ERROR cannot move out
- //~| cannot move out of here
+ //~| NOTE cannot move out of here
+ //~| HELP consider borrowing here
}
fn main() {}
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
index 8f6c31b..78c26ca 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
@@ -1,33 +1,50 @@
-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:10:13
|
LL | [box ref _a, _, _] => {
- | ------ borrow of `vec[..]` occurs here
+ | ------ borrow of `vec[_]` occurs here
LL |
LL | vec[0] = box 4;
- | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here
+ | ^^^^^^ assignment to borrowed `vec[_]` occurs here
+LL |
+LL | _a.use_ref();
+ | -- borrow later used here
-error[E0506]: cannot assign to `vec[..]` because it is borrowed
- --> $DIR/borrowck-vec-pattern-nesting.rs:23:13
+error[E0506]: cannot assign to `vec[_]` because it is borrowed
+ --> $DIR/borrowck-vec-pattern-nesting.rs:24:13
|
LL | &mut [ref _b..] => {
- | ------ borrow of `vec[..]` occurs here
+ | ------ borrow of `vec[_]` occurs here
LL |
LL | vec[0] = box 4;
- | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here
+ | ^^^^^^ assignment to borrowed `vec[_]` occurs here
+LL |
+LL | _b.use_ref();
+ | -- borrow later used here
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:34:14
+ --> $DIR/borrowck-vec-pattern-nesting.rs:35:11
|
-LL | &mut [_a,
- | ^-- hint: to prevent move, use `ref _a` or `ref mut _a`
- | ______________|
- | |
-LL | |
-LL | |
-LL | | ..
-LL | | ] => {
- | |_________^ cannot move out of here
+LL | match vec {
+ | ^^^ cannot move out of here
+...
+LL | &mut [_a,
+ | -- data moved here
+ |
+note: move occurs because `_a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-vec-pattern-nesting.rs:38:15
+ |
+LL | &mut [_a,
+ | ^^
+help: consider removing the `&mut`
+ |
+LL | [_a,
+LL |
+LL |
+LL |
+LL | ..
+LL | ] => {
+ |
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:47:13
@@ -36,47 +53,66 @@
| ^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&vec[0]`
+ | help: consider borrowing here: `&vec[0]`
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:55:14
+ --> $DIR/borrowck-vec-pattern-nesting.rs:55:11
|
-LL | &mut [
- | ______________^
-LL | |
-LL | | _b] => {}
- | |__________--^ cannot move out of here
- | |
- | hint: to prevent move, use `ref _b` or `ref mut _b`
+LL | match vec {
+ | ^^^ cannot move out of here
+...
+LL | _b] => {}
+ | -- data moved here
+ |
+note: move occurs because `_b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-vec-pattern-nesting.rs:60:10
+ |
+LL | _b] => {}
+ | ^^
+help: consider removing the `&mut`
+ |
+LL | [
+LL |
+LL | _b] => {}
+ |
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:60:13
+ --> $DIR/borrowck-vec-pattern-nesting.rs:65:13
|
LL | let a = vec[0];
| ^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&vec[0]`
+ | help: consider borrowing here: `&vec[0]`
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:68:14
+ --> $DIR/borrowck-vec-pattern-nesting.rs:73:11
+ |
+LL | match vec {
+ | ^^^ cannot move out of here
+...
+LL | &mut [_a, _b, _c] => {}
+ | -----------------
+ | | | | |
+ | | | | ...and here
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&mut`: `[_a, _b, _c]`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/borrowck-vec-pattern-nesting.rs:76:15
|
LL | &mut [_a, _b, _c] => {}
- | ^--^^--^^--^
- | || | |
- | || | ...and here (use `ref _c` or `ref mut _c`)
- | || ...and here (use `ref _b` or `ref mut _b`)
- | |hint: to prevent move, use `ref _a` or `ref mut _a`
- | cannot move out of here
+ | ^^ ^^ ^^
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
- --> $DIR/borrowck-vec-pattern-nesting.rs:72:13
+ --> $DIR/borrowck-vec-pattern-nesting.rs:84:13
|
LL | let a = vec[0];
| ^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&vec[0]`
+ | help: consider borrowing here: `&vec[0]`
error: aborting due to 8 previous errors
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr
deleted file mode 100644
index c1290a6..0000000
--- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return value referencing local variable `vec`
- --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:10:5
- |
-LL | let vec: &[isize] = &vec;
- | ---- `vec` is borrowed here
-...
-LL | tail
- | ^^^^ returns a value referencing data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs
index b18052a..e602e75 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs
@@ -2,12 +2,12 @@
fn a<'a>() -> &'a isize {
let vec = vec![1, 2, 3, 4];
- let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough
+ let vec: &[isize] = &vec;
let tail = match vec {
&[_a, ref tail..] => &tail[0],
_ => panic!("foo")
};
- tail
+ tail //~ ERROR cannot return value referencing local variable `vec`
}
fn main() {
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr
index 0a5f773..c1290a6 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr
@@ -1,18 +1,12 @@
-error[E0597]: `vec` does not live long enough
- --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:5:26
+error[E0515]: cannot return value referencing local variable `vec`
+ --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:10:5
|
LL | let vec: &[isize] = &vec;
- | ^^^ borrowed value does not live long enough
+ | ---- `vec` is borrowed here
...
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 3:6...
- --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:3:6
- |
-LL | fn a<'a>() -> &'a isize {
- | ^^
+LL | tail
+ | ^^^^ returns a value referencing data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/borrowck-while-break.nll.stderr b/src/test/ui/borrowck/borrowck-while-break.nll.stderr
deleted file mode 100644
index 0fe3cdc..0000000
--- a/src/test/ui/borrowck/borrowck-while-break.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `v`
- --> $DIR/borrowck-while-break.rs:7:20
- |
-LL | println!("{}", v);
- | ^ use of possibly uninitialized `v`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-while-break.rs b/src/test/ui/borrowck/borrowck-while-break.rs
index 293760e..e16bc58 100644
--- a/src/test/ui/borrowck/borrowck-while-break.rs
+++ b/src/test/ui/borrowck/borrowck-while-break.rs
@@ -4,7 +4,7 @@
v = 3;
break;
}
- println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v`
+ println!("{}", v); //~ ERROR borrow of possibly uninitialized variable: `v`
}
fn main() {
diff --git a/src/test/ui/borrowck/borrowck-while-break.stderr b/src/test/ui/borrowck/borrowck-while-break.stderr
index 55969b8..0fe3cdc 100644
--- a/src/test/ui/borrowck/borrowck-while-break.stderr
+++ b/src/test/ui/borrowck/borrowck-while-break.stderr
@@ -1,4 +1,4 @@
-error[E0381]: use of possibly uninitialized variable: `v`
+error[E0381]: borrow of possibly uninitialized variable: `v`
--> $DIR/borrowck-while-break.rs:7:20
|
LL | println!("{}", v);
diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr b/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr
deleted file mode 100644
index 4b29beb..0000000
--- a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/index-mut-help-with-impl.rs:9:5
- |
-LL | Index::index(&v, 1..2).make_ascii_uppercase();
- | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
- |
- = help: trait `IndexMut` is required to modify indexed content
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.stderr b/src/test/ui/borrowck/index-mut-help-with-impl.stderr
index 6e6efc6..4b29beb 100644
--- a/src/test/ui/borrowck/index-mut-help-with-impl.stderr
+++ b/src/test/ui/borrowck/index-mut-help-with-impl.stderr
@@ -1,8 +1,10 @@
-error[E0596]: cannot borrow immutable borrowed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/index-mut-help-with-impl.rs:9:5
|
LL | Index::index(&v, 1..2).make_ascii_uppercase();
| ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ |
+ = help: trait `IndexMut` is required to modify indexed content
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/index-mut-help.nll.stderr b/src/test/ui/borrowck/index-mut-help.nll.stderr
deleted file mode 100644
index fbc427a..0000000
--- a/src/test/ui/borrowck/index-mut-help.nll.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/index-mut-help.rs:11:5
- |
-LL | map["peter"].clear();
- | ^^^^^^^^^^^^ cannot borrow as mutable
- |
- = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/index-mut-help.rs:12:5
- |
-LL | map["peter"] = "0".to_string();
- | ^^^^^^^^^^^^ cannot assign
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/index-mut-help.rs:13:13
- |
-LL | let _ = &mut map["peter"];
- | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
- |
- = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/index-mut-help.stderr b/src/test/ui/borrowck/index-mut-help.stderr
index 11663fd..fbc427a 100644
--- a/src/test/ui/borrowck/index-mut-help.stderr
+++ b/src/test/ui/borrowck/index-mut-help.stderr
@@ -1,4 +1,4 @@
-error[E0596]: cannot borrow immutable indexed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/index-mut-help.rs:11:5
|
LL | map["peter"].clear();
@@ -6,19 +6,17 @@
|
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
-error[E0594]: cannot assign to immutable indexed content
+error[E0594]: cannot assign to data in a `&` reference
--> $DIR/index-mut-help.rs:12:5
|
LL | map["peter"] = "0".to_string();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
- |
- = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
+ | ^^^^^^^^^^^^ cannot assign
-error[E0596]: cannot borrow immutable indexed content as mutable
- --> $DIR/index-mut-help.rs:13:18
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/index-mut-help.rs:13:13
|
LL | let _ = &mut map["peter"];
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
diff --git a/src/test/ui/borrowck/issue-45983.ast.stderr b/src/test/ui/borrowck/issue-45983.ast.stderr
deleted file mode 100644
index 9cb83c9..0000000
--- a/src/test/ui/borrowck/issue-45983.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error: borrowed data cannot be stored outside of its closure
- --> $DIR/issue-45983.rs:26:27
- |
-LL | let x = None;
- | - borrowed data cannot be stored into here...
-LL | give_any(|y| x = Some(y));
- | --- ^ cannot be stored outside of its closure
- | |
- | ...because it cannot outlive this closure
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/borrowck/issue-45983.migrate.stderr b/src/test/ui/borrowck/issue-45983.migrate.stderr
index 9cb83c9..3a6b2f6 100644
--- a/src/test/ui/borrowck/issue-45983.migrate.stderr
+++ b/src/test/ui/borrowck/issue-45983.migrate.stderr
@@ -1,5 +1,5 @@
error: borrowed data cannot be stored outside of its closure
- --> $DIR/issue-45983.rs:26:27
+ --> $DIR/issue-45983.rs:19:27
|
LL | let x = None;
| - borrowed data cannot be stored into here...
diff --git a/src/test/ui/borrowck/issue-45983.nll.stderr b/src/test/ui/borrowck/issue-45983.nll.stderr
index 3e5ae45..94360b6 100644
--- a/src/test/ui/borrowck/issue-45983.nll.stderr
+++ b/src/test/ui/borrowck/issue-45983.nll.stderr
@@ -1,5 +1,5 @@
error[E0521]: borrowed data escapes outside of closure
- --> $DIR/issue-45983.rs:26:18
+ --> $DIR/issue-45983.rs:19:18
|
LL | let x = None;
| - `x` is declared here, outside of the closure body
@@ -9,7 +9,7 @@
| `y` is a reference that is only valid in the closure body
error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/issue-45983.rs:26:18
+ --> $DIR/issue-45983.rs:19:18
|
LL | let x = None;
| - help: consider changing this to be mutable: `mut x`
diff --git a/src/test/ui/borrowck/issue-45983.rs b/src/test/ui/borrowck/issue-45983.rs
index 4dac67d..a2656f59 100644
--- a/src/test/ui/borrowck/issue-45983.rs
+++ b/src/test/ui/borrowck/issue-45983.rs
@@ -1,21 +1,14 @@
// As documented in Issue #45983, this test is evaluating the quality
// of our diagnostics on erroneous code using higher-ranked closures.
-//
-// However, as documented on Issue #53026, this test also became a
-// prime example of our need to test the NLL migration mode
-// *separately* from the existing test suites that focus solely on
-// AST-borrwock and NLL.
-// revisions: ast migrate nll
+// revisions: migrate nll
// Since we are testing nll (and migration) explicitly as a separate
// revisions, don't worry about the --compare-mode=nll on this test.
// ignore-compare-mode-nll
-//[ast]compile-flags: -Z borrowck=ast
-//[migrate]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows
+//[nll]compile-flags: -Z borrowck=mir
fn give_any<F: for<'r> FnOnce(&'r ())>(f: F) {
f(&());
@@ -24,8 +17,7 @@
fn main() {
let x = None;
give_any(|y| x = Some(y));
- //[ast]~^ ERROR borrowed data cannot be stored outside of its closure
- //[migrate]~^^ ERROR borrowed data cannot be stored outside of its closure
- //[nll]~^^^ ERROR borrowed data escapes outside of closure
+ //[migrate]~^ ERROR borrowed data cannot be stored outside of its closure
+ //[nll]~^^ ERROR borrowed data escapes outside of closure
//[nll]~| ERROR cannot assign to `x`, as it is not declared as mutable
}
diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr
deleted file mode 100644
index eb71ab0..0000000
--- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of static item
- --> $DIR/issue-47215-ice-from-drop-elab.rs:17:21
- |
-LL | let mut x = X;
- | ^
- | |
- | cannot move out of static item
- | help: consider borrowing here: `&X`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.rs b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.rs
index 7477947..48dd14c 100644
--- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.rs
+++ b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.rs
@@ -14,7 +14,7 @@
fn main() {
unsafe {
- let mut x = X; //~ ERROR cannot move out of thread-local static item [E0507]
+ let mut x = X; //~ ERROR cannot move out of static item [E0507]
let _y = x.get_mut();
}
}
diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr
index b09028e..eb71ab0 100644
--- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr
+++ b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr
@@ -1,11 +1,11 @@
-error[E0507]: cannot move out of thread-local static item
+error[E0507]: cannot move out of static item
--> $DIR/issue-47215-ice-from-drop-elab.rs:17:21
|
LL | let mut x = X;
| ^
| |
- | cannot move out of thread-local static item
- | help: consider using a reference instead: `&X`
+ | cannot move out of static item
+ | help: consider borrowing here: `&X`
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/issue-51117.nll.stderr b/src/test/ui/borrowck/issue-51117.nll.stderr
deleted file mode 100644
index f8a9608..0000000
--- a/src/test/ui/borrowck/issue-51117.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0499]: cannot borrow `*bar` as mutable more than once at a time
- --> $DIR/issue-51117.rs:10:13
- |
-LL | Some(baz) => {
- | --- first mutable borrow occurs here
-LL | bar.take();
- | ^^^ second mutable borrow occurs here
-LL | drop(baz);
- | --- first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/issue-51117.stderr b/src/test/ui/borrowck/issue-51117.stderr
index 8f2a786..f8a9608 100644
--- a/src/test/ui/borrowck/issue-51117.stderr
+++ b/src/test/ui/borrowck/issue-51117.stderr
@@ -5,9 +5,8 @@
| --- first mutable borrow occurs here
LL | bar.take();
| ^^^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+LL | drop(baz);
+ | --- first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/issue-51415.nll.stderr b/src/test/ui/borrowck/issue-51415.nll.stderr
deleted file mode 100644
index b025374..0000000
--- a/src/test/ui/borrowck/issue-51415.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-51415.rs:6:42
- |
-LL | let opt = a.iter().enumerate().find(|(_, &s)| {
- | ^^^^^-^
- | | |
- | | data moved here
- | cannot move out of borrowed content
- |
-note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/issue-51415.rs:6:47
- |
-LL | let opt = a.iter().enumerate().find(|(_, &s)| {
- | ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/issue-51415.stderr b/src/test/ui/borrowck/issue-51415.stderr
index 895c35e..b025374 100644
--- a/src/test/ui/borrowck/issue-51415.stderr
+++ b/src/test/ui/borrowck/issue-51415.stderr
@@ -1,11 +1,17 @@
error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-51415.rs:6:46
+ --> $DIR/issue-51415.rs:6:42
|
LL | let opt = a.iter().enumerate().find(|(_, &s)| {
- | ^-
- | ||
- | |hint: to prevent move, use `ref s` or `ref mut s`
- | cannot move out of borrowed content
+ | ^^^^^-^
+ | | |
+ | | data moved here
+ | cannot move out of borrowed content
+ |
+note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/issue-51415.rs:6:47
+ |
+LL | let opt = a.iter().enumerate().find(|(_, &s)| {
+ | ^
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs b/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs
index dcf047c..fc8a075 100644
--- a/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs
+++ b/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs
@@ -2,9 +2,8 @@
// the initial deployment of NLL for the 2018 edition, I forgot to
// turn on two-phase-borrows in addition to `-Z borrowck=migrate`.
-// revisions: ast zflags edition
-//[zflags]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-//[edition]edition:2018
+// revisions: edition2015 edition2018
+//[edition2018]edition:2018
// run-pass
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.ast.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.ast.stderr
deleted file mode 100644
index d72cc20..0000000
--- a/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.ast.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `t.0`
- --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:25:31
- |
-LL | println!("{:?} {:?}", t.0, t.1);
- | ^^^ use of possibly uninitialized `t.0`
-
-error[E0381]: use of possibly uninitialized variable: `t.1`
- --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:25:36
- |
-LL | println!("{:?} {:?}", t.0, t.1);
- | ^^^ use of possibly uninitialized `t.1`
-
-error[E0381]: use of possibly uninitialized variable: `u.0`
- --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:35:31
- |
-LL | println!("{:?} {:?}", u.0, u.1);
- | ^^^ use of possibly uninitialized `u.0`
-
-error[E0381]: use of possibly uninitialized variable: `u.1`
- --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:35:36
- |
-LL | println!("{:?} {:?}", u.0, u.1);
- | ^^^ use of possibly uninitialized `u.1`
-
-error[E0381]: use of possibly uninitialized variable: `v.x`
- --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:45:31
- |
-LL | println!("{:?} {:?}", v.x, v.y);
- | ^^^ use of possibly uninitialized `v.x`
-
-error[E0381]: use of possibly uninitialized variable: `v.y`
- --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:45:36
- |
-LL | println!("{:?} {:?}", v.x, v.y);
- | ^^^ use of possibly uninitialized `v.y`
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.nll.stderr
deleted file mode 100644
index ebc6c7f..0000000
--- a/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0381]: assign to part of possibly uninitialized variable: `t`
- --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:22:9
- |
-LL | t.0 = S(1);
- | ^^^^^^^^^^ use of possibly uninitialized `t`
-
-error[E0381]: assign to part of possibly uninitialized variable: `u`
- --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:32:9
- |
-LL | u.0 = S(1);
- | ^^^^^^^^^^ use of possibly uninitialized `u`
-
-error[E0381]: assign to part of possibly uninitialized variable: `v`
- --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:42:9
- |
-LL | v.x = S(1);
- | ^^^^^^^^^^ use of possibly uninitialized `v`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.rs b/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.rs
index 4358e8e..8d8ac27 100644
--- a/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.rs
+++ b/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.rs
@@ -1,13 +1,3 @@
-// revisions: ast nll
-
-// Since we are testing nll migration explicitly as a separate
-// revision, don't worry about the --compare-mode=nll on this test.
-
-// ignore-compare-mode-nll
-
-//[ast]compile-flags: -Z borrowck=ast
-//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-
#![warn(unused)]
#[derive(Debug)]
struct S(i32);
@@ -20,30 +10,24 @@
{
let mut t: Tuple;
t.0 = S(1);
- //[nll]~^ ERROR assign to part of possibly uninitialized variable: `t` [E0381]
+ //~^ ERROR assign to part of possibly uninitialized variable: `t` [E0381]
t.1 = 2;
println!("{:?} {:?}", t.0, t.1);
- //[ast]~^ ERROR use of possibly uninitialized variable: `t.0` [E0381]
- //[ast]~| ERROR use of possibly uninitialized variable: `t.1` [E0381]
}
{
let mut u: Tpair;
u.0 = S(1);
- //[nll]~^ ERROR assign to part of possibly uninitialized variable: `u` [E0381]
+ //~^ ERROR assign to part of possibly uninitialized variable: `u` [E0381]
u.1 = 2;
println!("{:?} {:?}", u.0, u.1);
- //[ast]~^ ERROR use of possibly uninitialized variable: `u.0` [E0381]
- //[ast]~| ERROR use of possibly uninitialized variable: `u.1` [E0381]
}
{
let mut v: Spair;
v.x = S(1);
- //[nll]~^ ERROR assign to part of possibly uninitialized variable: `v` [E0381]
+ //~^ ERROR assign to part of possibly uninitialized variable: `v` [E0381]
v.y = 2;
println!("{:?} {:?}", v.x, v.y);
- //[ast]~^ ERROR use of possibly uninitialized variable: `v.x` [E0381]
- //[ast]~| ERROR use of possibly uninitialized variable: `v.y` [E0381]
}
}
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.stderr
new file mode 100644
index 0000000..6f18ff1
--- /dev/null
+++ b/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.stderr
@@ -0,0 +1,21 @@
+error[E0381]: assign to part of possibly uninitialized variable: `t`
+ --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:12:9
+ |
+LL | t.0 = S(1);
+ | ^^^^^^^^^^ use of possibly uninitialized `t`
+
+error[E0381]: assign to part of possibly uninitialized variable: `u`
+ --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:20:9
+ |
+LL | u.0 = S(1);
+ | ^^^^^^^^^^ use of possibly uninitialized `u`
+
+error[E0381]: assign to part of possibly uninitialized variable: `v`
+ --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:28:9
+ |
+LL | v.x = S(1);
+ | ^^^^^^^^^^ use of possibly uninitialized `v`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr
deleted file mode 100644
index 4f845d8..0000000
--- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr
+++ /dev/null
@@ -1,69 +0,0 @@
-error[E0382]: use of moved value: `t.0`
- --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:26:31
- |
-LL | drop(t);
- | - value moved here
-...
-LL | println!("{:?} {:?}", t.0, t.1);
- | ^^^ value used here after move
- |
- = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `t.1`
- --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:26:36
- |
-LL | drop(t);
- | - value moved here
-...
-LL | println!("{:?} {:?}", t.0, t.1);
- | ^^^ value used here after move
- |
- = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `u.0`
- --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:37:31
- |
-LL | drop(u);
- | - value moved here
-...
-LL | println!("{:?} {:?}", u.0, u.1);
- | ^^^ value used here after move
- |
- = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `u.1`
- --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:37:36
- |
-LL | drop(u);
- | - value moved here
-...
-LL | println!("{:?} {:?}", u.0, u.1);
- | ^^^ value used here after move
- |
- = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `v.x`
- --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:48:31
- |
-LL | drop(v);
- | - value moved here
-...
-LL | println!("{:?} {:?}", v.x, v.y);
- | ^^^ value used here after move
- |
- = note: move occurs because `v` has type `Spair`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `v.y`
- --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:48:36
- |
-LL | drop(v);
- | - value moved here
-...
-LL | println!("{:?} {:?}", v.x, v.y);
- | ^^^ value used here after move
- |
- = note: move occurs because `v` has type `Spair`, which does not implement the `Copy` trait
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr
deleted file mode 100644
index 42aa038..0000000
--- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0382]: assign to part of moved value: `t`
- --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:23:9
- |
-LL | let mut t: Tuple = (S(0), 0);
- | ----- move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait
-LL | drop(t);
- | - value moved here
-LL | t.0 = S(1);
- | ^^^^^^^^^^ value partially assigned here after move
-
-error[E0382]: assign to part of moved value: `u`
- --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:34:9
- |
-LL | let mut u: Tpair = Tpair(S(0), 0);
- | ----- move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait
-LL | drop(u);
- | - value moved here
-LL | u.0 = S(1);
- | ^^^^^^^^^^ value partially assigned here after move
-
-error[E0382]: assign to part of moved value: `v`
- --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:45:9
- |
-LL | let mut v: Spair = Spair { x: S(0), y: 0 };
- | ----- move occurs because `v` has type `Spair`, which does not implement the `Copy` trait
-LL | drop(v);
- | - value moved here
-LL | v.x = S(1);
- | ^^^^^^^^^^ value partially assigned here after move
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs
index 358a5dd..f7fb2fd 100644
--- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs
+++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs
@@ -1,13 +1,3 @@
-// revisions: ast nll
-
-// Since we are testing nll migration explicitly as a separate
-// revision, don't worry about the --compare-mode=nll on this test.
-
-// ignore-compare-mode-nll
-
-//[ast]compile-flags: -Z borrowck=ast
-//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-
#![warn(unused)]
#[derive(Debug)]
struct S(i32);
@@ -21,32 +11,26 @@
let mut t: Tuple = (S(0), 0);
drop(t);
t.0 = S(1);
- //[nll]~^ ERROR assign to part of moved value
+ //~^ ERROR assign to part of moved value
t.1 = 2;
println!("{:?} {:?}", t.0, t.1);
- //[ast]~^ ERROR use of moved value
- //[ast]~^^ ERROR use of moved value
}
{
let mut u: Tpair = Tpair(S(0), 0);
drop(u);
u.0 = S(1);
- //[nll]~^ ERROR assign to part of moved value
+ //~^ ERROR assign to part of moved value
u.1 = 2;
println!("{:?} {:?}", u.0, u.1);
- //[ast]~^ ERROR use of moved value
- //[ast]~^^ ERROR use of moved value
}
{
let mut v: Spair = Spair { x: S(0), y: 0 };
drop(v);
v.x = S(1);
- //[nll]~^ ERROR assign to part of moved value
+ //~^ ERROR assign to part of moved value
v.y = 2;
println!("{:?} {:?}", v.x, v.y);
- //[ast]~^ ERROR use of moved value
- //[ast]~^^ ERROR use of moved value
}
}
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.stderr
new file mode 100644
index 0000000..b188766
--- /dev/null
+++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.stderr
@@ -0,0 +1,33 @@
+error[E0382]: assign to part of moved value: `t`
+ --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:13:9
+ |
+LL | let mut t: Tuple = (S(0), 0);
+ | ----- move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait
+LL | drop(t);
+ | - value moved here
+LL | t.0 = S(1);
+ | ^^^^^^^^^^ value partially assigned here after move
+
+error[E0382]: assign to part of moved value: `u`
+ --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:22:9
+ |
+LL | let mut u: Tpair = Tpair(S(0), 0);
+ | ----- move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait
+LL | drop(u);
+ | - value moved here
+LL | u.0 = S(1);
+ | ^^^^^^^^^^ value partially assigned here after move
+
+error[E0382]: assign to part of moved value: `v`
+ --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:31:9
+ |
+LL | let mut v: Spair = Spair { x: S(0), y: 0 };
+ | ----- move occurs because `v` has type `Spair`, which does not implement the `Copy` trait
+LL | drop(v);
+ | - value moved here
+LL | v.x = S(1);
+ | ^^^^^^^^^^ value partially assigned here after move
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.ast.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.ast.stderr
deleted file mode 100644
index a9c091d..0000000
--- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.ast.stderr
+++ /dev/null
@@ -1,123 +0,0 @@
-error[E0594]: cannot assign to field `t.0` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:23:9
- |
-LL | let t: Tuple = (S(0), 0);
- | - help: make this binding mutable: `mut t`
-LL | drop(t);
-LL | t.0 = S(1);
- | ^^^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `t.1` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:27:9
- |
-LL | let t: Tuple = (S(0), 0);
- | - help: make this binding mutable: `mut t`
-...
-LL | t.1 = 2;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `u.0` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:38:9
- |
-LL | let u: Tpair = Tpair(S(0), 0);
- | - help: make this binding mutable: `mut u`
-LL | drop(u);
-LL | u.0 = S(1);
- | ^^^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `u.1` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:42:9
- |
-LL | let u: Tpair = Tpair(S(0), 0);
- | - help: make this binding mutable: `mut u`
-...
-LL | u.1 = 2;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `v.x` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:53:9
- |
-LL | let v: Spair = Spair { x: S(0), y: 0 };
- | - help: make this binding mutable: `mut v`
-LL | drop(v);
-LL | v.x = S(1);
- | ^^^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `v.y` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:57:9
- |
-LL | let v: Spair = Spair { x: S(0), y: 0 };
- | - help: make this binding mutable: `mut v`
-...
-LL | v.y = 2;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0382]: use of moved value: `t.0`
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:30:31
- |
-LL | drop(t);
- | - value moved here
-...
-LL | println!("{:?} {:?}", t.0, t.1);
- | ^^^ value used here after move
- |
- = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `t.1`
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:30:36
- |
-LL | drop(t);
- | - value moved here
-...
-LL | println!("{:?} {:?}", t.0, t.1);
- | ^^^ value used here after move
- |
- = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `u.0`
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:45:31
- |
-LL | drop(u);
- | - value moved here
-...
-LL | println!("{:?} {:?}", u.0, u.1);
- | ^^^ value used here after move
- |
- = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `u.1`
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:45:36
- |
-LL | drop(u);
- | - value moved here
-...
-LL | println!("{:?} {:?}", u.0, u.1);
- | ^^^ value used here after move
- |
- = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `v.x`
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:60:31
- |
-LL | drop(v);
- | - value moved here
-...
-LL | println!("{:?} {:?}", v.x, v.y);
- | ^^^ value used here after move
- |
- = note: move occurs because `v` has type `Spair`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `v.y`
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:60:36
- |
-LL | drop(v);
- | - value moved here
-...
-LL | println!("{:?} {:?}", v.x, v.y);
- | ^^^ value used here after move
- |
- = note: move occurs because `v` has type `Spair`, which does not implement the `Copy` trait
-
-error: aborting due to 12 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr
deleted file mode 100644
index ec150c5..0000000
--- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr
+++ /dev/null
@@ -1,87 +0,0 @@
-error[E0594]: cannot assign to `t.0`, as `t` is not declared as mutable
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:23:9
- |
-LL | let t: Tuple = (S(0), 0);
- | - help: consider changing this to be mutable: `mut t`
-LL | drop(t);
-LL | t.0 = S(1);
- | ^^^^^^^^^^ cannot assign
-
-error[E0382]: assign to part of moved value: `t`
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:23:9
- |
-LL | let t: Tuple = (S(0), 0);
- | - move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait
-LL | drop(t);
- | - value moved here
-LL | t.0 = S(1);
- | ^^^^^^^^^^ value partially assigned here after move
-
-error[E0594]: cannot assign to `t.1`, as `t` is not declared as mutable
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:27:9
- |
-LL | let t: Tuple = (S(0), 0);
- | - help: consider changing this to be mutable: `mut t`
-...
-LL | t.1 = 2;
- | ^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `u.0`, as `u` is not declared as mutable
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:38:9
- |
-LL | let u: Tpair = Tpair(S(0), 0);
- | - help: consider changing this to be mutable: `mut u`
-LL | drop(u);
-LL | u.0 = S(1);
- | ^^^^^^^^^^ cannot assign
-
-error[E0382]: assign to part of moved value: `u`
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:38:9
- |
-LL | let u: Tpair = Tpair(S(0), 0);
- | - move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait
-LL | drop(u);
- | - value moved here
-LL | u.0 = S(1);
- | ^^^^^^^^^^ value partially assigned here after move
-
-error[E0594]: cannot assign to `u.1`, as `u` is not declared as mutable
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:42:9
- |
-LL | let u: Tpair = Tpair(S(0), 0);
- | - help: consider changing this to be mutable: `mut u`
-...
-LL | u.1 = 2;
- | ^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `v.x`, as `v` is not declared as mutable
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:53:9
- |
-LL | let v: Spair = Spair { x: S(0), y: 0 };
- | - help: consider changing this to be mutable: `mut v`
-LL | drop(v);
-LL | v.x = S(1);
- | ^^^^^^^^^^ cannot assign
-
-error[E0382]: assign to part of moved value: `v`
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:53:9
- |
-LL | let v: Spair = Spair { x: S(0), y: 0 };
- | - move occurs because `v` has type `Spair`, which does not implement the `Copy` trait
-LL | drop(v);
- | - value moved here
-LL | v.x = S(1);
- | ^^^^^^^^^^ value partially assigned here after move
-
-error[E0594]: cannot assign to `v.y`, as `v` is not declared as mutable
- --> $DIR/issue-54499-field-mutation-of-moved-out.rs:57:9
- |
-LL | let v: Spair = Spair { x: S(0), y: 0 };
- | - help: consider changing this to be mutable: `mut v`
-...
-LL | v.y = 2;
- | ^^^^^^^ cannot assign
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.rs b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.rs
index b19dcd6..498ca01 100644
--- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.rs
+++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.rs
@@ -1,13 +1,3 @@
-// revisions: ast nll
-
-// Since we are testing nll migration explicitly as a separate
-// revision, don't worry about the --compare-mode=nll on this test.
-
-// ignore-compare-mode-nll
-
-//[ast]compile-flags: -Z borrowck=ast
-//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-
#![warn(unused)]
#[derive(Debug)]
struct S(i32);
@@ -21,44 +11,32 @@
let t: Tuple = (S(0), 0);
drop(t);
t.0 = S(1);
- //[ast]~^ ERROR cannot assign to field `t.0` of immutable binding [E0594]
- //[nll]~^^ ERROR assign to part of moved value: `t` [E0382]
- //[nll]~| ERROR cannot assign to `t.0`, as `t` is not declared as mutable [E0594]
+ //~^ ERROR assign to part of moved value: `t` [E0382]
+ //~| ERROR cannot assign to `t.0`, as `t` is not declared as mutable [E0594]
t.1 = 2;
- //[ast]~^ ERROR cannot assign to field `t.1` of immutable binding [E0594]
- //[nll]~^^ ERROR cannot assign to `t.1`, as `t` is not declared as mutable [E0594]
+ //~^ ERROR cannot assign to `t.1`, as `t` is not declared as mutable [E0594]
println!("{:?} {:?}", t.0, t.1);
- //[ast]~^ ERROR use of moved value: `t.0` [E0382]
- //[ast]~| ERROR use of moved value: `t.1` [E0382]
}
{
let u: Tpair = Tpair(S(0), 0);
drop(u);
u.0 = S(1);
- //[ast]~^ ERROR cannot assign to field `u.0` of immutable binding [E0594]
- //[nll]~^^ ERROR assign to part of moved value: `u` [E0382]
- //[nll]~| ERROR cannot assign to `u.0`, as `u` is not declared as mutable [E0594]
+ //~^ ERROR assign to part of moved value: `u` [E0382]
+ //~| ERROR cannot assign to `u.0`, as `u` is not declared as mutable [E0594]
u.1 = 2;
- //[ast]~^ ERROR cannot assign to field `u.1` of immutable binding [E0594]
- //[nll]~^^ ERROR cannot assign to `u.1`, as `u` is not declared as mutable [E0594]
+ //~^ ERROR cannot assign to `u.1`, as `u` is not declared as mutable [E0594]
println!("{:?} {:?}", u.0, u.1);
- //[ast]~^ ERROR use of moved value: `u.0` [E0382]
- //[ast]~| ERROR use of moved value: `u.1` [E0382]
}
{
let v: Spair = Spair { x: S(0), y: 0 };
drop(v);
v.x = S(1);
- //[ast]~^ ERROR cannot assign to field `v.x` of immutable binding [E0594]
- //[nll]~^^ ERROR assign to part of moved value: `v` [E0382]
- //[nll]~| ERROR cannot assign to `v.x`, as `v` is not declared as mutable [E0594]
+ //~^ ERROR assign to part of moved value: `v` [E0382]
+ //~| ERROR cannot assign to `v.x`, as `v` is not declared as mutable [E0594]
v.y = 2;
- //[ast]~^ ERROR cannot assign to field `v.y` of immutable binding [E0594]
- //[nll]~^^ ERROR cannot assign to `v.y`, as `v` is not declared as mutable [E0594]
+ //~^ ERROR cannot assign to `v.y`, as `v` is not declared as mutable [E0594]
println!("{:?} {:?}", v.x, v.y);
- //[ast]~^ ERROR use of moved value: `v.x` [E0382]
- //[ast]~| ERROR use of moved value: `v.y` [E0382]
}
}
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.stderr
new file mode 100644
index 0000000..7dfd71c
--- /dev/null
+++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.stderr
@@ -0,0 +1,87 @@
+error[E0594]: cannot assign to `t.0`, as `t` is not declared as mutable
+ --> $DIR/issue-54499-field-mutation-of-moved-out.rs:13:9
+ |
+LL | let t: Tuple = (S(0), 0);
+ | - help: consider changing this to be mutable: `mut t`
+LL | drop(t);
+LL | t.0 = S(1);
+ | ^^^^^^^^^^ cannot assign
+
+error[E0382]: assign to part of moved value: `t`
+ --> $DIR/issue-54499-field-mutation-of-moved-out.rs:13:9
+ |
+LL | let t: Tuple = (S(0), 0);
+ | - move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait
+LL | drop(t);
+ | - value moved here
+LL | t.0 = S(1);
+ | ^^^^^^^^^^ value partially assigned here after move
+
+error[E0594]: cannot assign to `t.1`, as `t` is not declared as mutable
+ --> $DIR/issue-54499-field-mutation-of-moved-out.rs:16:9
+ |
+LL | let t: Tuple = (S(0), 0);
+ | - help: consider changing this to be mutable: `mut t`
+...
+LL | t.1 = 2;
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `u.0`, as `u` is not declared as mutable
+ --> $DIR/issue-54499-field-mutation-of-moved-out.rs:24:9
+ |
+LL | let u: Tpair = Tpair(S(0), 0);
+ | - help: consider changing this to be mutable: `mut u`
+LL | drop(u);
+LL | u.0 = S(1);
+ | ^^^^^^^^^^ cannot assign
+
+error[E0382]: assign to part of moved value: `u`
+ --> $DIR/issue-54499-field-mutation-of-moved-out.rs:24:9
+ |
+LL | let u: Tpair = Tpair(S(0), 0);
+ | - move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait
+LL | drop(u);
+ | - value moved here
+LL | u.0 = S(1);
+ | ^^^^^^^^^^ value partially assigned here after move
+
+error[E0594]: cannot assign to `u.1`, as `u` is not declared as mutable
+ --> $DIR/issue-54499-field-mutation-of-moved-out.rs:27:9
+ |
+LL | let u: Tpair = Tpair(S(0), 0);
+ | - help: consider changing this to be mutable: `mut u`
+...
+LL | u.1 = 2;
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `v.x`, as `v` is not declared as mutable
+ --> $DIR/issue-54499-field-mutation-of-moved-out.rs:35:9
+ |
+LL | let v: Spair = Spair { x: S(0), y: 0 };
+ | - help: consider changing this to be mutable: `mut v`
+LL | drop(v);
+LL | v.x = S(1);
+ | ^^^^^^^^^^ cannot assign
+
+error[E0382]: assign to part of moved value: `v`
+ --> $DIR/issue-54499-field-mutation-of-moved-out.rs:35:9
+ |
+LL | let v: Spair = Spair { x: S(0), y: 0 };
+ | - move occurs because `v` has type `Spair`, which does not implement the `Copy` trait
+LL | drop(v);
+ | - value moved here
+LL | v.x = S(1);
+ | ^^^^^^^^^^ value partially assigned here after move
+
+error[E0594]: cannot assign to `v.y`, as `v` is not declared as mutable
+ --> $DIR/issue-54499-field-mutation-of-moved-out.rs:38:9
+ |
+LL | let v: Spair = Spair { x: S(0), y: 0 };
+ | - help: consider changing this to be mutable: `mut v`
+...
+LL | v.y = 2;
+ | ^^^^^^^ cannot assign
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.ast.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.ast.stderr
deleted file mode 100644
index 36e2007..0000000
--- a/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.ast.stderr
+++ /dev/null
@@ -1,90 +0,0 @@
-error[E0594]: cannot assign to field `t.0` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:22:9
- |
-LL | let t: Tuple;
- | - help: make this binding mutable: `mut t`
-LL | t.0 = S(1);
- | ^^^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `t.1` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:25:9
- |
-LL | let t: Tuple;
- | - help: make this binding mutable: `mut t`
-...
-LL | t.1 = 2;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `u.0` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:34:9
- |
-LL | let u: Tpair;
- | - help: make this binding mutable: `mut u`
-LL | u.0 = S(1);
- | ^^^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `u.1` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:37:9
- |
-LL | let u: Tpair;
- | - help: make this binding mutable: `mut u`
-...
-LL | u.1 = 2;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `v.x` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:46:9
- |
-LL | let v: Spair;
- | - help: make this binding mutable: `mut v`
-LL | v.x = S(1);
- | ^^^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to field `v.y` of immutable binding
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:49:9
- |
-LL | let v: Spair;
- | - help: make this binding mutable: `mut v`
-...
-LL | v.y = 2;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0381]: use of possibly uninitialized variable: `t.0`
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:27:31
- |
-LL | println!("{:?} {:?}", t.0, t.1);
- | ^^^ use of possibly uninitialized `t.0`
-
-error[E0381]: use of possibly uninitialized variable: `t.1`
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:27:36
- |
-LL | println!("{:?} {:?}", t.0, t.1);
- | ^^^ use of possibly uninitialized `t.1`
-
-error[E0381]: use of possibly uninitialized variable: `u.0`
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:39:31
- |
-LL | println!("{:?} {:?}", u.0, u.1);
- | ^^^ use of possibly uninitialized `u.0`
-
-error[E0381]: use of possibly uninitialized variable: `u.1`
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:39:36
- |
-LL | println!("{:?} {:?}", u.0, u.1);
- | ^^^ use of possibly uninitialized `u.1`
-
-error[E0381]: use of possibly uninitialized variable: `v.x`
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:51:31
- |
-LL | println!("{:?} {:?}", v.x, v.y);
- | ^^^ use of possibly uninitialized `v.x`
-
-error[E0381]: use of possibly uninitialized variable: `v.y`
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:51:36
- |
-LL | println!("{:?} {:?}", v.x, v.y);
- | ^^^ use of possibly uninitialized `v.y`
-
-error: aborting due to 12 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.nll.stderr
deleted file mode 100644
index 3dc2b5b..0000000
--- a/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0381]: assign to part of possibly uninitialized variable: `t`
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:22:9
- |
-LL | t.0 = S(1);
- | ^^^^^^^^^^ use of possibly uninitialized `t`
-
-error[E0381]: assign to part of possibly uninitialized variable: `u`
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:34:9
- |
-LL | u.0 = S(1);
- | ^^^^^^^^^^ use of possibly uninitialized `u`
-
-error[E0381]: assign to part of possibly uninitialized variable: `v`
- --> $DIR/issue-54499-field-mutation-of-never-init.rs:46:9
- |
-LL | v.x = S(1);
- | ^^^^^^^^^^ use of possibly uninitialized `v`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.rs b/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.rs
index 03eb962..1a1b376 100644
--- a/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.rs
+++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.rs
@@ -1,13 +1,3 @@
-// revisions: ast nll
-
-// Since we are testing nll migration explicitly as a separate
-// revision, don't worry about the --compare-mode=nll on this test.
-
-// ignore-compare-mode-nll
-
-//[ast]compile-flags: -Z borrowck=ast
-//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-
#![warn(unused)]
#[derive(Debug)]
struct S(i32);
@@ -20,36 +10,24 @@
{
let t: Tuple;
t.0 = S(1);
- //[ast]~^ ERROR cannot assign to field `t.0` of immutable binding [E0594]
- //[nll]~^^ ERROR assign to part of possibly uninitialized variable: `t` [E0381]
+ //~^ ERROR assign to part of possibly uninitialized variable: `t` [E0381]
t.1 = 2;
- //[ast]~^ ERROR cannot assign to field `t.1` of immutable binding [E0594]
println!("{:?} {:?}", t.0, t.1);
- //[ast]~^ ERROR use of possibly uninitialized variable: `t.0` [E0381]
- //[ast]~| ERROR use of possibly uninitialized variable: `t.1` [E0381]
}
{
let u: Tpair;
u.0 = S(1);
- //[ast]~^ ERROR cannot assign to field `u.0` of immutable binding [E0594]
- //[nll]~^^ ERROR assign to part of possibly uninitialized variable: `u` [E0381]
+ //~^ ERROR assign to part of possibly uninitialized variable: `u` [E0381]
u.1 = 2;
- //[ast]~^ ERROR cannot assign to field `u.1` of immutable binding [E0594]
println!("{:?} {:?}", u.0, u.1);
- //[ast]~^ ERROR use of possibly uninitialized variable: `u.0` [E0381]
- //[ast]~| ERROR use of possibly uninitialized variable: `u.1` [E0381]
}
{
let v: Spair;
v.x = S(1);
- //[ast]~^ ERROR cannot assign to field `v.x` of immutable binding [E0594]
- //[nll]~^^ ERROR assign to part of possibly uninitialized variable: `v` [E0381]
+ //~^ ERROR assign to part of possibly uninitialized variable: `v` [E0381]
v.y = 2;
- //[ast]~^ ERROR cannot assign to field `v.y` of immutable binding [E0594]
println!("{:?} {:?}", v.x, v.y);
- //[ast]~^ ERROR use of possibly uninitialized variable: `v.x` [E0381]
- //[ast]~| ERROR use of possibly uninitialized variable: `v.y` [E0381]
}
}
diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.stderr
new file mode 100644
index 0000000..68873ac
--- /dev/null
+++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.stderr
@@ -0,0 +1,21 @@
+error[E0381]: assign to part of possibly uninitialized variable: `t`
+ --> $DIR/issue-54499-field-mutation-of-never-init.rs:12:9
+ |
+LL | t.0 = S(1);
+ | ^^^^^^^^^^ use of possibly uninitialized `t`
+
+error[E0381]: assign to part of possibly uninitialized variable: `u`
+ --> $DIR/issue-54499-field-mutation-of-never-init.rs:20:9
+ |
+LL | u.0 = S(1);
+ | ^^^^^^^^^^ use of possibly uninitialized `u`
+
+error[E0381]: assign to part of possibly uninitialized variable: `v`
+ --> $DIR/issue-54499-field-mutation-of-never-init.rs:28:9
+ |
+LL | v.x = S(1);
+ | ^^^^^^^^^^ use of possibly uninitialized `v`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr
deleted file mode 100644
index f3e9ce3..0000000
--- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr
+++ /dev/null
@@ -1,55 +0,0 @@
-error[E0595]: closure cannot assign to immutable argument `x`
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:22
- |
-LL | let mut c1 = |y: &'static mut isize| x = y;
- | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably
-help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
- |
-LL | x
- |
-
-error[E0595]: closure cannot assign to immutable argument `x`
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:32:22
- |
-LL | let mut c1 = |z: &'static mut isize| {
- | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably
-help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
- |
-LL | x
- |
-
-error[E0595]: closure cannot assign to immutable argument `x`
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9
- |
-LL | pub fn capture_assign_whole(x: (i32,)) {
- | - help: make this binding mutable: `mut x`
-LL | || { x = (1,); };
- | ^^ cannot borrow mutably
-
-error[E0595]: closure cannot assign to immutable argument `x`
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:9
- |
-LL | pub fn capture_assign_part(x: (i32,)) {
- | - help: make this binding mutable: `mut x`
-LL | || { x.0 = 1; };
- | ^^ cannot borrow mutably
-
-error[E0595]: closure cannot assign to immutable argument `x`
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:9
- |
-LL | pub fn capture_reborrow_whole(x: (i32,)) {
- | - help: make this binding mutable: `mut x`
-LL | || { &mut x; };
- | ^^ cannot borrow mutably
-
-error[E0595]: closure cannot assign to immutable argument `x`
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:9
- |
-LL | pub fn capture_reborrow_part(x: (i32,)) {
- | - help: make this binding mutable: `mut x`
-LL | || { &mut x.0; };
- | ^^ cannot borrow mutably
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0595`.
diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr
index 26efff2..f1d28ee 100644
--- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr
+++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr
@@ -1,5 +1,5 @@
error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:46
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:19:46
|
LL | pub fn e(x: &'static mut isize) {
| - help: consider changing this to be mutable: `mut x`
@@ -8,7 +8,7 @@
| ^^^^^ cannot assign
error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:34:50
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50
|
LL | pub fn ee(x: &'static mut isize) {
| - help: consider changing this to be mutable: `mut x`
@@ -17,7 +17,7 @@
| ^^^^^ cannot assign
error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:42:14
|
LL | pub fn capture_assign_whole(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
@@ -25,7 +25,7 @@
| ^^^^^^^^ cannot assign
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:47:14
|
LL | pub fn capture_assign_part(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
@@ -33,7 +33,7 @@
| ^^^^^^^ cannot assign
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:14
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14
|
LL | pub fn capture_reborrow_whole(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
@@ -41,7 +41,7 @@
| ^^^^^^ cannot borrow as mutable
error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:14
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:57:14
|
LL | pub fn capture_reborrow_part(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr
index 26efff2..f1d28ee 100644
--- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr
+++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr
@@ -1,5 +1,5 @@
error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:46
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:19:46
|
LL | pub fn e(x: &'static mut isize) {
| - help: consider changing this to be mutable: `mut x`
@@ -8,7 +8,7 @@
| ^^^^^ cannot assign
error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:34:50
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50
|
LL | pub fn ee(x: &'static mut isize) {
| - help: consider changing this to be mutable: `mut x`
@@ -17,7 +17,7 @@
| ^^^^^ cannot assign
error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:42:14
|
LL | pub fn capture_assign_whole(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
@@ -25,7 +25,7 @@
| ^^^^^^^^ cannot assign
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:47:14
|
LL | pub fn capture_assign_part(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
@@ -33,7 +33,7 @@
| ^^^^^^^ cannot assign
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:14
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14
|
LL | pub fn capture_reborrow_whole(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
@@ -41,7 +41,7 @@
| ^^^^^^ cannot borrow as mutable
error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
- --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:14
+ --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:57:14
|
LL | pub fn capture_reborrow_part(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs
index 2bd71ec..751a911 100644
--- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs
+++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs
@@ -2,16 +2,14 @@
// analysis of a closure body may only be caught when AST-borrowck
// looks at some parent.
-// revisions: ast migrate nll
+// revisions: migrate nll
// Since we are testing nll (and migration) explicitly as a separate
// revisions, don't worry about the --compare-mode=nll on this test.
// ignore-compare-mode-nll
-//[ast]compile-flags: -Z borrowck=ast
-//[migrate]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows
+//[nll]compile-flags: -Z borrowck=mir
// transcribed from borrowck-closures-unique.rs
@@ -21,7 +19,6 @@
let mut c1 = |y: &'static mut isize| x = y;
//[migrate]~^ ERROR is not declared as mutable
//[nll]~^^ ERROR is not declared as mutable
- //[ast]~^^^ closure cannot assign to immutable
unsafe { c1(&mut Y); }
}
}
@@ -30,7 +27,6 @@
pub fn ee(x: &'static mut isize) {
static mut Z: isize = 3;
let mut c1 = |z: &'static mut isize| {
- //[ast]~^ closure cannot assign to immutable
let mut c2 = |y: &'static mut isize| x = y;
//[migrate]~^ ERROR is not declared as mutable
//[nll]~^^ ERROR is not declared as mutable
@@ -44,27 +40,23 @@
mod mutability_errors {
pub fn capture_assign_whole(x: (i32,)) {
|| { x = (1,); };
- //[ast]~^ ERROR immutable argument
- //[migrate]~^^ ERROR is not declared as mutable
- //[nll]~^^^ ERROR is not declared as mutable
+ //[migrate]~^ ERROR is not declared as mutable
+ //[nll]~^^ ERROR is not declared as mutable
}
pub fn capture_assign_part(x: (i32,)) {
|| { x.0 = 1; };
- //[ast]~^ ERROR immutable argument
- //[migrate]~^^ ERROR is not declared as mutable
- //[nll]~^^^ ERROR is not declared as mutable
+ //[migrate]~^ ERROR is not declared as mutable
+ //[nll]~^^ ERROR is not declared as mutable
}
pub fn capture_reborrow_whole(x: (i32,)) {
|| { &mut x; };
- //[ast]~^ ERROR immutable argument
- //[migrate]~^^ ERROR is not declared as mutable
- //[nll]~^^^ ERROR is not declared as mutable
+ //[migrate]~^ ERROR is not declared as mutable
+ //[nll]~^^ ERROR is not declared as mutable
}
pub fn capture_reborrow_part(x: (i32,)) {
|| { &mut x.0; };
- //[ast]~^ ERROR immutable argument
- //[migrate]~^^ ERROR is not declared as mutable
- //[nll]~^^^ ERROR is not declared as mutable
+ //[migrate]~^ ERROR is not declared as mutable
+ //[nll]~^^ ERROR is not declared as mutable
}
}
diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr
deleted file mode 100644
index 9e0b0aa..0000000
--- a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0597]: `**greeting` does not live long enough
- --> $DIR/issue-58776-borrowck-scans-children.rs:10:24
- |
-LL | let res = (|| (|| &greeting)())();
- | -- ^^^^^^^^ - borrowed value only lives until here
- | | |
- | | borrowed value does not live long enough
- | capture occurs here
-...
-LL | }
- | - borrowed value needs to live until here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr
index 1c227b5..efd4e1a 100644
--- a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr
+++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr
@@ -1,11 +1,11 @@
error[E0506]: cannot assign to `greeting` because it is borrowed
- --> $DIR/issue-58776-borrowck-scans-children.rs:13:5
+ --> $DIR/issue-58776-borrowck-scans-children.rs:11:5
|
LL | let res = (|| (|| &greeting)())();
| -- -------- borrow occurs due to use in closure
| |
| borrow of `greeting` occurs here
-...
+LL |
LL | greeting = "DEALLOCATED".to_string();
| ^^^^^^^^ assignment to borrowed `greeting` occurs here
...
@@ -13,7 +13,7 @@
| --- borrow later used here
error[E0505]: cannot move out of `greeting` because it is borrowed
- --> $DIR/issue-58776-borrowck-scans-children.rs:16:10
+ --> $DIR/issue-58776-borrowck-scans-children.rs:14:10
|
LL | let res = (|| (|| &greeting)())();
| -- -------- borrow occurs due to use in closure
diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr
index 1c227b5..efd4e1a 100644
--- a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr
+++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr
@@ -1,11 +1,11 @@
error[E0506]: cannot assign to `greeting` because it is borrowed
- --> $DIR/issue-58776-borrowck-scans-children.rs:13:5
+ --> $DIR/issue-58776-borrowck-scans-children.rs:11:5
|
LL | let res = (|| (|| &greeting)())();
| -- -------- borrow occurs due to use in closure
| |
| borrow of `greeting` occurs here
-...
+LL |
LL | greeting = "DEALLOCATED".to_string();
| ^^^^^^^^ assignment to borrowed `greeting` occurs here
...
@@ -13,7 +13,7 @@
| --- borrow later used here
error[E0505]: cannot move out of `greeting` because it is borrowed
- --> $DIR/issue-58776-borrowck-scans-children.rs:16:10
+ --> $DIR/issue-58776-borrowck-scans-children.rs:14:10
|
LL | let res = (|| (|| &greeting)())();
| -- -------- borrow occurs due to use in closure
diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs
index 378969f..0f3f1a6 100644
--- a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs
+++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs
@@ -1,14 +1,12 @@
// ignore-compare-mode-nll
-// revisions: ast migrate nll
+// revisions: migrate nll
-//[migrate]compile-flags: -Z borrowck=migrate
#![cfg_attr(nll, feature(nll))]
fn main() {
let mut greeting = "Hello world!".to_string();
let res = (|| (|| &greeting)())();
- //[ast]~^ ERROR does not live long enough
greeting = "DEALLOCATED".to_string();
//[migrate]~^ ERROR cannot assign
diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr
deleted file mode 100644
index 14078b7..0000000
--- a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/move-in-static-initializer-issue-38520.rs:15:23
- |
-LL | static Y: usize = get(*&X);
- | ^^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/move-in-static-initializer-issue-38520.rs:17:22
- |
-LL | const Z: usize = get(*&X);
- | ^^^ cannot move out of borrowed content
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr
deleted file mode 100644
index 14078b7..0000000
--- a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/move-in-static-initializer-issue-38520.rs:15:23
- |
-LL | static Y: usize = get(*&X);
- | ^^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/move-in-static-initializer-issue-38520.rs:17:22
- |
-LL | const Z: usize = get(*&X);
- | ^^^ cannot move out of borrowed content
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs
index a7b17f7..c2a59a1 100644
--- a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs
+++ b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
// Regression test for #38520. Check that moves of `Foo` are not
// permitted as `Foo` is not copy (even in a static/const
// initializer).
@@ -12,10 +9,8 @@
}
const X: Foo = Foo(22);
-static Y: usize = get(*&X); //[ast]~ ERROR E0507
- //[mir]~^ ERROR [E0507]
-const Z: usize = get(*&X); //[ast]~ ERROR E0507
- //[mir]~^ ERROR [E0507]
+static Y: usize = get(*&X); //~ ERROR [E0507]
+const Z: usize = get(*&X); //~ ERROR [E0507]
fn main() {
}
diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.stderr
new file mode 100644
index 0000000..9dcefac
--- /dev/null
+++ b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.stderr
@@ -0,0 +1,15 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/move-in-static-initializer-issue-38520.rs:12:23
+ |
+LL | static Y: usize = get(*&X);
+ | ^^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/move-in-static-initializer-issue-38520.rs:13:22
+ |
+LL | const Z: usize = get(*&X);
+ | ^^^ cannot move out of borrowed content
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr
deleted file mode 100644
index eda2f51..0000000
--- a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0499]: cannot borrow `*arg` as mutable more than once at a time
- --> $DIR/mut-borrow-in-loop.rs:10:25
- |
-LL | impl<'a, T : 'a> FuncWrapper<'a, T> {
- | -- lifetime `'a` defined here
-...
-LL | (self.func)(arg)
- | ------------^^^-
- | | |
- | | mutable borrow starts here in previous iteration of loop
- | argument requires that `*arg` is borrowed for `'a`
-
-error[E0499]: cannot borrow `*arg` as mutable more than once at a time
- --> $DIR/mut-borrow-in-loop.rs:16:25
- |
-LL | impl<'a, T : 'a> FuncWrapper<'a, T> {
- | -- lifetime `'a` defined here
-...
-LL | (self.func)(arg)
- | ------------^^^-
- | | |
- | | mutable borrow starts here in previous iteration of loop
- | argument requires that `*arg` is borrowed for `'a`
-
-error[E0499]: cannot borrow `*arg` as mutable more than once at a time
- --> $DIR/mut-borrow-in-loop.rs:23:25
- |
-LL | impl<'a, T : 'a> FuncWrapper<'a, T> {
- | -- lifetime `'a` defined here
-...
-LL | (self.func)(arg)
- | ------------^^^-
- | | |
- | | mutable borrow starts here in previous iteration of loop
- | argument requires that `*arg` is borrowed for `'a`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.stderr
index 478d586..eda2f51 100644
--- a/src/test/ui/borrowck/mut-borrow-in-loop.stderr
+++ b/src/test/ui/borrowck/mut-borrow-in-loop.stderr
@@ -1,29 +1,38 @@
error[E0499]: cannot borrow `*arg` as mutable more than once at a time
--> $DIR/mut-borrow-in-loop.rs:10:25
|
+LL | impl<'a, T : 'a> FuncWrapper<'a, T> {
+ | -- lifetime `'a` defined here
+...
LL | (self.func)(arg)
- | ^^^ mutable borrow starts here in previous iteration of loop
-LL | }
-LL | }
- | - mutable borrow ends here
+ | ------------^^^-
+ | | |
+ | | mutable borrow starts here in previous iteration of loop
+ | argument requires that `*arg` is borrowed for `'a`
error[E0499]: cannot borrow `*arg` as mutable more than once at a time
--> $DIR/mut-borrow-in-loop.rs:16:25
|
+LL | impl<'a, T : 'a> FuncWrapper<'a, T> {
+ | -- lifetime `'a` defined here
+...
LL | (self.func)(arg)
- | ^^^ mutable borrow starts here in previous iteration of loop
-LL | }
-LL | }
- | - mutable borrow ends here
+ | ------------^^^-
+ | | |
+ | | mutable borrow starts here in previous iteration of loop
+ | argument requires that `*arg` is borrowed for `'a`
error[E0499]: cannot borrow `*arg` as mutable more than once at a time
--> $DIR/mut-borrow-in-loop.rs:23:25
|
+LL | impl<'a, T : 'a> FuncWrapper<'a, T> {
+ | -- lifetime `'a` defined here
+...
LL | (self.func)(arg)
- | ^^^ mutable borrow starts here in previous iteration of loop
-LL | }
-LL | }
- | - mutable borrow ends here
+ | ------------^^^-
+ | | |
+ | | mutable borrow starts here in previous iteration of loop
+ | argument requires that `*arg` is borrowed for `'a`
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr
deleted file mode 100644
index 09dabbc..0000000
--- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
- --> $DIR/mut-borrow-of-mut-ref.rs:8:7
- |
-LL | fn f(b: &mut i32) {
- | - help: consider changing this to be mutable: `mut b`
-LL | g(&mut b)
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr
index 4653c35..09dabbc 100644
--- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr
+++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr
@@ -1,12 +1,10 @@
-error[E0596]: cannot borrow immutable argument `b` as mutable
- --> $DIR/mut-borrow-of-mut-ref.rs:8:12
+error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
+ --> $DIR/mut-borrow-of-mut-ref.rs:8:7
|
+LL | fn f(b: &mut i32) {
+ | - help: consider changing this to be mutable: `mut b`
LL | g(&mut b)
- | ^ cannot borrow mutably
-help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
- |
-LL | g(b)
- | ^
+ | ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr
deleted file mode 100644
index 4fcb693..0000000
--- a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0499]: cannot borrow `void` as mutable more than once at a time
- --> $DIR/mut-borrow-outside-loop.rs:7:18
- |
-LL | let first = &mut void;
- | --------- first mutable borrow occurs here
-LL | let second = &mut void;
- | ^^^^^^^^^ second mutable borrow occurs here
-LL | first.use_mut();
- | ----- first borrow later used here
-
-error[E0499]: cannot borrow `inner_void` as mutable more than once at a time
- --> $DIR/mut-borrow-outside-loop.rs:15:28
- |
-LL | let inner_first = &mut inner_void;
- | --------------- first mutable borrow occurs here
-LL | let inner_second = &mut inner_void;
- | ^^^^^^^^^^^^^^^ second mutable borrow occurs here
-LL | inner_second.use_mut();
-LL | inner_first.use_mut();
- | ----------- first borrow later used here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr
index 45db962..4fcb693 100644
--- a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr
+++ b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr
@@ -1,24 +1,23 @@
error[E0499]: cannot borrow `void` as mutable more than once at a time
- --> $DIR/mut-borrow-outside-loop.rs:7:23
+ --> $DIR/mut-borrow-outside-loop.rs:7:18
|
LL | let first = &mut void;
- | ---- first mutable borrow occurs here
+ | --------- first mutable borrow occurs here
LL | let second = &mut void;
- | ^^^^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+ | ^^^^^^^^^ second mutable borrow occurs here
+LL | first.use_mut();
+ | ----- first borrow later used here
error[E0499]: cannot borrow `inner_void` as mutable more than once at a time
- --> $DIR/mut-borrow-outside-loop.rs:15:33
+ --> $DIR/mut-borrow-outside-loop.rs:15:28
|
LL | let inner_first = &mut inner_void;
- | ---------- first mutable borrow occurs here
+ | --------------- first mutable borrow occurs here
LL | let inner_second = &mut inner_void;
- | ^^^^^^^^^^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+ | ^^^^^^^^^^^^^^^ second mutable borrow occurs here
+LL | inner_second.use_mut();
+LL | inner_first.use_mut();
+ | ----------- first borrow later used here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/mutability-errors.nll.stderr b/src/test/ui/borrowck/mutability-errors.nll.stderr
deleted file mode 100644
index 545de5d..0000000
--- a/src/test/ui/borrowck/mutability-errors.nll.stderr
+++ /dev/null
@@ -1,378 +0,0 @@
-error[E0594]: cannot assign to `*x` which is behind a `&` reference
- --> $DIR/mutability-errors.rs:9:5
- |
-LL | fn named_ref(x: &(i32,)) {
- | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
-LL | *x = (1,);
- | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `x.0` which is behind a `&` reference
- --> $DIR/mutability-errors.rs:10:5
- |
-LL | fn named_ref(x: &(i32,)) {
- | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
-LL | *x = (1,);
-LL | x.0 = 1;
- | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/mutability-errors.rs:11:5
- |
-LL | fn named_ref(x: &(i32,)) {
- | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
-...
-LL | &mut *x;
- | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference
- --> $DIR/mutability-errors.rs:12:5
- |
-LL | fn named_ref(x: &(i32,)) {
- | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
-...
-LL | &mut x.0;
- | ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/mutability-errors.rs:16:5
- |
-LL | *f() = (1,);
- | ^^^^^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to data in a `&` reference
- --> $DIR/mutability-errors.rs:17:5
- |
-LL | f().0 = 1;
- | ^^^^^^^^^ cannot assign
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/mutability-errors.rs:18:5
- |
-LL | &mut *f();
- | ^^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/mutability-errors.rs:19:5
- |
-LL | &mut f().0;
- | ^^^^^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to `*x` which is behind a `*const` pointer
- --> $DIR/mutability-errors.rs:23:5
- |
-LL | unsafe fn named_ptr(x: *const (i32,)) {
- | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
-LL | *x = (1,);
- | ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer
- --> $DIR/mutability-errors.rs:24:5
- |
-LL | unsafe fn named_ptr(x: *const (i32,)) {
- | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
-LL | *x = (1,);
-LL | (*x).0 = 1;
- | ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
-
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer
- --> $DIR/mutability-errors.rs:25:5
- |
-LL | unsafe fn named_ptr(x: *const (i32,)) {
- | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
-...
-LL | &mut *x;
- | ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer
- --> $DIR/mutability-errors.rs:26:5
- |
-LL | unsafe fn named_ptr(x: *const (i32,)) {
- | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
-...
-LL | &mut (*x).0;
- | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
-
-error[E0594]: cannot assign to data in a `*const` pointer
- --> $DIR/mutability-errors.rs:30:5
- |
-LL | *f() = (1,);
- | ^^^^^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to data in a `*const` pointer
- --> $DIR/mutability-errors.rs:31:5
- |
-LL | (*f()).0 = 1;
- | ^^^^^^^^^^^^ cannot assign
-
-error[E0596]: cannot borrow data in a `*const` pointer as mutable
- --> $DIR/mutability-errors.rs:32:5
- |
-LL | &mut *f();
- | ^^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow data in a `*const` pointer as mutable
- --> $DIR/mutability-errors.rs:33:5
- |
-LL | &mut (*f()).0;
- | ^^^^^^^^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
- --> $DIR/mutability-errors.rs:40:9
- |
-LL | x = (1,);
- | ^^^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/mutability-errors.rs:39:12
- |
-LL | fn_ref(|| {
- | ____________^
-LL | | x = (1,);
-LL | | x.0 = 1;
-LL | | &mut x;
-LL | | &mut x.0;
-LL | | });
- | |_____^
-
-error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
- --> $DIR/mutability-errors.rs:41:9
- |
-LL | x.0 = 1;
- | ^^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/mutability-errors.rs:39:12
- |
-LL | fn_ref(|| {
- | ____________^
-LL | | x = (1,);
-LL | | x.0 = 1;
-LL | | &mut x;
-LL | | &mut x.0;
-LL | | });
- | |_____^
-
-error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
- --> $DIR/mutability-errors.rs:42:9
- |
-LL | &mut x;
- | ^^^^^^ cannot borrow as mutable
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/mutability-errors.rs:39:12
- |
-LL | fn_ref(|| {
- | ____________^
-LL | | x = (1,);
-LL | | x.0 = 1;
-LL | | &mut x;
-LL | | &mut x.0;
-LL | | });
- | |_____^
-
-error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
- --> $DIR/mutability-errors.rs:43:9
- |
-LL | &mut x.0;
- | ^^^^^^^^ cannot borrow as mutable
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/mutability-errors.rs:39:12
- |
-LL | fn_ref(|| {
- | ____________^
-LL | | x = (1,);
-LL | | x.0 = 1;
-LL | | &mut x;
-LL | | &mut x.0;
-LL | | });
- | |_____^
-
-error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
- --> $DIR/mutability-errors.rs:46:9
- |
-LL | x = (1,);
- | ^^^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/mutability-errors.rs:45:12
- |
-LL | fn_ref(move || {
- | ____________^
-LL | | x = (1,);
-LL | | x.0 = 1;
-LL | | &mut x;
-LL | | &mut x.0;
-LL | | });
- | |_____^
-
-error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
- --> $DIR/mutability-errors.rs:47:9
- |
-LL | x.0 = 1;
- | ^^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/mutability-errors.rs:45:12
- |
-LL | fn_ref(move || {
- | ____________^
-LL | | x = (1,);
-LL | | x.0 = 1;
-LL | | &mut x;
-LL | | &mut x.0;
-LL | | });
- | |_____^
-
-error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
- --> $DIR/mutability-errors.rs:48:9
- |
-LL | &mut x;
- | ^^^^^^ cannot borrow as mutable
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/mutability-errors.rs:45:12
- |
-LL | fn_ref(move || {
- | ____________^
-LL | | x = (1,);
-LL | | x.0 = 1;
-LL | | &mut x;
-LL | | &mut x.0;
-LL | | });
- | |_____^
-
-error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
- --> $DIR/mutability-errors.rs:49:9
- |
-LL | &mut x.0;
- | ^^^^^^^^ cannot borrow as mutable
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/mutability-errors.rs:45:12
- |
-LL | fn_ref(move || {
- | ____________^
-LL | | x = (1,);
-LL | | x.0 = 1;
-LL | | &mut x;
-LL | | &mut x.0;
-LL | | });
- | |_____^
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/mutability-errors.rs:54:5
- |
-LL | fn imm_local(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-LL | &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
- --> $DIR/mutability-errors.rs:55:5
- |
-LL | fn imm_local(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-LL | &mut x;
-LL | &mut x.0;
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/mutability-errors.rs:60:9
- |
-LL | fn imm_capture(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-LL | || {
-LL | x = (1,);
- | ^^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
- --> $DIR/mutability-errors.rs:61:9
- |
-LL | fn imm_capture(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | x.0 = 1;
- | ^^^^^^^ cannot assign
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/mutability-errors.rs:62:9
- |
-LL | fn imm_capture(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
- --> $DIR/mutability-errors.rs:63:9
- |
-LL | fn imm_capture(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | &mut x.0;
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/mutability-errors.rs:66:9
- |
-LL | fn imm_capture(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | x = (1,);
- | ^^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
- --> $DIR/mutability-errors.rs:67:9
- |
-LL | fn imm_capture(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | x.0 = 1;
- | ^^^^^^^ cannot assign
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/mutability-errors.rs:68:9
- |
-LL | fn imm_capture(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
- --> $DIR/mutability-errors.rs:69:9
- |
-LL | fn imm_capture(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | &mut x.0;
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to immutable static item `X`
- --> $DIR/mutability-errors.rs:76:5
- |
-LL | X = (1,);
- | ^^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item
- --> $DIR/mutability-errors.rs:77:5
- |
-LL | X.0 = 1;
- | ^^^^^^^ cannot assign
-
-error[E0596]: cannot borrow immutable static item `X` as mutable
- --> $DIR/mutability-errors.rs:78:5
- |
-LL | &mut X;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item
- --> $DIR/mutability-errors.rs:79:5
- |
-LL | &mut X.0;
- | ^^^^^^^^ cannot borrow as mutable
-
-error: aborting due to 38 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/mutability-errors.rs b/src/test/ui/borrowck/mutability-errors.rs
index 26f7f60..5be0df1 100644
--- a/src/test/ui/borrowck/mutability-errors.rs
+++ b/src/test/ui/borrowck/mutability-errors.rs
@@ -56,11 +56,11 @@
}
fn imm_capture(x: (i32,)) {
- || { //~ ERROR
- x = (1,);
- x.0 = 1;
- &mut x;
- &mut x.0;
+ || {
+ x = (1,); //~ ERROR
+ x.0 = 1; //~ ERROR
+ &mut x; //~ ERROR
+ &mut x.0; //~ ERROR
};
move || {
x = (1,); //~ ERROR
diff --git a/src/test/ui/borrowck/mutability-errors.stderr b/src/test/ui/borrowck/mutability-errors.stderr
index 561acad..545de5d 100644
--- a/src/test/ui/borrowck/mutability-errors.stderr
+++ b/src/test/ui/borrowck/mutability-errors.stderr
@@ -1,117 +1,128 @@
-error[E0594]: cannot assign to immutable borrowed content `*x`
+error[E0594]: cannot assign to `*x` which is behind a `&` reference
--> $DIR/mutability-errors.rs:9:5
|
LL | fn named_ref(x: &(i32,)) {
- | ------- use `&mut (i32,)` here to make mutable
+ | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
LL | *x = (1,);
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-error[E0594]: cannot assign to field `x.0` of immutable binding
+error[E0594]: cannot assign to `x.0` which is behind a `&` reference
--> $DIR/mutability-errors.rs:10:5
|
LL | fn named_ref(x: &(i32,)) {
- | ------- use `&mut (i32,)` here to make mutable
+ | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
LL | *x = (1,);
LL | x.0 = 1;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
- --> $DIR/mutability-errors.rs:11:10
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
+ --> $DIR/mutability-errors.rs:11:5
|
LL | fn named_ref(x: &(i32,)) {
- | ------- use `&mut (i32,)` here to make mutable
+ | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
...
LL | &mut *x;
- | ^^ cannot borrow as mutable
+ | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
- --> $DIR/mutability-errors.rs:12:10
+error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference
+ --> $DIR/mutability-errors.rs:12:5
|
LL | fn named_ref(x: &(i32,)) {
- | ------- use `&mut (i32,)` here to make mutable
+ | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
...
LL | &mut x.0;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0594]: cannot assign to immutable borrowed content
+error[E0594]: cannot assign to data in a `&` reference
--> $DIR/mutability-errors.rs:16:5
|
LL | *f() = (1,);
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^ cannot assign
-error[E0594]: cannot assign to field of immutable binding
+error[E0594]: cannot assign to data in a `&` reference
--> $DIR/mutability-errors.rs:17:5
|
LL | f().0 = 1;
- | ^^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^ cannot assign
-error[E0596]: cannot borrow immutable borrowed content as mutable
- --> $DIR/mutability-errors.rs:18:10
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/mutability-errors.rs:18:5
|
LL | &mut *f();
- | ^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow field of immutable binding as mutable
- --> $DIR/mutability-errors.rs:19:10
- |
-LL | &mut f().0;
- | ^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0594]: cannot assign to immutable dereference of raw pointer `*x`
- --> $DIR/mutability-errors.rs:23:5
- |
-LL | *x = (1,);
| ^^^^^^^^^ cannot borrow as mutable
-error[E0594]: cannot assign to field `x.0` of immutable binding
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/mutability-errors.rs:19:5
+ |
+LL | &mut f().0;
+ | ^^^^^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to `*x` which is behind a `*const` pointer
+ --> $DIR/mutability-errors.rs:23:5
+ |
+LL | unsafe fn named_ptr(x: *const (i32,)) {
+ | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
+LL | *x = (1,);
+ | ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
+
+error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer
--> $DIR/mutability-errors.rs:24:5
|
+LL | unsafe fn named_ptr(x: *const (i32,)) {
+ | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
+LL | *x = (1,);
LL | (*x).0 = 1;
- | ^^^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
-error[E0596]: cannot borrow immutable dereference of raw pointer `*x` as mutable
- --> $DIR/mutability-errors.rs:25:10
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer
+ --> $DIR/mutability-errors.rs:25:5
|
+LL | unsafe fn named_ptr(x: *const (i32,)) {
+ | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
+...
LL | &mut *x;
- | ^^ cannot borrow as mutable
+ | ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
- --> $DIR/mutability-errors.rs:26:10
+error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer
+ --> $DIR/mutability-errors.rs:26:5
|
+LL | unsafe fn named_ptr(x: *const (i32,)) {
+ | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
+...
LL | &mut (*x).0;
- | ^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
-error[E0594]: cannot assign to immutable dereference of raw pointer
+error[E0594]: cannot assign to data in a `*const` pointer
--> $DIR/mutability-errors.rs:30:5
|
LL | *f() = (1,);
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^ cannot assign
-error[E0594]: cannot assign to field of immutable binding
+error[E0594]: cannot assign to data in a `*const` pointer
--> $DIR/mutability-errors.rs:31:5
|
LL | (*f()).0 = 1;
- | ^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^ cannot assign
-error[E0596]: cannot borrow immutable dereference of raw pointer as mutable
- --> $DIR/mutability-errors.rs:32:10
+error[E0596]: cannot borrow data in a `*const` pointer as mutable
+ --> $DIR/mutability-errors.rs:32:5
|
LL | &mut *f();
- | ^^^^ cannot borrow as mutable
+ | ^^^^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow field of immutable binding as mutable
- --> $DIR/mutability-errors.rs:33:10
+error[E0596]: cannot borrow data in a `*const` pointer as mutable
+ --> $DIR/mutability-errors.rs:33:5
|
LL | &mut (*f()).0;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^^ cannot borrow as mutable
-error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
--> $DIR/mutability-errors.rs:40:9
|
LL | x = (1,);
- | ^^^^^^^^
+ | ^^^^^^^^ cannot assign
|
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/mutability-errors.rs:39:12
|
LL | fn_ref(|| {
@@ -123,13 +134,13 @@
LL | | });
| |_____^
-error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
--> $DIR/mutability-errors.rs:41:9
|
LL | x.0 = 1;
- | ^^^^^^^
+ | ^^^^^^^ cannot assign
|
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/mutability-errors.rs:39:12
|
LL | fn_ref(|| {
@@ -141,13 +152,13 @@
LL | | });
| |_____^
-error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
- --> $DIR/mutability-errors.rs:42:14
+error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
+ --> $DIR/mutability-errors.rs:42:9
|
LL | &mut x;
- | ^
+ | ^^^^^^ cannot borrow as mutable
|
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/mutability-errors.rs:39:12
|
LL | fn_ref(|| {
@@ -159,13 +170,13 @@
LL | | });
| |_____^
-error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
- --> $DIR/mutability-errors.rs:43:14
+error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
+ --> $DIR/mutability-errors.rs:43:9
|
LL | &mut x.0;
- | ^^^
+ | ^^^^^^^^ cannot borrow as mutable
|
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/mutability-errors.rs:39:12
|
LL | fn_ref(|| {
@@ -177,14 +188,13 @@
LL | | });
| |_____^
-error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
--> $DIR/mutability-errors.rs:46:9
|
LL | x = (1,);
- | ^^^^^^^^
+ | ^^^^^^^^ cannot assign
|
- = note: `Fn` closures cannot capture their enclosing environment for modifications
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/mutability-errors.rs:45:12
|
LL | fn_ref(move || {
@@ -196,19 +206,13 @@
LL | | });
| |_____^
-error[E0594]: cannot assign to field `x.0` of immutable binding
+error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
--> $DIR/mutability-errors.rs:47:9
|
LL | x.0 = 1;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable
- --> $DIR/mutability-errors.rs:48:14
+ | ^^^^^^^ cannot assign
|
-LL | &mut x;
- | ^
- |
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/mutability-errors.rs:45:12
|
LL | fn_ref(move || {
@@ -220,89 +224,155 @@
LL | | });
| |_____^
-error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
- --> $DIR/mutability-errors.rs:49:14
+error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
+ --> $DIR/mutability-errors.rs:48:9
+ |
+LL | &mut x;
+ | ^^^^^^ cannot borrow as mutable
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/mutability-errors.rs:45:12
+ |
+LL | fn_ref(move || {
+ | ____________^
+LL | | x = (1,);
+LL | | x.0 = 1;
+LL | | &mut x;
+LL | | &mut x.0;
+LL | | });
+ | |_____^
+
+error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
+ --> $DIR/mutability-errors.rs:49:9
|
LL | &mut x.0;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/mutability-errors.rs:45:12
+ |
+LL | fn_ref(move || {
+ | ____________^
+LL | | x = (1,);
+LL | | x.0 = 1;
+LL | | &mut x;
+LL | | &mut x.0;
+LL | | });
+ | |_____^
-error[E0596]: cannot borrow immutable argument `x` as mutable
- --> $DIR/mutability-errors.rs:54:10
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/mutability-errors.rs:54:5
|
LL | fn imm_local(x: (i32,)) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | &mut x;
- | ^ cannot borrow mutably
+ | ^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
- --> $DIR/mutability-errors.rs:55:10
+error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
+ --> $DIR/mutability-errors.rs:55:5
|
LL | fn imm_local(x: (i32,)) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | &mut x;
LL | &mut x.0;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0595]: closure cannot assign to immutable argument `x`
- --> $DIR/mutability-errors.rs:59:5
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/mutability-errors.rs:60:9
|
LL | fn imm_capture(x: (i32,)) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | || {
- | ^^ cannot borrow mutably
+LL | x = (1,);
+ | ^^^^^^^^ cannot assign
-error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
+ --> $DIR/mutability-errors.rs:61:9
+ |
+LL | fn imm_capture(x: (i32,)) {
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | x.0 = 1;
+ | ^^^^^^^ cannot assign
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/mutability-errors.rs:62:9
+ |
+LL | fn imm_capture(x: (i32,)) {
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | &mut x;
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
+ --> $DIR/mutability-errors.rs:63:9
+ |
+LL | fn imm_capture(x: (i32,)) {
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | &mut x.0;
+ | ^^^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/mutability-errors.rs:66:9
|
LL | fn imm_capture(x: (i32,)) {
- | - help: consider making `x` mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
...
LL | x = (1,);
- | ^^^^^^^^
+ | ^^^^^^^^ cannot assign
-error[E0594]: cannot assign to field `x.0` of immutable binding
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
--> $DIR/mutability-errors.rs:67:9
|
+LL | fn imm_capture(x: (i32,)) {
+ | - help: consider changing this to be mutable: `mut x`
+...
LL | x.0 = 1;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ cannot assign
-error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable
- --> $DIR/mutability-errors.rs:68:14
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/mutability-errors.rs:68:9
|
+LL | fn imm_capture(x: (i32,)) {
+ | - help: consider changing this to be mutable: `mut x`
+...
LL | &mut x;
- | ^
+ | ^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
- --> $DIR/mutability-errors.rs:69:14
+error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
+ --> $DIR/mutability-errors.rs:69:9
|
+LL | fn imm_capture(x: (i32,)) {
+ | - help: consider changing this to be mutable: `mut x`
+...
LL | &mut x.0;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0594]: cannot assign to immutable static item
+error[E0594]: cannot assign to immutable static item `X`
--> $DIR/mutability-errors.rs:76:5
|
LL | X = (1,);
- | ^^^^^^^^
+ | ^^^^^^^^ cannot assign
-error[E0594]: cannot assign to field of immutable binding
+error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item
--> $DIR/mutability-errors.rs:77:5
|
LL | X.0 = 1;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ cannot assign
-error[E0596]: cannot borrow immutable static item as mutable
- --> $DIR/mutability-errors.rs:78:10
+error[E0596]: cannot borrow immutable static item `X` as mutable
+ --> $DIR/mutability-errors.rs:78:5
|
LL | &mut X;
- | ^
+ | ^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow field of immutable binding as mutable
- --> $DIR/mutability-errors.rs:79:10
+error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item
+ --> $DIR/mutability-errors.rs:79:5
|
LL | &mut X.0;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
-error: aborting due to 35 previous errors
+error: aborting due to 38 previous errors
-Some errors have detailed explanations: E0387, E0595, E0596.
-For more information about an error, try `rustc --explain E0387`.
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr
deleted file mode 100644
index 60af412..0000000
--- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr
+++ /dev/null
@@ -1,50 +0,0 @@
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:6:5
- |
-LL | let ref mut x = 1234543;
- | ------- temporary value created here
-LL | x
- | ^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:11:5
- |
-LL | let (ref mut x, ) = (1234543, );
- | ----------- temporary value created here
-LL | x
- | ^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:5
- |
-LL | match 1234543 {
- | ^ ------- temporary value created here
- | _____|
- | |
-LL | | ref mut x => x
-LL | | }
- | |_____^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:21:5
- |
-LL | match (123443,) {
- | ^ --------- temporary value created here
- | _____|
- | |
-LL | | (ref mut x,) => x,
-LL | | }
- | |_____^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return reference to temporary value
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:5
- |
-LL | &mut 1234543
- | ^^^^^-------
- | | |
- | | temporary value created here
- | returns a reference to data owned by the current function
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.rs b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.rs
index ae305b6..3576734 100644
--- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.rs
+++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.rs
@@ -2,24 +2,24 @@
// mut` borrow.
fn gimme_static_mut_let() -> &'static mut u32 {
- let ref mut x = 1234543; //~ ERROR
- x
+ let ref mut x = 1234543;
+ x //~ ERROR
}
fn gimme_static_mut_let_nested() -> &'static mut u32 {
- let (ref mut x, ) = (1234543, ); //~ ERROR
- x
+ let (ref mut x, ) = (1234543, );
+ x //~ ERROR
}
fn gimme_static_mut_match() -> &'static mut u32 {
- match 1234543 {
- ref mut x => x //~ ERROR
+ match 1234543 { //~ ERROR
+ ref mut x => x
}
}
fn gimme_static_mut_match_nested() -> &'static mut u32 {
- match (123443,) {
- (ref mut x,) => x, //~ ERROR
+ match (123443,) { //~ ERROR
+ (ref mut x,) => x,
}
}
diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr
index ae68df7..60af412 100644
--- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr
+++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr
@@ -1,57 +1,50 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:5:9
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/promote-ref-mut-in-let-issue-46557.rs:6:5
|
LL | let ref mut x = 1234543;
- | ^^^^^^^^^ temporary value does not live long enough
+ | ------- temporary value created here
LL | x
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ^ returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:10:10
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/promote-ref-mut-in-let-issue-46557.rs:11:5
|
LL | let (ref mut x, ) = (1234543, );
- | ^^^^^^^^^ borrowed value does not live long enough
+ | ----------- temporary value created here
LL | x
-LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ^ returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:16:9
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:5
|
-LL | ref mut x => x
- | ^^^^^^^^^ temporary value does not live long enough
-LL | }
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+LL | match 1234543 {
+ | ^ ------- temporary value created here
+ | _____|
+ | |
+LL | | ref mut x => x
+LL | | }
+ | |_____^ returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:22:10
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/promote-ref-mut-in-let-issue-46557.rs:21:5
|
-LL | (ref mut x,) => x,
- | ^^^^^^^^^ borrowed value does not live long enough
-LL | }
-LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+LL | match (123443,) {
+ | ^ --------- temporary value created here
+ | _____|
+ | |
+LL | | (ref mut x,) => x,
+LL | | }
+ | |_____^ returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:10
+error[E0515]: cannot return reference to temporary value
+ --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:5
|
LL | &mut 1234543
- | ^^^^^^^ temporary value does not live long enough
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ^^^^^-------
+ | | |
+ | | temporary value created here
+ | returns a reference to data owned by the current function
error: aborting due to 5 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr
deleted file mode 100644
index d455a8f..0000000
--- a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0381]: assign to part of possibly uninitialized variable: `x`
- --> $DIR/reassignment_immutable_fields.rs:7:5
- |
-LL | x.0 = 1;
- | ^^^^^^^ use of possibly uninitialized `x`
-
-error[E0381]: assign to part of possibly uninitialized variable: `x`
- --> $DIR/reassignment_immutable_fields.rs:15:5
- |
-LL | x.0 = 1;
- | ^^^^^^^ use of possibly uninitialized `x`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.rs b/src/test/ui/borrowck/reassignment_immutable_fields.rs
index 4529e32..fd2ab62 100644
--- a/src/test/ui/borrowck/reassignment_immutable_fields.rs
+++ b/src/test/ui/borrowck/reassignment_immutable_fields.rs
@@ -5,16 +5,16 @@
fn assign_both_fields_and_use() {
let x: (u32, u32);
x.0 = 1; //~ ERROR
- x.1 = 22; //~ ERROR
- drop(x.0); //~ ERROR
- drop(x.1); //~ ERROR
+ x.1 = 22;
+ drop(x.0);
+ drop(x.1);
}
fn assign_both_fields_the_use_var() {
let x: (u32, u32);
x.0 = 1; //~ ERROR
- x.1 = 22; //~ ERROR
- drop(x); //~ ERROR
+ x.1 = 22;
+ drop(x);
}
fn main() { }
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.stderr
index 6aa5831..d455a8f 100644
--- a/src/test/ui/borrowck/reassignment_immutable_fields.stderr
+++ b/src/test/ui/borrowck/reassignment_immutable_fields.stderr
@@ -1,55 +1,15 @@
-error[E0594]: cannot assign to field `x.0` of immutable binding
+error[E0381]: assign to part of possibly uninitialized variable: `x`
--> $DIR/reassignment_immutable_fields.rs:7:5
|
-LL | let x: (u32, u32);
- | - help: make this binding mutable: `mut x`
LL | x.0 = 1;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ use of possibly uninitialized `x`
-error[E0594]: cannot assign to field `x.1` of immutable binding
- --> $DIR/reassignment_immutable_fields.rs:8:5
- |
-LL | let x: (u32, u32);
- | - help: make this binding mutable: `mut x`
-LL | x.0 = 1;
-LL | x.1 = 22;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0381]: use of possibly uninitialized variable: `x.0`
- --> $DIR/reassignment_immutable_fields.rs:9:10
- |
-LL | drop(x.0);
- | ^^^ use of possibly uninitialized `x.0`
-
-error[E0381]: use of possibly uninitialized variable: `x.1`
- --> $DIR/reassignment_immutable_fields.rs:10:10
- |
-LL | drop(x.1);
- | ^^^ use of possibly uninitialized `x.1`
-
-error[E0594]: cannot assign to field `x.0` of immutable binding
+error[E0381]: assign to part of possibly uninitialized variable: `x`
--> $DIR/reassignment_immutable_fields.rs:15:5
|
-LL | let x: (u32, u32);
- | - help: make this binding mutable: `mut x`
LL | x.0 = 1;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ use of possibly uninitialized `x`
-error[E0594]: cannot assign to field `x.1` of immutable binding
- --> $DIR/reassignment_immutable_fields.rs:16:5
- |
-LL | let x: (u32, u32);
- | - help: make this binding mutable: `mut x`
-LL | x.0 = 1;
-LL | x.1 = 22;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error[E0381]: use of possibly uninitialized variable: `x`
- --> $DIR/reassignment_immutable_fields.rs:17:10
- |
-LL | drop(x);
- | ^ use of possibly uninitialized `x`
-
-error: aborting due to 7 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr
deleted file mode 100644
index 649c127..0000000
--- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0381]: assign to part of possibly uninitialized variable: `x`
- --> $DIR/reassignment_immutable_fields_overlapping.rs:12:5
- |
-LL | x.a = 1;
- | ^^^^^^^ use of possibly uninitialized `x`
-
-error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable
- --> $DIR/reassignment_immutable_fields_overlapping.rs:13:5
- |
-LL | let x: Foo;
- | - help: consider changing this to be mutable: `mut x`
-LL | x.a = 1;
-LL | x.b = 22;
- | ^^^^^^^^ cannot assign
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr
index ea16ce4..649c127 100644
--- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr
+++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr
@@ -1,19 +1,18 @@
-error[E0594]: cannot assign to field `x.a` of immutable binding
+error[E0381]: assign to part of possibly uninitialized variable: `x`
--> $DIR/reassignment_immutable_fields_overlapping.rs:12:5
|
-LL | let x: Foo;
- | - help: make this binding mutable: `mut x`
LL | x.a = 1;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ use of possibly uninitialized `x`
-error[E0594]: cannot assign to field `x.b` of immutable binding
+error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable
--> $DIR/reassignment_immutable_fields_overlapping.rs:13:5
|
LL | let x: Foo;
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | x.a = 1;
LL | x.b = 22;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot assign
error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr
deleted file mode 100644
index 9a2824c..0000000
--- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
- --> $DIR/reassignment_immutable_fields_twice.rs:7:5
- |
-LL | let x: (u32, u32);
- | - help: consider changing this to be mutable: `mut x`
-LL | x = (22, 44);
-LL | x.0 = 1;
- | ^^^^^^^ cannot assign
-
-error[E0381]: assign to part of possibly uninitialized variable: `x`
- --> $DIR/reassignment_immutable_fields_twice.rs:12:5
- |
-LL | x.0 = 1;
- | ^^^^^^^ use of possibly uninitialized `x`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs b/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs
index a10baf6..2775a54 100644
--- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs
+++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs
@@ -10,8 +10,8 @@
fn same_field_twice() {
let x: (u32, u32);
x.0 = 1; //~ ERROR
- x.0 = 22; //~ ERROR
- x.1 = 44; //~ ERROR
+ x.0 = 22;
+ x.1 = 44;
}
fn main() { }
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr
index 1704360..9a2824c 100644
--- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr
+++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr
@@ -1,37 +1,18 @@
-error[E0594]: cannot assign to field `x.0` of immutable binding
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
--> $DIR/reassignment_immutable_fields_twice.rs:7:5
|
LL | let x: (u32, u32);
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | x = (22, 44);
LL | x.0 = 1;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ cannot assign
-error[E0594]: cannot assign to field `x.0` of immutable binding
+error[E0381]: assign to part of possibly uninitialized variable: `x`
--> $DIR/reassignment_immutable_fields_twice.rs:12:5
|
-LL | let x: (u32, u32);
- | - help: make this binding mutable: `mut x`
LL | x.0 = 1;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^ use of possibly uninitialized `x`
-error[E0594]: cannot assign to field `x.0` of immutable binding
- --> $DIR/reassignment_immutable_fields_twice.rs:13:5
- |
-LL | let x: (u32, u32);
- | - help: make this binding mutable: `mut x`
-LL | x.0 = 1;
-LL | x.0 = 22;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
+error: aborting due to 2 previous errors
-error[E0594]: cannot assign to field `x.1` of immutable binding
- --> $DIR/reassignment_immutable_fields_twice.rs:14:5
- |
-LL | let x: (u32, u32);
- | - help: make this binding mutable: `mut x`
-...
-LL | x.1 = 44;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error: aborting due to 4 previous errors
-
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/two-phase-activation-sharing-interference.rs b/src/test/ui/borrowck/two-phase-activation-sharing-interference.rs
index 5754220..55a8ae7 100644
--- a/src/test/ui/borrowck/two-phase-activation-sharing-interference.rs
+++ b/src/test/ui/borrowck/two-phase-activation-sharing-interference.rs
@@ -3,9 +3,9 @@
// revisions: nll_target
// The following revisions are disabled due to missing support from two-phase beyond autorefs
-//[nll_beyond] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref
+//[nll_beyond] compile-flags: -Z borrowck=mir -Z two-phase-beyond-autoref
-//[nll_target] compile-flags: -Z borrowck=mir -Z two-phase-borrows
+//[nll_target] compile-flags: -Z borrowck=mir
// This is an important corner case pointed out by Niko: one is
// allowed to initiate a shared borrow during a reservation, but it
diff --git a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs
index e428964..07169af 100644
--- a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs
+++ b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs
@@ -3,9 +3,9 @@
// revisions: nll_target
// The following revisions are disabled due to missing support for two_phase_beyond_autoref
-//[nll_beyond] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two_phase_beyond_autoref
+//[nll_beyond] compile-flags: -Z borrowck=mir -Z two_phase_beyond_autoref
-//[nll_target] compile-flags: -Z borrowck=mir -Z two-phase-borrows
+//[nll_target] compile-flags: -Z borrowck=mir
// This is the second counter-example from Niko's blog post
// smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
diff --git a/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs b/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs
index fd1b884..f2097fd 100644
--- a/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs
+++ b/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs
@@ -1,4 +1,4 @@
-// compile-flags: -Z borrowck=mir -Z two-phase-borrows
+// compile-flags: -Z borrowck=mir
// This is the third counter-example from Niko's blog post
// smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
diff --git a/src/test/ui/borrowck/two-phase-method-receivers.rs b/src/test/ui/borrowck/two-phase-method-receivers.rs
index f1df1a6..6838f6c 100644
--- a/src/test/ui/borrowck/two-phase-method-receivers.rs
+++ b/src/test/ui/borrowck/two-phase-method-receivers.rs
@@ -1,4 +1,4 @@
-// compile-flags: -Z borrowck=mir -Z two-phase-borrows
+// compile-flags: -Z borrowck=mir
// run-pass
diff --git a/src/test/ui/borrowck/two-phase-multiple-activations.rs b/src/test/ui/borrowck/two-phase-multiple-activations.rs
index 38ba094..a7fa7fa 100644
--- a/src/test/ui/borrowck/two-phase-multiple-activations.rs
+++ b/src/test/ui/borrowck/two-phase-multiple-activations.rs
@@ -1,4 +1,4 @@
-// compile-flags: -Z borrowck=mir -Z two-phase-borrows
+// compile-flags: -Z borrowck=mir
// run-pass
diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr
deleted file mode 100644
index 62ab00f..0000000
--- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr
+++ /dev/null
@@ -1,71 +0,0 @@
-error[E0499]: cannot borrow `*f` as mutable more than once at a time
- --> $DIR/two-phase-nonrecv-autoref.rs:60:11
- |
-LL | f(f(10));
- | - ^ second mutable borrow occurs here
- | |
- | first mutable borrow occurs here
- | first borrow later used by call
-
-error[E0382]: use of moved value: `f`
- --> $DIR/two-phase-nonrecv-autoref.rs:69:11
- |
-LL | fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
- | - move occurs because `f` has type `std::boxed::Box<F>`, which does not implement the `Copy` trait
-LL | f(f(10));
- | - ^ value used here after move
- | |
- | value moved here
-
-error[E0499]: cannot borrow `*f` as mutable more than once at a time
- --> $DIR/two-phase-nonrecv-autoref.rs:76:11
- |
-LL | f(f(10));
- | - ^ second mutable borrow occurs here
- | |
- | first mutable borrow occurs here
- | first borrow later used by call
-
-error[E0382]: use of moved value: `f`
- --> $DIR/two-phase-nonrecv-autoref.rs:85:11
- |
-LL | fn twice_ten_oo(f: Box<FnOnce(i32) -> i32>) {
- | - move occurs because `f` has type `std::boxed::Box<dyn std::ops::FnOnce(i32) -> i32>`, which does not implement the `Copy` trait
-LL | f(f(10));
- | - ^ value used here after move
- | |
- | value moved here
-
-error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:125:27
- |
-LL | double_access(&mut a, &a);
- | ------------- ------ ^^ immutable borrow occurs here
- | | |
- | | mutable borrow occurs here
- | mutable borrow later used by call
-
-error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:153:7
- |
-LL | i[i[3]] = 4;
- | --^----
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
- | mutable borrow later used here
-
-error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:159:7
- |
-LL | i[i[3]] = i[4];
- | --^----
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
- | mutable borrow later used here
-
-error: aborting due to 7 previous errors
-
-Some errors have detailed explanations: E0382, E0499, E0502.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr
deleted file mode 100644
index 1d28246..0000000
--- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr
+++ /dev/null
@@ -1,113 +0,0 @@
-error[E0503]: cannot use `*x` because it was mutably borrowed
- --> $DIR/two-phase-nonrecv-autoref.rs:31:12
- |
-LL | foo(x, *x);
- | - ^^ use of borrowed `*x`
- | |
- | borrow of `*x` occurs here
-
-error[E0499]: cannot borrow `*f` as mutable more than once at a time
- --> $DIR/two-phase-nonrecv-autoref.rs:60:11
- |
-LL | f(f(10));
- | - ^ - first borrow ends here
- | | |
- | | second mutable borrow occurs here
- | first mutable borrow occurs here
-
-error[E0382]: use of moved value: `f`
- --> $DIR/two-phase-nonrecv-autoref.rs:69:11
- |
-LL | f(f(10));
- | - ^ value used here after move
- | |
- | value moved here
- |
- = note: move occurs because `f` has type `std::boxed::Box<F>`, which does not implement the `Copy` trait
-
-error[E0499]: cannot borrow `*f` as mutable more than once at a time
- --> $DIR/two-phase-nonrecv-autoref.rs:76:11
- |
-LL | f(f(10));
- | - ^ - first borrow ends here
- | | |
- | | second mutable borrow occurs here
- | first mutable borrow occurs here
-
-error[E0382]: use of moved value: `f`
- --> $DIR/two-phase-nonrecv-autoref.rs:85:11
- |
-LL | f(f(10));
- | - ^ value used here after move
- | |
- | value moved here
- |
- = note: move occurs because `f` has type `std::boxed::Box<(dyn std::ops::FnOnce(i32) -> i32 + 'static)>`, which does not implement the `Copy` trait
-
-error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:125:28
- |
-LL | double_access(&mut a, &a);
- | - ^- mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:131:9
- |
-LL | a.m(a.i(10));
- | - ^ - mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:153:7
- |
-LL | i[i[3]] = 4;
- | - ^ - mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:159:7
- |
-LL | i[i[3]] = i[4];
- | - ^ - mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:168:12
- |
-LL | v.push(v.len());
- | - ^ - mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:179:9
- |
-LL | s.m(s.i(10));
- | - ^ - mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `t` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:184:9
- |
-LL | t.m(t.i(10));
- | - ^ - mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error: aborting due to 12 previous errors
-
-Some errors have detailed explanations: E0382, E0499, E0502, E0503.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr
index 62ab00f..fca425d 100644
--- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr
+++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr
@@ -1,5 +1,5 @@
error[E0499]: cannot borrow `*f` as mutable more than once at a time
- --> $DIR/two-phase-nonrecv-autoref.rs:60:11
+ --> $DIR/two-phase-nonrecv-autoref.rs:58:11
|
LL | f(f(10));
| - ^ second mutable borrow occurs here
@@ -8,7 +8,7 @@
| first borrow later used by call
error[E0382]: use of moved value: `f`
- --> $DIR/two-phase-nonrecv-autoref.rs:69:11
+ --> $DIR/two-phase-nonrecv-autoref.rs:66:11
|
LL | fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
| - move occurs because `f` has type `std::boxed::Box<F>`, which does not implement the `Copy` trait
@@ -18,7 +18,7 @@
| value moved here
error[E0499]: cannot borrow `*f` as mutable more than once at a time
- --> $DIR/two-phase-nonrecv-autoref.rs:76:11
+ --> $DIR/two-phase-nonrecv-autoref.rs:72:11
|
LL | f(f(10));
| - ^ second mutable borrow occurs here
@@ -27,7 +27,7 @@
| first borrow later used by call
error[E0382]: use of moved value: `f`
- --> $DIR/two-phase-nonrecv-autoref.rs:85:11
+ --> $DIR/two-phase-nonrecv-autoref.rs:80:11
|
LL | fn twice_ten_oo(f: Box<FnOnce(i32) -> i32>) {
| - move occurs because `f` has type `std::boxed::Box<dyn std::ops::FnOnce(i32) -> i32>`, which does not implement the `Copy` trait
@@ -37,7 +37,7 @@
| value moved here
error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:125:27
+ --> $DIR/two-phase-nonrecv-autoref.rs:119:27
|
LL | double_access(&mut a, &a);
| ------------- ------ ^^ immutable borrow occurs here
@@ -46,7 +46,7 @@
| mutable borrow later used by call
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:153:7
+ --> $DIR/two-phase-nonrecv-autoref.rs:145:7
|
LL | i[i[3]] = 4;
| --^----
@@ -56,7 +56,7 @@
| mutable borrow later used here
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-nonrecv-autoref.rs:159:7
+ --> $DIR/two-phase-nonrecv-autoref.rs:150:7
|
LL | i[i[3]] = i[4];
| --^----
diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
index 1005da0..c0a117d 100644
--- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
+++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
@@ -1,8 +1,7 @@
-// revisions: ast nll
-//[ast]compile-flags:
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows
+// revisions: nll
+//[nll]compile-flags: -Z borrowck=mir
-//[g2p]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref
+//[g2p]compile-flags: -Z borrowck=mir -Z two-phase-beyond-autoref
// the above revision is disabled until two-phase-beyond-autoref support is better
// This is a test checking that when we limit two-phase borrows to
@@ -29,7 +28,6 @@
fn deref_coercion(x: &mut u32) {
foo(x, *x);
- //[ast]~^ ERROR cannot use `*x` because it was mutably borrowed [E0503]
// Above error is a known limitation of AST borrowck
}
@@ -60,7 +58,6 @@
f(f(10));
//[nll]~^ ERROR cannot borrow `*f` as mutable more than once at a time
//[g2p]~^^ ERROR cannot borrow `*f` as mutable more than once at a time
- //[ast]~^^^ ERROR cannot borrow `*f` as mutable more than once at a time
}
fn twice_ten_si<F: Fn(i32) -> i32>(f: &mut F) {
f(f(10));
@@ -69,14 +66,12 @@
f(f(10));
//[nll]~^ ERROR use of moved value: `f`
//[g2p]~^^ ERROR use of moved value: `f`
- //[ast]~^^^ ERROR use of moved value: `f`
}
fn twice_ten_om(f: &mut FnMut(i32) -> i32) {
f(f(10));
//[nll]~^ ERROR cannot borrow `*f` as mutable more than once at a time
//[g2p]~^^ ERROR cannot borrow `*f` as mutable more than once at a time
- //[ast]~^^^ ERROR cannot borrow `*f` as mutable more than once at a time
}
fn twice_ten_oi(f: &mut Fn(i32) -> i32) {
f(f(10));
@@ -85,7 +80,6 @@
f(f(10));
//[nll]~^ ERROR use of moved value: `f`
//[g2p]~^^ ERROR use of moved value: `f`
- //[ast]~^^^ ERROR use of moved value: `f`
}
twice_ten_sm(&mut |x| x + 1);
@@ -125,11 +119,9 @@
double_access(&mut a, &a);
//[nll]~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
//[g2p]~^^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
- //[ast]~^^^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
// But this is okay.
a.m(a.i(10));
- //[ast]~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
// Above error is an expected limitation of AST borrowck
}
@@ -152,13 +144,11 @@
let mut i = I(10);
i[i[3]] = 4;
//[nll]~^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
- //[ast]~^^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
i[3] = i[4];
i[i[3]] = i[4];
//[nll]~^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
- //[ast]~^^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
}
fn main() {
@@ -166,7 +156,6 @@
// As a reminder, this is the basic case we want to ensure we handle.
let mut v = vec![1, 2, 3];
v.push(v.len());
- //[ast]~^ ERROR cannot borrow `v` as immutable because it is also borrowed as mutable [E0502]
// Error above is an expected limitation of AST borrowck
// (as a rule, pnkfelix does not like to write tests with dead code.)
@@ -177,12 +166,10 @@
let mut s = S;
s.m(s.i(10));
- //[ast]~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable [E0502]
// Error above is an expected limitation of AST borrowck
let mut t = T;
t.m(t.i(10));
- //[ast]~^ ERROR cannot borrow `t` as immutable because it is also borrowed as mutable [E0502]
// Error above is an expected limitation of AST borrowck
coerce_unsized();
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.ast.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.ast.stderr
deleted file mode 100644
index 28c997e..0000000
--- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.ast.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
- |
-LL | let shared = &v;
- | - immutable borrow occurs here
-LL |
-LL | v.extend(shared);
- | ^ mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
-
-error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:30:15
- |
-LL | v.extend(&v);
- | - ^- mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:42:5
- |
-LL | let shared = &v;
- | - immutable borrow occurs here
-LL |
-LL | v.push(shared.len());
- | ^ mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.migrate2015.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.migrate2015.stderr
index bb11b2e..8eb4688 100644
--- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.migrate2015.stderr
+++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.migrate2015.stderr
@@ -1,5 +1,5 @@
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:18:5
|
LL | let shared = &v;
| -- immutable borrow occurs here
@@ -11,7 +11,7 @@
| mutable borrow occurs here
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:30:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:28:5
|
LL | v.extend(&v);
| ^^------^--^
@@ -21,7 +21,7 @@
| mutable borrow occurs here
warning: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:42:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:39:5
|
LL | let shared = &v;
| -- immutable borrow occurs here
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.migrate2018.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.migrate2018.stderr
index bb11b2e..8eb4688 100644
--- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.migrate2018.stderr
+++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.migrate2018.stderr
@@ -1,5 +1,5 @@
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:18:5
|
LL | let shared = &v;
| -- immutable borrow occurs here
@@ -11,7 +11,7 @@
| mutable borrow occurs here
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:30:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:28:5
|
LL | v.extend(&v);
| ^^------^--^
@@ -21,7 +21,7 @@
| mutable borrow occurs here
warning: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:42:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:39:5
|
LL | let shared = &v;
| -- immutable borrow occurs here
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.nll2015.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.nll2015.stderr
index fb3a1fd..730741c 100644
--- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.nll2015.stderr
+++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.nll2015.stderr
@@ -1,5 +1,5 @@
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:18:5
|
LL | let shared = &v;
| -- immutable borrow occurs here
@@ -10,7 +10,7 @@
| mutable borrow occurs here
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:30:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:28:5
|
LL | v.extend(&v);
| ^^------^--^
@@ -20,7 +20,7 @@
| mutable borrow occurs here
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:42:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:39:5
|
LL | let shared = &v;
| -- immutable borrow occurs here
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.nll2018.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.nll2018.stderr
index fb3a1fd..730741c 100644
--- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.nll2018.stderr
+++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.nll2018.stderr
@@ -1,5 +1,5 @@
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:18:5
|
LL | let shared = &v;
| -- immutable borrow occurs here
@@ -10,7 +10,7 @@
| mutable borrow occurs here
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:30:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:28:5
|
LL | v.extend(&v);
| ^^------^--^
@@ -20,7 +20,7 @@
| mutable borrow occurs here
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-reservation-sharing-interference-2.rs:42:5
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:39:5
|
LL | let shared = &v;
| -- immutable borrow occurs here
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs
index 54fad9f..de1af3a 100644
--- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs
+++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs
@@ -1,12 +1,11 @@
// Test for #56254, we previously allowed the last example on the 2018
-// editiion. Make sure that we now emit a warning in that case and an error for
+// edition. Make sure that we now emit a warning in that case and an error for
// everyone else.
//ignore-compare-mode-nll
-//revisions: ast migrate2015 migrate2018 nll2015 nll2018
+//revisions: migrate2015 migrate2018 nll2015 nll2018
-//[migrate2015] compile-flags: -Zborrowck=migrate -Ztwo-phase-borrows
//[migrate2018] edition:2018
//[nll2018] edition:2018
@@ -21,7 +20,6 @@
//[nll2015]~^^ ERROR cannot borrow `v` as mutable
//[migrate2018]~^^^ ERROR cannot borrow `v` as mutable
//[nll2018]~^^^^ ERROR cannot borrow `v` as mutable
- //[ast]~^^^^^ ERROR cannot borrow `v` as mutable
}
fn activation_conflict() {
@@ -32,7 +30,6 @@
//[nll2015]~^^ ERROR cannot borrow `v` as mutable
//[migrate2018]~^^^ ERROR cannot borrow `v` as mutable
//[nll2018]~^^^^ ERROR cannot borrow `v` as mutable
- //[ast]~^^^^^ ERROR cannot borrow `v` as immutable
}
fn reservation_conflict() {
@@ -47,8 +44,6 @@
//[migrate2018]~^^^^^^ WARNING cannot borrow `v` as mutable
//[migrate2018]~| WARNING may become a hard error in the future
-
- //[ast]~^^^^^^^^^ ERROR cannot borrow `v` as mutable
}
fn main() {}
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs
index f5fa821..d8e60c5 100644
--- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs
+++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs
@@ -3,10 +3,10 @@
// revisions: nll_target
// The following revisions are disabled due to missing support from two-phase beyond autorefs
-//[nll_beyond]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref
+//[nll_beyond]compile-flags: -Z borrowck=mir -Z two-phase-beyond-autoref
//[nll_beyond] should-fail
-//[nll_target]compile-flags: -Z borrowck=mir -Z two-phase-borrows
+//[nll_target]compile-flags: -Z borrowck=mir
// This is a corner case that the current implementation is (probably)
// treating more conservatively than is necessary. But it also does
diff --git a/src/test/ui/borrowck/two-phase-sneaky.nll.stderr b/src/test/ui/borrowck/two-phase-sneaky.nll.stderr
deleted file mode 100644
index c66f3cb..0000000
--- a/src/test/ui/borrowck/two-phase-sneaky.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0499]: cannot borrow `v` as mutable more than once at a time
- --> $DIR/two-phase-sneaky.rs:12:9
- |
-LL | v[0].push_str({
- | - -------- first borrow later used by call
- | |
- | first mutable borrow occurs here
-LL |
-LL | v.push(format!("foo"));
- | ^ second mutable borrow occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/two-phase-sneaky.rs b/src/test/ui/borrowck/two-phase-sneaky.rs
index abfa13d..b6e33d5 100644
--- a/src/test/ui/borrowck/two-phase-sneaky.rs
+++ b/src/test/ui/borrowck/two-phase-sneaky.rs
@@ -1,4 +1,4 @@
-// cmpile-flags: -Z borrowck=mir -Z two-phase-borrows
+// cmpile-flags: -Z borrowck=mir
// This is the first counter-example from Niko's blog post
// smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
diff --git a/src/test/ui/borrowck/two-phase-sneaky.stderr b/src/test/ui/borrowck/two-phase-sneaky.stderr
index 38f24cc..c66f3cb 100644
--- a/src/test/ui/borrowck/two-phase-sneaky.stderr
+++ b/src/test/ui/borrowck/two-phase-sneaky.stderr
@@ -2,13 +2,12 @@
--> $DIR/two-phase-sneaky.rs:12:9
|
LL | v[0].push_str({
- | - first mutable borrow occurs here
+ | - -------- first borrow later used by call
+ | |
+ | first mutable borrow occurs here
LL |
LL | v.push(format!("foo"));
| ^ second mutable borrow occurs here
-...
-LL | });
- | - first borrow ends here
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/two-phase-surprise-no-conflict.ast.stderr b/src/test/ui/borrowck/two-phase-surprise-no-conflict.ast.stderr
deleted file mode 100644
index 8150338..0000000
--- a/src/test/ui/borrowck/two-phase-surprise-no-conflict.ast.stderr
+++ /dev/null
@@ -1,133 +0,0 @@
-error[E0503]: cannot use `self.cx` because it was mutably borrowed
- --> $DIR/two-phase-surprise-no-conflict.rs:30:13
- |
-LL | let _mut_borrow = &mut *self;
- | ----- borrow of `*self` occurs here
-LL | let _access = self.cx;
- | ^^^^^^^ use of borrowed `*self`
-
-error[E0502]: cannot borrow `*self.cx_mut` as immutable because `*self` is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:69:33
- |
-LL | self.hash_expr(&self.cx_mut.body(eid).value);
- | ---- ^^^^^^^^^^^ - mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:121:52
- |
-LL | reg.register_static(Box::new(TrivialPass::new(®.sess_mut)));
- | --- ^^^^^^^^^^^^ - mutable borrow ends here
- | | |
- | mutable borrow occurs here immutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:125:51
- |
-LL | reg.register_bound(Box::new(TrivialPass::new(®.sess_mut)));
- | --- ^^^^^^^^^^^^ - mutable borrow ends here
- | | |
- | mutable borrow occurs here immutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:129:50
- |
-LL | reg.register_univ(Box::new(TrivialPass::new(®.sess_mut)));
- | --- ^^^^^^^^^^^^ - mutable borrow ends here
- | | |
- | mutable borrow occurs here immutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:133:41
- |
-LL | reg.register_ref(&TrivialPass::new(®.sess_mut));
- | --- ^^^^^^^^^^^^ - mutable borrow ends here
- | | |
- | mutable borrow occurs here immutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:141:56
- |
-LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
- | --- ^^^^^^^^^^^^ - first borrow ends here
- | | |
- | first mutable borrow occurs here second mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:146:59
- |
-LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | --- ^^^^^^^^^^^^ - first borrow ends here
- | | |
- | first mutable borrow occurs here second mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:151:58
- |
-LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | --- ^^^^^^^^^^^^ - first borrow ends here
- | | |
- | first mutable borrow occurs here second mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:156:49
- |
-LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
- | --- ^^^^^^^^^^^^ - first borrow ends here
- | | |
- | first mutable borrow occurs here second mutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:168:51
- |
-LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut)));
- | --- ^^^^^^^^^^^^ - mutable borrow ends here
- | | |
- | mutable borrow occurs here immutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:173:50
- |
-LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut)));
- | --- ^^^^^^^^^^^^ - mutable borrow ends here
- | | |
- | mutable borrow occurs here immutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:178:41
- |
-LL | reg.register_ref(&CapturePass::new(®.sess_mut));
- | --- ^^^^^^^^^^^^ - mutable borrow ends here
- | | |
- | mutable borrow occurs here immutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:190:59
- |
-LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | --- ^^^^^^^^^^^^ - first borrow ends here
- | | |
- | first mutable borrow occurs here second mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:196:58
- |
-LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | --- ^^^^^^^^^^^^ - first borrow ends here
- | | |
- | first mutable borrow occurs here second mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:202:49
- |
-LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
- | --- ^^^^^^^^^^^^ - first borrow ends here
- | | |
- | first mutable borrow occurs here second mutable borrow occurs here
-
-error: aborting due to 16 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0503.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/two-phase-surprise-no-conflict.nll.stderr b/src/test/ui/borrowck/two-phase-surprise-no-conflict.nll.stderr
deleted file mode 100644
index 09a2072..0000000
--- a/src/test/ui/borrowck/two-phase-surprise-no-conflict.nll.stderr
+++ /dev/null
@@ -1,154 +0,0 @@
-error[E0503]: cannot use `self.cx` because it was mutably borrowed
- --> $DIR/two-phase-surprise-no-conflict.rs:30:23
- |
-LL | let _mut_borrow = &mut *self;
- | ---------- borrow of `*self` occurs here
-LL | let _access = self.cx;
- | ^^^^^^^ use of borrowed `*self`
-...
-LL | _mut_borrow;
- | ----------- borrow later used here
-
-error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-surprise-no-conflict.rs:69:17
- |
-LL | self.hash_expr(&self.cx_mut.body(eid).value);
- | ^^^^^---------^^-----------^^^^^^^^^^^^^^^^^
- | | | |
- | | | immutable borrow occurs here
- | | immutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:141:51
- |
-LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
- | --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:146:54
- |
-LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:151:53
- |
-LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:156:44
- |
-LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
- | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-surprise-no-conflict.rs:168:5
- |
-LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut)));
- | ^^^^--------------^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^^^
- | | | |
- | | | immutable borrow occurs here
- | | immutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-surprise-no-conflict.rs:173:5
- |
-LL | fn register_plugins<'a>(mk_reg: impl Fn() -> &'a mut Registry<'a>) {
- | -- lifetime `'a` defined here
-...
-LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut)));
- | ^^^^^^^^^^^^^^^^^^-----------------------------------------^
- | | | |
- | | | immutable borrow occurs here
- | | cast requires that `reg.sess_mut` is borrowed for `'a`
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
- --> $DIR/two-phase-surprise-no-conflict.rs:178:5
- |
-LL | reg.register_ref(&CapturePass::new(®.sess_mut));
- | ^^^^------------^^^^^^^^^^^^^^^^^^^-------------^^
- | | | |
- | | | immutable borrow occurs here
- | | immutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0499]: cannot borrow `*reg` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:190:5
- |
-LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | ^^^^--------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------^^^
- | | | |
- | | | first mutable borrow occurs here
- | | first borrow later used by call
- | second mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:190:54
- |
-LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `*reg` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:196:5
- |
-LL | fn register_plugins<'a>(mk_reg: impl Fn() -> &'a mut Registry<'a>) {
- | -- lifetime `'a` defined here
-...
-LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | ^^^^^^^^^^^^^^^^^^-------------------------------------------------^
- | | | |
- | | | first mutable borrow occurs here
- | | cast requires that `reg.sess_mut` is borrowed for `'a`
- | second mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:196:53
- |
-LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `*reg` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:202:5
- |
-LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
- | ^^^^------------^^^^^^^^^^^^^^^^^^^^^^^-----------------^^
- | | | |
- | | | first mutable borrow occurs here
- | | first borrow later used by call
- | second mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:202:44
- |
-LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
- | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error: aborting due to 15 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0503.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/two-phase-surprise-no-conflict.no2pb.stderr b/src/test/ui/borrowck/two-phase-surprise-no-conflict.no2pb.stderr
deleted file mode 100644
index 37df02a..0000000
--- a/src/test/ui/borrowck/two-phase-surprise-no-conflict.no2pb.stderr
+++ /dev/null
@@ -1,159 +0,0 @@
-error[E0503]: cannot use `self.cx` because it was mutably borrowed
- --> $DIR/two-phase-surprise-no-conflict.rs:30:23
- |
-LL | let _mut_borrow = &mut *self;
- | ---------- borrow of `*self` occurs here
-LL | let _access = self.cx;
- | ^^^^^^^ use of borrowed `*self`
-...
-LL | _mut_borrow;
- | ----------- borrow later used here
-
-error[E0502]: cannot borrow `*self.cx` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:54:33
- |
-LL | self.hash_expr(&self.cx.body(eid).value);
- | ---- --------- ^^^^^^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `*self.cx_mut` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:69:33
- |
-LL | self.hash_expr(&self.cx_mut.body(eid).value);
- | ---- --------- ^^^^^^^^^^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:121:51
- |
-LL | reg.register_static(Box::new(TrivialPass::new(®.sess_mut)));
- | --- --------------- ^^^^^^^^^^^^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:125:50
- |
-LL | reg.register_bound(Box::new(TrivialPass::new(®.sess_mut)));
- | --- -------------- ^^^^^^^^^^^^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:129:49
- |
-LL | reg.register_univ(Box::new(TrivialPass::new(®.sess_mut)));
- | --- ------------- ^^^^^^^^^^^^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:133:40
- |
-LL | reg.register_ref(&TrivialPass::new(®.sess_mut));
- | --- ------------ ^^^^^^^^^^^^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:141:51
- |
-LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
- | --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:146:54
- |
-LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:151:53
- |
-LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:156:44
- |
-LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
- | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:168:50
- |
-LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut)));
- | --- -------------- ^^^^^^^^^^^^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:173:49
- |
-LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut)));
- | --- ------------- ^^^^^^^^^^^^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable
- --> $DIR/two-phase-surprise-no-conflict.rs:178:40
- |
-LL | reg.register_ref(&CapturePass::new(®.sess_mut));
- | --- ------------ ^^^^^^^^^^^^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:190:54
- |
-LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:196:53
- |
-LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
- --> $DIR/two-phase-surprise-no-conflict.rs:202:44
- |
-LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
- | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error: aborting due to 17 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0503.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/two-phase-surprise-no-conflict.rs b/src/test/ui/borrowck/two-phase-surprise-no-conflict.rs
index f097def..3fd24bb 100644
--- a/src/test/ui/borrowck/two-phase-surprise-no-conflict.rs
+++ b/src/test/ui/borrowck/two-phase-surprise-no-conflict.rs
@@ -5,15 +5,6 @@
// that we decided it warranted its own unit test, and pnkfelix
// decided to use that test as an opportunity to illustrate the cases.
-// revisions: ast no2pb nll
-//[ast]compile-flags: -Z borrowck=ast
-//[no2pb]compile-flags: -Z borrowck=mir
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows
-
-// (Since we are manually toggling NLL variations on and off, don't
-// bother with compare-mode=nll)
-// ignore-compare-mode-nll
-
#[derive(Copy, Clone)]
struct BodyId;
enum Expr { Closure(BodyId), Others }
@@ -28,9 +19,7 @@
fn demo(&mut self) {
let _mut_borrow = &mut *self;
let _access = self.cx;
- //[ast]~^ ERROR cannot use `self.cx` because it was mutably borrowed [E0503]
- //[no2pb]~^^ ERROR cannot use `self.cx` because it was mutably borrowed [E0503]
- //[nll]~^^^ ERROR cannot use `self.cx` because it was mutably borrowed [E0503]
+ //~^ ERROR cannot use `self.cx` because it was mutably borrowed [E0503]
_mut_borrow;
}
@@ -52,7 +41,6 @@
// nothing in the activation for `self.hash_expr(..)`
// can interfere with that immutable borrow.
self.hash_expr(&self.cx.body(eid).value);
- //[no2pb]~^ ERROR cannot borrow `*self.cx`
},
_ => {}
}
@@ -67,9 +55,7 @@
// eventual activation of the `self` mutable borrow
// for `self.hash_expr(..)`
self.hash_expr(&self.cx_mut.body(eid).value);
- //[ast]~^ ERROR cannot borrow `*self.cx_mut`
- //[no2pb]~^^ ERROR cannot borrow `*self.cx_mut`
- //[nll]~^^^ ERROR cannot borrow `*self`
+ //~^ ERROR cannot borrow `*self`
},
_ => {}
}
@@ -119,44 +105,28 @@
// cannot (according to its type) keep them alive.
let reg = mk_reg();
reg.register_static(Box::new(TrivialPass::new(®.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
let reg = mk_reg();
reg.register_bound(Box::new(TrivialPass::new(®.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
let reg = mk_reg();
reg.register_univ(Box::new(TrivialPass::new(®.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
let reg = mk_reg();
reg.register_ref(&TrivialPass::new(®.sess_mut));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
// These are not okay: the inner mutable borrows immediately
// conflict with the outer borrow/reservation, even with support
// for two-phase borrows.
let reg = mk_reg();
reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `reg.sess_mut`
+ //~^ ERROR cannot borrow `reg.sess_mut`
let reg = mk_reg();
reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `reg.sess_mut`
+ //~^ ERROR cannot borrow `reg.sess_mut`
let reg = mk_reg();
reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `reg.sess_mut`
+ //~^ ERROR cannot borrow `reg.sess_mut`
let reg = mk_reg();
reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `reg.sess_mut`
+ //~^ ERROR cannot borrow `reg.sess_mut`
// These are not okay: the inner borrows may reach the actual
// method invocation, because `CapturePass::new` might (according
@@ -166,19 +136,13 @@
// that will fail to get past lifetime inference.)
let reg = mk_reg();
reg.register_bound(Box::new(CapturePass::new(®.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `*reg` as mutable
+ //~^ ERROR cannot borrow `*reg` as mutable
let reg = mk_reg();
reg.register_univ(Box::new(CapturePass::new(®.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `*reg` as mutable
+ //~^ ERROR cannot borrow `*reg` as mutable
let reg = mk_reg();
reg.register_ref(&CapturePass::new(®.sess_mut));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `*reg` as mutable
+ //~^ ERROR cannot borrow `*reg` as mutable
// These are not okay: the inner mutable borrows immediately
// conflict with the outer borrow/reservation, even with support
@@ -188,22 +152,16 @@
// that will fail to get past lifetime inference.)
let reg = mk_reg();
reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `reg.sess_mut` as mutable more than once at a time
- //[nll]~^^^^ ERROR cannot borrow `*reg` as mutable more than once at a time
+ //~^ ERROR cannot borrow `reg.sess_mut` as mutable more than once at a time
+ //~^^ ERROR cannot borrow `*reg` as mutable more than once at a time
let reg = mk_reg();
reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `reg.sess_mut` as mutable more than once at a time
- //[nll]~^^^^ ERROR cannot borrow `*reg` as mutable more than once at a time
+ //~^ ERROR cannot borrow `reg.sess_mut` as mutable more than once at a time
+ //~^^ ERROR cannot borrow `*reg` as mutable more than once at a time
let reg = mk_reg();
reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
- //[ast]~^ ERROR cannot borrow `reg.sess_mut`
- //[no2pb]~^^ ERROR cannot borrow `reg.sess_mut`
- //[nll]~^^^ ERROR cannot borrow `reg.sess_mut` as mutable more than once at a time
- //[nll]~^^^^ ERROR cannot borrow `*reg` as mutable more than once at a time
+ //~^ ERROR cannot borrow `reg.sess_mut` as mutable more than once at a time
+ //~^^ ERROR cannot borrow `*reg` as mutable more than once at a time
}
fn main() { }
diff --git a/src/test/ui/borrowck/two-phase-surprise-no-conflict.stderr b/src/test/ui/borrowck/two-phase-surprise-no-conflict.stderr
new file mode 100644
index 0000000..7d0e156
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-surprise-no-conflict.stderr
@@ -0,0 +1,154 @@
+error[E0503]: cannot use `self.cx` because it was mutably borrowed
+ --> $DIR/two-phase-surprise-no-conflict.rs:21:23
+ |
+LL | let _mut_borrow = &mut *self;
+ | ---------- borrow of `*self` occurs here
+LL | let _access = self.cx;
+ | ^^^^^^^ use of borrowed `*self`
+LL |
+LL | _mut_borrow;
+ | ----------- borrow later used here
+
+error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as immutable
+ --> $DIR/two-phase-surprise-no-conflict.rs:57:17
+ |
+LL | self.hash_expr(&self.cx_mut.body(eid).value);
+ | ^^^^^---------^^-----------^^^^^^^^^^^^^^^^^
+ | | | |
+ | | | immutable borrow occurs here
+ | | immutable borrow later used by call
+ | mutable borrow occurs here
+
+error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:119:51
+ |
+LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
+ | --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+
+error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:122:54
+ |
+LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
+ | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+
+error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:125:53
+ |
+LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
+ | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+
+error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:128:44
+ |
+LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
+ | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+
+error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
+ --> $DIR/two-phase-surprise-no-conflict.rs:138:5
+ |
+LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut)));
+ | ^^^^--------------^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^^^
+ | | | |
+ | | | immutable borrow occurs here
+ | | immutable borrow later used by call
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
+ --> $DIR/two-phase-surprise-no-conflict.rs:141:5
+ |
+LL | fn register_plugins<'a>(mk_reg: impl Fn() -> &'a mut Registry<'a>) {
+ | -- lifetime `'a` defined here
+...
+LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut)));
+ | ^^^^^^^^^^^^^^^^^^-----------------------------------------^
+ | | | |
+ | | | immutable borrow occurs here
+ | | cast requires that `reg.sess_mut` is borrowed for `'a`
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
+ --> $DIR/two-phase-surprise-no-conflict.rs:144:5
+ |
+LL | reg.register_ref(&CapturePass::new(®.sess_mut));
+ | ^^^^------------^^^^^^^^^^^^^^^^^^^-------------^^
+ | | | |
+ | | | immutable borrow occurs here
+ | | immutable borrow later used by call
+ | mutable borrow occurs here
+
+error[E0499]: cannot borrow `*reg` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:154:5
+ |
+LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
+ | ^^^^--------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------^^^
+ | | | |
+ | | | first mutable borrow occurs here
+ | | first borrow later used by call
+ | second mutable borrow occurs here
+
+error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:154:54
+ |
+LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
+ | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+
+error[E0499]: cannot borrow `*reg` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:158:5
+ |
+LL | fn register_plugins<'a>(mk_reg: impl Fn() -> &'a mut Registry<'a>) {
+ | -- lifetime `'a` defined here
+...
+LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
+ | ^^^^^^^^^^^^^^^^^^-------------------------------------------------^
+ | | | |
+ | | | first mutable borrow occurs here
+ | | cast requires that `reg.sess_mut` is borrowed for `'a`
+ | second mutable borrow occurs here
+
+error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:158:53
+ |
+LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
+ | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+
+error[E0499]: cannot borrow `*reg` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:162:5
+ |
+LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
+ | ^^^^------------^^^^^^^^^^^^^^^^^^^^^^^-----------------^^
+ | | | |
+ | | | first mutable borrow occurs here
+ | | first borrow later used by call
+ | second mutable borrow occurs here
+
+error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
+ --> $DIR/two-phase-surprise-no-conflict.rs:162:44
+ |
+LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
+ | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+
+error: aborting due to 15 previous errors
+
+Some errors have detailed explanations: E0499, E0502, E0503.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
deleted file mode 100644
index d6125cf..0000000
--- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of captured variable in an `Fn` closure
- --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:11:9
- |
-LL | let y = vec![format!("World")];
- | - captured outer variable
-LL | call(|| {
-LL | y.into_iter();
- | ^ cannot move out of captured variable in an `Fn` closure
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs
index 4c6a053..f45aa90 100644
--- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs
+++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs
@@ -9,6 +9,6 @@
let y = vec![format!("World")];
call(|| {
y.into_iter();
- //~^ ERROR cannot move out of captured outer variable in an `Fn` closure
+ //~^ ERROR cannot move out of captured variable in an `Fn` closure
});
}
diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
index bdfd6fb7e..d6125cf 100644
--- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
+++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
@@ -1,11 +1,11 @@
-error[E0507]: cannot move out of captured outer variable in an `Fn` closure
+error[E0507]: cannot move out of captured variable in an `Fn` closure
--> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:11:9
|
LL | let y = vec![format!("World")];
| - captured outer variable
LL | call(|| {
LL | y.into_iter();
- | ^ cannot move out of captured outer variable in an `Fn` closure
+ | ^ cannot move out of captured variable in an `Fn` closure
error: aborting due to previous error
diff --git a/src/test/ui/by-move-pattern-binding.nll.stderr b/src/test/ui/by-move-pattern-binding.nll.stderr
deleted file mode 100644
index 8b53147..0000000
--- a/src/test/ui/by-move-pattern-binding.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/by-move-pattern-binding.rs:14:11
- |
-LL | match &s.x {
- | ^^^^ cannot move out of borrowed content
-LL | &E::Foo => {}
-LL | &E::Bar(identifier) => f(identifier.clone())
- | -------------------
- | | |
- | | data moved here
- | help: consider removing the `&`: `E::Bar(identifier)`
- |
-note: move occurs because `identifier` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/by-move-pattern-binding.rs:16:17
- |
-LL | &E::Bar(identifier) => f(identifier.clone())
- | ^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/by-move-pattern-binding.rs b/src/test/ui/by-move-pattern-binding.rs
index 455b206..d4c9f23 100644
--- a/src/test/ui/by-move-pattern-binding.rs
+++ b/src/test/ui/by-move-pattern-binding.rs
@@ -11,9 +11,9 @@
fn main() {
let s = S { x: E::Bar("hello".to_string()) };
- match &s.x {
+ match &s.x { //~ ERROR cannot move
&E::Foo => {}
- &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move
+ &E::Bar(identifier) => f(identifier.clone())
};
match &s.x {
&E::Foo => {}
diff --git a/src/test/ui/by-move-pattern-binding.stderr b/src/test/ui/by-move-pattern-binding.stderr
index 5135e0d..8b53147 100644
--- a/src/test/ui/by-move-pattern-binding.stderr
+++ b/src/test/ui/by-move-pattern-binding.stderr
@@ -1,11 +1,20 @@
error[E0507]: cannot move out of borrowed content
- --> $DIR/by-move-pattern-binding.rs:16:9
+ --> $DIR/by-move-pattern-binding.rs:14:11
+ |
+LL | match &s.x {
+ | ^^^^ cannot move out of borrowed content
+LL | &E::Foo => {}
+LL | &E::Bar(identifier) => f(identifier.clone())
+ | -------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `E::Bar(identifier)`
+ |
+note: move occurs because `identifier` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/by-move-pattern-binding.rs:16:17
|
LL | &E::Bar(identifier) => f(identifier.clone())
- | ^^^^^^^^----------^
- | | |
- | | hint: to prevent move, use `ref identifier` or `ref mut identifier`
- | cannot move out of borrowed content
+ | ^^^^^^^^^^
error: aborting due to previous error
diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr
deleted file mode 100644
index 9b444ba..0000000
--- a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/cannot-mutate-captured-non-mut-var.rs:13:25
- |
-LL | let x = 1;
- | - help: consider changing this to be mutable: `mut x`
-LL | to_fn_once(move|| { x = 2; });
- | ^^^^^ cannot assign
-
-error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
- --> $DIR/cannot-mutate-captured-non-mut-var.rs:18:25
- |
-LL | let s = std::io::stdin();
- | - help: consider changing this to be mutable: `mut s`
-LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
- | ^ cannot borrow as mutable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr
deleted file mode 100644
index 4cdd160..0000000
--- a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0594]: cannot assign to immutable captured outer variable in an `FnOnce` closure `x`
- --> $DIR/cannot-mutate-captured-non-mut-var.rs:13:25
- |
-LL | to_fn_once(move|| { x = 2; });
- | ^^^^^
-
-error[E0596]: cannot borrow immutable captured outer variable in an `FnOnce` closure `s` as mutable
- --> $DIR/cannot-mutate-captured-non-mut-var.rs:18:25
- |
-LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
- | ^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr
deleted file mode 100644
index 9b444ba..0000000
--- a/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/cannot-mutate-captured-non-mut-var.rs:13:25
- |
-LL | let x = 1;
- | - help: consider changing this to be mutable: `mut x`
-LL | to_fn_once(move|| { x = 2; });
- | ^^^^^ cannot assign
-
-error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
- --> $DIR/cannot-mutate-captured-non-mut-var.rs:18:25
- |
-LL | let s = std::io::stdin();
- | - help: consider changing this to be mutable: `mut s`
-LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
- | ^ cannot borrow as mutable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.rs b/src/test/ui/cannot-mutate-captured-non-mut-var.rs
index 18257d0..a83884a 100644
--- a/src/test/ui/cannot-mutate-captured-non-mut-var.rs
+++ b/src/test/ui/cannot-mutate-captured-non-mut-var.rs
@@ -1,7 +1,3 @@
-// ignore-tidy-linelength
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
#![feature(unboxed_closures)]
use std::io::Read;
@@ -11,11 +7,9 @@
fn main() {
let x = 1;
to_fn_once(move|| { x = 2; });
- //[ast]~^ ERROR: cannot assign to immutable captured outer variable
- //[mir]~^^ ERROR: cannot assign to `x`, as it is not declared as mutable
+ //~^ ERROR: cannot assign to `x`, as it is not declared as mutable
let s = std::io::stdin();
to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
- //[ast]~^ ERROR: cannot borrow immutable captured outer variable
- //[mir]~^^ ERROR: cannot borrow `s` as mutable, as it is not declared as mutable
+ //~^ ERROR: cannot borrow `s` as mutable, as it is not declared as mutable
}
diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.stderr
new file mode 100644
index 0000000..2961497
--- /dev/null
+++ b/src/test/ui/cannot-mutate-captured-non-mut-var.stderr
@@ -0,0 +1,19 @@
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/cannot-mutate-captured-non-mut-var.rs:9:25
+ |
+LL | let x = 1;
+ | - help: consider changing this to be mutable: `mut x`
+LL | to_fn_once(move|| { x = 2; });
+ | ^^^^^ cannot assign
+
+error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
+ --> $DIR/cannot-mutate-captured-non-mut-var.rs:13:25
+ |
+LL | let s = std::io::stdin();
+ | - help: consider changing this to be mutable: `mut s`
+LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
+ | ^ cannot borrow as mutable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/check-static-values-constraints.nll.stderr b/src/test/ui/check-static-values-constraints.nll.stderr
deleted file mode 100644
index f35703a..0000000
--- a/src/test/ui/check-static-values-constraints.nll.stderr
+++ /dev/null
@@ -1,112 +0,0 @@
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/check-static-values-constraints.rs:65:43
- |
-LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor),
- | ___________________________________________^
-LL | |
-LL | | field2: SafeEnum::Variant1}};
- | |________________________________________________________________________________^ statics cannot evaluate destructors
-
-error[E0010]: allocations are not allowed in statics
- --> $DIR/check-static-values-constraints.rs:79:33
- |
-LL | static STATIC11: Box<MyOwned> = box MyOwned;
- | ^^^^^^^^^^^ allocation not allowed in statics
-
-error[E0019]: static contains unimplemented expression type
- --> $DIR/check-static-values-constraints.rs:79:37
- |
-LL | static STATIC11: Box<MyOwned> = box MyOwned;
- | ^^^^^^^
-
-error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
- --> $DIR/check-static-values-constraints.rs:90:32
- |
-LL | field2: SafeEnum::Variant4("str".to_string())
- | ^^^^^^^^^^^^^^^^^
-
-error[E0010]: allocations are not allowed in statics
- --> $DIR/check-static-values-constraints.rs:95:5
- |
-LL | box MyOwned,
- | ^^^^^^^^^^^ allocation not allowed in statics
-
-error[E0019]: static contains unimplemented expression type
- --> $DIR/check-static-values-constraints.rs:95:9
- |
-LL | box MyOwned,
- | ^^^^^^^
-
-error[E0010]: allocations are not allowed in statics
- --> $DIR/check-static-values-constraints.rs:97:5
- |
-LL | box MyOwned,
- | ^^^^^^^^^^^ allocation not allowed in statics
-
-error[E0019]: static contains unimplemented expression type
- --> $DIR/check-static-values-constraints.rs:97:9
- |
-LL | box MyOwned,
- | ^^^^^^^
-
-error[E0010]: allocations are not allowed in statics
- --> $DIR/check-static-values-constraints.rs:102:6
- |
-LL | &box MyOwned,
- | ^^^^^^^^^^^ allocation not allowed in statics
-
-error[E0019]: static contains unimplemented expression type
- --> $DIR/check-static-values-constraints.rs:102:10
- |
-LL | &box MyOwned,
- | ^^^^^^^
-
-error[E0010]: allocations are not allowed in statics
- --> $DIR/check-static-values-constraints.rs:104:6
- |
-LL | &box MyOwned,
- | ^^^^^^^^^^^ allocation not allowed in statics
-
-error[E0019]: static contains unimplemented expression type
- --> $DIR/check-static-values-constraints.rs:104:10
- |
-LL | &box MyOwned,
- | ^^^^^^^
-
-error[E0010]: allocations are not allowed in statics
- --> $DIR/check-static-values-constraints.rs:111:5
- |
-LL | box 3;
- | ^^^^^ allocation not allowed in statics
-
-error[E0019]: static contains unimplemented expression type
- --> $DIR/check-static-values-constraints.rs:111:9
- |
-LL | box 3;
- | ^
-
-error[E0507]: cannot move out of static item
- --> $DIR/check-static-values-constraints.rs:116:45
- |
-LL | let y = { static x: Box<isize> = box 3; x };
- | ^
- | |
- | cannot move out of static item
- | help: consider borrowing here: `&x`
-
-error[E0010]: allocations are not allowed in statics
- --> $DIR/check-static-values-constraints.rs:116:38
- |
-LL | let y = { static x: Box<isize> = box 3; x };
- | ^^^^^ allocation not allowed in statics
-
-error[E0019]: static contains unimplemented expression type
- --> $DIR/check-static-values-constraints.rs:116:42
- |
-LL | let y = { static x: Box<isize> = box 3; x };
- | ^
-
-error: aborting due to 17 previous errors
-
-Some errors have detailed explanations: E0010, E0015, E0019, E0507.
-For more information about an error, try `rustc --explain E0010`.
diff --git a/src/test/ui/check-static-values-constraints.stderr b/src/test/ui/check-static-values-constraints.stderr
index 9648704..f35703a 100644
--- a/src/test/ui/check-static-values-constraints.stderr
+++ b/src/test/ui/check-static-values-constraints.stderr
@@ -89,7 +89,10 @@
--> $DIR/check-static-values-constraints.rs:116:45
|
LL | let y = { static x: Box<isize> = box 3; x };
- | ^ cannot move out of static item
+ | ^
+ | |
+ | cannot move out of static item
+ | help: consider borrowing here: `&x`
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:116:38
diff --git a/src/test/ui/cleanup-rvalue-scopes-cf.rs b/src/test/ui/cleanup-rvalue-scopes-cf.rs
index 106dbd3..e3cecb1 100644
--- a/src/test/ui/cleanup-rvalue-scopes-cf.rs
+++ b/src/test/ui/cleanup-rvalue-scopes-cf.rs
@@ -1,5 +1,3 @@
-// ignore-compare-mode-nll
-
// Test that the borrow checker prevents pointers to temporaries
// with statement lifetimes from escaping.
@@ -7,7 +5,7 @@
static mut FLAGS: u64 = 0;
-struct Box<T> { f: T }
+struct StackBox<T> { f: T }
struct AddFlags { bits: u64 }
fn AddFlags(bits: u64) -> AddFlags {
@@ -25,11 +23,13 @@
}
pub fn main() {
- let _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
- let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
- let _x = &*arg(&AddFlags(1)); //~ ERROR value does not live long enough
- let ref _x = *arg(&AddFlags(1)); //~ ERROR value does not live long enough
- let &ref _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
- let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
- let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough
+ let x1 = arg(&AddFlags(1)); //~ ERROR temporary value dropped while borrowed
+ let x2 = AddFlags(1).get(); //~ ERROR temporary value dropped while borrowed
+ let x3 = &*arg(&AddFlags(1)); //~ ERROR temporary value dropped while borrowed
+ let ref x4 = *arg(&AddFlags(1)); //~ ERROR temporary value dropped while borrowed
+ let &ref x5 = arg(&AddFlags(1)); //~ ERROR temporary value dropped while borrowed
+ let x6 = AddFlags(1).get(); //~ ERROR temporary value dropped while borrowed
+ let StackBox { f: x7 } = StackBox { f: AddFlags(1).get() };
+ //~^ ERROR temporary value dropped while borrowed
+ (x1, x2, x3, x4, x5, x6, x7);
}
diff --git a/src/test/ui/cleanup-rvalue-scopes-cf.stderr b/src/test/ui/cleanup-rvalue-scopes-cf.stderr
index e35e71c..04e5997 100644
--- a/src/test/ui/cleanup-rvalue-scopes-cf.stderr
+++ b/src/test/ui/cleanup-rvalue-scopes-cf.stderr
@@ -1,93 +1,94 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/cleanup-rvalue-scopes-cf.rs:28:19
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:26:19
|
-LL | let _x = arg(&AddFlags(1));
- | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+LL | let x1 = arg(&AddFlags(1));
+ | ^^^^^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
+ | creates a temporary which is freed while still in use
...
-LL | }
- | - temporary value needs to live until here
+LL | (x1, x2, x3, x4, x5, x6, x7);
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
-error[E0597]: borrowed value does not live long enough
- --> $DIR/cleanup-rvalue-scopes-cf.rs:29:14
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:27:14
|
-LL | let _x = AddFlags(1).get();
- | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+LL | let x2 = AddFlags(1).get();
+ | ^^^^^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
+ | creates a temporary which is freed while still in use
...
-LL | }
- | - temporary value needs to live until here
+LL | (x1, x2, x3, x4, x5, x6, x7);
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
-error[E0597]: borrowed value does not live long enough
- --> $DIR/cleanup-rvalue-scopes-cf.rs:30:21
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:28:21
|
-LL | let _x = &*arg(&AddFlags(1));
- | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+LL | let x3 = &*arg(&AddFlags(1));
+ | ^^^^^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
+ | creates a temporary which is freed while still in use
...
-LL | }
- | - temporary value needs to live until here
+LL | (x1, x2, x3, x4, x5, x6, x7);
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
-error[E0597]: borrowed value does not live long enough
- --> $DIR/cleanup-rvalue-scopes-cf.rs:31:24
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:29:24
|
-LL | let ref _x = *arg(&AddFlags(1));
- | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+LL | let ref x4 = *arg(&AddFlags(1));
+ | ^^^^^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
+ | creates a temporary which is freed while still in use
...
-LL | }
- | - temporary value needs to live until here
+LL | (x1, x2, x3, x4, x5, x6, x7);
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
-error[E0597]: borrowed value does not live long enough
- --> $DIR/cleanup-rvalue-scopes-cf.rs:32:24
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:30:24
|
-LL | let &ref _x = arg(&AddFlags(1));
- | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+LL | let &ref x5 = arg(&AddFlags(1));
+ | ^^^^^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
+ | creates a temporary which is freed while still in use
...
-LL | }
- | - temporary value needs to live until here
+LL | (x1, x2, x3, x4, x5, x6, x7);
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
-error[E0597]: borrowed value does not live long enough
- --> $DIR/cleanup-rvalue-scopes-cf.rs:33:14
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:31:14
|
-LL | let _x = AddFlags(1).get();
- | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+LL | let x6 = AddFlags(1).get();
+ | ^^^^^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
-LL | let Box { f: _x } = Box { f: AddFlags(1).get() };
-LL | }
- | - temporary value needs to live until here
+ | creates a temporary which is freed while still in use
+...
+LL | (x1, x2, x3, x4, x5, x6, x7);
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
-error[E0597]: borrowed value does not live long enough
- --> $DIR/cleanup-rvalue-scopes-cf.rs:34:34
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:32:44
|
-LL | let Box { f: _x } = Box { f: AddFlags(1).get() };
- | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
- | |
- | temporary value does not live long enough
-LL | }
- | - temporary value needs to live until here
+LL | let StackBox { f: x7 } = StackBox { f: AddFlags(1).get() };
+ | ^^^^^^^^^^^ - temporary value is freed at the end of this statement
+ | |
+ | creates a temporary which is freed while still in use
+LL |
+LL | (x1, x2, x3, x4, x5, x6, x7);
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
error: aborting due to 7 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/closure_promotion.rs b/src/test/ui/closure_promotion.rs
index a80745e..db9c0a6 100644
--- a/src/test/ui/closure_promotion.rs
+++ b/src/test/ui/closure_promotion.rs
@@ -1,8 +1,7 @@
-// ignore-compare-mode-nll
+// compile-pass
#![allow(const_err)]
-// nll successfully compiles this.
fn main() {
- let x: &'static _ = &|| { let z = 3; z }; //~ ERROR does not live long enough
+ let x: &'static _ = &|| { let z = 3; z };
}
diff --git a/src/test/ui/closure_promotion.stderr b/src/test/ui/closure_promotion.stderr
deleted file mode 100644
index 475e283..0000000
--- a/src/test/ui/closure_promotion.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/closure_promotion.rs:7:26
- |
-LL | let x: &'static _ = &|| { let z = 3; z };
- | ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/closures/closure-immutable-outer-variable.fixed b/src/test/ui/closures/closure-immutable-outer-variable.fixed
index 22164a2..03240d4 100644
--- a/src/test/ui/closures/closure-immutable-outer-variable.fixed
+++ b/src/test/ui/closures/closure-immutable-outer-variable.fixed
@@ -8,5 +8,6 @@
fn main() {
let mut y = true;
- foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable
+ foo(Box::new(move || y = false) as Box<_>);
+ //~^ ERROR cannot assign to `y`, as it is not declared as mutable
}
diff --git a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr
deleted file mode 100644
index 558c9ca..0000000
--- a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error[E0594]: cannot assign to `y`, as it is not declared as mutable
- --> $DIR/closure-immutable-outer-variable.rs:11:26
- |
-LL | let y = true;
- | - help: consider changing this to be mutable: `mut y`
-LL | foo(Box::new(move || y = false) as Box<_>);
- | ^^^^^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/closures/closure-immutable-outer-variable.rs b/src/test/ui/closures/closure-immutable-outer-variable.rs
index fc4e385..8fa9e44 100644
--- a/src/test/ui/closures/closure-immutable-outer-variable.rs
+++ b/src/test/ui/closures/closure-immutable-outer-variable.rs
@@ -8,5 +8,6 @@
fn main() {
let y = true;
- foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable
+ foo(Box::new(move || y = false) as Box<_>);
+ //~^ ERROR cannot assign to `y`, as it is not declared as mutable
}
diff --git a/src/test/ui/closures/closure-immutable-outer-variable.stderr b/src/test/ui/closures/closure-immutable-outer-variable.stderr
index e675a08..558c9ca 100644
--- a/src/test/ui/closures/closure-immutable-outer-variable.stderr
+++ b/src/test/ui/closures/closure-immutable-outer-variable.stderr
@@ -1,10 +1,10 @@
-error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
+error[E0594]: cannot assign to `y`, as it is not declared as mutable
--> $DIR/closure-immutable-outer-variable.rs:11:26
|
LL | let y = true;
- | - help: consider making `y` mutable: `mut y`
+ | - help: consider changing this to be mutable: `mut y`
LL | foo(Box::new(move || y = false) as Box<_>);
- | ^^^^^^^^^
+ | ^^^^^^^^^ cannot assign
error: aborting due to previous error
diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr
deleted file mode 100644
index a60f1c7..0000000
--- a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/huge_multispan_highlight.rs:90:13
- |
-LL | let x = "foo";
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | let y = &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr
index 13bd666..a60f1c7 100644
--- a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr
+++ b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr
@@ -1,11 +1,11 @@
-error[E0596]: cannot borrow immutable local variable `x` as mutable
- --> $DIR/huge_multispan_highlight.rs:90:18
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/huge_multispan_highlight.rs:90:13
|
LL | let x = "foo";
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
...
LL | let y = &mut x;
- | ^ cannot borrow mutably
+ | ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/codemap_tests/issue-11715.nll.stderr b/src/test/ui/codemap_tests/issue-11715.nll.stderr
deleted file mode 100644
index d0c29c7..0000000
--- a/src/test/ui/codemap_tests/issue-11715.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/issue-11715.rs:5:13
- |
-LL | let y = &mut x;
- | ------ first mutable borrow occurs here
-LL | let z = &mut x;
- | ^^^^^^ second mutable borrow occurs here
-LL | z.use_mut();
-LL | y.use_mut();
- | - first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/codemap_tests/issue-11715.stderr b/src/test/ui/codemap_tests/issue-11715.stderr
index c37e6b3..d0c29c7 100644
--- a/src/test/ui/codemap_tests/issue-11715.stderr
+++ b/src/test/ui/codemap_tests/issue-11715.stderr
@@ -1,13 +1,13 @@
error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/issue-11715.rs:5:18
+ --> $DIR/issue-11715.rs:5:13
|
LL | let y = &mut x;
- | - first mutable borrow occurs here
+ | ------ first mutable borrow occurs here
LL | let z = &mut x;
- | ^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+ | ^^^^^^ second mutable borrow occurs here
+LL | z.use_mut();
+LL | y.use_mut();
+ | - first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/codemap_tests/one_line.nll.stderr b/src/test/ui/codemap_tests/one_line.nll.stderr
deleted file mode 100644
index eddbd29..0000000
--- a/src/test/ui/codemap_tests/one_line.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0499]: cannot borrow `v` as mutable more than once at a time
- --> $DIR/one_line.rs:3:12
- |
-LL | v.push(v.pop().unwrap());
- | - ---- ^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/codemap_tests/one_line.stderr b/src/test/ui/codemap_tests/one_line.stderr
index 9dcaba8..eddbd29 100644
--- a/src/test/ui/codemap_tests/one_line.stderr
+++ b/src/test/ui/codemap_tests/one_line.stderr
@@ -2,9 +2,9 @@
--> $DIR/one_line.rs:3:12
|
LL | v.push(v.pop().unwrap());
- | - ^ - first borrow ends here
- | | |
- | | second mutable borrow occurs here
+ | - ---- ^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
| first mutable borrow occurs here
error: aborting due to previous error
diff --git a/src/test/ui/codemap_tests/tab_3.nll.stderr b/src/test/ui/codemap_tests/tab_3.nll.stderr
deleted file mode 100644
index 97816a7..0000000
--- a/src/test/ui/codemap_tests/tab_3.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0382]: borrow of moved value: `some_vec`
- --> $DIR/tab_3.rs:7:20
- |
-LL | let some_vec = vec!["hi"];
- | -------- move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait
-LL | some_vec.into_iter();
- | -------- value moved here
-LL | {
-LL | println!("{:?}", some_vec);
- | ^^^^^^^^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/codemap_tests/tab_3.rs b/src/test/ui/codemap_tests/tab_3.rs
index 4fd5b70..58b034d 100644
--- a/src/test/ui/codemap_tests/tab_3.rs
+++ b/src/test/ui/codemap_tests/tab_3.rs
@@ -4,6 +4,6 @@
let some_vec = vec!["hi"];
some_vec.into_iter();
{
- println!("{:?}", some_vec); //~ ERROR use of moved
+ println!("{:?}", some_vec); //~ ERROR borrow of moved
}
}
diff --git a/src/test/ui/codemap_tests/tab_3.stderr b/src/test/ui/codemap_tests/tab_3.stderr
index 4b550db..97816a7 100644
--- a/src/test/ui/codemap_tests/tab_3.stderr
+++ b/src/test/ui/codemap_tests/tab_3.stderr
@@ -1,13 +1,13 @@
-error[E0382]: use of moved value: `some_vec`
+error[E0382]: borrow of moved value: `some_vec`
--> $DIR/tab_3.rs:7:20
|
+LL | let some_vec = vec!["hi"];
+ | -------- move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait
LL | some_vec.into_iter();
| -------- value moved here
LL | {
LL | println!("{:?}", some_vec);
- | ^^^^^^^^ value used here after move
- |
- = note: move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait
+ | ^^^^^^^^ value borrowed here after move
error: aborting due to previous error
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr
deleted file mode 100644
index 71f7d87..0000000
--- a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr
+++ /dev/null
@@ -1,46 +0,0 @@
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/coerce-overloaded-autoderef.rs:12:24
- |
-LL | let y = borrow_mut(x);
- | - first mutable borrow occurs here
-LL | let z = borrow_mut(x);
- | ^ second mutable borrow occurs here
-...
-LL | drop((y, z));
- | - first borrow later used here
-
-error[E0506]: cannot assign to `**x` because it is borrowed
- --> $DIR/coerce-overloaded-autoderef.rs:21:5
- |
-LL | let y = borrow(x);
- | - borrow of `**x` occurs here
-LL | let z = borrow(x);
-LL | **x += 1;
- | ^^^^^^^^ assignment to borrowed `**x` occurs here
-...
-LL | drop((y, z));
- | - borrow later used here
-
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/coerce-overloaded-autoderef.rs:28:20
- |
-LL | borrow_mut2(x, x);
- | ----------- - ^ second mutable borrow occurs here
- | | |
- | | first mutable borrow occurs here
- | first borrow later used by call
-
-error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
- --> $DIR/coerce-overloaded-autoderef.rs:34:5
- |
-LL | borrow2(x, x);
- | -------^^^^-^
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
- | immutable borrow later used by call
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0506.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr
deleted file mode 100644
index 0e5a4a6..0000000
--- a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/coerce-overloaded-autoderef.rs:12:24
- |
-LL | let y = borrow_mut(x);
- | - first mutable borrow occurs here
-LL | let z = borrow_mut(x);
- | ^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
-
-error[E0506]: cannot assign to `**x` because it is borrowed
- --> $DIR/coerce-overloaded-autoderef.rs:21:5
- |
-LL | let y = borrow(x);
- | - borrow of `**x` occurs here
-LL | let z = borrow(x);
-LL | **x += 1;
- | ^^^^^^^^ assignment to borrowed `**x` occurs here
-
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/coerce-overloaded-autoderef.rs:28:20
- |
-LL | borrow_mut2(x, x);
- | - ^- first borrow ends here
- | | |
- | | second mutable borrow occurs here
- | first mutable borrow occurs here
-
-error[E0502]: cannot borrow `*x` as immutable because it is also borrowed as mutable
- --> $DIR/coerce-overloaded-autoderef.rs:34:16
- |
-LL | borrow2(x, x);
- | - ^- mutable borrow ends here
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0506.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr
deleted file mode 100644
index 71f7d87..0000000
--- a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr
+++ /dev/null
@@ -1,46 +0,0 @@
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/coerce-overloaded-autoderef.rs:12:24
- |
-LL | let y = borrow_mut(x);
- | - first mutable borrow occurs here
-LL | let z = borrow_mut(x);
- | ^ second mutable borrow occurs here
-...
-LL | drop((y, z));
- | - first borrow later used here
-
-error[E0506]: cannot assign to `**x` because it is borrowed
- --> $DIR/coerce-overloaded-autoderef.rs:21:5
- |
-LL | let y = borrow(x);
- | - borrow of `**x` occurs here
-LL | let z = borrow(x);
-LL | **x += 1;
- | ^^^^^^^^ assignment to borrowed `**x` occurs here
-...
-LL | drop((y, z));
- | - borrow later used here
-
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/coerce-overloaded-autoderef.rs:28:20
- |
-LL | borrow_mut2(x, x);
- | ----------- - ^ second mutable borrow occurs here
- | | |
- | | first mutable borrow occurs here
- | first borrow later used by call
-
-error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
- --> $DIR/coerce-overloaded-autoderef.rs:34:5
- |
-LL | borrow2(x, x);
- | -------^^^^-^
- | | |
- | | immutable borrow occurs here
- | mutable borrow occurs here
- | immutable borrow later used by call
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0506.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr
deleted file mode 100644
index 39a2847..0000000
--- a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr
+++ /dev/null
@@ -1,45 +0,0 @@
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/coerce-overloaded-autoderef.rs:12:24
- |
-LL | let y = borrow_mut(x);
- | - first mutable borrow occurs here
-LL | let z = borrow_mut(x);
- | ^ second mutable borrow occurs here
-...
-LL | drop((y, z));
- | - first borrow later used here
-
-error[E0506]: cannot assign to `**x` because it is borrowed
- --> $DIR/coerce-overloaded-autoderef.rs:21:5
- |
-LL | let y = borrow(x);
- | - borrow of `**x` occurs here
-LL | let z = borrow(x);
-LL | **x += 1;
- | ^^^^^^^^ assignment to borrowed `**x` occurs here
-...
-LL | drop((y, z));
- | - borrow later used here
-
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/coerce-overloaded-autoderef.rs:28:20
- |
-LL | borrow_mut2(x, x);
- | ----------- - ^ second mutable borrow occurs here
- | | |
- | | first mutable borrow occurs here
- | first borrow later used by call
-
-error[E0502]: cannot borrow `*x` as immutable because it is also borrowed as mutable
- --> $DIR/coerce-overloaded-autoderef.rs:34:16
- |
-LL | borrow2(x, x);
- | ------- - ^ immutable borrow occurs here
- | | |
- | | mutable borrow occurs here
- | mutable borrow later used by call
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0499, E0502, E0506.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.rs b/src/test/ui/coercion/coerce-overloaded-autoderef.rs
index ec72745..01d9c1e 100644
--- a/src/test/ui/coercion/coerce-overloaded-autoderef.rs
+++ b/src/test/ui/coercion/coerce-overloaded-autoderef.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn borrow_mut<T>(x: &mut T) -> &mut T { x }
fn borrow<T>(x: &T) -> &T { x }
@@ -10,8 +7,7 @@
fn double_mut_borrow<T>(x: &mut Box<T>) {
let y = borrow_mut(x);
let z = borrow_mut(x);
- //[ast]~^ ERROR cannot borrow `*x` as mutable more than once at a time
- //[mir]~^^ ERROR cannot borrow `*x` as mutable more than once at a time
+ //~^ ERROR cannot borrow `*x` as mutable more than once at a time
drop((y, z));
}
@@ -19,21 +15,18 @@
let y = borrow(x);
let z = borrow(x);
**x += 1;
- //[ast]~^ ERROR cannot assign to `**x` because it is borrowed
- //[mir]~^^ ERROR cannot assign to `**x` because it is borrowed
+ //~^ ERROR cannot assign to `**x` because it is borrowed
drop((y, z));
}
fn double_mut_borrow2<T>(x: &mut Box<T>) {
borrow_mut2(x, x);
- //[ast]~^ ERROR cannot borrow `*x` as mutable more than once at a time
- //[mir]~^^ ERROR cannot borrow `*x` as mutable more than once at a time
+ //~^ ERROR cannot borrow `*x` as mutable more than once at a time
}
fn double_borrow2<T>(x: &mut Box<T>) {
borrow2(x, x);
- //[ast]~^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable
- //[mir]~^^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable
+ //~^ ERROR cannot borrow `*x` as mutable because it is also borrowed as immutable
}
pub fn main() {}
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.stderr
new file mode 100644
index 0000000..7cdfcb5
--- /dev/null
+++ b/src/test/ui/coercion/coerce-overloaded-autoderef.stderr
@@ -0,0 +1,46 @@
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:9:24
+ |
+LL | let y = borrow_mut(x);
+ | - first mutable borrow occurs here
+LL | let z = borrow_mut(x);
+ | ^ second mutable borrow occurs here
+LL |
+LL | drop((y, z));
+ | - first borrow later used here
+
+error[E0506]: cannot assign to `**x` because it is borrowed
+ --> $DIR/coerce-overloaded-autoderef.rs:17:5
+ |
+LL | let y = borrow(x);
+ | - borrow of `**x` occurs here
+LL | let z = borrow(x);
+LL | **x += 1;
+ | ^^^^^^^^ assignment to borrowed `**x` occurs here
+LL |
+LL | drop((y, z));
+ | - borrow later used here
+
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:23:20
+ |
+LL | borrow_mut2(x, x);
+ | ----------- - ^ second mutable borrow occurs here
+ | | |
+ | | first mutable borrow occurs here
+ | first borrow later used by call
+
+error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
+ --> $DIR/coerce-overloaded-autoderef.rs:28:5
+ |
+LL | borrow2(x, x);
+ | -------^^^^-^
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+ | immutable borrow later used by call
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0499, E0502, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/command-line-diagnostics.nll.stderr b/src/test/ui/command-line-diagnostics.nll.stderr
deleted file mode 100644
index b3f8d8a..0000000
--- a/src/test/ui/command-line-diagnostics.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/command-line-diagnostics.rs:6:5
- |
-LL | let x = 42;
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x = 43;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/command-line-diagnostics.stderr b/src/test/ui/command-line-diagnostics.stderr
index 6f1156e..b3f8d8a 100644
--- a/src/test/ui/command-line-diagnostics.stderr
+++ b/src/test/ui/command-line-diagnostics.stderr
@@ -2,7 +2,10 @@
--> $DIR/command-line-diagnostics.rs:6:5
|
LL | let x = 42;
- | - first assignment to `x`
+ | -
+ | |
+ | first assignment to `x`
+ | help: make this binding mutable: `mut x`
LL | x = 43;
| ^^^^^^ cannot assign twice to immutable variable
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr
deleted file mode 100644
index ca80a9a..0000000
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error: `foo` is not yet stable as a const fn
- --> $DIR/dont_promote_unstable_const_fn.rs:15:25
- |
-LL | const fn bar() -> u32 { foo() }
- | ^^^^^
- |
- = help: add `#![feature(foo)]` to the crate attributes to enable
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/dont_promote_unstable_const_fn.rs:18:28
- |
-LL | let _: &'static u32 = &foo();
- | ------------ ^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/dont_promote_unstable_const_fn.rs:22:28
- |
-LL | let _: &'static u32 = &meh();
- | ------------ ^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/dont_promote_unstable_const_fn.rs:23:26
- |
-LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis();
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL |
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs
index 7170be1..9002869 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs
+++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs
@@ -15,11 +15,11 @@
const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn
fn a() {
- let _: &'static u32 = &foo(); //~ ERROR does not live long enough
+ let _: &'static u32 = &foo(); //~ ERROR temporary value dropped while borrowed
}
fn main() {
- let _: &'static u32 = &meh(); //~ ERROR does not live long enough
+ let _: &'static u32 = &meh(); //~ ERROR temporary value dropped while borrowed
let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis();
- //~^ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
index d796666..ca80a9a 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
+++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
@@ -6,38 +6,38 @@
|
= help: add `#![feature(foo)]` to the crate attributes to enable
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn.rs:18:28
|
LL | let _: &'static u32 = &foo();
- | ^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn.rs:22:28
|
LL | let _: &'static u32 = &meh();
- | ^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn.rs:23:26
|
LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL |
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr
deleted file mode 100644
index 129f061..0000000
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28
- |
-LL | let _: &'static u32 = &foo();
- | ------------ ^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | let _x: &'static u32 = &foo();
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29
- |
-LL | let _x: &'static u32 = &foo();
- | ------------ ^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs
index 6dcfcfe..ea35f46 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs
+++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs
@@ -5,6 +5,6 @@
use stability::foo;
fn main() {
- let _: &'static u32 = &foo(); //~ ERROR does not live long enough
- let _x: &'static u32 = &foo(); //~ ERROR does not live long enough
+ let _: &'static u32 = &foo(); //~ ERROR temporary value dropped while borrowed
+ let _x: &'static u32 = &foo(); //~ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr
index 516c008..129f061 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr
+++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr
@@ -1,24 +1,24 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28
|
LL | let _: &'static u32 = &foo();
- | ^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL | let _x: &'static u32 = &foo();
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29
|
LL | let _x: &'static u32 = &foo();
- | ^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr
deleted file mode 100644
index 519ba7d..0000000
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_const_fn_fail.rs:20:27
- |
-LL | let x: &'static u8 = &(bar() + 1);
- | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs b/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs
index 80562b0..88181cb 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs
+++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs
@@ -17,7 +17,7 @@
}
fn main() {
- let x: &'static u8 = &(bar() + 1); //~ ERROR does not live long enough
+ let x: &'static u8 = &(bar() + 1); //~ ERROR temporary value dropped while borrowed
let y = *x;
unreachable!();
}
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr
index c9a357d..519ba7d 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr
+++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr
@@ -1,14 +1,14 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_const_fn_fail.rs:20:27
|
LL | let x: &'static u8 = &(bar() + 1);
- | ^^^^^^^^^^^ temporary value does not live long enough
+ | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr
deleted file mode 100644
index 987d230..0000000
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_const_fn_fail_deny_const_err.rs:21:27
- |
-LL | let x: &'static u8 = &(bar() + 1);
- | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs
index f331e44..061ab7e 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs
+++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs
@@ -19,7 +19,7 @@
// This will compile, but then hard-abort at runtime.
// FIXME(oli-obk): this should instead panic (not hard-abort) at runtime.
let x: &'static u8 = &(bar() + 1);
- //~^ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
let y = *x;
unreachable!();
}
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
index 9c786b0..987d230 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
+++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
@@ -1,14 +1,14 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_const_fn_fail_deny_const_err.rs:21:27
|
LL | let x: &'static u8 = &(bar() + 1);
- | ^^^^^^^^^^^ temporary value does not live long enough
+ | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr
deleted file mode 100644
index a8bb697..0000000
--- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr
+++ /dev/null
@@ -1,46 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_raw_ptr_ops.rs:4:29
- |
-LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32);
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_raw_ptr_ops.rs:6:30
- |
-LL | let y: &'static usize = &(&1 as *const i32 as usize + 1);
- | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_raw_ptr_ops.rs:7:28
- |
-LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) });
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | let a: &'static bool = &(main as fn() == main as fn());
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_raw_ptr_ops.rs:8:29
- |
-LL | let a: &'static bool = &(main as fn() == main as fn());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs
index ef7e550..c6fb5ee 100644
--- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs
+++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs
@@ -2,8 +2,11 @@
fn main() {
let x: &'static bool = &(42 as *const i32 == 43 as *const i32);
- //~^ ERROR does not live long enough
- let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough
- let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough
- let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
+ let y: &'static usize = &(&1 as *const i32 as usize + 1);
+ //~^ ERROR temporary value dropped while borrowed
+ let z: &'static i32 = &(unsafe { *(42 as *const i32) });
+ //~^ ERROR temporary value dropped while borrowed
+ let a: &'static bool = &(main as fn() == main as fn());
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
index 5a0654c..7f2e489 100644
--- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
+++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
@@ -1,46 +1,47 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_raw_ptr_ops.rs:4:29
|
LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_raw_ptr_ops.rs:6:30
|
LL | let y: &'static usize = &(&1 as *const i32 as usize + 1);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
- --> $DIR/promoted_raw_ptr_ops.rs:7:28
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/promoted_raw_ptr_ops.rs:8:28
|
LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) });
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-LL | let a: &'static bool = &(main as fn() == main as fn());
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
- --> $DIR/promoted_raw_ptr_ops.rs:8:29
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/promoted_raw_ptr_ops.rs:10:29
|
LL | let a: &'static bool = &(main as fn() == main as fn());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+LL |
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr
deleted file mode 100644
index 5aae8c1..0000000
--- a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/transmute-const-promotion.rs:6:37
- |
-LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) };
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL |
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.rs b/src/test/ui/consts/const-eval/transmute-const-promotion.rs
index a1da350..8bd1b34 100644
--- a/src/test/ui/consts/const-eval/transmute-const-promotion.rs
+++ b/src/test/ui/consts/const-eval/transmute-const-promotion.rs
@@ -4,5 +4,5 @@
fn main() {
let x: &'static u32 = unsafe { &mem::transmute(3.0f32) };
- //~^ ERROR value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr
index 5829a17..5aae8c1 100644
--- a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr
+++ b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr
@@ -1,14 +1,14 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/transmute-const-promotion.rs:6:37
|
LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) };
- | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL |
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/union_promotion.nll.stderr b/src/test/ui/consts/const-eval/union_promotion.nll.stderr
deleted file mode 100644
index b530c02..0000000
--- a/src/test/ui/consts/const-eval/union_promotion.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/union_promotion.rs:9:29
- |
-LL | let x: &'static bool = &unsafe {
- | ____________-------------____^
- | | |
- | | type annotation requires that borrow lasts for `'static`
-LL | | Foo { a: &1 }.b == Foo { a: &2 }.b
-LL | | };
- | |_____^ creates a temporary which is freed while still in use
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/union_promotion.rs b/src/test/ui/consts/const-eval/union_promotion.rs
index c308c81..d356651 100644
--- a/src/test/ui/consts/const-eval/union_promotion.rs
+++ b/src/test/ui/consts/const-eval/union_promotion.rs
@@ -6,7 +6,7 @@
}
fn main() {
- let x: &'static bool = &unsafe { //~ borrowed value does not live long enough
+ let x: &'static bool = &unsafe { //~ temporary value dropped while borrowed
Foo { a: &1 }.b == Foo { a: &2 }.b
};
}
diff --git a/src/test/ui/consts/const-eval/union_promotion.stderr b/src/test/ui/consts/const-eval/union_promotion.stderr
index c60f671..b530c02 100644
--- a/src/test/ui/consts/const-eval/union_promotion.stderr
+++ b/src/test/ui/consts/const-eval/union_promotion.stderr
@@ -1,16 +1,16 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/union_promotion.rs:9:29
|
LL | let x: &'static bool = &unsafe {
- | _____________________________^
+ | ____________-------------____^
+ | | |
+ | | type annotation requires that borrow lasts for `'static`
LL | | Foo { a: &1 }.b == Foo { a: &2 }.b
LL | | };
- | |_____^ temporary value does not live long enough
+ | |_____^ creates a temporary which is freed while still in use
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-conversion.nll.stderr b/src/test/ui/consts/const-int-conversion.nll.stderr
deleted file mode 100644
index 65330e2..0000000
--- a/src/test/ui/consts/const-int-conversion.nll.stderr
+++ /dev/null
@@ -1,80 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-conversion.rs:4:28
- |
-LL | let x: &'static i32 = &(5_i32.reverse_bits());
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-conversion.rs:6:28
- |
-LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-conversion.rs:8:28
- |
-LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78]));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-conversion.rs:10:28
- |
-LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0])));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-conversion.rs:12:29
- |
-LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-conversion.rs:14:29
- |
-LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-conversion.rs:16:29
- |
-LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL |
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 7 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-conversion.rs b/src/test/ui/consts/const-int-conversion.rs
index 8f0aa14..ea40943 100644
--- a/src/test/ui/consts/const-int-conversion.rs
+++ b/src/test/ui/consts/const-int-conversion.rs
@@ -2,17 +2,17 @@
fn main() {
let x: &'static i32 = &(5_i32.reverse_bits());
- //~^ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]));
- //~^ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78]));
- //~^ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0])));
- //~^ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes());
- //~^ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes());
- //~^ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes());
- //~^ ERROR does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-int-conversion.stderr b/src/test/ui/consts/const-int-conversion.stderr
index ddb1a75..65330e2 100644
--- a/src/test/ui/consts/const-int-conversion.stderr
+++ b/src/test/ui/consts/const-int-conversion.stderr
@@ -1,80 +1,80 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:4:28
|
LL | let x: &'static i32 = &(5_i32.reverse_bits());
- | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:6:28
|
LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:8:28
|
LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78]));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:10:28
|
LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0])));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:12:29
|
LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:14:29
|
LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:16:29
|
LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL |
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to 7 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-overflowing.nll.stderr b/src/test/ui/consts/const-int-overflowing.nll.stderr
deleted file mode 100644
index bd061ab..0000000
--- a/src/test/ui/consts/const-int-overflowing.nll.stderr
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-overflowing.rs:2:36
- |
-LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3));
- | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-overflowing.rs:3:36
- |
-LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3));
- | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3));
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-overflowing.rs:4:36
- |
-LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3));
- | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-overflowing.rs b/src/test/ui/consts/const-int-overflowing.rs
index 4e69e85..cd74c99 100644
--- a/src/test/ui/consts/const-int-overflowing.rs
+++ b/src/test/ui/consts/const-int-overflowing.rs
@@ -1,5 +1,8 @@
fn main() {
- let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough
- let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough
- let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough
+ let x: &'static (i32, bool) = &(5_i32.overflowing_add(3));
+ //~^ ERROR temporary value dropped while borrowed
+ let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3));
+ //~^ ERROR temporary value dropped while borrowed
+ let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3));
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-int-overflowing.stderr b/src/test/ui/consts/const-int-overflowing.stderr
index 7228b5d..56c7f7f 100644
--- a/src/test/ui/consts/const-int-overflowing.stderr
+++ b/src/test/ui/consts/const-int-overflowing.stderr
@@ -1,35 +1,36 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-overflowing.rs:2:36
|
LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
- --> $DIR/const-int-overflowing.rs:3:36
- |
-LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3));
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-overflowing.rs:4:36
|
-LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3));
+ | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+...
LL | }
- | - temporary value only lives until here
+ | - temporary value is freed at the end of this statement
+
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/const-int-overflowing.rs:6:36
|
- = note: borrowed value must be valid for the static lifetime...
+LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3));
+ | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+LL |
+LL | }
+ | - temporary value is freed at the end of this statement
error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-rotate.nll.stderr b/src/test/ui/consts/const-int-rotate.nll.stderr
deleted file mode 100644
index 2b7cdf5..0000000
--- a/src/test/ui/consts/const-int-rotate.nll.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-rotate.rs:2:28
- |
-LL | let x: &'static i32 = &(5_i32.rotate_left(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | let y: &'static i32 = &(5_i32.rotate_right(3));
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-rotate.rs:3:28
- |
-LL | let y: &'static i32 = &(5_i32.rotate_right(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-rotate.rs b/src/test/ui/consts/const-int-rotate.rs
index d07c00e..3aacf85 100644
--- a/src/test/ui/consts/const-int-rotate.rs
+++ b/src/test/ui/consts/const-int-rotate.rs
@@ -1,4 +1,6 @@
fn main() {
- let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough
- let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough
+ let x: &'static i32 = &(5_i32.rotate_left(3));
+ //~^ ERROR temporary value dropped while borrowed
+ let y: &'static i32 = &(5_i32.rotate_right(3));
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-int-rotate.stderr b/src/test/ui/consts/const-int-rotate.stderr
index ec08e0a..ed26580 100644
--- a/src/test/ui/consts/const-int-rotate.stderr
+++ b/src/test/ui/consts/const-int-rotate.stderr
@@ -1,24 +1,25 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-rotate.rs:2:28
|
LL | let x: &'static i32 = &(5_i32.rotate_left(3));
- | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-LL | let y: &'static i32 = &(5_i32.rotate_right(3));
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
- --> $DIR/const-int-rotate.rs:3:28
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/const-int-rotate.rs:4:28
|
LL | let y: &'static i32 = &(5_i32.rotate_right(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+LL |
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-sign.nll.stderr b/src/test/ui/consts/const-int-sign.nll.stderr
deleted file mode 100644
index 0ad7a39..0000000
--- a/src/test/ui/consts/const-int-sign.nll.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-sign.rs:2:29
- |
-LL | let x: &'static bool = &(5_i32.is_negative());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | let y: &'static bool = &(5_i32.is_positive());
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-sign.rs:3:29
- |
-LL | let y: &'static bool = &(5_i32.is_positive());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-sign.rs b/src/test/ui/consts/const-int-sign.rs
index a21797c..c3111dd 100644
--- a/src/test/ui/consts/const-int-sign.rs
+++ b/src/test/ui/consts/const-int-sign.rs
@@ -1,4 +1,6 @@
fn main() {
- let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough
- let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough
+ let x: &'static bool = &(5_i32.is_negative());
+ //~^ ERROR temporary value dropped while borrowed
+ let y: &'static bool = &(5_i32.is_positive());
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-int-sign.stderr b/src/test/ui/consts/const-int-sign.stderr
index ffe09a0..5f8fd41 100644
--- a/src/test/ui/consts/const-int-sign.stderr
+++ b/src/test/ui/consts/const-int-sign.stderr
@@ -1,24 +1,25 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-sign.rs:2:29
|
LL | let x: &'static bool = &(5_i32.is_negative());
- | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-LL | let y: &'static bool = &(5_i32.is_positive());
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
- --> $DIR/const-int-sign.rs:3:29
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/const-int-sign.rs:4:29
|
LL | let y: &'static bool = &(5_i32.is_positive());
- | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+LL |
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-wrapping.nll.stderr b/src/test/ui/consts/const-int-wrapping.nll.stderr
deleted file mode 100644
index a186854..0000000
--- a/src/test/ui/consts/const-int-wrapping.nll.stderr
+++ /dev/null
@@ -1,57 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-wrapping.rs:2:28
- |
-LL | let x: &'static i32 = &(5_i32.wrapping_add(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-wrapping.rs:3:28
- |
-LL | let y: &'static i32 = &(5_i32.wrapping_sub(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-wrapping.rs:4:28
- |
-LL | let z: &'static i32 = &(5_i32.wrapping_mul(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-wrapping.rs:5:28
- |
-LL | let a: &'static i32 = &(5_i32.wrapping_shl(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | let b: &'static i32 = &(5_i32.wrapping_shr(3));
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-int-wrapping.rs:6:28
- |
-LL | let b: &'static i32 = &(5_i32.wrapping_shr(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-int-wrapping.rs b/src/test/ui/consts/const-int-wrapping.rs
index 720e40b..50d04f9 100644
--- a/src/test/ui/consts/const-int-wrapping.rs
+++ b/src/test/ui/consts/const-int-wrapping.rs
@@ -1,7 +1,12 @@
fn main() {
- let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough
- let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough
- let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough
- let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough
- let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough
+ let x: &'static i32 = &(5_i32.wrapping_add(3));
+ //~^ ERROR temporary value dropped while borrowed
+ let y: &'static i32 = &(5_i32.wrapping_sub(3));
+ //~^ ERROR temporary value dropped while borrowed
+ let z: &'static i32 = &(5_i32.wrapping_mul(3));
+ //~^ ERROR temporary value dropped while borrowed
+ let a: &'static i32 = &(5_i32.wrapping_shl(3));
+ //~^ ERROR temporary value dropped while borrowed
+ let b: &'static i32 = &(5_i32.wrapping_shr(3));
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-int-wrapping.stderr b/src/test/ui/consts/const-int-wrapping.stderr
index 478a6d8..5174b72 100644
--- a/src/test/ui/consts/const-int-wrapping.stderr
+++ b/src/test/ui/consts/const-int-wrapping.stderr
@@ -1,57 +1,58 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-wrapping.rs:2:28
|
LL | let x: &'static i32 = &(5_i32.wrapping_add(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
- --> $DIR/const-int-wrapping.rs:3:28
- |
-LL | let y: &'static i32 = &(5_i32.wrapping_sub(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-...
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-wrapping.rs:4:28
|
-LL | let z: &'static i32 = &(5_i32.wrapping_mul(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+LL | let y: &'static i32 = &(5_i32.wrapping_sub(3));
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
- --> $DIR/const-int-wrapping.rs:5:28
- |
-LL | let a: &'static i32 = &(5_i32.wrapping_shl(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-LL | let b: &'static i32 = &(5_i32.wrapping_shr(3));
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-wrapping.rs:6:28
|
-LL | let b: &'static i32 = &(5_i32.wrapping_shr(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+LL | let z: &'static i32 = &(5_i32.wrapping_mul(3));
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+...
LL | }
- | - temporary value only lives until here
+ | - temporary value is freed at the end of this statement
+
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/const-int-wrapping.rs:8:28
|
- = note: borrowed value must be valid for the static lifetime...
+LL | let a: &'static i32 = &(5_i32.wrapping_shl(3));
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+...
+LL | }
+ | - temporary value is freed at the end of this statement
+
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/const-int-wrapping.rs:10:28
+ |
+LL | let b: &'static i32 = &(5_i32.wrapping_shr(3));
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+LL |
+LL | }
+ | - temporary value is freed at the end of this statement
error: aborting due to 5 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-ptr-nonnull.nll.stderr b/src/test/ui/consts/const-ptr-nonnull.nll.stderr
deleted file mode 100644
index 26946fb..0000000
--- a/src/test/ui/consts/const-ptr-nonnull.nll.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-ptr-nonnull.rs:4:37
- |
-LL | let x: &'static NonNull<u32> = &(NonNull::dangling());
- | --------------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-ptr-nonnull.rs:9:37
- |
-LL | let x: &'static NonNull<u32> = &(non_null.cast());
- | --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL |
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-ptr-nonnull.rs b/src/test/ui/consts/const-ptr-nonnull.rs
index 54e743a..25cf6cf 100644
--- a/src/test/ui/consts/const-ptr-nonnull.rs
+++ b/src/test/ui/consts/const-ptr-nonnull.rs
@@ -2,10 +2,10 @@
fn main() {
let x: &'static NonNull<u32> = &(NonNull::dangling());
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
let mut i: i32 = 10;
let non_null = NonNull::new(&mut i).unwrap();
let x: &'static NonNull<u32> = &(non_null.cast());
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-ptr-nonnull.stderr b/src/test/ui/consts/const-ptr-nonnull.stderr
index a606bed..26946fb 100644
--- a/src/test/ui/consts/const-ptr-nonnull.stderr
+++ b/src/test/ui/consts/const-ptr-nonnull.stderr
@@ -1,25 +1,25 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-ptr-nonnull.rs:4:37
|
LL | let x: &'static NonNull<u32> = &(NonNull::dangling());
- | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | --------------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-ptr-nonnull.rs:9:37
|
LL | let x: &'static NonNull<u32> = &(non_null.cast());
- | ^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL |
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-ptr-unique.nll.stderr b/src/test/ui/consts/const-ptr-unique.nll.stderr
deleted file mode 100644
index 3644cf4..0000000
--- a/src/test/ui/consts/const-ptr-unique.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/const-ptr-unique.rs:8:33
- |
-LL | let x: &'static *mut u32 = &(unique.as_ptr());
- | ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL |
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-ptr-unique.rs b/src/test/ui/consts/const-ptr-unique.rs
index be44a24..252c5d1 100644
--- a/src/test/ui/consts/const-ptr-unique.rs
+++ b/src/test/ui/consts/const-ptr-unique.rs
@@ -6,5 +6,5 @@
let mut i: u32 = 10;
let unique = Unique::new(&mut i).unwrap();
let x: &'static *mut u32 = &(unique.as_ptr());
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/const-ptr-unique.stderr b/src/test/ui/consts/const-ptr-unique.stderr
index 482b78b..3644cf4 100644
--- a/src/test/ui/consts/const-ptr-unique.stderr
+++ b/src/test/ui/consts/const-ptr-unique.stderr
@@ -1,14 +1,14 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/const-ptr-unique.rs:8:33
|
LL | let x: &'static *mut u32 = &(unique.as_ptr());
- | ^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL |
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr
deleted file mode 100644
index 1ec93ce..0000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr
+++ /dev/null
@@ -1,298 +0,0 @@
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/min_const_fn.rs:37:25
- |
-LL | const fn into_inner(self) -> T { self.0 }
- | ^^^^ constant functions cannot evaluate destructors
-
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:39:36
- |
-LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/min_const_fn.rs:44:28
- |
-LL | const fn into_inner_lt(self) -> T { self.0 }
- | ^^^^ constant functions cannot evaluate destructors
-
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:46:42
- |
-LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
- | ^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/min_const_fn.rs:51:27
- |
-LL | const fn into_inner_s(self) -> T { self.0 }
- | ^^^^ constant functions cannot evaluate destructors
-
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:53:38
- |
-LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:58:39
- |
-LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:76:16
- |
-LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
- | ^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:78:18
- |
-LL | const fn foo11_2<T: Send>(t: T) -> T { t }
- | ^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:80:33
- |
-LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
- | ^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:82:35
- |
-LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
- | ^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: only int and `bool` operations are stable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:84:35
- |
-LL | const fn foo19_3(f: f32) -> f32 { -f }
- | ^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:86:43
- |
-LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
- | ^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: cannot access `static` items in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:90:27
- |
-LL | const fn foo25() -> u32 { BAR }
- | ^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: cannot access `static` items in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:91:36
- |
-LL | const fn foo26() -> &'static u32 { &BAR }
- | ^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:92:42
- |
-LL | const fn foo30(x: *const u32) -> usize { x as usize }
- | ^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:94:63
- |
-LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
- | ^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:96:42
- |
-LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
- | ^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:98:63
- |
-LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
- | ^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:100:38
- |
-LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:102:29
- |
-LL | const fn foo30_5(b: bool) { while b { } }
- | ^^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:104:44
- |
-LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
- | ^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
- --> $DIR/min_const_fn.rs:106:44
- |
-LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
- | ^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: mutable references in const fn are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:108:14
- |
-LL | const fn inc(x: &mut i32) { *x += 1 }
- | ^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:113:6
- |
-LL | impl<T: std::fmt::Debug> Foo<T> {
- | ^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:118:6
- |
-LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
- | ^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:123:6
- |
-LL | impl<T: Sync + Sized> Foo<T> {
- | ^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: `impl Trait` in const fn is unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:129:24
- |
-LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:131:34
- |
-LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
- | ^^^^^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:133:22
- |
-LL | const fn no_apit(_x: impl std::fmt::Debug) {}
- | ^^^^^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: `impl Trait` in const fn is unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:134:23
- |
-LL | const fn no_rpit() -> impl std::fmt::Debug {}
- | ^^^^^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:135:23
- |
-LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
- | ^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:136:32
- |
-LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-warning[E0515]: cannot return reference to temporary value
- --> $DIR/min_const_fn.rs:136:63
- |
-LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
- | ^--
- | ||
- | |temporary value created here
- | returns a reference to data owned by the current function
- |
- = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
- = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:141:41
- |
-LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:144:21
- |
-LL | const fn no_fn_ptrs(_x: fn()) {}
- | ^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: function pointers in const fn are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:146:27
- |
-LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
- | ^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error: aborting due to 36 previous errors
-
-Some errors have detailed explanations: E0515, E0723.
-For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs
index ee3ffcd..881cbb1 100644
--- a/src/test/ui/consts/min_const_fn/min_const_fn.rs
+++ b/src/test/ui/consts/min_const_fn/min_const_fn.rs
@@ -135,6 +135,9 @@
const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
//~^ ERROR trait bounds other than `Sized`
+//~| WARNING cannot return reference to temporary value
+//~| WARNING this error has been downgraded to a warning
+//~| WARNING this warning will become a hard error in the future
const fn no_unsafe() { unsafe {} }
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr
index b5f224c..e4b0d4e 100644
--- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr
+++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr
@@ -256,8 +256,20 @@
|
= help: add #![feature(const_fn)] to the crate attributes to enable
+warning[E0515]: cannot return reference to temporary value
+ --> $DIR/min_const_fn.rs:136:63
+ |
+LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
+ | ^--
+ | ||
+ | |temporary value created here
+ | returns a reference to data owned by the current function
+ |
+ = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+ = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:141:41
+ --> $DIR/min_const_fn.rs:144:41
|
LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -265,7 +277,7 @@
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: function pointers in const fn are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:144:21
+ --> $DIR/min_const_fn.rs:147:21
|
LL | const fn no_fn_ptrs(_x: fn()) {}
| ^^
@@ -273,7 +285,7 @@
= help: add #![feature(const_fn)] to the crate attributes to enable
error[E0723]: function pointers in const fn are unstable (see issue #57563)
- --> $DIR/min_const_fn.rs:146:27
+ --> $DIR/min_const_fn.rs:149:27
|
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
| ^^^^
@@ -282,4 +294,5 @@
error: aborting due to 36 previous errors
-For more information about this error, try `rustc --explain E0723`.
+Some errors have detailed explanations: E0515, E0723.
+For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr
deleted file mode 100644
index dc7e92a..0000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn_dyn.rs:9:5
- |
-LL | x.0.field;
- | ^^^^^^^^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
- --> $DIR/min_const_fn_dyn.rs:12:66
- |
-LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
- | ^^
- |
- = help: add #![feature(const_fn)] to the crate attributes to enable
-
-warning[E0716]: temporary value dropped while borrowed
- --> $DIR/min_const_fn_dyn.rs:12:67
- |
-LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
- | -^ - temporary value is freed at the end of this statement
- | ||
- | |creates a temporary which is freed while still in use
- | cast requires that borrow lasts for `'static`
- |
- = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
- = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0716, E0723.
-For more information about an error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs
index 6ca1e59..75b6719 100644
--- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs
@@ -11,5 +11,8 @@
}
const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
//~^ ERROR trait bounds other than `Sized`
+//~| WARNING temporary value dropped while borrowed
+//~| WARNING this error has been downgraded to a warning
+//~| WARNING this warning will become a hard error in the future
fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr
index 8ff9637..dc7e92a 100644
--- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr
+++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr
@@ -14,6 +14,19 @@
|
= help: add #![feature(const_fn)] to the crate attributes to enable
+warning[E0716]: temporary value dropped while borrowed
+ --> $DIR/min_const_fn_dyn.rs:12:67
+ |
+LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
+ | -^ - temporary value is freed at the end of this statement
+ | ||
+ | |creates a temporary which is freed while still in use
+ | cast requires that borrow lasts for `'static`
+ |
+ = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+ = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0723`.
+Some errors have detailed explanations: E0716, E0723.
+For more information about an error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/min_const_fn/promotion.nll.stderr b/src/test/ui/consts/min_const_fn/promotion.nll.stderr
deleted file mode 100644
index 550423c..0000000
--- a/src/test/ui/consts/min_const_fn/promotion.nll.stderr
+++ /dev/null
@@ -1,68 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:11:27
- |
-LL | let x: &'static () = &foo1();
- | ----------- ^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:12:28
- |
-LL | let y: &'static i32 = &foo2(42);
- | ------------ ^^^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:13:28
- |
-LL | let z: &'static i32 = &foo3();
- | ------------ ^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:14:34
- |
-LL | let a: &'static Cell<i32> = &foo4();
- | ------------------ ^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:15:42
- |
-LL | let a: &'static Option<Cell<i32>> = &foo5();
- | -------------------------- ^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | let a: &'static Option<Cell<i32>> = &foo6();
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:16:42
- |
-LL | let a: &'static Option<Cell<i32>> = &foo6();
- | -------------------------- ^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/min_const_fn/promotion.rs b/src/test/ui/consts/min_const_fn/promotion.rs
index 969bf40..fbe535c 100644
--- a/src/test/ui/consts/min_const_fn/promotion.rs
+++ b/src/test/ui/consts/min_const_fn/promotion.rs
@@ -8,10 +8,10 @@
const fn foo6() -> Option<Cell<i32>> { None }
fn main() {
- let x: &'static () = &foo1(); //~ ERROR does not live long enough
- let y: &'static i32 = &foo2(42); //~ ERROR does not live long enough
- let z: &'static i32 = &foo3(); //~ ERROR does not live long enough
- let a: &'static Cell<i32> = &foo4(); //~ ERROR does not live long enough
- let a: &'static Option<Cell<i32>> = &foo5(); //~ ERROR does not live long enough
- let a: &'static Option<Cell<i32>> = &foo6(); //~ ERROR does not live long enough
+ let x: &'static () = &foo1(); //~ ERROR temporary value dropped while borrowed
+ let y: &'static i32 = &foo2(42); //~ ERROR temporary value dropped while borrowed
+ let z: &'static i32 = &foo3(); //~ ERROR temporary value dropped while borrowed
+ let a: &'static Cell<i32> = &foo4(); //~ ERROR temporary value dropped while borrowed
+ let a: &'static Option<Cell<i32>> = &foo5(); //~ ERROR temporary value dropped while borrowed
+ let a: &'static Option<Cell<i32>> = &foo6(); //~ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/consts/min_const_fn/promotion.stderr b/src/test/ui/consts/min_const_fn/promotion.stderr
index 92d60f0..550423c 100644
--- a/src/test/ui/consts/min_const_fn/promotion.stderr
+++ b/src/test/ui/consts/min_const_fn/promotion.stderr
@@ -1,68 +1,68 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:11:27
|
LL | let x: &'static () = &foo1();
- | ^^^^^^ temporary value does not live long enough
+ | ----------- ^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:12:28
|
LL | let y: &'static i32 = &foo2(42);
- | ^^^^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:13:28
|
LL | let z: &'static i32 = &foo3();
- | ^^^^^^ temporary value does not live long enough
+ | ------------ ^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:14:34
|
LL | let a: &'static Cell<i32> = &foo4();
- | ^^^^^^ temporary value does not live long enough
+ | ------------------ ^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
...
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:15:42
|
LL | let a: &'static Option<Cell<i32>> = &foo5();
- | ^^^^^^ temporary value does not live long enough
+ | -------------------------- ^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL | let a: &'static Option<Cell<i32>> = &foo6();
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:16:42
|
LL | let a: &'static Option<Cell<i32>> = &foo6();
- | ^^^^^^ temporary value does not live long enough
+ | -------------------------- ^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to 6 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/promote_const_let.nll.stderr b/src/test/ui/consts/promote_const_let.nll.stderr
deleted file mode 100644
index c47d297..0000000
--- a/src/test/ui/consts/promote_const_let.nll.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error[E0597]: `y` does not live long enough
- --> $DIR/promote_const_let.rs:4:9
- |
-LL | let x: &'static u32 = {
- | ------------ type annotation requires that `y` is borrowed for `'static`
-LL | let y = 42;
-LL | &y
- | ^^ borrowed value does not live long enough
-LL | };
- | - `y` dropped here while still borrowed
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promote_const_let.rs:6:28
- |
-LL | let x: &'static u32 = &{
- | ____________------------____^
- | | |
- | | type annotation requires that borrow lasts for `'static`
-LL | | let y = 42;
-LL | | y
-LL | | };
- | |_____^ creates a temporary which is freed while still in use
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0597, E0716.
-For more information about an error, try `rustc --explain E0597`.
diff --git a/src/test/ui/consts/promote_const_let.rs b/src/test/ui/consts/promote_const_let.rs
index a8a6d4d..51a0fec 100644
--- a/src/test/ui/consts/promote_const_let.rs
+++ b/src/test/ui/consts/promote_const_let.rs
@@ -3,7 +3,7 @@
let y = 42;
&y //~ ERROR does not live long enough
};
- let x: &'static u32 = &{ //~ ERROR does not live long enough
+ let x: &'static u32 = &{ //~ ERROR temporary value dropped while borrowed
let y = 42;
y
};
diff --git a/src/test/ui/consts/promote_const_let.stderr b/src/test/ui/consts/promote_const_let.stderr
index c429577..c47d297 100644
--- a/src/test/ui/consts/promote_const_let.stderr
+++ b/src/test/ui/consts/promote_const_let.stderr
@@ -1,27 +1,29 @@
error[E0597]: `y` does not live long enough
- --> $DIR/promote_const_let.rs:4:10
+ --> $DIR/promote_const_let.rs:4:9
|
+LL | let x: &'static u32 = {
+ | ------------ type annotation requires that `y` is borrowed for `'static`
+LL | let y = 42;
LL | &y
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | };
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `y` dropped here while still borrowed
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/promote_const_let.rs:6:28
|
LL | let x: &'static u32 = &{
- | ____________________________^
+ | ____________------------____^
+ | | |
+ | | type annotation requires that borrow lasts for `'static`
LL | | let y = 42;
LL | | y
LL | | };
- | |_____^ temporary value does not live long enough
+ | |_____^ creates a temporary which is freed while still in use
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+Some errors have detailed explanations: E0597, E0716.
+For more information about an error, try `rustc --explain E0597`.
diff --git a/src/test/ui/did_you_mean/issue-31424.nll.stderr b/src/test/ui/did_you_mean/issue-31424.nll.stderr
deleted file mode 100644
index 147225f..0000000
--- a/src/test/ui/did_you_mean/issue-31424.nll.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
- --> $DIR/issue-31424.rs:7:9
- |
-LL | (&mut self).bar();
- | ^^^^^^^^^^^
- | |
- | cannot borrow as mutable
- | try removing `&mut` here
-
-warning: function cannot return without recursing
- --> $DIR/issue-31424.rs:12:5
- |
-LL | fn bar(self: &mut Self) {
- | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
-LL |
-LL | (&mut self).bar();
- | ----------------- recursive call site
- |
- = note: #[warn(unconditional_recursion)] on by default
- = help: a `loop` may express intention better if this is on purpose
-
-error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
- --> $DIR/issue-31424.rs:14:9
- |
-LL | (&mut self).bar();
- | ^^^^^^^^^^^
- | |
- | cannot borrow as mutable
- | try removing `&mut` here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-31424.stderr b/src/test/ui/did_you_mean/issue-31424.stderr
index 7c351ea..147225f 100644
--- a/src/test/ui/did_you_mean/issue-31424.stderr
+++ b/src/test/ui/did_you_mean/issue-31424.stderr
@@ -1,11 +1,11 @@
-error[E0596]: cannot borrow immutable argument `self` as mutable
- --> $DIR/issue-31424.rs:7:15
+error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
+ --> $DIR/issue-31424.rs:7:9
|
LL | (&mut self).bar();
- | ^^^^
- | |
- | cannot reborrow mutably
- | try removing `&mut` here
+ | ^^^^^^^^^^^
+ | |
+ | cannot borrow as mutable
+ | try removing `&mut` here
warning: function cannot return without recursing
--> $DIR/issue-31424.rs:12:5
@@ -19,15 +19,14 @@
= note: #[warn(unconditional_recursion)] on by default
= help: a `loop` may express intention better if this is on purpose
-error[E0596]: cannot borrow immutable argument `self` as mutable
- --> $DIR/issue-31424.rs:14:15
+error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
+ --> $DIR/issue-31424.rs:14:9
|
LL | (&mut self).bar();
- | ^^^^ cannot borrow mutably
-help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
- |
-LL | self.bar();
- | ^^^^
+ | ^^^^^^^^^^^
+ | |
+ | cannot borrow as mutable
+ | try removing `&mut` here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/did_you_mean/issue-34126.nll.stderr b/src/test/ui/did_you_mean/issue-34126.nll.stderr
deleted file mode 100644
index 0843df2..0000000
--- a/src/test/ui/did_you_mean/issue-34126.nll.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
- --> $DIR/issue-34126.rs:6:18
- |
-LL | self.run(&mut self);
- | ^^^^^^^^^
- | |
- | cannot borrow as mutable
- | try removing `&mut` here
-
-error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable
- --> $DIR/issue-34126.rs:6:18
- |
-LL | self.run(&mut self);
- | ---- --- ^^^^^^^^^ mutable borrow occurs here
- | | |
- | | immutable borrow later used by call
- | immutable borrow occurs here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0502, E0596.
-For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/did_you_mean/issue-34126.rs b/src/test/ui/did_you_mean/issue-34126.rs
index 15bef1e..4989577 100644
--- a/src/test/ui/did_you_mean/issue-34126.rs
+++ b/src/test/ui/did_you_mean/issue-34126.rs
@@ -4,6 +4,7 @@
fn run(&self, z: &mut Z) { }
fn start(&mut self) {
self.run(&mut self); //~ ERROR cannot borrow
+ //~| ERROR cannot borrow
}
}
diff --git a/src/test/ui/did_you_mean/issue-34126.stderr b/src/test/ui/did_you_mean/issue-34126.stderr
index 536e2951..0843df2 100644
--- a/src/test/ui/did_you_mean/issue-34126.stderr
+++ b/src/test/ui/did_you_mean/issue-34126.stderr
@@ -1,12 +1,22 @@
-error[E0596]: cannot borrow immutable argument `self` as mutable
- --> $DIR/issue-34126.rs:6:23
+error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
+ --> $DIR/issue-34126.rs:6:18
|
LL | self.run(&mut self);
- | ^^^^
- | |
- | cannot reborrow mutably
- | try removing `&mut` here
+ | ^^^^^^^^^
+ | |
+ | cannot borrow as mutable
+ | try removing `&mut` here
-error: aborting due to previous error
+error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable
+ --> $DIR/issue-34126.rs:6:18
+ |
+LL | self.run(&mut self);
+ | ---- --- ^^^^^^^^^ mutable borrow occurs here
+ | | |
+ | | immutable borrow later used by call
+ | immutable borrow occurs here
-For more information about this error, try `rustc --explain E0596`.
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0502, E0596.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/did_you_mean/issue-34337.nll.stderr b/src/test/ui/did_you_mean/issue-34337.nll.stderr
deleted file mode 100644
index 81f7b6d..0000000
--- a/src/test/ui/did_you_mean/issue-34337.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0596]: cannot borrow `key` as mutable, as it is not declared as mutable
- --> $DIR/issue-34337.rs:6:9
- |
-LL | get(&mut key);
- | ^^^^^^^^
- | |
- | cannot borrow as mutable
- | try removing `&mut` here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-34337.stderr b/src/test/ui/did_you_mean/issue-34337.stderr
index 353f409..81f7b6d 100644
--- a/src/test/ui/did_you_mean/issue-34337.stderr
+++ b/src/test/ui/did_you_mean/issue-34337.stderr
@@ -1,11 +1,11 @@
-error[E0596]: cannot borrow immutable local variable `key` as mutable
- --> $DIR/issue-34337.rs:6:14
+error[E0596]: cannot borrow `key` as mutable, as it is not declared as mutable
+ --> $DIR/issue-34337.rs:6:9
|
LL | get(&mut key);
- | ^^^
- | |
- | cannot reborrow mutably
- | try removing `&mut` here
+ | ^^^^^^^^
+ | |
+ | cannot borrow as mutable
+ | try removing `&mut` here
error: aborting due to previous error
diff --git a/src/test/ui/did_you_mean/issue-35937.nll.stderr b/src/test/ui/did_you_mean/issue-35937.nll.stderr
deleted file mode 100644
index 4f9b6a6..0000000
--- a/src/test/ui/did_you_mean/issue-35937.nll.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0596]: cannot borrow `f.v` as mutable, as `f` is not declared as mutable
- --> $DIR/issue-35937.rs:7:5
- |
-LL | let f = Foo { v: Vec::new() };
- | - help: consider changing this to be mutable: `mut f`
-LL | f.v.push("cat".to_string());
- | ^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable
- --> $DIR/issue-35937.rs:16:5
- |
-LL | let s = S { x: 42 };
- | - help: consider changing this to be mutable: `mut s`
-LL | s.x += 1;
- | ^^^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable
- --> $DIR/issue-35937.rs:20:5
- |
-LL | fn bar(s: S) {
- | - help: consider changing this to be mutable: `mut s`
-LL | s.x += 1;
- | ^^^^^^^^ cannot assign
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-35937.stderr b/src/test/ui/did_you_mean/issue-35937.stderr
index ea0f558..4f9b6a6 100644
--- a/src/test/ui/did_you_mean/issue-35937.stderr
+++ b/src/test/ui/did_you_mean/issue-35937.stderr
@@ -1,26 +1,26 @@
-error[E0596]: cannot borrow field `f.v` of immutable binding as mutable
+error[E0596]: cannot borrow `f.v` as mutable, as `f` is not declared as mutable
--> $DIR/issue-35937.rs:7:5
|
LL | let f = Foo { v: Vec::new() };
- | - help: make this binding mutable: `mut f`
+ | - help: consider changing this to be mutable: `mut f`
LL | f.v.push("cat".to_string());
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^ cannot borrow as mutable
-error[E0594]: cannot assign to field `s.x` of immutable binding
+error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable
--> $DIR/issue-35937.rs:16:5
|
LL | let s = S { x: 42 };
- | - help: make this binding mutable: `mut s`
+ | - help: consider changing this to be mutable: `mut s`
LL | s.x += 1;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot assign
-error[E0594]: cannot assign to field `s.x` of immutable binding
+error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable
--> $DIR/issue-35937.rs:20:5
|
LL | fn bar(s: S) {
- | - help: make this binding mutable: `mut s`
+ | - help: consider changing this to be mutable: `mut s`
LL | s.x += 1;
- | ^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot assign
error: aborting due to 3 previous errors
diff --git a/src/test/ui/did_you_mean/issue-37139.nll.stderr b/src/test/ui/did_you_mean/issue-37139.nll.stderr
deleted file mode 100644
index 163817d..0000000
--- a/src/test/ui/did_you_mean/issue-37139.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/issue-37139.rs:12:18
- |
-LL | test(&mut x);
- | ^^^^^^
- | |
- | cannot borrow as mutable
- | try removing `&mut` here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-37139.rs b/src/test/ui/did_you_mean/issue-37139.rs
index b7f419a..07d855d 100644
--- a/src/test/ui/did_you_mean/issue-37139.rs
+++ b/src/test/ui/did_you_mean/issue-37139.rs
@@ -9,7 +9,7 @@
let mut x = TestEnum::Item(10);
match x {
TestEnum::Item(ref mut x) => {
- test(&mut x); //~ ERROR cannot borrow immutable
+ test(&mut x); //~ ERROR cannot borrow `x` as mutable, as it is not declared as mutable
}
}
}
diff --git a/src/test/ui/did_you_mean/issue-37139.stderr b/src/test/ui/did_you_mean/issue-37139.stderr
index cd42ee8..163817d 100644
--- a/src/test/ui/did_you_mean/issue-37139.stderr
+++ b/src/test/ui/did_you_mean/issue-37139.stderr
@@ -1,11 +1,11 @@
-error[E0596]: cannot borrow immutable local variable `x` as mutable
- --> $DIR/issue-37139.rs:12:23
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/issue-37139.rs:12:18
|
LL | test(&mut x);
- | ^
- | |
- | cannot reborrow mutably
- | try removing `&mut` here
+ | ^^^^^^
+ | |
+ | cannot borrow as mutable
+ | try removing `&mut` here
error: aborting due to previous error
diff --git a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr
deleted file mode 100644
index 6efac37..0000000
--- a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference
- --> $DIR/issue-38147-1.rs:17:9
- |
-LL | fn f(&self) {
- | ----- help: consider changing this to be a mutable reference: `&mut self`
-LL | self.s.push('x');
- | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-38147-1.rs b/src/test/ui/did_you_mean/issue-38147-1.rs
index b672396..c068a18 100644
--- a/src/test/ui/did_you_mean/issue-38147-1.rs
+++ b/src/test/ui/did_you_mean/issue-38147-1.rs
@@ -14,7 +14,7 @@
impl<'a> Foo<'a> {
fn f(&self) {
- self.s.push('x'); //~ ERROR cannot borrow data mutably
+ self.s.push('x'); //~ cannot borrow `*self.s` as mutable, as it is behind a `&` reference
}
}
diff --git a/src/test/ui/did_you_mean/issue-38147-1.stderr b/src/test/ui/did_you_mean/issue-38147-1.stderr
index 4311836..6efac37 100644
--- a/src/test/ui/did_you_mean/issue-38147-1.stderr
+++ b/src/test/ui/did_you_mean/issue-38147-1.stderr
@@ -1,11 +1,11 @@
-error[E0389]: cannot borrow data mutably in a `&` reference
+error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference
--> $DIR/issue-38147-1.rs:17:9
|
LL | fn f(&self) {
- | ----- use `&mut self` here to make mutable
+ | ----- help: consider changing this to be a mutable reference: `&mut self`
LL | self.s.push('x');
- | ^^^^^^ assignment into an immutable reference
+ | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0389`.
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-38147-2.nll.stderr b/src/test/ui/did_you_mean/issue-38147-2.nll.stderr
deleted file mode 100644
index cb49810..0000000
--- a/src/test/ui/did_you_mean/issue-38147-2.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference
- --> $DIR/issue-38147-2.rs:7:9
- |
-LL | s: &'a String
- | ---------- help: consider changing this to be mutable: `&'a mut String`
-...
-LL | self.s.push('x');
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-38147-2.rs b/src/test/ui/did_you_mean/issue-38147-2.rs
index e43ebf9..fe2634d 100644
--- a/src/test/ui/did_you_mean/issue-38147-2.rs
+++ b/src/test/ui/did_you_mean/issue-38147-2.rs
@@ -5,7 +5,7 @@
impl<'a> Bar<'a> {
fn f(&mut self) {
self.s.push('x');
- //~^ ERROR cannot borrow borrowed content `*self.s` of immutable binding as mutable
+ //~^ ERROR cannot borrow `*self.s` as mutable, as it is behind a `&` reference
}
}
diff --git a/src/test/ui/did_you_mean/issue-38147-2.stderr b/src/test/ui/did_you_mean/issue-38147-2.stderr
index fa4fccb..cb49810 100644
--- a/src/test/ui/did_you_mean/issue-38147-2.stderr
+++ b/src/test/ui/did_you_mean/issue-38147-2.stderr
@@ -1,8 +1,8 @@
-error[E0596]: cannot borrow borrowed content `*self.s` of immutable binding as mutable
+error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference
--> $DIR/issue-38147-2.rs:7:9
|
LL | s: &'a String
- | ---------- use `&'a mut String` here to make mutable
+ | ---------- help: consider changing this to be mutable: `&'a mut String`
...
LL | self.s.push('x');
| ^^^^^^ cannot borrow as mutable
diff --git a/src/test/ui/did_you_mean/issue-38147-3.nll.stderr b/src/test/ui/did_you_mean/issue-38147-3.nll.stderr
deleted file mode 100644
index 6778257..0000000
--- a/src/test/ui/did_you_mean/issue-38147-3.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference
- --> $DIR/issue-38147-3.rs:7:9
- |
-LL | s: &'a String
- | ---------- help: consider changing this to be mutable: `&'a mut String`
-...
-LL | self.s.push('x');
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-38147-3.rs b/src/test/ui/did_you_mean/issue-38147-3.rs
index 4cd703f..40b8e0d 100644
--- a/src/test/ui/did_you_mean/issue-38147-3.rs
+++ b/src/test/ui/did_you_mean/issue-38147-3.rs
@@ -5,7 +5,7 @@
impl<'a> Qux<'a> {
fn f(&self) {
self.s.push('x');
- //~^ ERROR cannot borrow borrowed content `*self.s` of immutable binding as mutable
+ //~^ ERROR cannot borrow `*self.s` as mutable, as it is behind a `&` reference
}
}
diff --git a/src/test/ui/did_you_mean/issue-38147-3.stderr b/src/test/ui/did_you_mean/issue-38147-3.stderr
index 2cb9835..6778257 100644
--- a/src/test/ui/did_you_mean/issue-38147-3.stderr
+++ b/src/test/ui/did_you_mean/issue-38147-3.stderr
@@ -1,8 +1,8 @@
-error[E0596]: cannot borrow borrowed content `*self.s` of immutable binding as mutable
+error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference
--> $DIR/issue-38147-3.rs:7:9
|
LL | s: &'a String
- | ---------- use `&'a mut String` here to make mutable
+ | ---------- help: consider changing this to be mutable: `&'a mut String`
...
LL | self.s.push('x');
| ^^^^^^ cannot borrow as mutable
diff --git a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr
deleted file mode 100644
index db3e6b8..0000000
--- a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `*f.s` as mutable, as it is behind a `&` reference
- --> $DIR/issue-38147-4.rs:6:5
- |
-LL | fn f(x: usize, f: &Foo) {
- | ---- help: consider changing this to be a mutable reference: `&mut Foo<'_>`
-LL | f.s.push('x');
- | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-38147-4.rs b/src/test/ui/did_you_mean/issue-38147-4.rs
index 26573d4..e2028a9 100644
--- a/src/test/ui/did_you_mean/issue-38147-4.rs
+++ b/src/test/ui/did_you_mean/issue-38147-4.rs
@@ -3,7 +3,7 @@
}
fn f(x: usize, f: &Foo) {
- f.s.push('x'); //~ ERROR cannot borrow data mutably
+ f.s.push('x'); //~ ERROR cannot borrow `*f.s` as mutable, as it is behind a `&` reference
}
fn main() {}
diff --git a/src/test/ui/did_you_mean/issue-38147-4.stderr b/src/test/ui/did_you_mean/issue-38147-4.stderr
index 71d44f9..db3e6b8 100644
--- a/src/test/ui/did_you_mean/issue-38147-4.stderr
+++ b/src/test/ui/did_you_mean/issue-38147-4.stderr
@@ -1,11 +1,11 @@
-error[E0389]: cannot borrow data mutably in a `&` reference
+error[E0596]: cannot borrow `*f.s` as mutable, as it is behind a `&` reference
--> $DIR/issue-38147-4.rs:6:5
|
LL | fn f(x: usize, f: &Foo) {
- | ---- use `&mut Foo` here to make mutable
+ | ---- help: consider changing this to be a mutable reference: `&mut Foo<'_>`
LL | f.s.push('x');
- | ^^^ assignment into an immutable reference
+ | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0389`.
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-39544.nll.stderr b/src/test/ui/did_you_mean/issue-39544.nll.stderr
deleted file mode 100644
index dfaaf6b..0000000
--- a/src/test/ui/did_you_mean/issue-39544.nll.stderr
+++ /dev/null
@@ -1,101 +0,0 @@
-error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable
- --> $DIR/issue-39544.rs:11:13
- |
-LL | let z = Z { x: X::Y };
- | - help: consider changing this to be mutable: `mut z`
-LL | let _ = &mut z.x;
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
- --> $DIR/issue-39544.rs:16:17
- |
-LL | fn foo<'z>(&'z self) {
- | -------- help: consider changing this to be a mutable reference: `&'z mut self`
-LL | let _ = &mut self.x;
- | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
- --> $DIR/issue-39544.rs:20:17
- |
-LL | fn foo1(&self, other: &Z) {
- | ----- help: consider changing this to be a mutable reference: `&mut self`
-LL | let _ = &mut self.x;
- | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
- --> $DIR/issue-39544.rs:21:17
- |
-LL | fn foo1(&self, other: &Z) {
- | -- help: consider changing this to be a mutable reference: `&mut Z`
-LL | let _ = &mut self.x;
-LL | let _ = &mut other.x;
- | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
- --> $DIR/issue-39544.rs:25:17
- |
-LL | fn foo2<'a>(&'a self, other: &Z) {
- | -------- help: consider changing this to be a mutable reference: `&'a mut self`
-LL | let _ = &mut self.x;
- | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
- --> $DIR/issue-39544.rs:26:17
- |
-LL | fn foo2<'a>(&'a self, other: &Z) {
- | -- help: consider changing this to be a mutable reference: `&mut Z`
-LL | let _ = &mut self.x;
-LL | let _ = &mut other.x;
- | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
- --> $DIR/issue-39544.rs:30:17
- |
-LL | fn foo3<'a>(self: &'a Self, other: &Z) {
- | -------- help: consider changing this to be a mutable reference: `&'a mut Self`
-LL | let _ = &mut self.x;
- | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
- --> $DIR/issue-39544.rs:31:17
- |
-LL | fn foo3<'a>(self: &'a Self, other: &Z) {
- | -- help: consider changing this to be a mutable reference: `&mut Z`
-LL | let _ = &mut self.x;
-LL | let _ = &mut other.x;
- | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
- --> $DIR/issue-39544.rs:35:17
- |
-LL | fn foo4(other: &Z) {
- | -- help: consider changing this to be a mutable reference: `&mut Z`
-LL | let _ = &mut other.x;
- | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable
- --> $DIR/issue-39544.rs:41:13
- |
-LL | pub fn with_arg(z: Z, w: &Z) {
- | - help: consider changing this to be mutable: `mut z`
-LL | let _ = &mut z.x;
- | ^^^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference
- --> $DIR/issue-39544.rs:42:13
- |
-LL | pub fn with_arg(z: Z, w: &Z) {
- | -- help: consider changing this to be a mutable reference: `&mut Z`
-LL | let _ = &mut z.x;
-LL | let _ = &mut w.x;
- | ^^^^^^^^ `w` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0594]: cannot assign to `*x.0` which is behind a `&` reference
- --> $DIR/issue-39544.rs:48:5
- |
-LL | *x.0 = 1;
- | ^^^^^^^^ cannot assign
-
-error: aborting due to 12 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-39544.rs b/src/test/ui/did_you_mean/issue-39544.rs
index 89696a0..3c86f29 100644
--- a/src/test/ui/did_you_mean/issue-39544.rs
+++ b/src/test/ui/did_you_mean/issue-39544.rs
@@ -46,5 +46,5 @@
let mut y = 0;
let x = (&y,);
*x.0 = 1;
- //~^ ERROR cannot assign to borrowed content `*x.0` of immutable binding
+ //~^ ERROR cannot assign to `*x.0` which is behind a `&` reference
}
diff --git a/src/test/ui/did_you_mean/issue-39544.stderr b/src/test/ui/did_you_mean/issue-39544.stderr
index 2e2a665..dfaaf6b 100644
--- a/src/test/ui/did_you_mean/issue-39544.stderr
+++ b/src/test/ui/did_you_mean/issue-39544.stderr
@@ -1,100 +1,100 @@
-error[E0596]: cannot borrow field `z.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:11:18
+error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable
+ --> $DIR/issue-39544.rs:11:13
|
LL | let z = Z { x: X::Y };
- | - help: make this binding mutable: `mut z`
+ | - help: consider changing this to be mutable: `mut z`
LL | let _ = &mut z.x;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:16:22
+error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-39544.rs:16:17
|
LL | fn foo<'z>(&'z self) {
- | -------- use `&'z mut self` here to make mutable
+ | -------- help: consider changing this to be a mutable reference: `&'z mut self`
LL | let _ = &mut self.x;
- | ^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:20:22
+error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-39544.rs:20:17
|
LL | fn foo1(&self, other: &Z) {
- | ----- use `&mut self` here to make mutable
+ | ----- help: consider changing this to be a mutable reference: `&mut self`
LL | let _ = &mut self.x;
- | ^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:21:22
+error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-39544.rs:21:17
|
LL | fn foo1(&self, other: &Z) {
- | -- use `&mut Z` here to make mutable
+ | -- help: consider changing this to be a mutable reference: `&mut Z`
LL | let _ = &mut self.x;
LL | let _ = &mut other.x;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:25:22
+error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-39544.rs:25:17
|
LL | fn foo2<'a>(&'a self, other: &Z) {
- | -------- use `&'a mut self` here to make mutable
+ | -------- help: consider changing this to be a mutable reference: `&'a mut self`
LL | let _ = &mut self.x;
- | ^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:26:22
+error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-39544.rs:26:17
|
LL | fn foo2<'a>(&'a self, other: &Z) {
- | -- use `&mut Z` here to make mutable
+ | -- help: consider changing this to be a mutable reference: `&mut Z`
LL | let _ = &mut self.x;
LL | let _ = &mut other.x;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `self.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:30:22
+error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-39544.rs:30:17
|
LL | fn foo3<'a>(self: &'a Self, other: &Z) {
- | -------- use `&'a mut Self` here to make mutable
+ | -------- help: consider changing this to be a mutable reference: `&'a mut Self`
LL | let _ = &mut self.x;
- | ^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:31:22
+error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-39544.rs:31:17
|
LL | fn foo3<'a>(self: &'a Self, other: &Z) {
- | -- use `&mut Z` here to make mutable
+ | -- help: consider changing this to be a mutable reference: `&mut Z`
LL | let _ = &mut self.x;
LL | let _ = &mut other.x;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `other.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:35:22
+error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-39544.rs:35:17
|
LL | fn foo4(other: &Z) {
- | -- use `&mut Z` here to make mutable
+ | -- help: consider changing this to be a mutable reference: `&mut Z`
LL | let _ = &mut other.x;
- | ^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `z.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:41:18
+error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable
+ --> $DIR/issue-39544.rs:41:13
|
LL | pub fn with_arg(z: Z, w: &Z) {
- | - help: make this binding mutable: `mut z`
+ | - help: consider changing this to be mutable: `mut z`
LL | let _ = &mut z.x;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow field `w.x` of immutable binding as mutable
- --> $DIR/issue-39544.rs:42:18
+error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-39544.rs:42:13
|
LL | pub fn with_arg(z: Z, w: &Z) {
- | -- use `&mut Z` here to make mutable
+ | -- help: consider changing this to be a mutable reference: `&mut Z`
LL | let _ = &mut z.x;
LL | let _ = &mut w.x;
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^ `w` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0594]: cannot assign to borrowed content `*x.0` of immutable binding
+error[E0594]: cannot assign to `*x.0` which is behind a `&` reference
--> $DIR/issue-39544.rs:48:5
|
LL | *x.0 = 1;
- | ^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^ cannot assign
error: aborting due to 12 previous errors
diff --git a/src/test/ui/did_you_mean/issue-40823.nll.stderr b/src/test/ui/did_you_mean/issue-40823.nll.stderr
deleted file mode 100644
index 7347340..0000000
--- a/src/test/ui/did_you_mean/issue-40823.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `*buf` as mutable, as it is behind a `&` reference
- --> $DIR/issue-40823.rs:3:5
- |
-LL | let mut buf = &[1, 2, 3, 4];
- | ------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4]`
-LL | buf.iter_mut();
- | ^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/did_you_mean/issue-40823.rs b/src/test/ui/did_you_mean/issue-40823.rs
index 7e456a3..0f8c745 100644
--- a/src/test/ui/did_you_mean/issue-40823.rs
+++ b/src/test/ui/did_you_mean/issue-40823.rs
@@ -1,4 +1,4 @@
fn main() {
let mut buf = &[1, 2, 3, 4];
- buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content
+ buf.iter_mut(); //~ ERROR cannot borrow `*buf` as mutable, as it is behind a `&` reference
}
diff --git a/src/test/ui/did_you_mean/issue-40823.stderr b/src/test/ui/did_you_mean/issue-40823.stderr
index fa2150a..7347340 100644
--- a/src/test/ui/did_you_mean/issue-40823.stderr
+++ b/src/test/ui/did_you_mean/issue-40823.stderr
@@ -1,8 +1,10 @@
-error[E0596]: cannot borrow immutable borrowed content `*buf` as mutable
+error[E0596]: cannot borrow `*buf` as mutable, as it is behind a `&` reference
--> $DIR/issue-40823.rs:3:5
|
+LL | let mut buf = &[1, 2, 3, 4];
+ | ------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4]`
LL | buf.iter_mut();
- | ^^^ cannot borrow as mutable
+ | ^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to previous error
diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr
deleted file mode 100644
index fff3a64..0000000
--- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0509]: cannot move out of type `X`, which implements the `Drop` trait
- --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:22
- |
-LL | let X { x: y } = x;
- | - ^ cannot move out of here
- | |
- | data moved here
- |
-note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:16
- |
-LL | let X { x: y } = x;
- | ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr
index 9984cac..fff3a64 100644
--- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr
+++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr
@@ -1,11 +1,16 @@
error[E0509]: cannot move out of type `X`, which implements the `Drop` trait
- --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:9
+ --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:22
|
LL | let X { x: y } = x;
- | ^^^^^^^-^^
- | | |
- | | hint: to prevent move, use `ref y` or `ref mut y`
- | cannot move out of here
+ | - ^ cannot move out of here
+ | |
+ | data moved here
+ |
+note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:16
+ |
+LL | let X { x: y } = x;
+ | ^
error: aborting due to previous error
diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr
deleted file mode 100644
index 2143c2f9..0000000
--- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0509]: cannot move out of type `X`, which implements the `Drop` trait
- --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:14:11
- |
-LL | match x {
- | ^ cannot move out of here
-LL | X { x: y } => println!("contents: {}", y)
- | - data moved here
- |
-note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
- --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:15:16
- |
-LL | X { x: y } => println!("contents: {}", y)
- | ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs
index 3a5ed6e..9c996a9 100644
--- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs
+++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs
@@ -12,7 +12,7 @@
let x = X { x: "hello".to_string() };
match x {
+ //~^ ERROR cannot move out of type `X`, which implements the `Drop` trait
X { x: y } => println!("contents: {}", y)
- //~^ ERROR cannot move out of type `X`, which implements the `Drop` trait
}
}
diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr
index 8be1b38..762f64b 100644
--- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr
+++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr
@@ -1,11 +1,17 @@
error[E0509]: cannot move out of type `X`, which implements the `Drop` trait
- --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:15:9
+ --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:14:11
+ |
+LL | match x {
+ | ^ cannot move out of here
+LL |
+LL | X { x: y } => println!("contents: {}", y)
+ | - data moved here
+ |
+note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:16:16
|
LL | X { x: y } => println!("contents: {}", y)
- | ^^^^^^^-^^
- | | |
- | | hint: to prevent move, use `ref y` or `ref mut y`
- | cannot move out of here
+ | ^
error: aborting due to previous error
diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr
deleted file mode 100644
index 7fed27a..0000000
--- a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0505]: cannot move out of `a` because it is borrowed
- --> $DIR/drop-with-active-borrows-1.rs:4:10
- |
-LL | let b: Vec<&str> = a.lines().collect();
- | - borrow of `a` occurs here
-LL | drop(a);
- | ^ move out of `a` occurs here
-LL | for s in &b {
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.stderr
index 71960fc..7fed27a 100644
--- a/src/test/ui/dropck/drop-with-active-borrows-1.stderr
+++ b/src/test/ui/dropck/drop-with-active-borrows-1.stderr
@@ -5,6 +5,8 @@
| - borrow of `a` occurs here
LL | drop(a);
| ^ move out of `a` occurs here
+LL | for s in &b {
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr
deleted file mode 100644
index ffec930..0000000
--- a/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return value referencing local variable `raw_lines`
- --> $DIR/drop-with-active-borrows-2.rs:3:5
- |
-LL | raw_lines.iter().map(|l| l.trim()).collect()
- | ---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | returns a value referencing data owned by the current function
- | `raw_lines` is borrowed here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.rs b/src/test/ui/dropck/drop-with-active-borrows-2.rs
index 4e45633..cf4cb3d 100644
--- a/src/test/ui/dropck/drop-with-active-borrows-2.rs
+++ b/src/test/ui/dropck/drop-with-active-borrows-2.rs
@@ -1,7 +1,7 @@
fn read_lines_borrowed<'a>() -> Vec<&'a str> {
let raw_lines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
raw_lines.iter().map(|l| l.trim()).collect()
- //~^ ERROR `raw_lines` does not live long enough
+ //~^ ERROR cannot return value referencing local variable `raw_lines`
}
fn main() {
diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.stderr b/src/test/ui/dropck/drop-with-active-borrows-2.stderr
index ef46c92..ffec930 100644
--- a/src/test/ui/dropck/drop-with-active-borrows-2.stderr
+++ b/src/test/ui/dropck/drop-with-active-borrows-2.stderr
@@ -1,18 +1,12 @@
-error[E0597]: `raw_lines` does not live long enough
+error[E0515]: cannot return value referencing local variable `raw_lines`
--> $DIR/drop-with-active-borrows-2.rs:3:5
|
LL | raw_lines.iter().map(|l| l.trim()).collect()
- | ^^^^^^^^^ borrowed value does not live long enough
-LL |
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 1:24...
- --> $DIR/drop-with-active-borrows-2.rs:1:24
- |
-LL | fn read_lines_borrowed<'a>() -> Vec<&'a str> {
- | ^^
+ | ---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | returns a value referencing data owned by the current function
+ | `raw_lines` is borrowed here
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr b/src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr
deleted file mode 100644
index 31adb2f..0000000
--- a/src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr
+++ /dev/null
@@ -1,69 +0,0 @@
-error[E0597]: `c` does not live long enough
- --> $DIR/dropck-eyepatch-extern-crate.rs:41:20
- |
-LL | dt = Dt("dt", &c);
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - `c` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c` does not live long enough
- --> $DIR/dropck-eyepatch-extern-crate.rs:43:20
- |
-LL | dr = Dr("dr", &c);
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - `c` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-extern-crate.rs:47:20
- |
-LL | dt = Dt("dt", &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-extern-crate.rs:50:20
- |
-LL | dr = Dr("dr", &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-extern-crate.rs:57:29
- |
-LL | pt = Pt("pt", &c_long, &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-extern-crate.rs:59:29
- |
-LL | pr = Pr("pr", &c_long, &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.nll.stderr b/src/test/ui/dropck/dropck-eyepatch-extern-crate.nll.stderr
deleted file mode 100644
index e0b7fc4..0000000
--- a/src/test/ui/dropck/dropck-eyepatch-extern-crate.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-extern-crate.rs:47:19
- |
-LL | dt = Dt("dt", &c_shortest);
- | ^^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `c_shortest` dropped here while still borrowed
- | borrow might be used here, when `dt` is dropped and runs the `Drop` code for type `other::Dt`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs
index 6806563..b8f3035 100644
--- a/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs
+++ b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs
@@ -1,13 +1,3 @@
-// The behavior of AST-borrowck and NLL explcitly differ here due to
-// NLL's increased precision; so we use revisions and do not worry
-// about the --compare-mode=nll on this test.
-
-// revisions: ast nll
-//[ast]compile-flags: -Z borrowck=ast
-//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-
-// ignore-compare-mode-nll
-
// aux-build:dropck_eyepatch_extern_crate.rs
// The point of this test is to illustrate that the `#[may_dangle]`
@@ -19,52 +9,74 @@
//
// See also dropck-eyepatch.rs for more information about the general
// structure of the test.
-#![feature(rustc_attrs)]
extern crate dropck_eyepatch_extern_crate as other;
use other::{Dt,Dr,Pt,Pr,St,Sr};
-fn main() { #![rustc_error] // rust-lang/rust#49855
+fn main() {
use std::cell::Cell;
- let c_long;
- let (c, mut dt, mut dr, mut pt, mut pr, st, sr, c_shortest)
- : (Cell<_>, Dt<_>, Dr<_>, Pt<_, _>, Pr<_>, St<_>, Sr<_>, Cell<_>);
- c_long = Cell::new(1);
- c = Cell::new(1);
- c_shortest = Cell::new(1);
- // No error: sufficiently long-lived state can be referenced in dtors
- dt = Dt("dt", &c_long);
- dr = Dr("dr", &c_long);
+ // We use separate blocks with separate variable to prevent the error
+ // messages from being deduplicated.
- // Error: destructor order imprecisely modelled
- dt = Dt("dt", &c);
- //[ast]~^ ERROR `c` does not live long enough
- dr = Dr("dr", &c);
- //[ast]~^ ERROR `c` does not live long enough
+ {
+ let c_long;
+ let (mut dt, mut dr): (Dt<_>, Dr<_>);
+ c_long = Cell::new(1);
- // Error: `c_shortest` dies too soon for the references in dtors to be valid.
- dt = Dt("dt", &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
- //[nll]~^^ ERROR `c_shortest` does not live long enough
- dr = Dr("dr", &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
- // No error: Drop impl asserts .1 (A and &'a _) are not accessed
- pt = Pt("pt", &c_shortest, &c_long);
- pr = Pr("pr", &c_shortest, &c_long);
+ // No error: sufficiently long-lived state can be referenced in dtors
+ dt = Dt("dt", &c_long);
+ dr = Dr("dr", &c_long);
+ }
- // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
- pt = Pt("pt", &c_long, &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
- pr = Pr("pr", &c_long, &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
+ {
+ let (c, mut dt, mut dr): (Cell<_>, Dt<_>, Dr<_>);
+ c = Cell::new(1);
- // No error: St and Sr have no destructor.
- st = St("st", &c_shortest);
- sr = Sr("sr", &c_shortest);
+ // No Error: destructor order precisely modelled
+ dt = Dt("dt", &c);
+ dr = Dr("dr", &c);
+ }
- println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
- use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1);
+ {
+ let (mut dt, mut dr, c_shortest): (Dt<_>, Dr<_>, Cell<_>);
+ c_shortest = Cell::new(1);
+
+ // Error: `c_shortest` dies too soon for the references in dtors to be valid.
+ dt = Dt("dt", &c_shortest);
+ //~^ ERROR `c_shortest` does not live long enough
+ dr = Dr("dr", &c_shortest);
+ }
+
+ {
+ let c_long;
+ let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>);
+ c_long = Cell::new(1);
+ c_shortest = Cell::new(1);
+
+ // No error: Drop impl asserts .1 (A and &'a _) are not accessed
+ pt = Pt("pt", &c_shortest, &c_long);
+ pr = Pr("pr", &c_shortest, &c_long);
+ }
+
+ {
+ let c_long;
+ let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>);
+ c_long = Cell::new(1);
+ c_shortest = Cell::new(1);
+ // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
+ pt = Pt("pt", &c_long, &c_shortest);
+ //~^ ERROR `c_shortest` does not live long enough
+ pr = Pr("pr", &c_long, &c_shortest);
+ }
+
+ {
+ let (st, sr, c_shortest): (St<_>, Sr<_>, Cell<_>);
+ c_shortest = Cell::new(1);
+ // No error: St and Sr have no destructor.
+ st = St("st", &c_shortest);
+ sr = Sr("sr", &c_shortest);
+ }
}
fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr b/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr
new file mode 100644
index 0000000..c102321
--- /dev/null
+++ b/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr
@@ -0,0 +1,31 @@
+error[E0597]: `c_shortest` does not live long enough
+ --> $DIR/dropck-eyepatch-extern-crate.rs:46:23
+ |
+LL | dt = Dt("dt", &c_shortest);
+ | ^^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | -
+ | |
+ | `c_shortest` dropped here while still borrowed
+ | borrow might be used here, when `dt` is dropped and runs the `Drop` code for type `other::Dt`
+ |
+ = note: values in a scope are dropped in the opposite order they are defined
+
+error[E0597]: `c_shortest` does not live long enough
+ --> $DIR/dropck-eyepatch-extern-crate.rs:68:32
+ |
+LL | pt = Pt("pt", &c_long, &c_shortest);
+ | ^^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | -
+ | |
+ | `c_shortest` dropped here while still borrowed
+ | borrow might be used here, when `pt` is dropped and runs the `Drop` code for type `other::Pt`
+ |
+ = note: values in a scope are dropped in the opposite order they are defined
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr b/src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr
deleted file mode 100644
index ddd47e9..0000000
--- a/src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr
+++ /dev/null
@@ -1,69 +0,0 @@
-error[E0597]: `c` does not live long enough
- --> $DIR/dropck-eyepatch-reorder.rs:58:20
- |
-LL | dt = Dt("dt", &c);
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - `c` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c` does not live long enough
- --> $DIR/dropck-eyepatch-reorder.rs:60:20
- |
-LL | dr = Dr("dr", &c);
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - `c` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-reorder.rs:64:20
- |
-LL | dt = Dt("dt", &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-reorder.rs:67:20
- |
-LL | dr = Dr("dr", &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-reorder.rs:74:29
- |
-LL | pt = Pt("pt", &c_long, &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-reorder.rs:76:29
- |
-LL | pr = Pr("pr", &c_long, &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.nll.stderr b/src/test/ui/dropck/dropck-eyepatch-reorder.nll.stderr
deleted file mode 100644
index 97c1caa..0000000
--- a/src/test/ui/dropck/dropck-eyepatch-reorder.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch-reorder.rs:64:19
- |
-LL | dt = Dt("dt", &c_shortest);
- | ^^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `c_shortest` dropped here while still borrowed
- | borrow might be used here, when `dt` is dropped and runs the `Drop` code for type `Dt`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.rs b/src/test/ui/dropck/dropck-eyepatch-reorder.rs
index 16aaa26..44552b3 100644
--- a/src/test/ui/dropck/dropck-eyepatch-reorder.rs
+++ b/src/test/ui/dropck/dropck-eyepatch-reorder.rs
@@ -1,14 +1,4 @@
-// The behavior of AST-borrowck and NLL explcitly differ here due to
-// NLL's increased precision; so we use revisions and do not worry
-// about the --compare-mode=nll on this test.
-
-// revisions: ast nll
-//[ast]compile-flags: -Z borrowck=ast
-//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-
-// ignore-compare-mode-nll
-
-#![feature(dropck_eyepatch, rustc_attrs)]
+#![feature(dropck_eyepatch)]
// The point of this test is to test uses of `#[may_dangle]` attribute
// where the formal declaration order (in the impl generics) does not
@@ -41,47 +31,70 @@
fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); }
}
-fn main() { #![rustc_error] // rust-lang/rust#49855
+fn main() {
use std::cell::Cell;
- let c_long;
- let (c, mut dt, mut dr, mut pt, mut pr, st, sr, c_shortest)
- : (Cell<_>, Dt<_>, Dr<_>, Pt<_, _>, Pr<_>, St<_>, Sr<_>, Cell<_>);
- c_long = Cell::new(1);
- c = Cell::new(1);
- c_shortest = Cell::new(1);
- // No error: sufficiently long-lived state can be referenced in dtors
- dt = Dt("dt", &c_long);
- dr = Dr("dr", &c_long);
+ // We use separate blocks with separate variable to prevent the error
+ // messages from being deduplicated.
- // Error: destructor order imprecisely modelled
- dt = Dt("dt", &c);
- //[ast]~^ ERROR `c` does not live long enough
- dr = Dr("dr", &c);
- //[ast]~^ ERROR `c` does not live long enough
+ {
+ let c_long;
+ let (mut dt, mut dr): (Dt<_>, Dr<_>);
+ c_long = Cell::new(1);
- // Error: `c_shortest` dies too soon for the references in dtors to be valid.
- dt = Dt("dt", &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
- //[nll]~^^ ERROR `c_shortest` does not live long enough
- dr = Dr("dr", &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
- // No error: Drop impl asserts .1 (A and &'a _) are not accessed
- pt = Pt("pt", &c_shortest, &c_long);
- pr = Pr("pr", &c_shortest, &c_long);
+ // No error: sufficiently long-lived state can be referenced in dtors
+ dt = Dt("dt", &c_long);
+ dr = Dr("dr", &c_long);
+ }
- // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
- pt = Pt("pt", &c_long, &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
- pr = Pr("pr", &c_long, &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
+ {
+ let (c, mut dt, mut dr): (Cell<_>, Dt<_>, Dr<_>);
+ c = Cell::new(1);
- // No error: St and Sr have no destructor.
- st = St("st", &c_shortest);
- sr = Sr("sr", &c_shortest);
+ // No Error: destructor order precisely modelled
+ dt = Dt("dt", &c);
+ dr = Dr("dr", &c);
+ }
- println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
- use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1);
+ {
+ let (mut dt, mut dr, c_shortest): (Dt<_>, Dr<_>, Cell<_>);
+ c_shortest = Cell::new(1);
+
+ // Error: `c_shortest` dies too soon for the references in dtors to be valid.
+ dt = Dt("dt", &c_shortest);
+ //~^ ERROR `c_shortest` does not live long enough
+ dr = Dr("dr", &c_shortest);
+ }
+
+ {
+ let c_long;
+ let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>);
+ c_long = Cell::new(1);
+ c_shortest = Cell::new(1);
+
+ // No error: Drop impl asserts .1 (A and &'a _) are not accessed
+ pt = Pt("pt", &c_shortest, &c_long);
+ pr = Pr("pr", &c_shortest, &c_long);
+ }
+
+ {
+ let c_long;
+ let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>);
+ c_long = Cell::new(1);
+ c_shortest = Cell::new(1);
+ // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
+ pt = Pt("pt", &c_long, &c_shortest);
+ //~^ ERROR `c_shortest` does not live long enough
+ pr = Pr("pr", &c_long, &c_shortest);
+ }
+
+ {
+ let (st, sr, c_shortest): (St<_>, Sr<_>, Cell<_>);
+ c_shortest = Cell::new(1);
+ // No error: St and Sr have no destructor.
+ st = St("st", &c_shortest);
+ sr = Sr("sr", &c_shortest);
+ }
}
fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.stderr b/src/test/ui/dropck/dropck-eyepatch-reorder.stderr
new file mode 100644
index 0000000..5055cdd
--- /dev/null
+++ b/src/test/ui/dropck/dropck-eyepatch-reorder.stderr
@@ -0,0 +1,31 @@
+error[E0597]: `c_shortest` does not live long enough
+ --> $DIR/dropck-eyepatch-reorder.rs:64:23
+ |
+LL | dt = Dt("dt", &c_shortest);
+ | ^^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | -
+ | |
+ | `c_shortest` dropped here while still borrowed
+ | borrow might be used here, when `dt` is dropped and runs the `Drop` code for type `Dt`
+ |
+ = note: values in a scope are dropped in the opposite order they are defined
+
+error[E0597]: `c_shortest` does not live long enough
+ --> $DIR/dropck-eyepatch-reorder.rs:86:32
+ |
+LL | pt = Pt("pt", &c_long, &c_shortest);
+ | ^^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | -
+ | |
+ | `c_shortest` dropped here while still borrowed
+ | borrow might be used here, when `pt` is dropped and runs the `Drop` code for type `Pt`
+ |
+ = note: values in a scope are dropped in the opposite order they are defined
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch.ast.stderr b/src/test/ui/dropck/dropck-eyepatch.ast.stderr
deleted file mode 100644
index 0952ed0..0000000
--- a/src/test/ui/dropck/dropck-eyepatch.ast.stderr
+++ /dev/null
@@ -1,69 +0,0 @@
-error[E0597]: `c` does not live long enough
- --> $DIR/dropck-eyepatch.rs:81:20
- |
-LL | dt = Dt("dt", &c);
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - `c` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c` does not live long enough
- --> $DIR/dropck-eyepatch.rs:83:20
- |
-LL | dr = Dr("dr", &c);
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - `c` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch.rs:87:20
- |
-LL | dt = Dt("dt", &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch.rs:90:20
- |
-LL | dr = Dr("dr", &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch.rs:98:29
- |
-LL | pt = Pt("pt", &c_long, &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch.rs:100:29
- |
-LL | pr = Pr("pr", &c_long, &c_shortest);
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `c_shortest` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch.nll.stderr b/src/test/ui/dropck/dropck-eyepatch.nll.stderr
deleted file mode 100644
index 4a6e42e..0000000
--- a/src/test/ui/dropck/dropck-eyepatch.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0597]: `c_shortest` does not live long enough
- --> $DIR/dropck-eyepatch.rs:87:19
- |
-LL | dt = Dt("dt", &c_shortest);
- | ^^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `c_shortest` dropped here while still borrowed
- | borrow might be used here, when `dt` is dropped and runs the `Drop` code for type `Dt`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-eyepatch.rs b/src/test/ui/dropck/dropck-eyepatch.rs
index fb1c03b..ec1c685 100644
--- a/src/test/ui/dropck/dropck-eyepatch.rs
+++ b/src/test/ui/dropck/dropck-eyepatch.rs
@@ -1,14 +1,4 @@
-// The behavior of AST-borrowck and NLL explcitly differ here due to
-// NLL's increased precision; so we use revisions and do not worry
-// about the --compare-mode=nll on this test.
-
-// revisions: ast nll
-//[ast]compile-flags: -Z borrowck=ast
-//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-
-// ignore-compare-mode-nll
-
-#![feature(dropck_eyepatch, rustc_attrs)]
+#![feature(dropck_eyepatch)]
// The point of this test is to illustrate that the `#[may_dangle]`
// attribute specifically allows, in the context of a type
@@ -64,48 +54,70 @@
fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); }
}
-fn main() { #![rustc_error] // rust-lang/rust#49855
+
+fn main() {
use std::cell::Cell;
- let c_long;
- let (c, mut dt, mut dr, mut pt, mut pr, st, sr, c_shortest)
- : (Cell<_>, Dt<_>, Dr<_>, Pt<_, _>, Pr<_>, St<_>, Sr<_>, Cell<_>);
- c_long = Cell::new(1);
- c = Cell::new(1);
- c_shortest = Cell::new(1);
- // No error: sufficiently long-lived state can be referenced in dtors
- dt = Dt("dt", &c_long);
- dr = Dr("dr", &c_long);
+ // We use separate blocks with separate variable to prevent the error
+ // messages from being deduplicated.
- // Error: destructor order imprecisely modelled
- dt = Dt("dt", &c);
- //[ast]~^ ERROR `c` does not live long enough
- dr = Dr("dr", &c);
- //[ast]~^ ERROR `c` does not live long enough
+ {
+ let c_long;
+ let (mut dt, mut dr): (Dt<_>, Dr<_>);
+ c_long = Cell::new(1);
- // Error: `c_shortest` dies too soon for the references in dtors to be valid.
- dt = Dt("dt", &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
- //[nll]~^^ ERROR `c_shortest` does not live long enough
- dr = Dr("dr", &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
+ // No error: sufficiently long-lived state can be referenced in dtors
+ dt = Dt("dt", &c_long);
+ dr = Dr("dr", &c_long);
+ }
- // No error: Drop impl asserts .1 (A and &'a _) are not accessed
- pt = Pt("pt", &c_shortest, &c_long);
- pr = Pr("pr", &c_shortest, &c_long);
+ {
+ let (c, mut dt, mut dr): (Cell<_>, Dt<_>, Dr<_>);
+ c = Cell::new(1);
- // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
- pt = Pt("pt", &c_long, &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
- pr = Pr("pr", &c_long, &c_shortest);
- //[ast]~^ ERROR `c_shortest` does not live long enough
+ // No Error: destructor order precisely modelled
+ dt = Dt("dt", &c);
+ dr = Dr("dr", &c);
+ }
- // No error: St and Sr have no destructor.
- st = St("st", &c_shortest);
- sr = Sr("sr", &c_shortest);
+ {
+ let (mut dt, mut dr, c_shortest): (Dt<_>, Dr<_>, Cell<_>);
+ c_shortest = Cell::new(1);
- println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
- use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1);
+ // Error: `c_shortest` dies too soon for the references in dtors to be valid.
+ dt = Dt("dt", &c_shortest);
+ //~^ ERROR `c_shortest` does not live long enough
+ dr = Dr("dr", &c_shortest);
+ }
+
+ {
+ let c_long;
+ let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>);
+ c_long = Cell::new(1);
+ c_shortest = Cell::new(1);
+
+ // No error: Drop impl asserts .1 (A and &'a _) are not accessed
+ pt = Pt("pt", &c_shortest, &c_long);
+ pr = Pr("pr", &c_shortest, &c_long);
+ }
+
+ {
+ let c_long;
+ let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>);
+ c_long = Cell::new(1);
+ c_shortest = Cell::new(1);
+ // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
+ pt = Pt("pt", &c_long, &c_shortest);
+ //~^ ERROR `c_shortest` does not live long enough
+ pr = Pr("pr", &c_long, &c_shortest);
+ }
+
+ {
+ let (st, sr, c_shortest): (St<_>, Sr<_>, Cell<_>);
+ c_shortest = Cell::new(1);
+ // No error: St and Sr have no destructor.
+ st = St("st", &c_shortest);
+ sr = Sr("sr", &c_shortest);
+ }
}
-
fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/dropck/dropck-eyepatch.stderr b/src/test/ui/dropck/dropck-eyepatch.stderr
new file mode 100644
index 0000000..21295e6
--- /dev/null
+++ b/src/test/ui/dropck/dropck-eyepatch.stderr
@@ -0,0 +1,31 @@
+error[E0597]: `c_shortest` does not live long enough
+ --> $DIR/dropck-eyepatch.rs:88:23
+ |
+LL | dt = Dt("dt", &c_shortest);
+ | ^^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | -
+ | |
+ | `c_shortest` dropped here while still borrowed
+ | borrow might be used here, when `dt` is dropped and runs the `Drop` code for type `Dt`
+ |
+ = note: values in a scope are dropped in the opposite order they are defined
+
+error[E0597]: `c_shortest` does not live long enough
+ --> $DIR/dropck-eyepatch.rs:110:32
+ |
+LL | pt = Pt("pt", &c_long, &c_shortest);
+ | ^^^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | -
+ | |
+ | `c_shortest` dropped here while still borrowed
+ | borrow might be used here, when `pt` is dropped and runs the `Drop` code for type `Pt`
+ |
+ = note: values in a scope are dropped in the opposite order they are defined
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-union.nll.stderr b/src/test/ui/dropck/dropck-union.nll.stderr
deleted file mode 100644
index 2287443..0000000
--- a/src/test/ui/dropck/dropck-union.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `v` does not live long enough
- --> $DIR/dropck-union.rs:39:18
- |
-LL | v.0.set(Some(&v));
- | ^^ borrowed value does not live long enough
-LL | }
- | -
- | |
- | `v` dropped here while still borrowed
- | borrow might be used here, when `v` is dropped and runs the `Drop` code for type `Wrap`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-union.stderr b/src/test/ui/dropck/dropck-union.stderr
index 4f6cd87..2287443 100644
--- a/src/test/ui/dropck/dropck-union.stderr
+++ b/src/test/ui/dropck/dropck-union.stderr
@@ -1,12 +1,13 @@
error[E0597]: `v` does not live long enough
- --> $DIR/dropck-union.rs:39:19
+ --> $DIR/dropck-union.rs:39:18
|
LL | v.0.set(Some(&v));
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | }
- | - `v` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `v` dropped here while still borrowed
+ | borrow might be used here, when `v` is dropped and runs the `Drop` code for type `Wrap`
error: aborting due to previous error
diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr
deleted file mode 100644
index 8c669b5..0000000
--- a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr
+++ /dev/null
@@ -1,73 +0,0 @@
-error[E0597]: `o2` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:111:13
- |
-LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
- | -------- cast requires that `o2` is borrowed for `'static`
-LL | o1.set0(&o2);
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | - `o2` dropped here while still borrowed
-
-error[E0597]: `o3` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:112:13
- |
-LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
- | -------- cast requires that `o3` is borrowed for `'static`
-LL | o1.set0(&o2);
-LL | o1.set1(&o3);
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | - `o3` dropped here while still borrowed
-
-error[E0597]: `o2` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:113:13
- |
-LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
- | -------- cast requires that `o2` is borrowed for `'static`
-...
-LL | o2.set0(&o2);
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | - `o2` dropped here while still borrowed
-
-error[E0597]: `o3` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:114:13
- |
-LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
- | -------- cast requires that `o3` is borrowed for `'static`
-...
-LL | o2.set1(&o3);
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | - `o3` dropped here while still borrowed
-
-error[E0597]: `o1` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:115:13
- |
-LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
- | -------- cast requires that `o1` is borrowed for `'static`
-...
-LL | o3.set0(&o1);
- | ^^^ borrowed value does not live long enough
-LL | o3.set1(&o2);
-LL | }
- | - `o1` dropped here while still borrowed
-
-error[E0597]: `o2` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:116:13
- |
-LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
- | -------- cast requires that `o2` is borrowed for `'static`
-...
-LL | o3.set1(&o2);
- | ^^^ borrowed value does not live long enough
-LL | }
- | - `o2` dropped here while still borrowed
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr
index 792ef46..8c669b5 100644
--- a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr
+++ b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr
@@ -1,67 +1,72 @@
error[E0597]: `o2` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:111:14
+ --> $DIR/dropck_trait_cycle_checked.rs:111:13
|
+LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
+ | -------- cast requires that `o2` is borrowed for `'static`
LL | o1.set0(&o2);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `o2` dropped here while still borrowed
error[E0597]: `o3` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:112:14
+ --> $DIR/dropck_trait_cycle_checked.rs:112:13
|
+LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
+ | -------- cast requires that `o3` is borrowed for `'static`
+LL | o1.set0(&o2);
LL | o1.set1(&o3);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `o3` dropped here while still borrowed
error[E0597]: `o2` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:113:14
+ --> $DIR/dropck_trait_cycle_checked.rs:113:13
|
+LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
+ | -------- cast requires that `o2` is borrowed for `'static`
+...
LL | o2.set0(&o2);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `o2` dropped here while still borrowed
error[E0597]: `o3` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:114:14
+ --> $DIR/dropck_trait_cycle_checked.rs:114:13
|
+LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
+ | -------- cast requires that `o3` is borrowed for `'static`
+...
LL | o2.set1(&o3);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `o3` dropped here while still borrowed
error[E0597]: `o1` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:115:14
+ --> $DIR/dropck_trait_cycle_checked.rs:115:13
|
+LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
+ | -------- cast requires that `o1` is borrowed for `'static`
+...
LL | o3.set0(&o1);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
LL | o3.set1(&o2);
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `o1` dropped here while still borrowed
error[E0597]: `o2` does not live long enough
- --> $DIR/dropck_trait_cycle_checked.rs:116:14
+ --> $DIR/dropck_trait_cycle_checked.rs:116:13
|
+LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new());
+ | -------- cast requires that `o2` is borrowed for `'static`
+...
LL | o3.set1(&o2);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `o2` dropped here while still borrowed
error: aborting due to 6 previous errors
diff --git a/src/test/ui/dst/dst-bad-coerce3.nll.stderr b/src/test/ui/dst/dst-bad-coerce3.nll.stderr
deleted file mode 100644
index 289d451..0000000
--- a/src/test/ui/dst/dst-bad-coerce3.nll.stderr
+++ /dev/null
@@ -1,58 +0,0 @@
-error[E0597]: `f1` does not live long enough
- --> $DIR/dst-bad-coerce3.rs:16:32
- |
-LL | fn baz<'a>() {
- | -- lifetime `'a` defined here
-...
-LL | let f2: &Fat<[isize; 3]> = &f1;
- | ^^^ borrowed value does not live long enough
-LL | let f3: &'a Fat<[isize]> = f2;
- | ---------------- type annotation requires that `f1` is borrowed for `'a`
-...
-LL | }
- | - `f1` dropped here while still borrowed
-
-error[E0597]: `f1` does not live long enough
- --> $DIR/dst-bad-coerce3.rs:21:25
- |
-LL | fn baz<'a>() {
- | -- lifetime `'a` defined here
-...
-LL | let f2: &Fat<Foo> = &f1;
- | ^^^ borrowed value does not live long enough
-LL | let f3: &'a Fat<Bar> = f2;
- | ------------ type annotation requires that `f1` is borrowed for `'a`
-...
-LL | }
- | - `f1` dropped here while still borrowed
-
-error[E0597]: `f1` does not live long enough
- --> $DIR/dst-bad-coerce3.rs:26:30
- |
-LL | fn baz<'a>() {
- | -- lifetime `'a` defined here
-...
-LL | let f2: &([isize; 3],) = &f1;
- | ^^^ borrowed value does not live long enough
-LL | let f3: &'a ([isize],) = f2;
- | -------------- type annotation requires that `f1` is borrowed for `'a`
-...
-LL | }
- | - `f1` dropped here while still borrowed
-
-error[E0597]: `f1` does not live long enough
- --> $DIR/dst-bad-coerce3.rs:31:23
- |
-LL | fn baz<'a>() {
- | -- lifetime `'a` defined here
-...
-LL | let f2: &(Foo,) = &f1;
- | ^^^ borrowed value does not live long enough
-LL | let f3: &'a (Bar,) = f2;
- | ---------- type annotation requires that `f1` is borrowed for `'a`
-LL | }
- | - `f1` dropped here while still borrowed
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dst/dst-bad-coerce3.stderr b/src/test/ui/dst/dst-bad-coerce3.stderr
index 6147326..289d451 100644
--- a/src/test/ui/dst/dst-bad-coerce3.stderr
+++ b/src/test/ui/dst/dst-bad-coerce3.stderr
@@ -1,62 +1,57 @@
error[E0597]: `f1` does not live long enough
- --> $DIR/dst-bad-coerce3.rs:16:33
+ --> $DIR/dst-bad-coerce3.rs:16:32
|
+LL | fn baz<'a>() {
+ | -- lifetime `'a` defined here
+...
LL | let f2: &Fat<[isize; 3]> = &f1;
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | let f3: &'a Fat<[isize]> = f2;
+ | ---------------- type annotation requires that `f1` is borrowed for `'a`
...
LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8...
- --> $DIR/dst-bad-coerce3.rs:13:8
- |
-LL | fn baz<'a>() {
- | ^^
+ | - `f1` dropped here while still borrowed
error[E0597]: `f1` does not live long enough
- --> $DIR/dst-bad-coerce3.rs:21:26
+ --> $DIR/dst-bad-coerce3.rs:21:25
|
+LL | fn baz<'a>() {
+ | -- lifetime `'a` defined here
+...
LL | let f2: &Fat<Foo> = &f1;
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | let f3: &'a Fat<Bar> = f2;
+ | ------------ type annotation requires that `f1` is borrowed for `'a`
...
LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8...
- --> $DIR/dst-bad-coerce3.rs:13:8
- |
-LL | fn baz<'a>() {
- | ^^
+ | - `f1` dropped here while still borrowed
error[E0597]: `f1` does not live long enough
- --> $DIR/dst-bad-coerce3.rs:26:31
+ --> $DIR/dst-bad-coerce3.rs:26:30
|
+LL | fn baz<'a>() {
+ | -- lifetime `'a` defined here
+...
LL | let f2: &([isize; 3],) = &f1;
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | let f3: &'a ([isize],) = f2;
+ | -------------- type annotation requires that `f1` is borrowed for `'a`
...
LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8...
- --> $DIR/dst-bad-coerce3.rs:13:8
- |
-LL | fn baz<'a>() {
- | ^^
+ | - `f1` dropped here while still borrowed
error[E0597]: `f1` does not live long enough
- --> $DIR/dst-bad-coerce3.rs:31:24
- |
-LL | let f2: &(Foo,) = &f1;
- | ^^ borrowed value does not live long enough
-LL | let f3: &'a (Bar,) = f2;
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8...
- --> $DIR/dst-bad-coerce3.rs:13:8
+ --> $DIR/dst-bad-coerce3.rs:31:23
|
LL | fn baz<'a>() {
- | ^^
+ | -- lifetime `'a` defined here
+...
+LL | let f2: &(Foo,) = &f1;
+ | ^^^ borrowed value does not live long enough
+LL | let f3: &'a (Bar,) = f2;
+ | ---------- type annotation requires that `f1` is borrowed for `'a`
+LL | }
+ | - `f1` dropped here while still borrowed
error: aborting due to 4 previous errors
diff --git a/src/test/ui/dst/dst-index.nll.stderr b/src/test/ui/dst/dst-index.nll.stderr
deleted file mode 100644
index ec09a93..0000000
--- a/src/test/ui/dst/dst-index.nll.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
- --> $DIR/dst-index.rs:31:5
- |
-LL | S[0];
- | ^^^^
-
-error[E0161]: cannot move a value of type dyn std::fmt::Debug: the size of dyn std::fmt::Debug cannot be statically determined
- --> $DIR/dst-index.rs:34:5
- |
-LL | T[0];
- | ^^^^
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/dst-index.rs:31:5
- |
-LL | S[0];
- | ^^^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/dst-index.rs:34:5
- |
-LL | T[0];
- | ^^^^ cannot move out of borrowed content
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0161, E0507.
-For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/ui/dst/dst-index.rs b/src/test/ui/dst/dst-index.rs
index 663c704..71ff067 100644
--- a/src/test/ui/dst/dst-index.rs
+++ b/src/test/ui/dst/dst-index.rs
@@ -29,9 +29,9 @@
fn main() {
S[0];
- //~^ ERROR cannot move out of indexed content
+ //~^ ERROR cannot move out of borrowed content
//~^^ ERROR E0161
T[0];
- //~^ ERROR cannot move out of indexed content
+ //~^ ERROR cannot move out of borrowed content
//~^^ ERROR E0161
}
diff --git a/src/test/ui/dst/dst-index.stderr b/src/test/ui/dst/dst-index.stderr
index 863a5c1..ec09a93 100644
--- a/src/test/ui/dst/dst-index.stderr
+++ b/src/test/ui/dst/dst-index.stderr
@@ -4,23 +4,23 @@
LL | S[0];
| ^^^^
-error[E0161]: cannot move a value of type (dyn std::fmt::Debug + 'static): the size of (dyn std::fmt::Debug + 'static) cannot be statically determined
+error[E0161]: cannot move a value of type dyn std::fmt::Debug: the size of dyn std::fmt::Debug cannot be statically determined
--> $DIR/dst-index.rs:34:5
|
LL | T[0];
| ^^^^
-error[E0507]: cannot move out of indexed content
+error[E0507]: cannot move out of borrowed content
--> $DIR/dst-index.rs:31:5
|
LL | S[0];
- | ^^^^ cannot move out of indexed content
+ | ^^^^ cannot move out of borrowed content
-error[E0507]: cannot move out of indexed content
+error[E0507]: cannot move out of borrowed content
--> $DIR/dst-index.rs:34:5
|
LL | T[0];
- | ^^^^ cannot move out of indexed content
+ | ^^^^ cannot move out of borrowed content
error: aborting due to 4 previous errors
diff --git a/src/test/ui/dst/dst-rvalue.nll.stderr b/src/test/ui/dst/dst-rvalue.nll.stderr
deleted file mode 100644
index 7ef8e4d..0000000
--- a/src/test/ui/dst/dst-rvalue.nll.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
- --> $DIR/dst-rvalue.rs:6:28
- |
-LL | let _x: Box<str> = box *"hello world";
- | ^^^^^^^^^^^^^^
-
-error[E0161]: cannot move a value of type [isize]: the size of [isize] cannot be statically determined
- --> $DIR/dst-rvalue.rs:11:32
- |
-LL | let _x: Box<[isize]> = box *array;
- | ^^^^^^
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/dst-rvalue.rs:6:28
- |
-LL | let _x: Box<str> = box *"hello world";
- | ^^^^^^^^^^^^^^ cannot move out of borrowed content
-
-error[E0508]: cannot move out of type `[isize]`, a non-copy slice
- --> $DIR/dst-rvalue.rs:11:32
- |
-LL | let _x: Box<[isize]> = box *array;
- | ^^^^^^ cannot move out of here
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0161, E0507, E0508.
-For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/ui/dst/dst-rvalue.rs b/src/test/ui/dst/dst-rvalue.rs
index 86747da..5115bee 100644
--- a/src/test/ui/dst/dst-rvalue.rs
+++ b/src/test/ui/dst/dst-rvalue.rs
@@ -10,5 +10,5 @@
let array: &[isize] = &[1, 2, 3];
let _x: Box<[isize]> = box *array;
//~^ ERROR E0161
- //~^^ ERROR cannot move out of borrowed content
+ //~^^ ERROR cannot move out of type `[isize]`, a non-copy slice
}
diff --git a/src/test/ui/dst/dst-rvalue.stderr b/src/test/ui/dst/dst-rvalue.stderr
index 1ad5971..7ef8e4d 100644
--- a/src/test/ui/dst/dst-rvalue.stderr
+++ b/src/test/ui/dst/dst-rvalue.stderr
@@ -16,13 +16,13 @@
LL | let _x: Box<str> = box *"hello world";
| ^^^^^^^^^^^^^^ cannot move out of borrowed content
-error[E0507]: cannot move out of borrowed content
+error[E0508]: cannot move out of type `[isize]`, a non-copy slice
--> $DIR/dst-rvalue.rs:11:32
|
LL | let _x: Box<[isize]> = box *array;
- | ^^^^^^ cannot move out of borrowed content
+ | ^^^^^^ cannot move out of here
error: aborting due to 4 previous errors
-Some errors have detailed explanations: E0161, E0507.
+Some errors have detailed explanations: E0161, E0507, E0508.
For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/ui/error-codes/E0008.nll.stderr b/src/test/ui/error-codes/E0008.nll.stderr
deleted file mode 100644
index 2505c03..0000000
--- a/src/test/ui/error-codes/E0008.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0008]: cannot bind by-move into a pattern guard
- --> $DIR/E0008.rs:3:14
- |
-LL | Some(s) if s.len() == 0 => {},
- | ^ moves value into pattern guard
- |
- = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0008`.
diff --git a/src/test/ui/error-codes/E0008.stderr b/src/test/ui/error-codes/E0008.stderr
index d5c44ef..2505c03 100644
--- a/src/test/ui/error-codes/E0008.stderr
+++ b/src/test/ui/error-codes/E0008.stderr
@@ -3,6 +3,8 @@
|
LL | Some(s) if s.len() == 0 => {},
| ^ moves value into pattern guard
+ |
+ = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0017.nll.stderr b/src/test/ui/error-codes/E0017.nll.stderr
deleted file mode 100644
index 67ff7da..0000000
--- a/src/test/ui/error-codes/E0017.nll.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0017]: references in constants may only refer to immutable values
- --> $DIR/E0017.rs:4:30
- |
-LL | const CR: &'static mut i32 = &mut C;
- | ^^^^^^ constants require immutable values
-
-error[E0017]: references in statics may only refer to immutable values
- --> $DIR/E0017.rs:5:39
- |
-LL | static STATIC_REF: &'static mut i32 = &mut X;
- | ^^^^^^ statics require immutable values
-
-error: cannot mutate statics in the initializer of another static
- --> $DIR/E0017.rs:5:39
- |
-LL | static STATIC_REF: &'static mut i32 = &mut X;
- | ^^^^^^
-
-error[E0596]: cannot borrow immutable static item `X` as mutable
- --> $DIR/E0017.rs:5:39
- |
-LL | static STATIC_REF: &'static mut i32 = &mut X;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0017]: references in statics may only refer to immutable values
- --> $DIR/E0017.rs:8:38
- |
-LL | static CONST_REF: &'static mut i32 = &mut C;
- | ^^^^^^ statics require immutable values
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0017, E0596.
-For more information about an error, try `rustc --explain E0017`.
diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr
index 07fe907..67ff7da 100644
--- a/src/test/ui/error-codes/E0017.stderr
+++ b/src/test/ui/error-codes/E0017.stderr
@@ -16,11 +16,11 @@
LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^
-error[E0596]: cannot borrow immutable static item as mutable
- --> $DIR/E0017.rs:5:44
+error[E0596]: cannot borrow immutable static item `X` as mutable
+ --> $DIR/E0017.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X;
- | ^
+ | ^^^^^^ cannot borrow as mutable
error[E0017]: references in statics may only refer to immutable values
--> $DIR/E0017.rs:8:38
diff --git a/src/test/ui/error-codes/E0161.ast.stderr b/src/test/ui/error-codes/E0161.migrate.stderr
similarity index 100%
rename from src/test/ui/error-codes/E0161.ast.stderr
rename to src/test/ui/error-codes/E0161.migrate.stderr
diff --git a/src/test/ui/error-codes/E0161.astul.stderr b/src/test/ui/error-codes/E0161.migrateul.stderr
similarity index 100%
rename from src/test/ui/error-codes/E0161.astul.stderr
rename to src/test/ui/error-codes/E0161.migrateul.stderr
diff --git a/src/test/ui/error-codes/E0161.rs b/src/test/ui/error-codes/E0161.rs
index a6d2b24..2ca1705 100644
--- a/src/test/ui/error-codes/E0161.rs
+++ b/src/test/ui/error-codes/E0161.rs
@@ -3,15 +3,15 @@
// Check that E0161 is a hard error in all possible configurations that might
// affect it.
-// revisions: ast nll zflags edition astul nllul zflagsul editionul
-//[zflags]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+// revisions: migrate nll zflags edition migrateul nllul zflagsul editionul
+//[zflags]compile-flags: -Z borrowck=migrate
//[edition]edition:2018
-//[zflagsul]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+//[zflagsul]compile-flags: -Z borrowck=migrate
//[editionul]edition:2018
#![cfg_attr(nll, feature(nll))]
#![cfg_attr(nllul, feature(nll))]
-#![cfg_attr(astul, feature(unsized_locals))]
+#![cfg_attr(migrateul, feature(unsized_locals))]
#![cfg_attr(zflagsul, feature(unsized_locals))]
#![cfg_attr(nllul, feature(unsized_locals))]
#![cfg_attr(editionul, feature(unsized_locals))]
@@ -20,11 +20,11 @@
fn foo(x: Box<[i32]>) {
box *x;
- //[ast]~^ ERROR E0161
+ //[migrate]~^ ERROR E0161
//[nll]~^^ ERROR E0161
//[zflags]~^^^ ERROR E0161
//[edition]~^^^^ ERROR E0161
- //[astul]~^^^^^ ERROR E0161
+ //[migrateul]~^^^^^ ERROR E0161
//[nllul]~^^^^^^ ERROR E0161
//[zflagsul]~^^^^^^^ ERROR E0161
//[editionul]~^^^^^^^^ ERROR E0161
diff --git a/src/test/ui/error-codes/E0301.nll.stderr b/src/test/ui/error-codes/E0301.nll.stderr
deleted file mode 100644
index 24234c9..0000000
--- a/src/test/ui/error-codes/E0301.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0301]: cannot mutably borrow in a pattern guard
- --> $DIR/E0301.rs:4:19
- |
-LL | option if option.take().is_none() => {},
- | ^^^^^^ borrowed mutably in pattern guard
- |
- = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0301`.
diff --git a/src/test/ui/error-codes/E0301.stderr b/src/test/ui/error-codes/E0301.stderr
index 80ee681..24234c9 100644
--- a/src/test/ui/error-codes/E0301.stderr
+++ b/src/test/ui/error-codes/E0301.stderr
@@ -3,6 +3,8 @@
|
LL | option if option.take().is_none() => {},
| ^^^^^^ borrowed mutably in pattern guard
+ |
+ = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0388.nll.stderr b/src/test/ui/error-codes/E0388.nll.stderr
deleted file mode 100644
index e0ca431..0000000
--- a/src/test/ui/error-codes/E0388.nll.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0017]: references in constants may only refer to immutable values
- --> $DIR/E0388.rs:4:30
- |
-LL | const CR: &'static mut i32 = &mut C;
- | ^^^^^^ constants require immutable values
-
-error[E0017]: references in statics may only refer to immutable values
- --> $DIR/E0388.rs:5:39
- |
-LL | static STATIC_REF: &'static mut i32 = &mut X;
- | ^^^^^^ statics require immutable values
-
-error: cannot mutate statics in the initializer of another static
- --> $DIR/E0388.rs:5:39
- |
-LL | static STATIC_REF: &'static mut i32 = &mut X;
- | ^^^^^^
-
-error[E0596]: cannot borrow immutable static item `X` as mutable
- --> $DIR/E0388.rs:5:39
- |
-LL | static STATIC_REF: &'static mut i32 = &mut X;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0017]: references in statics may only refer to immutable values
- --> $DIR/E0388.rs:8:38
- |
-LL | static CONST_REF: &'static mut i32 = &mut C;
- | ^^^^^^ statics require immutable values
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0017, E0596.
-For more information about an error, try `rustc --explain E0017`.
diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr
index fae43ff..e0ca431 100644
--- a/src/test/ui/error-codes/E0388.stderr
+++ b/src/test/ui/error-codes/E0388.stderr
@@ -16,11 +16,11 @@
LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^
-error[E0596]: cannot borrow immutable static item as mutable
- --> $DIR/E0388.rs:5:44
+error[E0596]: cannot borrow immutable static item `X` as mutable
+ --> $DIR/E0388.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X;
- | ^
+ | ^^^^^^ cannot borrow as mutable
error[E0017]: references in statics may only refer to immutable values
--> $DIR/E0388.rs:8:38
diff --git a/src/test/ui/error-codes/E0389.nll.stderr b/src/test/ui/error-codes/E0389.nll.stderr
deleted file mode 100644
index 5310367..0000000
--- a/src/test/ui/error-codes/E0389.nll.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference
- --> $DIR/E0389.rs:8:5
- |
-LL | let fancy_ref = &(&mut fancy);
- | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)`
-LL | fancy_ref.num = 6;
- | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/error-codes/E0389.rs b/src/test/ui/error-codes/E0389.rs
index 8b82133..9dab2c3 100644
--- a/src/test/ui/error-codes/E0389.rs
+++ b/src/test/ui/error-codes/E0389.rs
@@ -5,6 +5,6 @@
fn main() {
let mut fancy = FancyNum{ num: 5 };
let fancy_ref = &(&mut fancy);
- fancy_ref.num = 6; //~ ERROR E0389
+ fancy_ref.num = 6; //~ ERROR cannot assign to `fancy_ref.num` which is behind a `&` reference
println!("{}", fancy_ref.num);
}
diff --git a/src/test/ui/error-codes/E0389.stderr b/src/test/ui/error-codes/E0389.stderr
index 927eace..5310367 100644
--- a/src/test/ui/error-codes/E0389.stderr
+++ b/src/test/ui/error-codes/E0389.stderr
@@ -1,9 +1,10 @@
-error[E0389]: cannot assign to data in a `&` reference
+error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference
--> $DIR/E0389.rs:8:5
|
+LL | let fancy_ref = &(&mut fancy);
+ | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)`
LL | fancy_ref.num = 6;
- | ^^^^^^^^^^^^^^^^^ assignment into an immutable reference
+ | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0389`.
diff --git a/src/test/ui/error-codes/E0499.nll.stderr b/src/test/ui/error-codes/E0499.nll.stderr
deleted file mode 100644
index d56baf7..0000000
--- a/src/test/ui/error-codes/E0499.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0499]: cannot borrow `i` as mutable more than once at a time
- --> $DIR/E0499.rs:4:17
- |
-LL | let mut x = &mut i;
- | ------ first mutable borrow occurs here
-LL | let mut a = &mut i;
- | ^^^^^^ second mutable borrow occurs here
-LL | a.use_mut();
-LL | x.use_mut();
- | - first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/error-codes/E0499.stderr b/src/test/ui/error-codes/E0499.stderr
index 8227016..d56baf7 100644
--- a/src/test/ui/error-codes/E0499.stderr
+++ b/src/test/ui/error-codes/E0499.stderr
@@ -1,13 +1,13 @@
error[E0499]: cannot borrow `i` as mutable more than once at a time
- --> $DIR/E0499.rs:4:22
+ --> $DIR/E0499.rs:4:17
|
LL | let mut x = &mut i;
- | - first mutable borrow occurs here
+ | ------ first mutable borrow occurs here
LL | let mut a = &mut i;
- | ^ second mutable borrow occurs here
-...
-LL | }
- | - first borrow ends here
+ | ^^^^^^ second mutable borrow occurs here
+LL | a.use_mut();
+LL | x.use_mut();
+ | - first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr
deleted file mode 100644
index cade6d7..0000000
--- a/src/test/ui/error-codes/E0502.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable
- --> $DIR/E0502.rs:4:5
- |
-LL | let ref y = a;
- | ----- immutable borrow occurs here
-LL | bar(a);
- | ^^^^^^ mutable borrow occurs here
-LL | y.use_ref();
- | - immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/error-codes/E0502.stderr b/src/test/ui/error-codes/E0502.stderr
index 26a2c3b..cade6d7 100644
--- a/src/test/ui/error-codes/E0502.stderr
+++ b/src/test/ui/error-codes/E0502.stderr
@@ -1,13 +1,12 @@
-error[E0502]: cannot borrow `*a` as mutable because `a` is also borrowed as immutable
- --> $DIR/E0502.rs:4:9
+error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable
+ --> $DIR/E0502.rs:4:5
|
LL | let ref y = a;
| ----- immutable borrow occurs here
LL | bar(a);
- | ^ mutable borrow occurs here
+ | ^^^^^^ mutable borrow occurs here
LL | y.use_ref();
-LL | }
- | - immutable borrow ends here
+ | - immutable borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0503.nll.stderr b/src/test/ui/error-codes/E0503.nll.stderr
deleted file mode 100644
index 106dda2..0000000
--- a/src/test/ui/error-codes/E0503.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0503]: cannot use `value` because it was mutably borrowed
- --> $DIR/E0503.rs:4:16
- |
-LL | let _borrow = &mut value;
- | ---------- borrow of `value` occurs here
-LL | let _sum = value + 1;
- | ^^^^^ use of borrowed `value`
-LL | _borrow.use_mut();
- | ------- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/error-codes/E0503.stderr b/src/test/ui/error-codes/E0503.stderr
index 62cb3af..106dda2 100644
--- a/src/test/ui/error-codes/E0503.stderr
+++ b/src/test/ui/error-codes/E0503.stderr
@@ -2,9 +2,11 @@
--> $DIR/E0503.rs:4:16
|
LL | let _borrow = &mut value;
- | ----- borrow of `value` occurs here
+ | ---------- borrow of `value` occurs here
LL | let _sum = value + 1;
| ^^^^^ use of borrowed `value`
+LL | _borrow.use_mut();
+ | ------- borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0504.nll.stderr b/src/test/ui/error-codes/E0504.nll.stderr
deleted file mode 100644
index 1f2a040..0000000
--- a/src/test/ui/error-codes/E0504.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0505]: cannot move out of `fancy_num` because it is borrowed
- --> $DIR/E0504.rs:9:13
- |
-LL | let fancy_ref = &fancy_num;
- | ---------- borrow of `fancy_num` occurs here
-LL |
-LL | let x = move || {
- | ^^^^^^^ move out of `fancy_num` occurs here
-LL | println!("child function: {}", fancy_num.num);
- | --------- move occurs due to use in closure
-...
-LL | println!("main function: {}", fancy_ref.num);
- | ------------- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/error-codes/E0504.rs b/src/test/ui/error-codes/E0504.rs
index 06ae084..c2658be 100644
--- a/src/test/ui/error-codes/E0504.rs
+++ b/src/test/ui/error-codes/E0504.rs
@@ -6,8 +6,8 @@
let fancy_num = FancyNum { num: 5 };
let fancy_ref = &fancy_num;
- let x = move || {
- println!("child function: {}", fancy_num.num); //~ ERROR E0504
+ let x = move || { //~ ERROR E0505
+ println!("child function: {}", fancy_num.num);
};
x();
diff --git a/src/test/ui/error-codes/E0504.stderr b/src/test/ui/error-codes/E0504.stderr
index a987713..1f2a040 100644
--- a/src/test/ui/error-codes/E0504.stderr
+++ b/src/test/ui/error-codes/E0504.stderr
@@ -1,12 +1,17 @@
-error[E0504]: cannot move `fancy_num` into closure because it is borrowed
- --> $DIR/E0504.rs:10:40
+error[E0505]: cannot move out of `fancy_num` because it is borrowed
+ --> $DIR/E0504.rs:9:13
|
LL | let fancy_ref = &fancy_num;
- | --------- borrow of `fancy_num` occurs here
-...
+ | ---------- borrow of `fancy_num` occurs here
+LL |
+LL | let x = move || {
+ | ^^^^^^^ move out of `fancy_num` occurs here
LL | println!("child function: {}", fancy_num.num);
- | ^^^^^^^^^ move into closure occurs here
+ | --------- move occurs due to use in closure
+...
+LL | println!("main function: {}", fancy_ref.num);
+ | ------------- borrow later used here
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0504`.
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/error-codes/E0505.nll.stderr b/src/test/ui/error-codes/E0505.nll.stderr
deleted file mode 100644
index 4d9d1ef..0000000
--- a/src/test/ui/error-codes/E0505.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/E0505.rs:9:13
- |
-LL | let _ref_to_val: &Value = &x;
- | -- borrow of `x` occurs here
-LL | eat(x);
- | ^ move out of `x` occurs here
-LL | _ref_to_val.use_ref();
- | ----------- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/error-codes/E0505.stderr b/src/test/ui/error-codes/E0505.stderr
index 28dfb25..4d9d1ef 100644
--- a/src/test/ui/error-codes/E0505.stderr
+++ b/src/test/ui/error-codes/E0505.stderr
@@ -2,9 +2,11 @@
--> $DIR/E0505.rs:9:13
|
LL | let _ref_to_val: &Value = &x;
- | - borrow of `x` occurs here
+ | -- borrow of `x` occurs here
LL | eat(x);
| ^ move out of `x` occurs here
+LL | _ref_to_val.use_ref();
+ | ----------- borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0509.nll.stderr b/src/test/ui/error-codes/E0509.nll.stderr
deleted file mode 100644
index e5c0cf6..0000000
--- a/src/test/ui/error-codes/E0509.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait
- --> $DIR/E0509.rs:16:23
- |
-LL | let fancy_field = drop_struct.fancy;
- | ^^^^^^^^^^^^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&drop_struct.fancy`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/error-codes/E0509.stderr b/src/test/ui/error-codes/E0509.stderr
index 25b6d8a..e5c0cf6 100644
--- a/src/test/ui/error-codes/E0509.stderr
+++ b/src/test/ui/error-codes/E0509.stderr
@@ -5,7 +5,7 @@
| ^^^^^^^^^^^^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&drop_struct.fancy`
+ | help: consider borrowing here: `&drop_struct.fancy`
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0597.nll.stderr b/src/test/ui/error-codes/E0597.nll.stderr
deleted file mode 100644
index b4a1180..0000000
--- a/src/test/ui/error-codes/E0597.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0597]: `y` does not live long enough
- --> $DIR/E0597.rs:8:16
- |
-LL | x.x = Some(&y);
- | ^^ borrowed value does not live long enough
-LL |
-LL | }
- | -
- | |
- | `y` dropped here while still borrowed
- | borrow might be used here, when `x` is dropped and runs the `Drop` code for type `Foo`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/error-codes/E0597.stderr b/src/test/ui/error-codes/E0597.stderr
index cab9785..b4a1180 100644
--- a/src/test/ui/error-codes/E0597.stderr
+++ b/src/test/ui/error-codes/E0597.stderr
@@ -1,13 +1,16 @@
error[E0597]: `y` does not live long enough
- --> $DIR/E0597.rs:8:17
+ --> $DIR/E0597.rs:8:16
|
LL | x.x = Some(&y);
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL |
LL | }
- | - `y` dropped here while still borrowed
+ | -
+ | |
+ | `y` dropped here while still borrowed
+ | borrow might be used here, when `x` is dropped and runs the `Drop` code for type `Foo`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to previous error
diff --git a/src/test/ui/feature-gates/feature-gate-nll.rs b/src/test/ui/feature-gates/feature-gate-nll.rs
index 14c48fb..2cf6e4d 100644
--- a/src/test/ui/feature-gates/feature-gate-nll.rs
+++ b/src/test/ui/feature-gates/feature-gate-nll.rs
@@ -1,18 +1,20 @@
-// This is a test checking that if you do not opt into NLL then you
-// should not get the effects of NLL applied to the test.
-
-// Don't use 2018 edition, since that turns on NLL (migration mode).
-// edition:2015
+// There isn't a great way to test feature(nll), since it just disables migrate
+// mode and changes some error messages. We just test for migrate mode.
// Don't use compare-mode=nll, since that turns on NLL.
// ignore-compare-mode-nll
+#![feature(rustc_attrs)]
-#![allow(dead_code)]
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ let mut x = (33, &0);
-fn main() {
- let mut x = 33;
-
- let p = &x;
- x = 22; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
+ let m = &mut x;
+ let p = &*x.1;
+ //~^ WARNING cannot borrow
+ //~| WARNING this error has been downgraded to a warning
+ //~| WARNING this warning will become a hard error in the future
+ m;
}
+
diff --git a/src/test/ui/feature-gates/feature-gate-nll.stderr b/src/test/ui/feature-gates/feature-gate-nll.stderr
index cc004e3..ac21241 100644
--- a/src/test/ui/feature-gates/feature-gate-nll.stderr
+++ b/src/test/ui/feature-gates/feature-gate-nll.stderr
@@ -1,11 +1,29 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/feature-gate-nll.rs:17:5
+warning[E0502]: cannot borrow `*x.1` as immutable because it is also borrowed as mutable
+ --> $DIR/feature-gate-nll.rs:14:13
|
-LL | let p = &x;
- | - borrow of `x` occurs here
-LL | x = 22;
- | ^^^^^^ assignment to borrowed `x` occurs here
+LL | let m = &mut x;
+ | ------ mutable borrow occurs here
+LL | let p = &*x.1;
+ | ^^^^^ immutable borrow occurs here
+...
+LL | m;
+ | - mutable borrow later used here
+ |
+ = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+ = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
+error: compilation successful
+ --> $DIR/feature-gate-nll.rs:10:1
+ |
+LL | / fn main() {
+LL | | let mut x = (33, &0);
+LL | |
+LL | | let m = &mut x;
+... |
+LL | | m;
+LL | | }
+ | |_^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0506`.
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/fn/fn-closure-mutable-capture.nll.stderr b/src/test/ui/fn/fn-closure-mutable-capture.nll.stderr
deleted file mode 100644
index 8dfae0c..0000000
--- a/src/test/ui/fn/fn-closure-mutable-capture.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
- --> $DIR/fn-closure-mutable-capture.rs:5:17
- |
-LL | bar(move || x = 1);
- | ^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/fn-closure-mutable-capture.rs:5:9
- |
-LL | bar(move || x = 1);
- | ^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/fn/fn-closure-mutable-capture.rs b/src/test/ui/fn/fn-closure-mutable-capture.rs
index a37ecef..81376af 100644
--- a/src/test/ui/fn/fn-closure-mutable-capture.rs
+++ b/src/test/ui/fn/fn-closure-mutable-capture.rs
@@ -3,8 +3,9 @@
pub fn foo() {
let mut x = 0;
bar(move || x = 1);
- //~^ ERROR cannot assign to captured outer variable in an `Fn` closure
- //~| NOTE `Fn` closures cannot capture their enclosing environment for modifications
+ //~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure
+ //~| NOTE cannot assign
+ //~| HELP consider changing this to accept closures that implement `FnMut`
}
fn main() {}
diff --git a/src/test/ui/fn/fn-closure-mutable-capture.stderr b/src/test/ui/fn/fn-closure-mutable-capture.stderr
index 2414bcd..8dfae0c 100644
--- a/src/test/ui/fn/fn-closure-mutable-capture.stderr
+++ b/src/test/ui/fn/fn-closure-mutable-capture.stderr
@@ -1,11 +1,10 @@
-error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
--> $DIR/fn-closure-mutable-capture.rs:5:17
|
LL | bar(move || x = 1);
- | ^^^^^
+ | ^^^^^ cannot assign
|
- = note: `Fn` closures cannot capture their enclosing environment for modifications
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/fn-closure-mutable-capture.rs:5:9
|
LL | bar(move || x = 1);
diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr
deleted file mode 100644
index e7b4575..0000000
--- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0509]: cannot move out of type `A`, which implements the `Drop` trait
- --> $DIR/functional-struct-update-noncopyable.rs:12:14
- |
-LL | let _b = A { y: Arc::new(3), ..a };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr
index 5549adc..e7b4575 100644
--- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr
+++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr
@@ -1,8 +1,8 @@
error[E0509]: cannot move out of type `A`, which implements the `Drop` trait
- --> $DIR/functional-struct-update-noncopyable.rs:12:36
+ --> $DIR/functional-struct-update-noncopyable.rs:12:14
|
LL | let _b = A { y: Arc::new(3), ..a };
- | ^ cannot move out of here
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
error: aborting due to previous error
diff --git a/src/test/ui/generator/borrowing.nll.stderr b/src/test/ui/generator/borrowing.nll.stderr
deleted file mode 100644
index 3d58873..0000000
--- a/src/test/ui/generator/borrowing.nll.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:9:33
- |
-LL | Pin::new(&mut || yield &a).resume()
- | ----------^
- | | |
- | | borrowed value does not live long enough
- | value captured here by generator
- | a temporary with access to the borrow is created here ...
-LL |
-LL | };
- | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator
- | |
- | `a` dropped here while still borrowed
- |
- = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
-
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:16:20
- |
-LL | let _b = {
- | -- borrow later stored here
-LL | let a = 3;
-LL | || {
- | -- value captured here by generator
-LL | yield &a
- | ^ borrowed value does not live long enough
-...
-LL | };
- | - `a` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/generator/borrowing.stderr b/src/test/ui/generator/borrowing.stderr
index 38502aa..3d58873 100644
--- a/src/test/ui/generator/borrowing.stderr
+++ b/src/test/ui/generator/borrowing.stderr
@@ -2,28 +2,32 @@
--> $DIR/borrowing.rs:9:33
|
LL | Pin::new(&mut || yield &a).resume()
- | -- ^ borrowed value does not live long enough
- | |
- | capture occurs here
+ | ----------^
+ | | |
+ | | borrowed value does not live long enough
+ | value captured here by generator
+ | a temporary with access to the borrow is created here ...
LL |
LL | };
- | - borrowed value only lives until here
-...
-LL | }
- | - borrowed value needs to live until here
+ | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator
+ | |
+ | `a` dropped here while still borrowed
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
error[E0597]: `a` does not live long enough
--> $DIR/borrowing.rs:16:20
|
+LL | let _b = {
+ | -- borrow later stored here
+LL | let a = 3;
LL | || {
- | -- capture occurs here
+ | -- value captured here by generator
LL | yield &a
| ^ borrowed value does not live long enough
...
LL | };
- | - borrowed value only lives until here
-LL | }
- | - borrowed value needs to live until here
+ | - `a` dropped here while still borrowed
error: aborting due to 2 previous errors
diff --git a/src/test/ui/generator/dropck.nll.stderr b/src/test/ui/generator/dropck.nll.stderr
deleted file mode 100644
index 8bb860f..0000000
--- a/src/test/ui/generator/dropck.nll.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0597]: `*cell` does not live long enough
- --> $DIR/dropck.rs:10:40
- |
-LL | let ref_ = Box::leak(Box::new(Some(cell.borrow_mut())));
- | ^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `*cell` dropped here while still borrowed
- | borrow might be used here, when `gen` is dropped and runs the destructor for generator
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `ref_` does not live long enough
- --> $DIR/dropck.rs:15:18
- |
-LL | gen = || {
- | -- value captured here by generator
-LL | // but the generator can use it to drop a `Ref<'a, i32>`.
-LL | let _d = ref_.take();
- | ^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `ref_` dropped here while still borrowed
- | borrow might be used here, when `gen` is dropped and runs the destructor for generator
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/generator/dropck.stderr b/src/test/ui/generator/dropck.stderr
index 977f388..8bb860f 100644
--- a/src/test/ui/generator/dropck.stderr
+++ b/src/test/ui/generator/dropck.stderr
@@ -5,23 +5,29 @@
| ^^^^ borrowed value does not live long enough
...
LL | }
- | - `*cell` dropped here while still borrowed
+ | -
+ | |
+ | `*cell` dropped here while still borrowed
+ | borrow might be used here, when `gen` is dropped and runs the destructor for generator
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `ref_` does not live long enough
--> $DIR/dropck.rs:15:18
|
LL | gen = || {
- | -- capture occurs here
+ | -- value captured here by generator
LL | // but the generator can use it to drop a `Ref<'a, i32>`.
LL | let _d = ref_.take();
| ^^^^ borrowed value does not live long enough
...
LL | }
- | - borrowed value dropped before borrower
+ | -
+ | |
+ | `ref_` dropped here while still borrowed
+ | borrow might be used here, when `gen` is dropped and runs the destructor for generator
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to 2 previous errors
diff --git a/src/test/ui/generator/generator-region-requirements.ast.stderr b/src/test/ui/generator/generator-region-requirements.migrate.stderr
similarity index 100%
rename from src/test/ui/generator/generator-region-requirements.ast.stderr
rename to src/test/ui/generator/generator-region-requirements.migrate.stderr
diff --git a/src/test/ui/generator/generator-region-requirements.rs b/src/test/ui/generator/generator-region-requirements.rs
index 9738f6c..cd9abaa 100644
--- a/src/test/ui/generator/generator-region-requirements.rs
+++ b/src/test/ui/generator/generator-region-requirements.rs
@@ -1,4 +1,4 @@
-// revisions: ast nll
+// revisions: migrate nll
// ignore-compare-mode-nll
#![feature(generators, generator_trait)]
@@ -15,7 +15,7 @@
match Pin::new(&mut g).resume() {
GeneratorState::Complete(c) => return c,
//[nll]~^ ERROR explicit lifetime required
-//[ast]~^^ ERROR explicit lifetime required
+//[migrate]~^^ ERROR explicit lifetime required
GeneratorState::Yielded(_) => (),
}
}
diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.nll.stderr b/src/test/ui/generator/ref-escapes-but-not-over-yield.nll.stderr
deleted file mode 100644
index de533e4..0000000
--- a/src/test/ui/generator/ref-escapes-but-not-over-yield.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0521]: borrowed data escapes outside of generator
- --> $DIR/ref-escapes-but-not-over-yield.rs:11:9
- |
-LL | let mut a = &3;
- | ----- `a` is declared here, outside of the generator body
-...
-LL | a = &b;
- | ^^^^--
- | | |
- | | borrow is only valid in the generator body
- | reference to `b` escapes the generator body here
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.rs b/src/test/ui/generator/ref-escapes-but-not-over-yield.rs
index 8c57658..3856d82 100644
--- a/src/test/ui/generator/ref-escapes-but-not-over-yield.rs
+++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.rs
@@ -9,7 +9,7 @@
yield();
let b = 5;
a = &b;
- //~^ ERROR `b` does not live long enough
+ //~^ ERROR borrowed data escapes outside of generator
};
}
diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr
index 20a06ab..de533e4 100644
--- a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr
+++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr
@@ -1,14 +1,14 @@
-error[E0597]: `b` does not live long enough
- --> $DIR/ref-escapes-but-not-over-yield.rs:11:14
+error[E0521]: borrowed data escapes outside of generator
+ --> $DIR/ref-escapes-but-not-over-yield.rs:11:9
|
+LL | let mut a = &3;
+ | ----- `a` is declared here, outside of the generator body
+...
LL | a = &b;
- | ^ borrowed value does not live long enough
-LL |
-LL | };
- | - `b` dropped here while still borrowed
-LL | }
- | - borrowed value needs to live until here
+ | ^^^^--
+ | | |
+ | | borrow is only valid in the generator body
+ | reference to `b` escapes the generator body here
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/generator/yield-in-args.nll.stderr b/src/test/ui/generator/yield-in-args.nll.stderr
deleted file mode 100644
index ee6d22c..0000000
--- a/src/test/ui/generator/yield-in-args.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0626]: borrow may still be in use when generator yields
- --> $DIR/yield-in-args.rs:8:13
- |
-LL | foo(&b, yield);
- | ^^ ----- possible yield occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0626`.
diff --git a/src/test/ui/generator/yield-in-args.stderr b/src/test/ui/generator/yield-in-args.stderr
index 2f22dea..ee6d22c 100644
--- a/src/test/ui/generator/yield-in-args.stderr
+++ b/src/test/ui/generator/yield-in-args.stderr
@@ -1,8 +1,8 @@
error[E0626]: borrow may still be in use when generator yields
- --> $DIR/yield-in-args.rs:8:14
+ --> $DIR/yield-in-args.rs:8:13
|
LL | foo(&b, yield);
- | ^ ----- possible yield occurs here
+ | ^^ ----- possible yield occurs here
error: aborting due to previous error
diff --git a/src/test/ui/generator/yield-while-iterating.nll.stderr b/src/test/ui/generator/yield-while-iterating.nll.stderr
deleted file mode 100644
index 6a96b25..0000000
--- a/src/test/ui/generator/yield-while-iterating.nll.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0626]: borrow may still be in use when generator yields
- --> $DIR/yield-while-iterating.rs:13:18
- |
-LL | for p in &x {
- | ^^
-LL | yield();
- | ------- possible yield occurs here
-
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/yield-while-iterating.rs:58:20
- |
-LL | let mut b = || {
- | -- mutable borrow occurs here
-LL | for p in &mut x {
- | - first borrow occurs due to use of `x` in generator
-...
-LL | println!("{}", x[0]);
- | ^ immutable borrow occurs here
-LL | Pin::new(&mut b).resume();
- | ------ mutable borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0502, E0626.
-For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/generator/yield-while-iterating.stderr b/src/test/ui/generator/yield-while-iterating.stderr
index 91f28e1..6a96b25 100644
--- a/src/test/ui/generator/yield-while-iterating.stderr
+++ b/src/test/ui/generator/yield-while-iterating.stderr
@@ -1,8 +1,8 @@
error[E0626]: borrow may still be in use when generator yields
- --> $DIR/yield-while-iterating.rs:13:19
+ --> $DIR/yield-while-iterating.rs:13:18
|
LL | for p in &x {
- | ^
+ | ^^
LL | yield();
| ------- possible yield occurs here
@@ -12,13 +12,12 @@
LL | let mut b = || {
| -- mutable borrow occurs here
LL | for p in &mut x {
- | - previous borrow occurs due to use of `x` in closure
+ | - first borrow occurs due to use of `x` in generator
...
LL | println!("{}", x[0]);
| ^ immutable borrow occurs here
LL | Pin::new(&mut b).resume();
-LL | }
- | - mutable borrow ends here
+ | ------ mutable borrow later used here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr
deleted file mode 100644
index 4c37cd3..0000000
--- a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access
- --> $DIR/yield-while-ref-reborrowed.rs:36:20
- |
-LL | let mut b = || {
- | -- generator construction occurs here
-LL | let a = &mut *x;
- | - first borrow occurs due to use of `x` in generator
-...
-LL | println!("{}", x);
- | ^ second borrow occurs here
-LL | Pin::new(&mut b).resume();
- | ------ first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0501`.
diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.stderr
index 155f277..4c37cd3 100644
--- a/src/test/ui/generator/yield-while-ref-reborrowed.stderr
+++ b/src/test/ui/generator/yield-while-ref-reborrowed.stderr
@@ -2,15 +2,14 @@
--> $DIR/yield-while-ref-reborrowed.rs:36:20
|
LL | let mut b = || {
- | -- closure construction occurs here
+ | -- generator construction occurs here
LL | let a = &mut *x;
- | - previous borrow occurs due to use of `x` in closure
+ | - first borrow occurs due to use of `x` in generator
...
LL | println!("{}", x);
- | ^ borrow occurs here
+ | ^ second borrow occurs here
LL | Pin::new(&mut b).resume();
-LL | }
- | - borrow from closure ends here
+ | ------ first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr
deleted file mode 100644
index f7626b1..0000000
--- a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
- --> $DIR/hashmap-iter-value-lifetime.rs:7:5
- |
-LL | let (_, thing) = my_stuff.iter().next().unwrap();
- | -------- immutable borrow occurs here
-LL |
-LL | my_stuff.clear();
- | ^^^^^^^^^^^^^^^^ mutable borrow occurs here
-LL |
-LL | println!("{}", *thing);
- | ------ immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/hashmap-iter-value-lifetime.stderr b/src/test/ui/hashmap-iter-value-lifetime.stderr
index 0f7e04d..f7626b1 100644
--- a/src/test/ui/hashmap-iter-value-lifetime.stderr
+++ b/src/test/ui/hashmap-iter-value-lifetime.stderr
@@ -5,10 +5,10 @@
| -------- immutable borrow occurs here
LL |
LL | my_stuff.clear();
- | ^^^^^^^^ mutable borrow occurs here
-...
-LL | }
- | - immutable borrow ends here
+ | ^^^^^^^^^^^^^^^^ mutable borrow occurs here
+LL |
+LL | println!("{}", *thing);
+ | ------ immutable borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr
deleted file mode 100644
index 497c7d1..0000000
--- a/src/test/ui/hashmap-lifetimes.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
- --> $DIR/hashmap-lifetimes.rs:6:5
- |
-LL | let mut it = my_stuff.iter();
- | -------- immutable borrow occurs here
-LL | my_stuff.insert(1, 43);
- | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
-LL | it;
- | -- immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/hashmap-lifetimes.stderr b/src/test/ui/hashmap-lifetimes.stderr
index 728946c..497c7d1 100644
--- a/src/test/ui/hashmap-lifetimes.stderr
+++ b/src/test/ui/hashmap-lifetimes.stderr
@@ -4,10 +4,9 @@
LL | let mut it = my_stuff.iter();
| -------- immutable borrow occurs here
LL | my_stuff.insert(1, 43);
- | ^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | it;
-LL | }
- | - immutable borrow ends here
+ | -- immutable borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr
deleted file mode 100644
index 70d5b3c..0000000
--- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0499]: cannot borrow `foo` as mutable more than once at a time
- --> $DIR/hrtb-debruijn-in-receiver.rs:17:5
- |
-LL | foo.insert();
- | --- first mutable borrow occurs here
-LL | foo.insert();
- | ^^^
- | |
- | second mutable borrow occurs here
- | first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr
index e498a9a..70d5b3c 100644
--- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr
+++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr
@@ -4,9 +4,10 @@
LL | foo.insert();
| --- first mutable borrow occurs here
LL | foo.insert();
- | ^^^ second mutable borrow occurs here
-LL | }
- | - first borrow ends here
+ | ^^^
+ | |
+ | second mutable borrow occurs here
+ | first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr
deleted file mode 100644
index 2b69b3f..0000000
--- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/hrtb-identity-fn-borrows.rs:17:5
- |
-LL | let y = f.call(&x);
- | -- borrow of `x` occurs here
-LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
-...
-LL | drop(y);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr
deleted file mode 100644
index 6f055aa..0000000
--- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/hrtb-identity-fn-borrows.rs:17:5
- |
-LL | let y = f.call(&x);
- | - borrow of `x` occurs here
-LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr
deleted file mode 100644
index 2b69b3f..0000000
--- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/hrtb-identity-fn-borrows.rs:17:5
- |
-LL | let y = f.call(&x);
- | -- borrow of `x` occurs here
-LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
-...
-LL | drop(y);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs b/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs
index 35b39a9..89fc470 100644
--- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs
+++ b/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs
@@ -1,9 +1,6 @@
// Test that the `'a` in the where clause correctly links the region
// of the output to the region of the input.
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
trait FnLike<A,R> {
fn call(&self, arg: A) -> R;
}
@@ -14,8 +11,7 @@
// Result is stored: cannot re-assign `x`
let mut x = 3;
let y = f.call(&x);
- x = 5; //[ast]~ ERROR cannot assign
- //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+ x = 5; //~ ERROR cannot assign to `x` because it is borrowed
// Result is not stored: can re-assign `x`
let mut x = 3;
diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr
new file mode 100644
index 0000000..4886a3c
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/hrtb-identity-fn-borrows.rs:14:5
+ |
+LL | let y = f.call(&x);
+ | -- borrow of `x` occurs here
+LL | x = 5;
+ | ^^^^^ assignment to borrowed `x` occurs here
+...
+LL | drop(y);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/hygiene/fields-move.nll.stderr b/src/test/ui/hygiene/fields-move.nll.stderr
deleted file mode 100644
index 562f60e..0000000
--- a/src/test/ui/hygiene/fields-move.nll.stderr
+++ /dev/null
@@ -1,38 +0,0 @@
-error[E0382]: use of moved value: `foo.x`
- --> $DIR/fields-move.rs:18:9
- |
-LL | $foo.x
- | ^^^^^^ value used here after move
-...
-LL | assert_two_copies(copy_modern!(foo), foo.x);
- | ----- value moved here
-LL | assert_two_copies(copy_legacy!(foo), foo.x);
- | ----------------- in this macro invocation
- |
- = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `foo.x`
- --> $DIR/fields-move.rs:28:42
- |
-LL | $foo.x
- | ------ value moved here
-...
-LL | assert_two_copies(copy_modern!(foo), foo.x);
- | ^^^^^ value used here after move
- |
- = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `foo.x`
- --> $DIR/fields-move.rs:29:42
- |
-LL | $foo.x
- | ------ value moved here
-...
-LL | assert_two_copies(copy_legacy!(foo), foo.x);
- | ^^^^^ value used here after move
- |
- = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/hygiene/fields-move.stderr b/src/test/ui/hygiene/fields-move.stderr
index 43d55fd..562f60e 100644
--- a/src/test/ui/hygiene/fields-move.stderr
+++ b/src/test/ui/hygiene/fields-move.stderr
@@ -1,4 +1,17 @@
error[E0382]: use of moved value: `foo.x`
+ --> $DIR/fields-move.rs:18:9
+ |
+LL | $foo.x
+ | ^^^^^^ value used here after move
+...
+LL | assert_two_copies(copy_modern!(foo), foo.x);
+ | ----- value moved here
+LL | assert_two_copies(copy_legacy!(foo), foo.x);
+ | ----------------- in this macro invocation
+ |
+ = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `foo.x`
--> $DIR/fields-move.rs:28:42
|
LL | $foo.x
@@ -10,24 +23,10 @@
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `foo.x`
- --> $DIR/fields-move.rs:18:9
- |
-LL | $foo.x
- | ------ value moved here
-...
-LL | $foo.x
- | ^^^^^^ value used here after move
-...
-LL | assert_two_copies(copy_legacy!(foo), foo.x);
- | ----------------- in this macro invocation
- |
- = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `foo.x`
--> $DIR/fields-move.rs:29:42
|
-LL | $foo.x
- | ------ value moved here
+LL | $foo.x
+ | ------ value moved here
...
LL | assert_two_copies(copy_legacy!(foo), foo.x);
| ^^^^^ value used here after move
diff --git a/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr b/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr
deleted file mode 100644
index fb90825..0000000
--- a/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0499]: cannot borrow `s.0` as mutable more than once at a time
- --> $DIR/fields-numeric-borrowck.rs:6:16
- |
-LL | let borrow1 = &mut s.0;
- | -------- first mutable borrow occurs here
-LL | let S { 0: ref mut borrow2 } = s;
- | ^^^^^^^^^^^^^^^ second mutable borrow occurs here
-...
-LL | borrow1.use_mut();
- | ------- first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/hygiene/fields-numeric-borrowck.stderr b/src/test/ui/hygiene/fields-numeric-borrowck.stderr
index 11b5fd7..fb90825 100644
--- a/src/test/ui/hygiene/fields-numeric-borrowck.stderr
+++ b/src/test/ui/hygiene/fields-numeric-borrowck.stderr
@@ -2,12 +2,12 @@
--> $DIR/fields-numeric-borrowck.rs:6:16
|
LL | let borrow1 = &mut s.0;
- | --- first mutable borrow occurs here
+ | -------- first mutable borrow occurs here
LL | let S { 0: ref mut borrow2 } = s;
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
...
-LL | }
- | - first borrow ends here
+LL | borrow1.use_mut();
+ | ------- first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/immut-function-arguments.ast.nll.stderr b/src/test/ui/immut-function-arguments.ast.nll.stderr
deleted file mode 100644
index 4847137..0000000
--- a/src/test/ui/immut-function-arguments.ast.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable
- --> $DIR/immut-function-arguments.rs:5:5
- |
-LL | fn f(y: Box<isize>) {
- | - help: consider changing this to be mutable: `mut y`
-LL | *y = 5;
- | ^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable
- --> $DIR/immut-function-arguments.rs:10:35
- |
-LL | let _frob = |q: Box<isize>| { *q = 2; };
- | - ^^^^^^ cannot assign
- | |
- | help: consider changing this to be mutable: `mut q`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/immut-function-arguments.ast.stderr b/src/test/ui/immut-function-arguments.ast.stderr
deleted file mode 100644
index 1b5615a..0000000
--- a/src/test/ui/immut-function-arguments.ast.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0594]: cannot assign to immutable `Box` content `*y`
- --> $DIR/immut-function-arguments.rs:5:5
- |
-LL | fn f(y: Box<isize>) {
- | - help: make this binding mutable: `mut y`
-LL | *y = 5;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to immutable `Box` content `*q`
- --> $DIR/immut-function-arguments.rs:10:35
- |
-LL | let _frob = |q: Box<isize>| { *q = 2; };
- | - ^^^^^^ cannot borrow as mutable
- | |
- | help: make this binding mutable: `mut q`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/immut-function-arguments.mir.stderr b/src/test/ui/immut-function-arguments.mir.stderr
deleted file mode 100644
index 4847137..0000000
--- a/src/test/ui/immut-function-arguments.mir.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable
- --> $DIR/immut-function-arguments.rs:5:5
- |
-LL | fn f(y: Box<isize>) {
- | - help: consider changing this to be mutable: `mut y`
-LL | *y = 5;
- | ^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable
- --> $DIR/immut-function-arguments.rs:10:35
- |
-LL | let _frob = |q: Box<isize>| { *q = 2; };
- | - ^^^^^^ cannot assign
- | |
- | help: consider changing this to be mutable: `mut q`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/immut-function-arguments.rs b/src/test/ui/immut-function-arguments.rs
index 2cc9c69..242a33e 100644
--- a/src/test/ui/immut-function-arguments.rs
+++ b/src/test/ui/immut-function-arguments.rs
@@ -1,14 +1,9 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn f(y: Box<isize>) {
- *y = 5; //[ast]~ ERROR cannot assign
- //[mir]~^ ERROR cannot assign
+ *y = 5; //~ ERROR cannot assign
}
fn g() {
- let _frob = |q: Box<isize>| { *q = 2; }; //[ast]~ ERROR cannot assign
- //[mir]~^ ERROR cannot assign
+ let _frob = |q: Box<isize>| { *q = 2; }; //~ ERROR cannot assign
}
fn main() {}
diff --git a/src/test/ui/immut-function-arguments.stderr b/src/test/ui/immut-function-arguments.stderr
new file mode 100644
index 0000000..7871ba5
--- /dev/null
+++ b/src/test/ui/immut-function-arguments.stderr
@@ -0,0 +1,18 @@
+error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable
+ --> $DIR/immut-function-arguments.rs:2:5
+ |
+LL | fn f(y: Box<isize>) {
+ | - help: consider changing this to be mutable: `mut y`
+LL | *y = 5;
+ | ^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable
+ --> $DIR/immut-function-arguments.rs:6:35
+ |
+LL | let _frob = |q: Box<isize>| { *q = 2; };
+ | - ^^^^^^ cannot assign
+ | |
+ | help: consider changing this to be mutable: `mut q`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr
deleted file mode 100644
index f96ff9d..0000000
--- a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0506]: cannot assign to `p` because it is borrowed
- --> $DIR/mut_while_borrow.rs:9:5
- |
-LL | let r = foo(&p);
- | -- borrow of `p` occurs here
-LL | p += 1;
- | ^^^^^^ assignment to borrowed `p` occurs here
-LL | println!("{}", r);
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr
index 556c15d..f96ff9d 100644
--- a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr
+++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr
@@ -2,9 +2,11 @@
--> $DIR/mut_while_borrow.rs:9:5
|
LL | let r = foo(&p);
- | - borrow of `p` occurs here
+ | -- borrow of `p` occurs here
LL | p += 1;
| ^^^^^^ assignment to borrowed `p` occurs here
+LL | println!("{}", r);
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-10398.nll.stderr b/src/test/ui/issues/issue-10398.nll.stderr
deleted file mode 100644
index f5f4974..0000000
--- a/src/test/ui/issues/issue-10398.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/issue-10398.rs:7:14
- |
-LL | let _a = x;
- | - value moved here
-LL | drop(x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/issues/issue-10398.stderr b/src/test/ui/issues/issue-10398.stderr
index ceb2cfe..f5f4974 100644
--- a/src/test/ui/issues/issue-10398.stderr
+++ b/src/test/ui/issues/issue-10398.stderr
@@ -2,7 +2,7 @@
--> $DIR/issue-10398.rs:7:14
|
LL | let _a = x;
- | -- value moved here
+ | - value moved here
LL | drop(x);
| ^ value used here after move
|
diff --git a/src/test/ui/issues/issue-11192.nll.stderr b/src/test/ui/issues/issue-11192.nll.stderr
deleted file mode 100644
index 2a9d913..0000000
--- a/src/test/ui/issues/issue-11192.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
- --> $DIR/issue-11192.rs:20:10
- |
-LL | let mut test = |foo: &Foo| {
- | ----------- mutable borrow occurs here
-LL | println!("access {}", foo.x);
-LL | ptr = box Foo { x: ptr.x + 1 };
- | --- first borrow occurs due to use of `ptr` in closure
-...
-LL | test(&*ptr);
- | ---- ^^^^^ immutable borrow occurs here
- | |
- | mutable borrow later used by call
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/issues/issue-11192.stderr b/src/test/ui/issues/issue-11192.stderr
index ce90b16..2a9d913 100644
--- a/src/test/ui/issues/issue-11192.stderr
+++ b/src/test/ui/issues/issue-11192.stderr
@@ -1,17 +1,16 @@
-error[E0502]: cannot borrow `*ptr` as immutable because `ptr` is also borrowed as mutable
- --> $DIR/issue-11192.rs:20:11
+error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
+ --> $DIR/issue-11192.rs:20:10
|
LL | let mut test = |foo: &Foo| {
| ----------- mutable borrow occurs here
LL | println!("access {}", foo.x);
LL | ptr = box Foo { x: ptr.x + 1 };
- | --- previous borrow occurs due to use of `ptr` in closure
+ | --- first borrow occurs due to use of `ptr` in closure
...
LL | test(&*ptr);
- | ^^^^ immutable borrow occurs here
-LL |
-LL | }
- | - mutable borrow ends here
+ | ---- ^^^^^ immutable borrow occurs here
+ | |
+ | mutable borrow later used by call
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-11493.ast.stderr b/src/test/ui/issues/issue-11493.ast.stderr
deleted file mode 100644
index a5f8aef..0000000
--- a/src/test/ui/issues/issue-11493.ast.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0597]: borrowed value does not live long enough (Ast)
- --> $DIR/issue-11493.rs:10:35
- |
-LL | let y = x.as_ref().unwrap_or(&id(5));
- | ^^^^^ - temporary value dropped here while still borrowed
- | |
- | temporary value does not live long enough
-...
-LL | }
- | - temporary value needs to live until here
- |
- = note: consider using a `let` binding to increase its lifetime
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issues/issue-11493.mir.stderr b/src/test/ui/issues/issue-11493.mir.stderr
deleted file mode 100644
index a5f8aef..0000000
--- a/src/test/ui/issues/issue-11493.mir.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0597]: borrowed value does not live long enough (Ast)
- --> $DIR/issue-11493.rs:10:35
- |
-LL | let y = x.as_ref().unwrap_or(&id(5));
- | ^^^^^ - temporary value dropped here while still borrowed
- | |
- | temporary value does not live long enough
-...
-LL | }
- | - temporary value needs to live until here
- |
- = note: consider using a `let` binding to increase its lifetime
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issues/issue-11493.rs b/src/test/ui/issues/issue-11493.rs
index 4fdc32b..b28c173 100644
--- a/src/test/ui/issues/issue-11493.rs
+++ b/src/test/ui/issues/issue-11493.rs
@@ -1,14 +1,7 @@
-// This file must never have a trailing newline
-//
-// revisions: ast mir
-// compile-flags: -Z borrowck=compare
-
fn id<T>(x: T) -> T { x }
fn main() {
let x = Some(3);
- let y = x.as_ref().unwrap_or(&id(5));
- //[ast]~^ ERROR borrowed value does not live long enough (Ast)
- //[mir]~^^ ERROR borrowed value does not live long enough (Ast)
- // This actually passes in mir
+ let y = x.as_ref().unwrap_or(&id(5)); //~ ERROR
+ &y;
}
diff --git a/src/test/ui/issues/issue-11493.stderr b/src/test/ui/issues/issue-11493.stderr
new file mode 100644
index 0000000..f954d64
--- /dev/null
+++ b/src/test/ui/issues/issue-11493.stderr
@@ -0,0 +1,15 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/issue-11493.rs:5:35
+ |
+LL | let y = x.as_ref().unwrap_or(&id(5));
+ | ^^^^^ - temporary value is freed at the end of this statement
+ | |
+ | creates a temporary which is freed while still in use
+LL | &y;
+ | -- borrow later used here
+ |
+ = note: consider using a `let` binding to create a longer lived value
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-11681.nll.stderr b/src/test/ui/issues/issue-11681.nll.stderr
deleted file mode 100644
index f2f9307..0000000
--- a/src/test/ui/issues/issue-11681.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/issue-11681.rs:13:10
- |
-LL | let testValue = &Test;
- | ---- temporary value created here
-LL | return testValue;
- | ^^^^^^^^^ returns a value referencing data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-11681.rs b/src/test/ui/issues/issue-11681.rs
index 8294ca6..6d8810d 100644
--- a/src/test/ui/issues/issue-11681.rs
+++ b/src/test/ui/issues/issue-11681.rs
@@ -9,8 +9,8 @@
}
fn createTest<'a>() -> &'a Test {
- let testValue = &Test; //~ ERROR borrowed value does not live long enough
- return testValue;
+ let testValue = &Test;
+ return testValue; //~ ERROR cannot return value referencing temporary value
}
diff --git a/src/test/ui/issues/issue-11681.stderr b/src/test/ui/issues/issue-11681.stderr
index f59ddb0..f2f9307 100644
--- a/src/test/ui/issues/issue-11681.stderr
+++ b/src/test/ui/issues/issue-11681.stderr
@@ -1,18 +1,11 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-11681.rs:12:20
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/issue-11681.rs:13:10
|
LL | let testValue = &Test;
- | ^^^^ temporary value does not live long enough
+ | ---- temporary value created here
LL | return testValue;
-LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 11:15...
- --> $DIR/issue-11681.rs:11:15
- |
-LL | fn createTest<'a>() -> &'a Test {
- | ^^
+ | ^^^^^^^^^ returns a value referencing data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-11873.nll.stderr b/src/test/ui/issues/issue-11873.nll.stderr
deleted file mode 100644
index 4475bdf..0000000
--- a/src/test/ui/issues/issue-11873.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0505]: cannot move out of `v` because it is borrowed
- --> $DIR/issue-11873.rs:4:14
- |
-LL | let mut f = || v.push(2);
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `v` occurs here
-LL | let _w = v;
- | ^ move out of `v` occurs here
-LL |
-LL | f();
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/issues/issue-11873.stderr b/src/test/ui/issues/issue-11873.stderr
index 63bb4e7..4475bdf 100644
--- a/src/test/ui/issues/issue-11873.stderr
+++ b/src/test/ui/issues/issue-11873.stderr
@@ -1,10 +1,15 @@
error[E0505]: cannot move out of `v` because it is borrowed
- --> $DIR/issue-11873.rs:4:9
+ --> $DIR/issue-11873.rs:4:14
|
LL | let mut f = || v.push(2);
- | -- borrow of `v` occurs here
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `v` occurs here
LL | let _w = v;
- | ^^ move out of `v` occurs here
+ | ^ move out of `v` occurs here
+LL |
+LL | f();
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-12041.nll.stderr b/src/test/ui/issues/issue-12041.nll.stderr
deleted file mode 100644
index d95cc89..0000000
--- a/src/test/ui/issues/issue-12041.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0382]: use of moved value: `tx`
- --> $DIR/issue-12041.rs:8:22
- |
-LL | let tx = tx;
- | ^^ value moved here, in previous iteration of loop
- |
- = note: move occurs because `tx` has type `std::sync::mpsc::Sender<i32>`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/issues/issue-12041.stderr b/src/test/ui/issues/issue-12041.stderr
index 48544c0..d95cc89 100644
--- a/src/test/ui/issues/issue-12041.stderr
+++ b/src/test/ui/issues/issue-12041.stderr
@@ -1,8 +1,8 @@
error[E0382]: use of moved value: `tx`
- --> $DIR/issue-12041.rs:8:17
+ --> $DIR/issue-12041.rs:8:22
|
LL | let tx = tx;
- | ^^ value moved here in previous iteration of loop
+ | ^^ value moved here, in previous iteration of loop
|
= note: move occurs because `tx` has type `std::sync::mpsc::Sender<i32>`, which does not implement the `Copy` trait
diff --git a/src/test/ui/issues/issue-12470.nll.stderr b/src/test/ui/issues/issue-12470.nll.stderr
deleted file mode 100644
index c97e591..0000000
--- a/src/test/ui/issues/issue-12470.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0515]: cannot return value referencing local data `*b`
- --> $DIR/issue-12470.rs:29:5
- |
-LL | let bb: &B = &*b;
- | --- `*b` is borrowed here
-LL | make_a(bb)
- | ^^^^^^^^^^ returns a value referencing data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-12470.rs b/src/test/ui/issues/issue-12470.rs
index acf1b76..77b78c8 100644
--- a/src/test/ui/issues/issue-12470.rs
+++ b/src/test/ui/issues/issue-12470.rs
@@ -25,8 +25,8 @@
fn make_make_a<'a>() -> A<'a> {
let b: Box<B> = box B {i:1};
- let bb: &B = &*b; //~ ERROR does not live long enough
- make_a(bb)
+ let bb: &B = &*b;
+ make_a(bb) //~ ERROR cannot return value referencing local data `*b`
}
fn main() {
diff --git a/src/test/ui/issues/issue-12470.stderr b/src/test/ui/issues/issue-12470.stderr
index fadfb75..c97e591 100644
--- a/src/test/ui/issues/issue-12470.stderr
+++ b/src/test/ui/issues/issue-12470.stderr
@@ -1,18 +1,11 @@
-error[E0597]: `*b` does not live long enough
- --> $DIR/issue-12470.rs:28:19
+error[E0515]: cannot return value referencing local data `*b`
+ --> $DIR/issue-12470.rs:29:5
|
LL | let bb: &B = &*b;
- | ^^ borrowed value does not live long enough
+ | --- `*b` is borrowed here
LL | make_a(bb)
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 26:16...
- --> $DIR/issue-12470.rs:26:16
- |
-LL | fn make_make_a<'a>() -> A<'a> {
- | ^^
+ | ^^^^^^^^^^ returns a value referencing data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-12567.nll.stderr b/src/test/ui/issues/issue-12567.nll.stderr
deleted file mode 100644
index 17388df..0000000
--- a/src/test/ui/issues/issue-12567.nll.stderr
+++ /dev/null
@@ -1,45 +0,0 @@
-error[E0508]: cannot move out of type `[T]`, a non-copy slice
- --> $DIR/issue-12567.rs:4:11
- |
-LL | match (l1, l2) {
- | ^^^^^^^^ cannot move out of here
-LL | (&[], &[]) => println!("both empty"),
-LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
- | -- data moved here
-...
-LL | (&[hd1, ..], &[hd2, ..])
- | --- ...and here
- |
-note: move occurs because these variables have types that don't implement the `Copy` trait
- --> $DIR/issue-12567.rs:6:17
- |
-LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
- | ^^
-...
-LL | (&[hd1, ..], &[hd2, ..])
- | ^^^
-
-error[E0508]: cannot move out of type `[T]`, a non-copy slice
- --> $DIR/issue-12567.rs:4:11
- |
-LL | match (l1, l2) {
- | ^^^^^^^^ cannot move out of here
-LL | (&[], &[]) => println!("both empty"),
-LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
- | -- data moved here
-...
-LL | (&[hd1, ..], &[hd2, ..])
- | --- ...and here
- |
-note: move occurs because these variables have types that don't implement the `Copy` trait
- --> $DIR/issue-12567.rs:6:17
- |
-LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
- | ^^
-...
-LL | (&[hd1, ..], &[hd2, ..])
- | ^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/issues/issue-12567.rs b/src/test/ui/issues/issue-12567.rs
index 1e1debe..643d9a2 100644
--- a/src/test/ui/issues/issue-12567.rs
+++ b/src/test/ui/issues/issue-12567.rs
@@ -2,15 +2,13 @@
fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) {
match (l1, l2) {
+ //~^ ERROR: cannot move out of type `[T]`, a non-copy slice
+ //~| ERROR: cannot move out of type `[T]`, a non-copy slice
(&[], &[]) => println!("both empty"),
(&[], &[hd, ..]) | (&[hd, ..], &[])
=> println!("one empty"),
- //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
- //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
(&[hd1, ..], &[hd2, ..])
=> println!("both nonempty"),
- //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
- //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
}
}
diff --git a/src/test/ui/issues/issue-12567.stderr b/src/test/ui/issues/issue-12567.stderr
index 15f723f..1de29dc 100644
--- a/src/test/ui/issues/issue-12567.stderr
+++ b/src/test/ui/issues/issue-12567.stderr
@@ -1,39 +1,45 @@
error[E0508]: cannot move out of type `[T]`, a non-copy slice
- --> $DIR/issue-12567.rs:6:16
+ --> $DIR/issue-12567.rs:4:11
+ |
+LL | match (l1, l2) {
+ | ^^^^^^^^ cannot move out of here
+...
+LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
+ | -- data moved here
+LL | => println!("one empty"),
+LL | (&[hd1, ..], &[hd2, ..])
+ | --- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/issue-12567.rs:8:17
|
LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
- | ^--^^^^^
- | ||
- | |hint: to prevent move, use `ref hd` or `ref mut hd`
- | cannot move out of here
+ | ^^
+LL | => println!("one empty"),
+LL | (&[hd1, ..], &[hd2, ..])
+ | ^^^
error[E0508]: cannot move out of type `[T]`, a non-copy slice
- --> $DIR/issue-12567.rs:6:30
+ --> $DIR/issue-12567.rs:4:11
+ |
+LL | match (l1, l2) {
+ | ^^^^^^^^ cannot move out of here
+...
+LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
+ | -- data moved here
+LL | => println!("one empty"),
+LL | (&[hd1, ..], &[hd2, ..])
+ | --- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/issue-12567.rs:8:17
|
LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
- | ^--^^^^^
- | ||
- | |hint: to prevent move, use `ref hd` or `ref mut hd`
- | cannot move out of here
-
-error[E0508]: cannot move out of type `[T]`, a non-copy slice
- --> $DIR/issue-12567.rs:10:11
- |
+ | ^^
+LL | => println!("one empty"),
LL | (&[hd1, ..], &[hd2, ..])
- | ^---^^^^^
- | ||
- | |hint: to prevent move, use `ref hd1` or `ref mut hd1`
- | cannot move out of here
+ | ^^^
-error[E0508]: cannot move out of type `[T]`, a non-copy slice
- --> $DIR/issue-12567.rs:10:23
- |
-LL | (&[hd1, ..], &[hd2, ..])
- | ^---^^^^^
- | ||
- | |hint: to prevent move, use `ref hd2` or `ref mut hd2`
- | cannot move out of here
-
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/issues/issue-13497-2.nll.stderr b/src/test/ui/issues/issue-13497-2.nll.stderr
deleted file mode 100644
index 8ad9210..0000000
--- a/src/test/ui/issues/issue-13497-2.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0515]: cannot return value referencing local variable `rawLines`
- --> $DIR/issue-13497-2.rs:3:5
- |
-LL | rawLines
- | ^-------
- | |
- | _____`rawLines` is borrowed here
- | |
-LL | | .iter().map(|l| l.trim()).collect()
- | |___________________________________________^ returns a value referencing data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-13497-2.rs b/src/test/ui/issues/issue-13497-2.rs
index a39ae4f..c82da0f 100644
--- a/src/test/ui/issues/issue-13497-2.rs
+++ b/src/test/ui/issues/issue-13497-2.rs
@@ -1,6 +1,6 @@
fn read_lines_borrowed<'a>() -> Vec<&'a str> {
let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
- rawLines //~ ERROR `rawLines` does not live long enough
+ rawLines //~ ERROR cannot return value referencing local variable `rawLines`
.iter().map(|l| l.trim()).collect()
}
diff --git a/src/test/ui/issues/issue-13497-2.stderr b/src/test/ui/issues/issue-13497-2.stderr
index 5fde55c..8ad9210 100644
--- a/src/test/ui/issues/issue-13497-2.stderr
+++ b/src/test/ui/issues/issue-13497-2.stderr
@@ -1,18 +1,14 @@
-error[E0597]: `rawLines` does not live long enough
+error[E0515]: cannot return value referencing local variable `rawLines`
--> $DIR/issue-13497-2.rs:3:5
|
-LL | rawLines
- | ^^^^^^^^ borrowed value does not live long enough
-LL | .iter().map(|l| l.trim()).collect()
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 1:24...
- --> $DIR/issue-13497-2.rs:1:24
- |
-LL | fn read_lines_borrowed<'a>() -> Vec<&'a str> {
- | ^^
+LL | rawLines
+ | ^-------
+ | |
+ | _____`rawLines` is borrowed here
+ | |
+LL | | .iter().map(|l| l.trim()).collect()
+ | |___________________________________________^ returns a value referencing data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-17263.ast.stderr b/src/test/ui/issues/issue-17263.ast.stderr
deleted file mode 100644
index 09e3307..0000000
--- a/src/test/ui/issues/issue-17263.ast.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0499]: cannot borrow `x` (via `x.b`) as mutable more than once at a time
- --> $DIR/issue-17263.rs:17:34
- |
-LL | let (a, b) = (&mut x.a, &mut x.b);
- | --- ^^^ second mutable borrow occurs here (via `x.b`)
- | |
- | first mutable borrow occurs here (via `x.a`)
-...
-LL | }
- | - first borrow ends here
-
-error[E0502]: cannot borrow `foo` (via `foo.b`) as immutable because `foo` is also borrowed as mutable (via `foo.a`)
- --> $DIR/issue-17263.rs:21:32
- |
-LL | let (c, d) = (&mut foo.a, &foo.b);
- | ----- ^^^^^ immutable borrow of `foo.b` -- which overlaps with `foo.a` -- occurs here
- | |
- | mutable borrow occurs here (via `foo.a`)
-...
-LL | }
- | - mutable borrow ends here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0499, E0502.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/issues/issue-17263.nll.stderr b/src/test/ui/issues/issue-17263.nll.stderr
deleted file mode 100644
index 5604037..0000000
--- a/src/test/ui/issues/issue-17263.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: compilation successful
- --> $DIR/issue-17263.rs:15:1
- |
-LL | / fn main() {
-LL | | let mut x: Box<_> = box Foo { a: 1, b: 2 };
-LL | | let (a, b) = (&mut x.a, &mut x.b);
-LL | |
-... |
-LL | | use_mut(a);
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-17263.rs b/src/test/ui/issues/issue-17263.rs
index 754f3b9..dce3027 100644
--- a/src/test/ui/issues/issue-17263.rs
+++ b/src/test/ui/issues/issue-17263.rs
@@ -1,28 +1,18 @@
-// This checks diagnostic quality for cases where AST-borrowck treated
-// `Box<T>` as other types (see rust-lang/rfcs#130). NLL again treats
-// `Box<T>` specially. We capture the differences via revisions.
+// compile-pass
-// revisions: ast nll
-//[ast]compile-flags: -Z borrowck=ast
-//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-
-// don't worry about the --compare-mode=nll on this test.
-// ignore-compare-mode-nll
-#![feature(box_syntax, rustc_attrs)]
+#![feature(box_syntax)]
struct Foo { a: isize, b: isize }
-#[rustc_error] // rust-lang/rust#49855
-fn main() { //[nll]~ ERROR compilation successful
+
+fn main() {
let mut x: Box<_> = box Foo { a: 1, b: 2 };
let (a, b) = (&mut x.a, &mut x.b);
- //[ast]~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
let mut foo: Box<_> = box Foo { a: 1, b: 2 };
let (c, d) = (&mut foo.a, &foo.b);
- //[ast]~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
- // We explicitly use the references created above to illustrate
- // that NLL is accepting this code *not* because of artificially
+ // We explicitly use the references created above to illustrate that the
+ // borrow checker is accepting this code *not* because of artificially
// short lifetimes, but rather because it understands that all the
// references are of disjoint parts of memory.
use_imm(d);
diff --git a/src/test/ui/issues/issue-17385.nll.stderr b/src/test/ui/issues/issue-17385.nll.stderr
deleted file mode 100644
index 28c2226..0000000
--- a/src/test/ui/issues/issue-17385.nll.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0382]: use of moved value: `foo`
- --> $DIR/issue-17385.rs:19:11
- |
-LL | let foo = X(1);
- | --- move occurs because `foo` has type `X`, which does not implement the `Copy` trait
-LL | drop(foo);
- | --- value moved here
-LL | match foo {
-LL | X(1) => (),
- | ^ value used here after move
-
-error[E0382]: use of moved value: `e`
- --> $DIR/issue-17385.rs:25:11
- |
-LL | let e = Enum::Variant2;
- | - move occurs because `e` has type `Enum`, which does not implement the `Copy` trait
-LL | drop(e);
- | - value moved here
-LL | match e {
- | ^ value used here after move
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/issues/issue-17385.rs b/src/test/ui/issues/issue-17385.rs
index 7400aad..93364d2 100644
--- a/src/test/ui/issues/issue-17385.rs
+++ b/src/test/ui/issues/issue-17385.rs
@@ -15,8 +15,8 @@
fn main() {
let foo = X(1);
drop(foo);
- match foo { //~ ERROR use of moved value
- X(1) => (),
+ match foo {
+ X(1) => (), //~ ERROR use of moved value
_ => unreachable!()
}
diff --git a/src/test/ui/issues/issue-17385.stderr b/src/test/ui/issues/issue-17385.stderr
index ee55d86..28c2226 100644
--- a/src/test/ui/issues/issue-17385.stderr
+++ b/src/test/ui/issues/issue-17385.stderr
@@ -1,22 +1,23 @@
error[E0382]: use of moved value: `foo`
- --> $DIR/issue-17385.rs:18:11
+ --> $DIR/issue-17385.rs:19:11
|
+LL | let foo = X(1);
+ | --- move occurs because `foo` has type `X`, which does not implement the `Copy` trait
LL | drop(foo);
| --- value moved here
LL | match foo {
- | ^^^ value used here after move
- |
- = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait
+LL | X(1) => (),
+ | ^ value used here after move
error[E0382]: use of moved value: `e`
--> $DIR/issue-17385.rs:25:11
|
+LL | let e = Enum::Variant2;
+ | - move occurs because `e` has type `Enum`, which does not implement the `Copy` trait
LL | drop(e);
| - value moved here
LL | match e {
| ^ value used here after move
- |
- = note: move occurs because `e` has type `Enum`, which does not implement the `Copy` trait
error: aborting due to 2 previous errors
diff --git a/src/test/ui/issues/issue-17545.nll.stderr b/src/test/ui/issues/issue-17545.nll.stderr
deleted file mode 100644
index 79a1e09..0000000
--- a/src/test/ui/issues/issue-17545.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/issue-17545.rs:7:10
- |
-LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
- | -- lifetime `'a` defined here
-LL | / bar.call((
-LL | | &id(()),
- | | ^^^^^^ creates a temporary which is freed while still in use
-LL | | ));
- | | -- temporary value is freed at the end of this statement
- | |______|
- | argument requires that borrow lasts for `'a`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-17545.rs b/src/test/ui/issues/issue-17545.rs
index d62c0b9..ced6fff 100644
--- a/src/test/ui/issues/issue-17545.rs
+++ b/src/test/ui/issues/issue-17545.rs
@@ -4,7 +4,7 @@
pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
bar.call((
- &id(()), //~ ERROR borrowed value does not live long enough
+ &id(()), //~ ERROR temporary value dropped while borrowed
));
}
fn main() {}
diff --git a/src/test/ui/issues/issue-17545.stderr b/src/test/ui/issues/issue-17545.stderr
index c4acaf2..79a1e09 100644
--- a/src/test/ui/issues/issue-17545.stderr
+++ b/src/test/ui/issues/issue-17545.stderr
@@ -1,18 +1,16 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/issue-17545.rs:7:10
|
-LL | &id(()),
- | ^^^^^^ temporary value does not live long enough
-LL | ));
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 5:12...
- --> $DIR/issue-17545.rs:5:12
- |
-LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
- | ^^
- = note: consider using a `let` binding to increase its lifetime
+LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
+ | -- lifetime `'a` defined here
+LL | / bar.call((
+LL | | &id(()),
+ | | ^^^^^^ creates a temporary which is freed while still in use
+LL | | ));
+ | | -- temporary value is freed at the end of this statement
+ | |______|
+ | argument requires that borrow lasts for `'a`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr b/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr
deleted file mode 100644
index 8f3acae..0000000
--- a/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return reference to temporary value
- --> $DIR/issue-17718-constants-not-static.rs:5:30
- |
-LL | fn foo() -> &'static usize { &id(FOO) }
- | ^-------
- | ||
- | |temporary value created here
- | returns a reference to data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-17718-constants-not-static.rs b/src/test/ui/issues/issue-17718-constants-not-static.rs
index e857b90..2e6aff1 100644
--- a/src/test/ui/issues/issue-17718-constants-not-static.rs
+++ b/src/test/ui/issues/issue-17718-constants-not-static.rs
@@ -3,7 +3,7 @@
const FOO: usize = 3;
fn foo() -> &'static usize { &id(FOO) }
-//~^ ERROR: borrowed value does not live long enough
+//~^ ERROR: cannot return reference to temporary value
fn main() {
}
diff --git a/src/test/ui/issues/issue-17718-constants-not-static.stderr b/src/test/ui/issues/issue-17718-constants-not-static.stderr
index 2a5b9d7..8f3acae 100644
--- a/src/test/ui/issues/issue-17718-constants-not-static.stderr
+++ b/src/test/ui/issues/issue-17718-constants-not-static.stderr
@@ -1,13 +1,12 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-17718-constants-not-static.rs:5:31
+error[E0515]: cannot return reference to temporary value
+ --> $DIR/issue-17718-constants-not-static.rs:5:30
|
LL | fn foo() -> &'static usize { &id(FOO) }
- | ^^^^^^^ - temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ^-------
+ | ||
+ | |temporary value created here
+ | returns a reference to data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-17718-static-move.nll.stderr b/src/test/ui/issues/issue-17718-static-move.nll.stderr
deleted file mode 100644
index c3e6267..0000000
--- a/src/test/ui/issues/issue-17718-static-move.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of static item
- --> $DIR/issue-17718-static-move.rs:6:14
- |
-LL | let _a = FOO;
- | ^^^
- | |
- | cannot move out of static item
- | help: consider borrowing here: `&FOO`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issues/issue-17718-static-move.stderr b/src/test/ui/issues/issue-17718-static-move.stderr
index 064a991..c3e6267 100644
--- a/src/test/ui/issues/issue-17718-static-move.stderr
+++ b/src/test/ui/issues/issue-17718-static-move.stderr
@@ -5,7 +5,7 @@
| ^^^
| |
| cannot move out of static item
- | help: consider using a reference instead: `&FOO`
+ | help: consider borrowing here: `&FOO`
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-17954.nll.stderr b/src/test/ui/issues/issue-17954.nll.stderr
deleted file mode 100644
index e08375f..0000000
--- a/src/test/ui/issues/issue-17954.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0712]: thread-local variable borrowed past end of function
- --> $DIR/issue-17954.rs:7:13
- |
-LL | let a = &FOO;
- | ^^^^ thread-local variables cannot be borrowed beyond the end of the function
-...
-LL | }
- | - end of enclosing function is here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/issues/issue-17954.rs b/src/test/ui/issues/issue-17954.rs
index a8fbf237..eb6a3d7 100644
--- a/src/test/ui/issues/issue-17954.rs
+++ b/src/test/ui/issues/issue-17954.rs
@@ -5,12 +5,11 @@
fn main() {
let a = &FOO;
- //~^ ERROR borrowed value does not live long enough
- //~| does not live long enough
- //~| NOTE borrowed value must be valid for the static lifetime
+ //~^ ERROR thread-local variable borrowed past end of function
+ //~| NOTE thread-local variables cannot be borrowed beyond the end of the function
std::thread::spawn(move || {
println!("{}", a);
});
}
-//~^ NOTE borrowed value only lives until here
+//~^ NOTE end of enclosing function is here
diff --git a/src/test/ui/issues/issue-17954.stderr b/src/test/ui/issues/issue-17954.stderr
index 458bef5..e08375f 100644
--- a/src/test/ui/issues/issue-17954.stderr
+++ b/src/test/ui/issues/issue-17954.stderr
@@ -1,14 +1,12 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-17954.rs:7:14
+error[E0712]: thread-local variable borrowed past end of function
+ --> $DIR/issue-17954.rs:7:13
|
LL | let a = &FOO;
- | ^^^ borrowed value does not live long enough
+ | ^^^^ thread-local variables cannot be borrowed beyond the end of the function
...
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - end of enclosing function is here
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/issues/issue-18118.nll.stderr b/src/test/ui/issues/issue-18118.nll.stderr
deleted file mode 100644
index 49798a1..0000000
--- a/src/test/ui/issues/issue-18118.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `p` does not live long enough
- --> $DIR/issue-18118.rs:4:9
- |
-LL | &p
- | ^^
- | |
- | borrowed value does not live long enough
- | using this value as a constant requires that `p` is borrowed for `'static`
-LL | };
- | - `p` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issues/issue-18118.stderr b/src/test/ui/issues/issue-18118.stderr
index 07fa1f6..49798a1 100644
--- a/src/test/ui/issues/issue-18118.stderr
+++ b/src/test/ui/issues/issue-18118.stderr
@@ -1,12 +1,13 @@
error[E0597]: `p` does not live long enough
- --> $DIR/issue-18118.rs:4:10
+ --> $DIR/issue-18118.rs:4:9
|
LL | &p
- | ^ borrowed value does not live long enough
+ | ^^
+ | |
+ | borrowed value does not live long enough
+ | using this value as a constant requires that `p` is borrowed for `'static`
LL | };
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `p` dropped here while still borrowed
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-18566.nll.stderr b/src/test/ui/issues/issue-18566.nll.stderr
deleted file mode 100644
index 8db7893..0000000
--- a/src/test/ui/issues/issue-18566.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0499]: cannot borrow `*s` as mutable more than once at a time
- --> $DIR/issue-18566.rs:23:19
- |
-LL | MyPtr(s).poke(s);
- | - ---- ^ second mutable borrow occurs here
- | | |
- | | first borrow later used by call
- | first mutable borrow occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/issues/issue-18566.stderr b/src/test/ui/issues/issue-18566.stderr
index 90c3af4..8db7893 100644
--- a/src/test/ui/issues/issue-18566.stderr
+++ b/src/test/ui/issues/issue-18566.stderr
@@ -2,9 +2,9 @@
--> $DIR/issue-18566.rs:23:19
|
LL | MyPtr(s).poke(s);
- | - ^- first borrow ends here
- | | |
- | | second mutable borrow occurs here
+ | - ---- ^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
| first mutable borrow occurs here
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-18783.nll.stderr b/src/test/ui/issues/issue-18783.nll.stderr
deleted file mode 100644
index 047b425..0000000
--- a/src/test/ui/issues/issue-18783.nll.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0499]: cannot borrow `y` as mutable more than once at a time
- --> $DIR/issue-18783.rs:7:21
- |
-LL | c.push(Box::new(|| y = 0));
- | -- - first borrow occurs due to use of `y` in closure
- | |
- | first mutable borrow occurs here
-LL | c.push(Box::new(|| y = 0));
- | ^^ - second borrow occurs due to use of `y` in closure
- | |
- | second mutable borrow occurs here
-LL |
-LL | }
- | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell<std::vec::Vec<std::boxed::Box<dyn std::ops::FnMut()>>>`
-
-error[E0499]: cannot borrow `y` as mutable more than once at a time
- --> $DIR/issue-18783.rs:16:29
- |
-LL | Push::push(&c, Box::new(|| y = 0));
- | -- - first borrow occurs due to use of `y` in closure
- | |
- | first mutable borrow occurs here
-LL | Push::push(&c, Box::new(|| y = 0));
- | ^^ - second borrow occurs due to use of `y` in closure
- | |
- | second mutable borrow occurs here
-LL |
-LL | }
- | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell<std::vec::Vec<std::boxed::Box<dyn std::ops::FnMut()>>>`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/issues/issue-18783.stderr b/src/test/ui/issues/issue-18783.stderr
index f88c425..047b425 100644
--- a/src/test/ui/issues/issue-18783.stderr
+++ b/src/test/ui/issues/issue-18783.stderr
@@ -2,31 +2,31 @@
--> $DIR/issue-18783.rs:7:21
|
LL | c.push(Box::new(|| y = 0));
- | -- - previous borrow occurs due to use of `y` in closure
+ | -- - first borrow occurs due to use of `y` in closure
| |
| first mutable borrow occurs here
LL | c.push(Box::new(|| y = 0));
- | ^^ - borrow occurs due to use of `y` in closure
+ | ^^ - second borrow occurs due to use of `y` in closure
| |
| second mutable borrow occurs here
LL |
LL | }
- | - first borrow ends here
+ | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell<std::vec::Vec<std::boxed::Box<dyn std::ops::FnMut()>>>`
error[E0499]: cannot borrow `y` as mutable more than once at a time
--> $DIR/issue-18783.rs:16:29
|
LL | Push::push(&c, Box::new(|| y = 0));
- | -- - previous borrow occurs due to use of `y` in closure
+ | -- - first borrow occurs due to use of `y` in closure
| |
| first mutable borrow occurs here
LL | Push::push(&c, Box::new(|| y = 0));
- | ^^ - borrow occurs due to use of `y` in closure
+ | ^^ - second borrow occurs due to use of `y` in closure
| |
| second mutable borrow occurs here
LL |
LL | }
- | - first borrow ends here
+ | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell<std::vec::Vec<std::boxed::Box<dyn std::ops::FnMut()>>>`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/issues/issue-19163.nll.stderr b/src/test/ui/issues/issue-19163.nll.stderr
deleted file mode 100644
index af509aa..0000000
--- a/src/test/ui/issues/issue-19163.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/issue-19163.rs:9:14
- |
-LL | mywrite!(&v, "Hello world");
- | ^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issues/issue-19163.rs b/src/test/ui/issues/issue-19163.rs
index 20d3244..d98c591 100644
--- a/src/test/ui/issues/issue-19163.rs
+++ b/src/test/ui/issues/issue-19163.rs
@@ -7,5 +7,5 @@
fn main() {
let mut v = vec![];
mywrite!(&v, "Hello world");
- //~^ error: cannot borrow immutable borrowed content as mutable
+ //~^ ERROR cannot borrow data in a `&` reference as mutable
}
diff --git a/src/test/ui/issues/issue-19163.stderr b/src/test/ui/issues/issue-19163.stderr
index 242ceaed..af509aa 100644
--- a/src/test/ui/issues/issue-19163.stderr
+++ b/src/test/ui/issues/issue-19163.stderr
@@ -1,4 +1,4 @@
-error[E0596]: cannot borrow immutable borrowed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/issue-19163.rs:9:14
|
LL | mywrite!(&v, "Hello world");
diff --git a/src/test/ui/issues/issue-20801.nll.stderr b/src/test/ui/issues/issue-20801.nll.stderr
deleted file mode 100644
index adcbe55..0000000
--- a/src/test/ui/issues/issue-20801.nll.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-20801.rs:26:22
- |
-LL | let a = unsafe { *mut_ref() };
- | ^^^^^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `mut_ref()`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-20801.rs:29:22
- |
-LL | let b = unsafe { *imm_ref() };
- | ^^^^^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `imm_ref()`
-
-error[E0507]: cannot move out of dereference of raw pointer
- --> $DIR/issue-20801.rs:32:22
- |
-LL | let c = unsafe { *mut_ptr() };
- | ^^^^^^^^^^
- | |
- | cannot move out of dereference of raw pointer
- | help: consider removing the `*`: `mut_ptr()`
-
-error[E0507]: cannot move out of dereference of raw pointer
- --> $DIR/issue-20801.rs:35:22
- |
-LL | let d = unsafe { *const_ptr() };
- | ^^^^^^^^^^^^
- | |
- | cannot move out of dereference of raw pointer
- | help: consider removing the `*`: `const_ptr()`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issues/issue-20801.stderr b/src/test/ui/issues/issue-20801.stderr
index 3e27391..adcbe55 100644
--- a/src/test/ui/issues/issue-20801.stderr
+++ b/src/test/ui/issues/issue-20801.stderr
@@ -2,25 +2,37 @@
--> $DIR/issue-20801.rs:26:22
|
LL | let a = unsafe { *mut_ref() };
- | ^^^^^^^^^^ cannot move out of borrowed content
+ | ^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `mut_ref()`
error[E0507]: cannot move out of borrowed content
--> $DIR/issue-20801.rs:29:22
|
LL | let b = unsafe { *imm_ref() };
- | ^^^^^^^^^^ cannot move out of borrowed content
+ | ^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `imm_ref()`
error[E0507]: cannot move out of dereference of raw pointer
--> $DIR/issue-20801.rs:32:22
|
LL | let c = unsafe { *mut_ptr() };
- | ^^^^^^^^^^ cannot move out of dereference of raw pointer
+ | ^^^^^^^^^^
+ | |
+ | cannot move out of dereference of raw pointer
+ | help: consider removing the `*`: `mut_ptr()`
error[E0507]: cannot move out of dereference of raw pointer
--> $DIR/issue-20801.rs:35:22
|
LL | let d = unsafe { *const_ptr() };
- | ^^^^^^^^^^^^ cannot move out of dereference of raw pointer
+ | ^^^^^^^^^^^^
+ | |
+ | cannot move out of dereference of raw pointer
+ | help: consider removing the `*`: `const_ptr()`
error: aborting due to 4 previous errors
diff --git a/src/test/ui/issues/issue-21600.nll.stderr b/src/test/ui/issues/issue-21600.nll.stderr
deleted file mode 100644
index 21f3774..0000000
--- a/src/test/ui/issues/issue-21600.nll.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
- --> $DIR/issue-21600.rs:14:20
- |
-LL | call_it(|| x.gen_mut());
- | ^ cannot borrow as mutable
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/issue-21600.rs:14:17
- |
-LL | call_it(|| x.gen_mut());
- | ^^^^^^^^^^^^^^
-
-error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
- --> $DIR/issue-21600.rs:14:17
- |
-LL | call_it(|| x.gen_mut());
- | ^^ - mutable borrow occurs due to use of `x` in closure
- | |
- | cannot borrow as mutable
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/issue-21600.rs:12:13
- |
-LL | call_it(|| {
- | _____________^
-LL | | call_it(|| x.gen());
-LL | | call_it(|| x.gen_mut());
-LL | |
-LL | | });
- | |_____^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issues/issue-21600.rs b/src/test/ui/issues/issue-21600.rs
index 1efc873..2e22e5e 100644
--- a/src/test/ui/issues/issue-21600.rs
+++ b/src/test/ui/issues/issue-21600.rs
@@ -11,7 +11,8 @@
let mut x = A;
call_it(|| {
call_it(|| x.gen());
- call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer
- //~^ ERROR cannot borrow data mutably in a captured outer
+ call_it(|| x.gen_mut());
+ //~^ ERROR cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
+ //~| ERROR cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
});
}
diff --git a/src/test/ui/issues/issue-21600.stderr b/src/test/ui/issues/issue-21600.stderr
index a20838c..9c53480 100644
--- a/src/test/ui/issues/issue-21600.stderr
+++ b/src/test/ui/issues/issue-21600.stderr
@@ -1,8 +1,22 @@
-error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
+error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
+ --> $DIR/issue-21600.rs:14:20
+ |
+LL | call_it(|| x.gen_mut());
+ | ^ cannot borrow as mutable
+ |
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/issue-21600.rs:14:17
|
LL | call_it(|| x.gen_mut());
- | ^^
+ | ^^^^^^^^^^^^^^
+
+error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
+ --> $DIR/issue-21600.rs:14:17
+ |
+LL | call_it(|| x.gen_mut());
+ | ^^ - mutable borrow occurs due to use of `x` in closure
+ | |
+ | cannot borrow as mutable
|
help: consider changing this to accept closures that implement `FnMut`
--> $DIR/issue-21600.rs:12:13
@@ -12,21 +26,10 @@
LL | | call_it(|| x.gen());
LL | | call_it(|| x.gen_mut());
LL | |
+LL | |
LL | | });
| |_____^
-error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
- --> $DIR/issue-21600.rs:14:20
- |
-LL | call_it(|| x.gen_mut());
- | ^
- |
-help: consider changing this closure to take self by mutable reference
- --> $DIR/issue-21600.rs:14:17
- |
-LL | call_it(|| x.gen_mut());
- | ^^^^^^^^^^^^^^
-
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0387`.
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr
deleted file mode 100644
index 3b4f276..0000000
--- a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/issue-24267-flow-exit.rs:12:20
- |
-LL | println!("{}", x);
- | ^ use of possibly uninitialized `x`
-
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/issue-24267-flow-exit.rs:18:20
- |
-LL | println!("{}", x);
- | ^ use of possibly uninitialized `x`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/issues/issue-24267-flow-exit.rs b/src/test/ui/issues/issue-24267-flow-exit.rs
index ce3a799..a1b4d75 100644
--- a/src/test/ui/issues/issue-24267-flow-exit.rs
+++ b/src/test/ui/issues/issue-24267-flow-exit.rs
@@ -9,11 +9,11 @@
pub fn foo1() {
let x: i32;
loop { x = break; }
- println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ println!("{}", x); //~ ERROR borrow of possibly uninitialized variable: `x`
}
pub fn foo2() {
let x: i32;
for _ in 0..10 { x = continue; }
- println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ println!("{}", x); //~ ERROR borrow of possibly uninitialized variable: `x`
}
diff --git a/src/test/ui/issues/issue-24267-flow-exit.stderr b/src/test/ui/issues/issue-24267-flow-exit.stderr
index 2b9e2ee..3b4f276 100644
--- a/src/test/ui/issues/issue-24267-flow-exit.stderr
+++ b/src/test/ui/issues/issue-24267-flow-exit.stderr
@@ -1,10 +1,10 @@
-error[E0381]: use of possibly uninitialized variable: `x`
+error[E0381]: borrow of possibly uninitialized variable: `x`
--> $DIR/issue-24267-flow-exit.rs:12:20
|
LL | println!("{}", x);
| ^ use of possibly uninitialized `x`
-error[E0381]: use of possibly uninitialized variable: `x`
+error[E0381]: borrow of possibly uninitialized variable: `x`
--> $DIR/issue-24267-flow-exit.rs:18:20
|
LL | println!("{}", x);
diff --git a/src/test/ui/issues/issue-24357.nll.stderr b/src/test/ui/issues/issue-24357.nll.stderr
deleted file mode 100644
index a9c43a8..0000000
--- a/src/test/ui/issues/issue-24357.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/issue-24357.rs:6:12
- |
-LL | let x = NoCopy;
- | - move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait
-LL | let f = move || { let y = x; };
- | ------- - variable moved due to use in closure
- | |
- | value moved into closure here
-LL |
-LL | let z = x;
- | ^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/issues/issue-24357.rs b/src/test/ui/issues/issue-24357.rs
index 84f263f..152e69e 100644
--- a/src/test/ui/issues/issue-24357.rs
+++ b/src/test/ui/issues/issue-24357.rs
@@ -1,10 +1,11 @@
struct NoCopy;
fn main() {
let x = NoCopy;
+ //~^ NOTE move occurs because `x` has type `NoCopy`
let f = move || { let y = x; };
- //~^ NOTE value moved (into closure) here
+ //~^ NOTE value moved into closure here
+ //~| NOTE variable moved due to use in closure
let z = x;
//~^ ERROR use of moved value: `x`
//~| NOTE value used here after move
- //~| NOTE move occurs because `x` has type `NoCopy`
}
diff --git a/src/test/ui/issues/issue-24357.stderr b/src/test/ui/issues/issue-24357.stderr
index ced24ff..b9e15f5 100644
--- a/src/test/ui/issues/issue-24357.stderr
+++ b/src/test/ui/issues/issue-24357.stderr
@@ -1,13 +1,16 @@
error[E0382]: use of moved value: `x`
- --> $DIR/issue-24357.rs:6:8
+ --> $DIR/issue-24357.rs:8:12
|
-LL | let f = move || { let y = x; };
- | ------- value moved (into closure) here
+LL | let x = NoCopy;
+ | - move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait
LL |
+LL | let f = move || { let y = x; };
+ | ------- - variable moved due to use in closure
+ | |
+ | value moved into closure here
+...
LL | let z = x;
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait
+ | ^ value used here after move
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-25579.ast.nll.stderr b/src/test/ui/issues/issue-25579.ast.nll.stderr
deleted file mode 100644
index 107f88b..0000000
--- a/src/test/ui/issues/issue-25579.ast.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error: compilation successful
- --> $DIR/issue-25579.rs:21:1
- |
-LL | / fn main() {
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-25579.ast.stderr b/src/test/ui/issues/issue-25579.ast.stderr
deleted file mode 100644
index 31e74d1..0000000
--- a/src/test/ui/issues/issue-25579.ast.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0499]: cannot borrow `l.0` as mutable more than once at a time
- --> $DIR/issue-25579.rs:14:32
- |
-LL | &mut Sexpression::Cons(ref mut expr) => {
- | ^^^^^^^^^^^^ mutable borrow starts here in previous iteration of loop
-...
-LL | }
- | - mutable borrow ends here
-
-error[E0506]: cannot assign to `l` because it is borrowed
- --> $DIR/issue-25579.rs:15:13
- |
-LL | &mut Sexpression::Cons(ref mut expr) => {
- | ------------ borrow of `l` occurs here
-LL | l = &mut **expr;
- | ^^^^^^^^^^^^^^^ assignment to borrowed `l` occurs here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0499, E0506.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/issues/issue-25579.mir.stderr b/src/test/ui/issues/issue-25579.mir.stderr
deleted file mode 100644
index 107f88b..0000000
--- a/src/test/ui/issues/issue-25579.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error: compilation successful
- --> $DIR/issue-25579.rs:21:1
- |
-LL | / fn main() {
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-25579.rs b/src/test/ui/issues/issue-25579.rs
index 1813253..31ba102 100644
--- a/src/test/ui/issues/issue-25579.rs
+++ b/src/test/ui/issues/issue-25579.rs
@@ -1,7 +1,4 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
-#![feature(rustc_attrs)]
+// compile-pass
enum Sexpression {
Num(()),
@@ -11,12 +8,13 @@
fn causes_error_in_ast(mut l: &mut Sexpression) {
loop { match l {
&mut Sexpression::Num(ref mut n) => {},
- &mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499]
- l = &mut **expr; //[ast]~ ERROR [E0506]
+ &mut Sexpression::Cons(ref mut expr) => {
+ l = &mut **expr;
}
}}
}
-#[rustc_error]
-fn main() { //[mir]~ ERROR compilation successful
+
+fn main() {
+ causes_error_in_ast(&mut Sexpression::Num(()));
}
diff --git a/src/test/ui/issues/issue-25700.nll.stderr b/src/test/ui/issues/issue-25700.nll.stderr
deleted file mode 100644
index fa309a5..0000000
--- a/src/test/ui/issues/issue-25700.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: use of moved value: `t`
- --> $DIR/issue-25700.rs:13:10
- |
-LL | let t = S::<()>(None);
- | - move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait
-LL | drop(t);
- | - value moved here
-LL | drop(t);
- | ^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/issues/issue-25700.stderr b/src/test/ui/issues/issue-25700.stderr
index 4a203c7..fa309a5 100644
--- a/src/test/ui/issues/issue-25700.stderr
+++ b/src/test/ui/issues/issue-25700.stderr
@@ -1,12 +1,12 @@
error[E0382]: use of moved value: `t`
--> $DIR/issue-25700.rs:13:10
|
+LL | let t = S::<()>(None);
+ | - move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait
LL | drop(t);
| - value moved here
LL | drop(t);
| ^ value used here after move
- |
- = note: move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-25793.nll.stderr b/src/test/ui/issues/issue-25793.nll.stderr
deleted file mode 100644
index daea9cd..0000000
--- a/src/test/ui/issues/issue-25793.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0503]: cannot use `self.width` because it was mutably borrowed
- --> $DIR/issue-25793.rs:4:9
- |
-LL | $this.width.unwrap()
- | ^^^^^^^^^^^ use of borrowed `*self`
-...
-LL | let r = &mut *self;
- | ---------- borrow of `*self` occurs here
-LL | r.get_size(width!(self))
- | -------- ------------ in this macro invocation
- | |
- | borrow later used by call
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/issues/issue-25793.stderr b/src/test/ui/issues/issue-25793.stderr
index e8d208c..daea9cd 100644
--- a/src/test/ui/issues/issue-25793.stderr
+++ b/src/test/ui/issues/issue-25793.stderr
@@ -5,9 +5,11 @@
| ^^^^^^^^^^^ use of borrowed `*self`
...
LL | let r = &mut *self;
- | ----- borrow of `*self` occurs here
+ | ---------- borrow of `*self` occurs here
LL | r.get_size(width!(self))
- | ------------ in this macro invocation
+ | -------- ------------ in this macro invocation
+ | |
+ | borrow later used by call
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-2590.nll.stderr b/src/test/ui/issues/issue-2590.nll.stderr
deleted file mode 100644
index e19e83d..0000000
--- a/src/test/ui/issues/issue-2590.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-2590.rs:11:9
- |
-LL | self.tokens
- | ^^^^^^^^^^^ cannot move out of borrowed content
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issues/issue-2590.stderr b/src/test/ui/issues/issue-2590.stderr
index c50652d..e19e83d 100644
--- a/src/test/ui/issues/issue-2590.stderr
+++ b/src/test/ui/issues/issue-2590.stderr
@@ -2,7 +2,7 @@
--> $DIR/issue-2590.rs:11:9
|
LL | self.tokens
- | ^^^^ cannot move out of borrowed content
+ | ^^^^^^^^^^^ cannot move out of borrowed content
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-26619.nll.stderr b/src/test/ui/issues/issue-26619.nll.stderr
deleted file mode 100644
index d1157cd..0000000
--- a/src/test/ui/issues/issue-26619.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0515]: cannot return value referencing function parameter
- --> $DIR/issue-26619.rs:7:76
- |
-LL | for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) {
- | -------- ^^^^^^^^^^^^^^^^^^^^^ returns a value referencing data owned by the current function
- | |
- | function parameter borrowed here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-26619.rs b/src/test/ui/issues/issue-26619.rs
index cd89c67..00e09f3 100644
--- a/src/test/ui/issues/issue-26619.rs
+++ b/src/test/ui/issues/issue-26619.rs
@@ -5,7 +5,7 @@
impl<'a> History<'a> {
pub fn get_page(&self) {
for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) {
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR cannot return value referencing function parameter
println!("{:?}", s);
}
}
diff --git a/src/test/ui/issues/issue-26619.stderr b/src/test/ui/issues/issue-26619.stderr
index 3ac6c4e..d1157cd 100644
--- a/src/test/ui/issues/issue-26619.stderr
+++ b/src/test/ui/issues/issue-26619.stderr
@@ -1,12 +1,11 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-26619.rs:7:66
+error[E0515]: cannot return value referencing function parameter
+ --> $DIR/issue-26619.rs:7:76
|
LL | for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) {
- | ^^^^^^^^ -- temporary value needs to live until here
- | | |
- | | temporary value dropped here while still borrowed
- | temporary value does not live long enough
+ | -------- ^^^^^^^^^^^^^^^^^^^^^ returns a value referencing data owned by the current function
+ | |
+ | function parameter borrowed here
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-27592.nll.stderr b/src/test/ui/issues/issue-27592.nll.stderr
deleted file mode 100644
index 9d3eaa9..0000000
--- a/src/test/ui/issues/issue-27592.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/issue-27592.rs:16:14
- |
-LL | write(|| format_args!("{}", String::from("Hello world")));
- | ^^^^^^^^^^^^^^^^^^^---------------------------^
- | | |
- | | temporary value created here
- | returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/issue-27592.rs:16:14
- |
-LL | write(|| format_args!("{}", String::from("Hello world")));
- | ^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | temporary value created here
- | returns a value referencing data owned by the current function
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-27592.rs b/src/test/ui/issues/issue-27592.rs
index 6006f9a..b023ea1 100644
--- a/src/test/ui/issues/issue-27592.rs
+++ b/src/test/ui/issues/issue-27592.rs
@@ -14,6 +14,6 @@
fn main() {
write(|| format_args!("{}", String::from("Hello world")));
- //~^ ERROR borrowed value does not live long enough
- //~| ERROR borrowed value does not live long enough
+ //~^ ERROR cannot return value referencing temporary value
+ //~| ERROR cannot return value referencing temporary value
}
diff --git a/src/test/ui/issues/issue-27592.stderr b/src/test/ui/issues/issue-27592.stderr
index 0f62abe..9d3eaa9 100644
--- a/src/test/ui/issues/issue-27592.stderr
+++ b/src/test/ui/issues/issue-27592.stderr
@@ -1,21 +1,21 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-27592.rs:16:27
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/issue-27592.rs:16:14
|
LL | write(|| format_args!("{}", String::from("Hello world")));
- | ^^^^ -- temporary value needs to live until here
- | | |
- | | temporary value dropped here while still borrowed
- | temporary value does not live long enough
+ | ^^^^^^^^^^^^^^^^^^^---------------------------^
+ | | |
+ | | temporary value created here
+ | returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-27592.rs:16:33
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/issue-27592.rs:16:14
|
LL | write(|| format_args!("{}", String::from("Hello world")));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^-- temporary value needs to live until here
- | | |
- | | temporary value dropped here while still borrowed
- | temporary value does not live long enough
+ | ^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | temporary value created here
+ | returns a value referencing data owned by the current function
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-30438-a.nll.stderr b/src/test/ui/issues/issue-30438-a.nll.stderr
deleted file mode 100644
index 53845af..0000000
--- a/src/test/ui/issues/issue-30438-a.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return reference to temporary value
- --> $DIR/issue-30438-a.rs:12:16
- |
-LL | return &Test { s: &self.s};
- | ^------------------
- | ||
- | |temporary value created here
- | returns a reference to data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-30438-a.rs b/src/test/ui/issues/issue-30438-a.rs
index 8900821..0d4eb79 100644
--- a/src/test/ui/issues/issue-30438-a.rs
+++ b/src/test/ui/issues/issue-30438-a.rs
@@ -10,7 +10,7 @@
type Output = Test<'a>;
fn index(&self, _: usize) -> &Self::Output {
return &Test { s: &self.s};
- //~^ ERROR: borrowed value does not live long enough
+ //~^ ERROR: cannot return reference to temporary value
}
}
diff --git a/src/test/ui/issues/issue-30438-a.stderr b/src/test/ui/issues/issue-30438-a.stderr
index 89f8e62..53845af 100644
--- a/src/test/ui/issues/issue-30438-a.stderr
+++ b/src/test/ui/issues/issue-30438-a.stderr
@@ -1,21 +1,12 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-30438-a.rs:12:17
+error[E0515]: cannot return reference to temporary value
+ --> $DIR/issue-30438-a.rs:12:16
|
LL | return &Test { s: &self.s};
- | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
-note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 11:5...
- --> $DIR/issue-30438-a.rs:11:5
- |
-LL | / fn index(&self, _: usize) -> &Self::Output {
-LL | | return &Test { s: &self.s};
-LL | |
-LL | | }
- | |_____^
- = note: consider using a `let` binding to increase its lifetime
+ | ^------------------
+ | ||
+ | |temporary value created here
+ | returns a reference to data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-30438-b.nll.stderr b/src/test/ui/issues/issue-30438-b.nll.stderr
deleted file mode 100644
index fd6bd25..0000000
--- a/src/test/ui/issues/issue-30438-b.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return reference to temporary value
- --> $DIR/issue-30438-b.rs:13:9
- |
-LL | &Test { s: &self.s}
- | ^------------------
- | ||
- | |temporary value created here
- | returns a reference to data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-30438-b.rs b/src/test/ui/issues/issue-30438-b.rs
index b84211b..79510cd 100644
--- a/src/test/ui/issues/issue-30438-b.rs
+++ b/src/test/ui/issues/issue-30438-b.rs
@@ -11,7 +11,7 @@
type Output = Test<'a>;
fn index(&self, _: usize) -> &Self::Output {
&Test { s: &self.s}
- //~^ ERROR: borrowed value does not live long enough
+ //~^ ERROR: cannot return reference to temporary value
}
}
diff --git a/src/test/ui/issues/issue-30438-b.stderr b/src/test/ui/issues/issue-30438-b.stderr
index 49208ed..fd6bd25 100644
--- a/src/test/ui/issues/issue-30438-b.stderr
+++ b/src/test/ui/issues/issue-30438-b.stderr
@@ -1,21 +1,12 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-30438-b.rs:13:10
+error[E0515]: cannot return reference to temporary value
+ --> $DIR/issue-30438-b.rs:13:9
|
LL | &Test { s: &self.s}
- | ^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-LL |
-LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 12:5...
- --> $DIR/issue-30438-b.rs:12:5
- |
-LL | / fn index(&self, _: usize) -> &Self::Output {
-LL | | &Test { s: &self.s}
-LL | |
-LL | | }
- | |_____^
+ | ^------------------
+ | ||
+ | |temporary value created here
+ | returns a reference to data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-30438-c.nll.stderr b/src/test/ui/issues/issue-30438-c.nll.stderr
deleted file mode 100644
index 7c00108..0000000
--- a/src/test/ui/issues/issue-30438-c.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0515]: cannot return reference to local variable `x`
- --> $DIR/issue-30438-c.rs:9:5
- |
-LL | &x
- | ^^ returns a reference to data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-30438-c.rs b/src/test/ui/issues/issue-30438-c.rs
index 75caf0a..813c1d3 100644
--- a/src/test/ui/issues/issue-30438-c.rs
+++ b/src/test/ui/issues/issue-30438-c.rs
@@ -7,7 +7,7 @@
fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static {
let x = Test { s: "this cannot last" };
&x
- //~^ ERROR: `x` does not live long enough
+ //~^ ERROR: cannot return reference to local variable `x`
}
impl<'b> Trait for Test<'b> { type Out = Test<'b>; }
diff --git a/src/test/ui/issues/issue-30438-c.stderr b/src/test/ui/issues/issue-30438-c.stderr
index a003e27..7c00108 100644
--- a/src/test/ui/issues/issue-30438-c.stderr
+++ b/src/test/ui/issues/issue-30438-c.stderr
@@ -1,18 +1,9 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/issue-30438-c.rs:9:6
+error[E0515]: cannot return reference to local variable `x`
+ --> $DIR/issue-30438-c.rs:9:5
|
LL | &x
- | ^ borrowed value does not live long enough
-LL |
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'y as defined on the function body at 7:10...
- --> $DIR/issue-30438-c.rs:7:10
- |
-LL | fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static {
- | ^^
+ | ^^ returns a reference to data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/issues/issue-33819.nll.stderr b/src/test/ui/issues/issue-33819.nll.stderr
deleted file mode 100644
index 8bc2d82..0000000
--- a/src/test/ui/issues/issue-33819.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
- --> $DIR/issue-33819.rs:4:34
- |
-LL | Some(ref v) => { let a = &mut v; },
- | ^^^^^^
- | |
- | cannot borrow as mutable
- | try removing `&mut` here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issues/issue-33819.rs b/src/test/ui/issues/issue-33819.rs
index 7f25ebd1..b73e859 100644
--- a/src/test/ui/issues/issue-33819.rs
+++ b/src/test/ui/issues/issue-33819.rs
@@ -2,8 +2,7 @@
let mut op = Some(2);
match op {
Some(ref v) => { let a = &mut v; },
- //~^ ERROR:cannot borrow immutable
- //~| cannot borrow mutably
+ //~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
None => {},
}
}
diff --git a/src/test/ui/issues/issue-33819.stderr b/src/test/ui/issues/issue-33819.stderr
index 09b8835..8bc2d82 100644
--- a/src/test/ui/issues/issue-33819.stderr
+++ b/src/test/ui/issues/issue-33819.stderr
@@ -1,8 +1,11 @@
-error[E0596]: cannot borrow immutable local variable `v` as mutable
- --> $DIR/issue-33819.rs:4:39
+error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
+ --> $DIR/issue-33819.rs:4:34
|
LL | Some(ref v) => { let a = &mut v; },
- | ^ cannot borrow mutably
+ | ^^^^^^
+ | |
+ | cannot borrow as mutable
+ | try removing `&mut` here
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-36082.ast.nll.stderr b/src/test/ui/issues/issue-36082.ast.nll.stderr
deleted file mode 100644
index 6b3b13a..0000000
--- a/src/test/ui/issues/issue-36082.ast.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/issue-36082.rs:11:19
- |
-LL | let val: &_ = x.borrow().0;
- | ^^^^^^^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary which is freed while still in use
-...
-LL | println!("{}", val);
- | --- borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-36082.ast.stderr b/src/test/ui/issues/issue-36082.ast.stderr
deleted file mode 100644
index 56e50e5..0000000
--- a/src/test/ui/issues/issue-36082.ast.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-36082.rs:11:19
- |
-LL | let val: &_ = x.borrow().0;
- | ^^^^^^^^^^ - temporary value dropped here while still borrowed
- | |
- | temporary value does not live long enough
-...
-LL | }
- | - temporary value needs to live until here
- |
- = note: consider using a `let` binding to increase its lifetime
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issues/issue-36082.mir.stderr b/src/test/ui/issues/issue-36082.mir.stderr
deleted file mode 100644
index 6b3b13a..0000000
--- a/src/test/ui/issues/issue-36082.mir.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/issue-36082.rs:11:19
- |
-LL | let val: &_ = x.borrow().0;
- | ^^^^^^^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary which is freed while still in use
-...
-LL | println!("{}", val);
- | --- borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-36082.rs b/src/test/ui/issues/issue-36082.rs
index 2658ef0..a2ff477 100644
--- a/src/test/ui/issues/issue-36082.rs
+++ b/src/test/ui/issues/issue-36082.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
use std::cell::RefCell;
fn main() {
@@ -9,15 +6,10 @@
let x = RefCell::new((&mut r,s));
let val: &_ = x.borrow().0;
- //[ast]~^ ERROR borrowed value does not live long enough [E0597]
- //[ast]~| NOTE temporary value dropped here while still borrowed
- //[ast]~| NOTE temporary value does not live long enough
- //[ast]~| NOTE consider using a `let` binding to increase its lifetime
- //[mir]~^^^^^ ERROR temporary value dropped while borrowed [E0716]
- //[mir]~| NOTE temporary value is freed at the end of this statement
- //[mir]~| NOTE creates a temporary which is freed while still in use
- //[mir]~| NOTE consider using a `let` binding to create a longer lived value
+ //~^ ERROR temporary value dropped while borrowed [E0716]
+ //~| NOTE temporary value is freed at the end of this statement
+ //~| NOTE creates a temporary which is freed while still in use
+ //~| NOTE consider using a `let` binding to create a longer lived value
println!("{}", val);
- //[mir]~^ borrow later used here
+ //~^ borrow later used here
}
-//[ast]~^ NOTE temporary value needs to live until here
diff --git a/src/test/ui/issues/issue-36082.stderr b/src/test/ui/issues/issue-36082.stderr
new file mode 100644
index 0000000..26bf4cb
--- /dev/null
+++ b/src/test/ui/issues/issue-36082.stderr
@@ -0,0 +1,16 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/issue-36082.rs:8:19
+ |
+LL | let val: &_ = x.borrow().0;
+ | ^^^^^^^^^^ - temporary value is freed at the end of this statement
+ | |
+ | creates a temporary which is freed while still in use
+...
+LL | println!("{}", val);
+ | --- borrow later used here
+ |
+ = note: consider using a `let` binding to create a longer lived value
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-36400.nll.stderr b/src/test/ui/issues/issue-36400.nll.stderr
deleted file mode 100644
index 3b37578..0000000
--- a/src/test/ui/issues/issue-36400.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable
- --> $DIR/issue-36400.rs:5:7
- |
-LL | let x = Box::new(3);
- | - help: consider changing this to be mutable: `mut x`
-LL | f(&mut *x);
- | ^^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issues/issue-36400.rs b/src/test/ui/issues/issue-36400.rs
index 5ba9eb2..a405f9b 100644
--- a/src/test/ui/issues/issue-36400.rs
+++ b/src/test/ui/issues/issue-36400.rs
@@ -2,5 +2,5 @@
fn main() {
let x = Box::new(3);
- f(&mut *x); //~ ERROR cannot borrow immutable
+ f(&mut *x); //~ ERROR cannot borrow `*x` as mutable, as `x` is not declared as mutable
}
diff --git a/src/test/ui/issues/issue-36400.stderr b/src/test/ui/issues/issue-36400.stderr
index 1494324..3b37578 100644
--- a/src/test/ui/issues/issue-36400.stderr
+++ b/src/test/ui/issues/issue-36400.stderr
@@ -1,10 +1,10 @@
-error[E0596]: cannot borrow immutable `Box` content `*x` as mutable
- --> $DIR/issue-36400.rs:5:12
+error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable
+ --> $DIR/issue-36400.rs:5:7
|
LL | let x = Box::new(3);
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | f(&mut *x);
- | ^^ cannot borrow as mutable
+ | ^^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-40288.nll.stderr b/src/test/ui/issues/issue-40288.nll.stderr
deleted file mode 100644
index fb4ecab..0000000
--- a/src/test/ui/issues/issue-40288.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0506]: cannot assign to `*refr` because it is borrowed
- --> $DIR/issue-40288.rs:16:5
- |
-LL | save_ref(&*refr, &mut out);
- | ------ borrow of `*refr` occurs here
-...
-LL | *refr = 3;
- | ^^^^^^^^^ assignment to borrowed `*refr` occurs here
-...
-LL | println!("{:?}", out[0]);
- | ------ borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/issues/issue-40288.stderr b/src/test/ui/issues/issue-40288.stderr
index 5e8ad32..fb4ecab 100644
--- a/src/test/ui/issues/issue-40288.stderr
+++ b/src/test/ui/issues/issue-40288.stderr
@@ -2,10 +2,13 @@
--> $DIR/issue-40288.rs:16:5
|
LL | save_ref(&*refr, &mut out);
- | ----- borrow of `*refr` occurs here
+ | ------ borrow of `*refr` occurs here
...
LL | *refr = 3;
| ^^^^^^^^^ assignment to borrowed `*refr` occurs here
+...
+LL | println!("{:?}", out[0]);
+ | ------ borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr
deleted file mode 100644
index fbfbc0c..0000000
--- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-40402-1.rs:9:13
- |
-LL | let e = f.v[0];
- | ^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider borrowing here: `&f.v[0]`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs
index 6bb0b6f..786c37e 100644
--- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs
+++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs
@@ -6,5 +6,5 @@
fn main() {
let mut f = Foo { v: Vec::new() };
f.v.push("hello".to_string());
- let e = f.v[0]; //~ ERROR cannot move out of indexed content
+ let e = f.v[0]; //~ ERROR cannot move out of borrowed content
}
diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr
index 5e7be1a..fbfbc0c 100644
--- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr
+++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr
@@ -1,11 +1,11 @@
-error[E0507]: cannot move out of indexed content
+error[E0507]: cannot move out of borrowed content
--> $DIR/issue-40402-1.rs:9:13
|
LL | let e = f.v[0];
| ^^^^^^
| |
- | cannot move out of indexed content
- | help: consider using a reference instead: `&f.v[0]`
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&f.v[0]`
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr
deleted file mode 100644
index 0c4a85b..0000000
--- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-40402-2.rs:5:18
- |
-LL | let (a, b) = x[0];
- | - - ^^^^
- | | | |
- | | | cannot move out of borrowed content
- | | | help: consider borrowing here: `&x[0]`
- | | ...and here
- | data moved here
- |
-note: move occurs because these variables have types that don't implement the `Copy` trait
- --> $DIR/issue-40402-2.rs:5:10
- |
-LL | let (a, b) = x[0];
- | ^ ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs
index 0b8f40c..480a4df 100644
--- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs
+++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs
@@ -2,5 +2,5 @@
// are nested within a pattern
fn main() {
let x = vec![(String::new(), String::new())];
- let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
+ let (a, b) = x[0]; //~ ERROR cannot move out of borrowed content
}
diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr
index b672029..0c4a85b 100644
--- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr
+++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr
@@ -1,11 +1,19 @@
-error[E0507]: cannot move out of indexed content
+error[E0507]: cannot move out of borrowed content
--> $DIR/issue-40402-2.rs:5:18
|
LL | let (a, b) = x[0];
- | - - ^^^^ cannot move out of indexed content
- | | |
- | | ...and here (use `ref b` or `ref mut b`)
- | hint: to prevent move, use `ref a` or `ref mut a`
+ | - - ^^^^
+ | | | |
+ | | | cannot move out of borrowed content
+ | | | help: consider borrowing here: `&x[0]`
+ | | ...and here
+ | data moved here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/issue-40402-2.rs:5:10
+ |
+LL | let (a, b) = x[0];
+ | ^ ^
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-40510-1.nll.stderr b/src/test/ui/issues/issue-40510-1.stderr
similarity index 100%
rename from src/test/ui/issues/issue-40510-1.nll.stderr
rename to src/test/ui/issues/issue-40510-1.stderr
diff --git a/src/test/ui/issues/issue-40510-3.nll.stderr b/src/test/ui/issues/issue-40510-3.stderr
similarity index 100%
rename from src/test/ui/issues/issue-40510-3.nll.stderr
rename to src/test/ui/issues/issue-40510-3.stderr
diff --git a/src/test/ui/issues/issue-41139.nll.stderr b/src/test/ui/issues/issue-41139.nll.stderr
deleted file mode 100644
index 4dd017b..0000000
--- a/src/test/ui/issues/issue-41139.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0161]: cannot move a value of type dyn Trait: the size of dyn Trait cannot be statically determined
- --> $DIR/issue-41139.rs:6:23
- |
-LL | let t : &Trait = &get_function()();
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0161`.
diff --git a/src/test/ui/issues/issue-41139.rs b/src/test/ui/issues/issue-41139.rs
index 0bfbea1..f3e6c44 100644
--- a/src/test/ui/issues/issue-41139.rs
+++ b/src/test/ui/issues/issue-41139.rs
@@ -4,5 +4,5 @@
fn main() {
let t : &Trait = &get_function()();
- //~^ ERROR cannot move a value of type (dyn Trait + 'static)
+ //~^ ERROR cannot move a value of type dyn Trait
}
diff --git a/src/test/ui/issues/issue-41139.stderr b/src/test/ui/issues/issue-41139.stderr
index 3e3de7b..4dd017b 100644
--- a/src/test/ui/issues/issue-41139.stderr
+++ b/src/test/ui/issues/issue-41139.stderr
@@ -1,4 +1,4 @@
-error[E0161]: cannot move a value of type (dyn Trait + 'static): the size of (dyn Trait + 'static) cannot be statically determined
+error[E0161]: cannot move a value of type dyn Trait: the size of dyn Trait cannot be statically determined
--> $DIR/issue-41139.rs:6:23
|
LL | let t : &Trait = &get_function()();
diff --git a/src/test/ui/issues/issue-41726.nll.stderr b/src/test/ui/issues/issue-41726.nll.stderr
deleted file mode 100644
index c92753d..0000000
--- a/src/test/ui/issues/issue-41726.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/issue-41726.rs:5:9
- |
-LL | things[src.as_str()].sort();
- | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
- |
- = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<std::string::String, std::vec::Vec<std::string::String>>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issues/issue-41726.rs b/src/test/ui/issues/issue-41726.rs
index 41dcaa8..ed05629 100644
--- a/src/test/ui/issues/issue-41726.rs
+++ b/src/test/ui/issues/issue-41726.rs
@@ -2,6 +2,6 @@
fn main() {
let things: HashMap<String, Vec<String>> = HashMap::new();
for src in things.keys() {
- things[src.as_str()].sort(); //~ ERROR cannot borrow immutable
+ things[src.as_str()].sort(); //~ ERROR cannot borrow data in a `&` reference as mutable
}
}
diff --git a/src/test/ui/issues/issue-41726.stderr b/src/test/ui/issues/issue-41726.stderr
index e29c163..c92753d 100644
--- a/src/test/ui/issues/issue-41726.stderr
+++ b/src/test/ui/issues/issue-41726.stderr
@@ -1,4 +1,4 @@
-error[E0596]: cannot borrow immutable indexed content as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/issue-41726.rs:5:9
|
LL | things[src.as_str()].sort();
diff --git a/src/test/ui/issues/issue-42106.nll.stderr b/src/test/ui/issues/issue-42106.nll.stderr
deleted file mode 100644
index d5a9d23..0000000
--- a/src/test/ui/issues/issue-42106.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed as immutable
- --> $DIR/issue-42106.rs:3:5
- |
-LL | let _a = &collection;
- | ----------- immutable borrow occurs here
-LL | collection.swap(1, 2);
- | ^^^^^^^^^^ mutable borrow occurs here
-LL | _a.use_ref();
- | -- immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/issues/issue-42106.stderr b/src/test/ui/issues/issue-42106.stderr
index 9e3ce98..d5a9d23 100644
--- a/src/test/ui/issues/issue-42106.stderr
+++ b/src/test/ui/issues/issue-42106.stderr
@@ -1,13 +1,12 @@
-error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable
+error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed as immutable
--> $DIR/issue-42106.rs:3:5
|
LL | let _a = &collection;
- | ---------- immutable borrow occurs here
+ | ----------- immutable borrow occurs here
LL | collection.swap(1, 2);
| ^^^^^^^^^^ mutable borrow occurs here
LL | _a.use_ref();
-LL | }
- | - immutable borrow ends here
+ | -- immutable borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-42344.nll.stderr b/src/test/ui/issues/issue-42344.nll.stderr
deleted file mode 100644
index 5cffa1b..0000000
--- a/src/test/ui/issues/issue-42344.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item
- --> $DIR/issue-42344.rs:4:5
- |
-LL | TAB[0].iter_mut();
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issues/issue-42344.rs b/src/test/ui/issues/issue-42344.rs
index 5f1bb4f..a7636ed 100644
--- a/src/test/ui/issues/issue-42344.rs
+++ b/src/test/ui/issues/issue-42344.rs
@@ -1,7 +1,8 @@
static TAB: [&mut [u8]; 0] = [];
pub unsafe fn test() {
- TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389]
+ TAB[0].iter_mut();
+ //~^ ERROR cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item [E0596]
}
pub fn main() {}
diff --git a/src/test/ui/issues/issue-42344.stderr b/src/test/ui/issues/issue-42344.stderr
index 6bf26c2..5cffa1b 100644
--- a/src/test/ui/issues/issue-42344.stderr
+++ b/src/test/ui/issues/issue-42344.stderr
@@ -1,9 +1,9 @@
-error[E0389]: cannot borrow data mutably in a `&` reference
+error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item
--> $DIR/issue-42344.rs:4:5
|
LL | TAB[0].iter_mut();
- | ^^^^^^ assignment into an immutable reference
+ | ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0389`.
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issues/issue-42796.nll.stderr b/src/test/ui/issues/issue-42796.nll.stderr
deleted file mode 100644
index d9dfbc9..0000000
--- a/src/test/ui/issues/issue-42796.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0382]: borrow of moved value: `s`
- --> $DIR/issue-42796.rs:18:20
- |
-LL | let s = "Hello!".to_owned();
- | - move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
-LL | let mut s_copy = s;
- | - value moved here
-...
-LL | println!("{}", s);
- | ^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/issues/issue-42796.rs b/src/test/ui/issues/issue-42796.rs
index 98b9127..5e83a1c 100644
--- a/src/test/ui/issues/issue-42796.rs
+++ b/src/test/ui/issues/issue-42796.rs
@@ -15,5 +15,5 @@
let mut s_copy = s;
s_copy.push_str("World!");
"0wned!".to_owned();
- println!("{}", s); //~ ERROR use of moved value
+ println!("{}", s); //~ ERROR borrow of moved value
}
diff --git a/src/test/ui/issues/issue-42796.stderr b/src/test/ui/issues/issue-42796.stderr
index d180e64..d9dfbc9 100644
--- a/src/test/ui/issues/issue-42796.stderr
+++ b/src/test/ui/issues/issue-42796.stderr
@@ -1,13 +1,13 @@
-error[E0382]: use of moved value: `s`
+error[E0382]: borrow of moved value: `s`
--> $DIR/issue-42796.rs:18:20
|
+LL | let s = "Hello!".to_owned();
+ | - move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
LL | let mut s_copy = s;
- | ---------- value moved here
+ | - value moved here
...
LL | println!("{}", s);
- | ^ value used here after move
- |
- = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^ value borrowed here after move
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-4335.nll.stderr b/src/test/ui/issues/issue-4335.nll.stderr
deleted file mode 100644
index 1b5cab2..0000000
--- a/src/test/ui/issues/issue-4335.nll.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0507]: cannot move out of captured variable in an `FnMut` closure
- --> $DIR/issue-4335.rs:6:20
- |
-LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
- | - captured outer variable
-LL | id(Box::new(|| *v))
- | ^^ cannot move out of captured variable in an `FnMut` closure
-
-error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function
- --> $DIR/issue-4335.rs:6:17
- |
-LL | id(Box::new(|| *v))
- | ^^ - `v` is borrowed here
- | |
- | may outlive borrowed value `v`
- |
-note: closure is returned here
- --> $DIR/issue-4335.rs:6:5
- |
-LL | id(Box::new(|| *v))
- | ^^^^^^^^^^^^^^^^^^^
-help: to force the closure to take ownership of `v` (and any other referenced variables), use the `move` keyword
- |
-LL | id(Box::new(move || *v))
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0373, E0507.
-For more information about an error, try `rustc --explain E0373`.
diff --git a/src/test/ui/issues/issue-4335.stderr b/src/test/ui/issues/issue-4335.stderr
index 3b04c26..1b5cab2 100644
--- a/src/test/ui/issues/issue-4335.stderr
+++ b/src/test/ui/issues/issue-4335.stderr
@@ -1,3 +1,11 @@
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/issue-4335.rs:6:20
+ |
+LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
+ | - captured outer variable
+LL | id(Box::new(|| *v))
+ | ^^ cannot move out of captured variable in an `FnMut` closure
+
error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function
--> $DIR/issue-4335.rs:6:17
|
@@ -5,17 +13,17 @@
| ^^ - `v` is borrowed here
| |
| may outlive borrowed value `v`
+ |
+note: closure is returned here
+ --> $DIR/issue-4335.rs:6:5
+ |
+LL | id(Box::new(|| *v))
+ | ^^^^^^^^^^^^^^^^^^^
help: to force the closure to take ownership of `v` (and any other referenced variables), use the `move` keyword
|
LL | id(Box::new(move || *v))
| ^^^^^^^
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-4335.rs:6:20
- |
-LL | id(Box::new(|| *v))
- | ^^ cannot move out of borrowed content
-
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0373, E0507.
diff --git a/src/test/ui/issues/issue-44373.nll.stderr b/src/test/ui/issues/issue-44373.nll.stderr
deleted file mode 100644
index 6f92fbb..0000000
--- a/src/test/ui/issues/issue-44373.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/issue-44373.rs:4:42
- |
-LL | let _val: &'static [&'static u32] = &[&FOO];
- | ----------------------- ^^^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-44373.rs b/src/test/ui/issues/issue-44373.rs
index 13e9fa9..0d011d0 100644
--- a/src/test/ui/issues/issue-44373.rs
+++ b/src/test/ui/issues/issue-44373.rs
@@ -1,5 +1,5 @@
static FOO: u32 = 50;
fn main() {
- let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough
+ let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR temporary value dropped while borrowed
}
diff --git a/src/test/ui/issues/issue-44373.stderr b/src/test/ui/issues/issue-44373.stderr
index c529558..6f92fbb 100644
--- a/src/test/ui/issues/issue-44373.stderr
+++ b/src/test/ui/issues/issue-44373.stderr
@@ -1,13 +1,13 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/issue-44373.rs:4:42
|
LL | let _val: &'static [&'static u32] = &[&FOO];
- | ^^^^^^ temporary value does not live long enough
+ | ----------------------- ^^^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-45199.ast.nll.stderr b/src/test/ui/issues/issue-45199.ast.nll.stderr
deleted file mode 100644
index c6ae7c9..0000000
--- a/src/test/ui/issues/issue-45199.ast.nll.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/issue-45199.rs:10:5
- |
-LL | let b: Box<isize>;
- | - help: make this binding mutable: `mut b`
-...
-LL | b = Box::new(1);
- | - first assignment to `b`
-LL |
-LL | b = Box::new(2);
- | ^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/issue-45199.rs:21:5
- |
-LL | let b = Box::new(1);
- | -
- | |
- | first assignment to `b`
- | help: make this binding mutable: `mut b`
-...
-LL | b = Box::new(2);
- | ^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign to immutable argument `b`
- --> $DIR/issue-45199.rs:30:5
- |
-LL | fn test_args(b: Box<i32>) {
- | - help: make this binding mutable: `mut b`
-...
-LL | b = Box::new(2);
- | ^ cannot assign to immutable argument
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/issues/issue-45199.ast.stderr b/src/test/ui/issues/issue-45199.ast.stderr
deleted file mode 100644
index 9dfd8e8..0000000
--- a/src/test/ui/issues/issue-45199.ast.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/issue-45199.rs:10:5
- |
-LL | b = Box::new(1);
- | --------------- first assignment to `b`
-LL |
-LL | b = Box::new(2);
- | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/issue-45199.rs:21:5
- |
-LL | let b = Box::new(1);
- | - first assignment to `b`
-...
-LL | b = Box::new(2);
- | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/issue-45199.rs:30:5
- |
-LL | fn test_args(b: Box<i32>) {
- | - first assignment to `b`
-...
-LL | b = Box::new(2);
- | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/issues/issue-45199.mir.stderr b/src/test/ui/issues/issue-45199.mir.stderr
deleted file mode 100644
index c6ae7c9..0000000
--- a/src/test/ui/issues/issue-45199.mir.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/issue-45199.rs:10:5
- |
-LL | let b: Box<isize>;
- | - help: make this binding mutable: `mut b`
-...
-LL | b = Box::new(1);
- | - first assignment to `b`
-LL |
-LL | b = Box::new(2);
- | ^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/issue-45199.rs:21:5
- |
-LL | let b = Box::new(1);
- | -
- | |
- | first assignment to `b`
- | help: make this binding mutable: `mut b`
-...
-LL | b = Box::new(2);
- | ^ cannot assign twice to immutable variable
-
-error[E0384]: cannot assign to immutable argument `b`
- --> $DIR/issue-45199.rs:30:5
- |
-LL | fn test_args(b: Box<i32>) {
- | - help: make this binding mutable: `mut b`
-...
-LL | b = Box::new(2);
- | ^ cannot assign to immutable argument
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/issues/issue-45199.rs b/src/test/ui/issues/issue-45199.rs
index bb55534..cbd45cb 100644
--- a/src/test/ui/issues/issue-45199.rs
+++ b/src/test/ui/issues/issue-45199.rs
@@ -1,36 +1,24 @@
-// revisions: ast mir
-//[mir]compile-flags: -Zborrowck=mir
-
fn test_drop_replace() {
let b: Box<isize>;
- //[mir]~^ HELP make this binding mutable
- //[mir]~| SUGGESTION mut b
- b = Box::new(1); //[ast]~ NOTE first assignment
- //[mir]~^ NOTE first assignment
- b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `b`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign twice to immutable
+ //~^ HELP make this binding mutable
+ //~| SUGGESTION mut b
+ b = Box::new(1); //~ NOTE first assignment
+ b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
+ //~| NOTE cannot assign twice to immutable
}
fn test_call() {
- let b = Box::new(1); //[ast]~ NOTE first assignment
- //[mir]~^ NOTE first assignment
- //[mir]~| HELP make this binding mutable
- //[mir]~| SUGGESTION mut b
- b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `b`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign twice to immutable
+ let b = Box::new(1); //~ NOTE first assignment
+ //~| HELP make this binding mutable
+ //~| SUGGESTION mut b
+ b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
+ //~| NOTE cannot assign twice to immutable
}
-fn test_args(b: Box<i32>) { //[ast]~ NOTE first assignment
- //[mir]~^ HELP make this binding mutable
- //[mir]~| SUGGESTION mut b
- b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign to immutable argument `b`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign to immutable argument
+fn test_args(b: Box<i32>) { //~ HELP make this binding mutable
+ //~| SUGGESTION mut b
+ b = Box::new(2); //~ ERROR cannot assign to immutable argument `b`
+ //~| NOTE cannot assign to immutable argument
}
fn main() {}
diff --git a/src/test/ui/issues/issue-45199.stderr b/src/test/ui/issues/issue-45199.stderr
new file mode 100644
index 0000000..83b6340
--- /dev/null
+++ b/src/test/ui/issues/issue-45199.stderr
@@ -0,0 +1,35 @@
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/issue-45199.rs:6:5
+ |
+LL | let b: Box<isize>;
+ | - help: make this binding mutable: `mut b`
+...
+LL | b = Box::new(1);
+ | - first assignment to `b`
+LL | b = Box::new(2);
+ | ^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/issue-45199.rs:14:5
+ |
+LL | let b = Box::new(1);
+ | -
+ | |
+ | first assignment to `b`
+ | help: make this binding mutable: `mut b`
+...
+LL | b = Box::new(2);
+ | ^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign to immutable argument `b`
+ --> $DIR/issue-45199.rs:20:5
+ |
+LL | fn test_args(b: Box<i32>) {
+ | - help: make this binding mutable: `mut b`
+LL |
+LL | b = Box::new(2);
+ | ^ cannot assign to immutable argument
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs b/src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs
index 9f86cae..b3f6556 100644
--- a/src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs
+++ b/src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs
@@ -1,14 +1,5 @@
// rust-lang/rust#45696: This test is checking that we can return
// mutable borrows owned by boxes even when the boxes are dropped.
-//
-// We will explicitly test AST-borrowck, NLL, and migration modes;
-// thus we will also skip the automated compare-mode=nll.
-
-// revisions: ast nll migrate
-// ignore-compare-mode-nll
-
-#![cfg_attr(nll, feature(nll))]
-//[migrate]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
// run-pass
diff --git a/src/test/ui/issues/issue-45696-no-variant-box-recur.rs b/src/test/ui/issues/issue-45696-no-variant-box-recur.rs
index 867da22..b5d9036 100644
--- a/src/test/ui/issues/issue-45696-no-variant-box-recur.rs
+++ b/src/test/ui/issues/issue-45696-no-variant-box-recur.rs
@@ -1,16 +1,15 @@
-// rust-lang/rust#45696: This test checks the compiler won't infinite
-// loop when you declare a variable of type `struct A(Box<A>, ...);`
-// (which is impossible to construct but *is* possible to declare; see
-// also issues #4287, #44933, and #52852).
+// rust-lang/rust#45696: This test checks the compiler won't infinite loop when
+// you declare a variable of type `struct A(Box<A>, ...);` (which is impossible
+// to construct but *is* possible to declare; see also issues #4287, #44933,
+// and #52852).
//
-// We will explicitly test AST-borrowck, NLL, and migration modes;
-// thus we will also skip the automated compare-mode=nll.
+// We will explicitly test NLL, and migration modes; thus we will also skip the
+// automated compare-mode=nll.
-// revisions: ast nll migrate
+// revisions: nll migrate
// ignore-compare-mode-nll
#![cfg_attr(nll, feature(nll))]
-//[migrate]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
// run-pass
diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr
deleted file mode 100644
index 0aaba52..0000000
--- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: compilation successful
- --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:82:1
- |
-LL | / fn main() {
-LL | |
-LL | | let mut x = 1;
-LL | | {
-... |
-LL | | *boxed_boxed_scribbled(Box::new(Box::new(Scribble(&mut x)))) += 10;
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr
index f8aab23..8cc9f1e 100644
--- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr
+++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr
@@ -1,5 +1,5 @@
warning[E0713]: borrow may still be in use when destructor runs
- --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:53:5
+ --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:51:5
|
LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
| -- lifetime `'a` defined here
@@ -13,7 +13,7 @@
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
warning[E0713]: borrow may still be in use when destructor runs
- --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:64:5
+ --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:62:5
|
LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
| -- lifetime `'a` defined here
@@ -27,7 +27,7 @@
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
warning[E0713]: borrow may still be in use when destructor runs
- --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:75:5
+ --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5
|
LL | fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
| -- lifetime `'a` defined here
@@ -41,12 +41,12 @@
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
error: compilation successful
- --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:82:1
+ --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:80:1
|
LL | / fn main() {
-LL | |
LL | | let mut x = 1;
LL | | {
+LL | | let mut long_lived = Scribble(&mut x);
... |
LL | | *boxed_boxed_scribbled(Box::new(Box::new(Scribble(&mut x)))) += 10;
LL | | }
diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr
index bfb5832..1b9fb04 100644
--- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr
+++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr
@@ -1,5 +1,5 @@
error[E0713]: borrow may still be in use when destructor runs
- --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:53:5
+ --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:51:5
|
LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
| -- lifetime `'a` defined here
@@ -10,7 +10,7 @@
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
error[E0713]: borrow may still be in use when destructor runs
- --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:64:5
+ --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:62:5
|
LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
| -- lifetime `'a` defined here
@@ -21,7 +21,7 @@
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
error[E0713]: borrow may still be in use when destructor runs
- --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:75:5
+ --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5
|
LL | fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
| -- lifetime `'a` defined here
diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs
index fc56a2a..f568efa 100644
--- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs
+++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs
@@ -2,21 +2,19 @@
// mutable borrows that would be scribbled over by destructors before
// the return occurs.
//
-// We will explicitly test AST-borrowck, NLL, and migration modes;
+// We will explicitly test NLL, and migration modes;
// thus we will also skip the automated compare-mode=nll.
-// revisions: ast nll migrate
+// revisions: nll migrate
// ignore-compare-mode-nll
-// This test is going to pass in the ast and migrate revisions,
-// because the AST-borrowck accepted this code in the past (see notes
-// below). So we use `#[rustc_error]` to keep the outcome as an error
-// in all scenarios, and rely on the stderr files to show what the
-// actual behavior is. (See rust-lang/rust#49855.)
+// This test is going to pass in the migrate revision, because the AST-borrowck
+// accepted this code in the past (see notes below). So we use `#[rustc_error]`
+// to keep the outcome as an error in all scenarios, and rely on the stderr
+// files to show what the actual behavior is. (See rust-lang/rust#49855.)
#![feature(rustc_attrs)]
#![cfg_attr(nll, feature(nll))]
-//[migrate]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
struct Scribble<'a>(&'a mut u32);
@@ -79,8 +77,7 @@
}
#[rustc_error]
-fn main() { //[ast]~ ERROR compilation successful
- //[migrate]~^ ERROR compilation successful
+fn main() { //[migrate]~ ERROR compilation successful
let mut x = 1;
{
let mut long_lived = Scribble(&mut x);
diff --git a/src/test/ui/issues/issue-46023.ast.nll.stderr b/src/test/ui/issues/issue-46023.ast.nll.stderr
deleted file mode 100644
index 6ef44b4..0000000
--- a/src/test/ui/issues/issue-46023.ast.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/issue-46023.rs:8:9
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | x = 1;
- | ^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-46023.ast.stderr b/src/test/ui/issues/issue-46023.ast.stderr
deleted file mode 100644
index 68f7741..0000000
--- a/src/test/ui/issues/issue-46023.ast.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
- --> $DIR/issue-46023.rs:8:9
- |
-LL | let x = 0;
- | - help: consider making `x` mutable: `mut x`
-...
-LL | x = 1;
- | ^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-46023.mir.stderr b/src/test/ui/issues/issue-46023.mir.stderr
deleted file mode 100644
index 6ef44b4..0000000
--- a/src/test/ui/issues/issue-46023.mir.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/issue-46023.rs:8:9
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | x = 1;
- | ^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-46023.rs b/src/test/ui/issues/issue-46023.rs
index a9ecbbe..a923eb2 100644
--- a/src/test/ui/issues/issue-46023.rs
+++ b/src/test/ui/issues/issue-46023.rs
@@ -1,12 +1,8 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn main() {
let x = 0;
(move || {
x = 1;
- //[mir]~^ ERROR cannot assign to `x`, as it is not declared as mutable [E0594]
- //[ast]~^^ ERROR cannot assign to captured outer variable in an `FnMut` closure [E0594]
+ //~^ ERROR cannot assign to `x`, as it is not declared as mutable [E0594]
})()
}
diff --git a/src/test/ui/issues/issue-46023.stderr b/src/test/ui/issues/issue-46023.stderr
new file mode 100644
index 0000000..fac696c
--- /dev/null
+++ b/src/test/ui/issues/issue-46023.stderr
@@ -0,0 +1,11 @@
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/issue-46023.rs:5:9
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | x = 1;
+ | ^^^^^ cannot assign
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-46604.ast.nll.stderr b/src/test/ui/issues/issue-46604.ast.nll.stderr
deleted file mode 100644
index 497af09..0000000
--- a/src/test/ui/issues/issue-46604.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0017]: references in statics may only refer to immutable values
- --> $DIR/issue-46604.rs:4:25
- |
-LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];
- | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
-
-error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item
- --> $DIR/issue-46604.rs:10:5
- |
-LL | buf[0]=2;
- | ^^^^^^^^ cannot assign
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0017`.
diff --git a/src/test/ui/issues/issue-46604.ast.stderr b/src/test/ui/issues/issue-46604.ast.stderr
deleted file mode 100644
index 058ee15..0000000
--- a/src/test/ui/issues/issue-46604.ast.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0017]: references in statics may only refer to immutable values
- --> $DIR/issue-46604.rs:4:25
- |
-LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];
- | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
-
-error[E0389]: cannot assign to data in a `&` reference
- --> $DIR/issue-46604.rs:10:5
- |
-LL | buf[0]=2;
- | ^^^^^^^^ assignment into an immutable reference
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0017, E0389.
-For more information about an error, try `rustc --explain E0017`.
diff --git a/src/test/ui/issues/issue-46604.mir.stderr b/src/test/ui/issues/issue-46604.mir.stderr
deleted file mode 100644
index 497af09..0000000
--- a/src/test/ui/issues/issue-46604.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0017]: references in statics may only refer to immutable values
- --> $DIR/issue-46604.rs:4:25
- |
-LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];
- | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
-
-error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item
- --> $DIR/issue-46604.rs:10:5
- |
-LL | buf[0]=2;
- | ^^^^^^^^ cannot assign
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0017`.
diff --git a/src/test/ui/issues/issue-46604.rs b/src/test/ui/issues/issue-46604.rs
index 34fe3af..4f1ad38 100644
--- a/src/test/ui/issues/issue-46604.rs
+++ b/src/test/ui/issues/issue-46604.rs
@@ -1,12 +1,7 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
-static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017
- //[mir]~^ ERROR E0017
+static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //~ ERROR E0017
fn write<T: AsRef<[u8]>>(buffer: T) { }
fn main() {
write(&buf);
- buf[0]=2; //[ast]~ ERROR E0389
- //[mir]~^ ERROR E0594
+ buf[0]=2; //~ ERROR E0594
}
diff --git a/src/test/ui/issues/issue-46604.stderr b/src/test/ui/issues/issue-46604.stderr
new file mode 100644
index 0000000..961b249
--- /dev/null
+++ b/src/test/ui/issues/issue-46604.stderr
@@ -0,0 +1,15 @@
+error[E0017]: references in statics may only refer to immutable values
+ --> $DIR/issue-46604.rs:1:25
+ |
+LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];
+ | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
+
+error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item
+ --> $DIR/issue-46604.rs:6:5
+ |
+LL | buf[0]=2;
+ | ^^^^^^^^ cannot assign
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0017`.
diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr
deleted file mode 100644
index bfa0705..0000000
--- a/src/test/ui/issues/issue-49824.nll.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-warning: captured variable cannot escape `FnMut` closure body
- --> $DIR/issue-49824.rs:12:9
- |
-LL | || {
- | - inferred to be a `FnMut` closure
-LL | / || {
-LL | | let _y = &mut x;
-LL | | }
- | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
- |
- = note: `FnMut` closures only have access to their captured variables while they are executing...
- = note: ...therefore, they cannot allow references to captured variables to escape
- = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
- = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
-error: compilation successful
- --> $DIR/issue-49824.rs:8:1
- |
-LL | / fn main() {
-LL | |
-LL | | let mut x = 0;
-LL | | || {
-... |
-LL | | };
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-49824.rs b/src/test/ui/issues/issue-49824.rs
index 58cada5..b0d01b3 100644
--- a/src/test/ui/issues/issue-49824.rs
+++ b/src/test/ui/issues/issue-49824.rs
@@ -1,15 +1,16 @@
#![feature(rustc_attrs)]
-// This test checks that a failure occurs with NLL but does not fail with the
-// legacy AST output. Check issue-49824.nll.stderr for expected compilation error
-// output under NLL and #49824 for more information.
+// This test checks that a warning occurs with migrate mode.
#[rustc_error]
fn main() {
- //~^ compilation successful
+ //~^ ERROR compilation successful
let mut x = 0;
|| {
|| {
+ //~^ WARNING captured variable cannot escape `FnMut` closure body
+ //~| WARNING this error has been downgraded to a warning
+ //~| WARNING this warning will become a hard error in the future
let _y = &mut x;
}
};
diff --git a/src/test/ui/issues/issue-49824.stderr b/src/test/ui/issues/issue-49824.stderr
index 4ad537f..c66ee69 100644
--- a/src/test/ui/issues/issue-49824.stderr
+++ b/src/test/ui/issues/issue-49824.stderr
@@ -1,5 +1,23 @@
+warning: captured variable cannot escape `FnMut` closure body
+ --> $DIR/issue-49824.rs:10:9
+ |
+LL | || {
+ | - inferred to be a `FnMut` closure
+LL | / || {
+LL | |
+LL | |
+LL | |
+LL | | let _y = &mut x;
+LL | | }
+ | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
+ |
+ = note: `FnMut` closures only have access to their captured variables while they are executing...
+ = note: ...therefore, they cannot allow references to captured variables to escape
+ = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+ = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
error: compilation successful
- --> $DIR/issue-49824.rs:8:1
+ --> $DIR/issue-49824.rs:6:1
|
LL | / fn main() {
LL | |
diff --git a/src/test/ui/issues/issue-51244.nll.stderr b/src/test/ui/issues/issue-51244.nll.stderr
deleted file mode 100644
index 8a7e71e..0000000
--- a/src/test/ui/issues/issue-51244.nll.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference
- --> $DIR/issue-51244.rs:3:5
- |
-LL | let ref my_ref @ _ = 0;
- | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _`
-LL | *my_ref = 0;
- | ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-51244.rs b/src/test/ui/issues/issue-51244.rs
index d365181..509060e 100644
--- a/src/test/ui/issues/issue-51244.rs
+++ b/src/test/ui/issues/issue-51244.rs
@@ -1,4 +1,4 @@
fn main() {
let ref my_ref @ _ = 0;
- *my_ref = 0; //~ ERROR cannot assign to immutable borrowed content `*my_ref` [E0594]
+ *my_ref = 0; //~ ERROR cannot assign to `*my_ref` which is behind a `&` reference [E0594]
}
diff --git a/src/test/ui/issues/issue-51244.stderr b/src/test/ui/issues/issue-51244.stderr
index 4ab5e8d..8a7e71e 100644
--- a/src/test/ui/issues/issue-51244.stderr
+++ b/src/test/ui/issues/issue-51244.stderr
@@ -1,10 +1,10 @@
-error[E0594]: cannot assign to immutable borrowed content `*my_ref`
+error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference
--> $DIR/issue-51244.rs:3:5
|
LL | let ref my_ref @ _ = 0;
- | -------------- help: use a mutable reference instead: `ref mut my_ref @ _`
+ | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _`
LL | *my_ref = 0;
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-52049.nll.stderr b/src/test/ui/issues/issue-52049.nll.stderr
deleted file mode 100644
index 55929d8..0000000
--- a/src/test/ui/issues/issue-52049.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/issue-52049.rs:6:10
- |
-LL | foo(&unpromotable(5u32));
- | -----^^^^^^^^^^^^^^^^^^-
- | | |
- | | creates a temporary which is freed while still in use
- | argument requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-52049.rs b/src/test/ui/issues/issue-52049.rs
index 23b21cf..efdcc44 100644
--- a/src/test/ui/issues/issue-52049.rs
+++ b/src/test/ui/issues/issue-52049.rs
@@ -5,4 +5,4 @@
fn main() {
foo(&unpromotable(5u32));
}
-//~^^ ERROR borrowed value does not live long enough
+//~^^ ERROR temporary value dropped while borrowed
diff --git a/src/test/ui/issues/issue-52049.stderr b/src/test/ui/issues/issue-52049.stderr
index 4538176..55929d8 100644
--- a/src/test/ui/issues/issue-52049.stderr
+++ b/src/test/ui/issues/issue-52049.stderr
@@ -1,13 +1,14 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/issue-52049.rs:6:10
|
LL | foo(&unpromotable(5u32));
- | ^^^^^^^^^^^^^^^^^^ - temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
- = note: borrowed value must be valid for the static lifetime...
+ | -----^^^^^^^^^^^^^^^^^^-
+ | | |
+ | | creates a temporary which is freed while still in use
+ | argument requires that borrow lasts for `'static`
+LL | }
+ | - temporary value is freed at the end of this statement
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr b/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr
deleted file mode 100644
index d231f62..0000000
--- a/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0597]: `line` does not live long enough
- --> $DIR/issue-52126-assign-op-invariance.rs:34:28
- |
-LL | let v: Vec<&str> = line.split_whitespace().collect();
- | ^^^^ borrowed value does not live long enough
-...
-LL | acc += cnt2;
- | --- borrow later used here
-...
-LL | }
- | - `line` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.stderr b/src/test/ui/issues/issue-52126-assign-op-invariance.stderr
index b07b8d5..d231f62 100644
--- a/src/test/ui/issues/issue-52126-assign-op-invariance.stderr
+++ b/src/test/ui/issues/issue-52126-assign-op-invariance.stderr
@@ -4,10 +4,11 @@
LL | let v: Vec<&str> = line.split_whitespace().collect();
| ^^^^ borrowed value does not live long enough
...
+LL | acc += cnt2;
+ | --- borrow later used here
+...
LL | }
| - `line` dropped here while still borrowed
-LL | }
- | - borrowed value needs to live until here
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-52240.nll.stderr b/src/test/ui/issues/issue-52240.nll.stderr
deleted file mode 100644
index 69b663b..0000000
--- a/src/test/ui/issues/issue-52240.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/issue-52240.rs:9:27
- |
-LL | if let (Some(Foo::Bar(ref mut val)), _) = (&arr.get(0), 0) {
- | ^^^^^^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issues/issue-52240.rs b/src/test/ui/issues/issue-52240.rs
index 9ac7e99..5def557 100644
--- a/src/test/ui/issues/issue-52240.rs
+++ b/src/test/ui/issues/issue-52240.rs
@@ -7,7 +7,7 @@
fn main() {
let arr = vec!(Foo::Bar(0));
if let (Some(Foo::Bar(ref mut val)), _) = (&arr.get(0), 0) {
- //~^ ERROR cannot borrow field of immutable binding as mutable
+ //~^ ERROR cannot borrow data in a `&` reference as mutable
*val = 9001;
}
match arr[0] {
diff --git a/src/test/ui/issues/issue-52240.stderr b/src/test/ui/issues/issue-52240.stderr
index c2c2524..69b663b 100644
--- a/src/test/ui/issues/issue-52240.stderr
+++ b/src/test/ui/issues/issue-52240.stderr
@@ -1,8 +1,8 @@
-error[E0596]: cannot borrow field of immutable binding as mutable
+error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/issue-52240.rs:9:27
|
LL | if let (Some(Foo::Bar(ref mut val)), _) = (&arr.get(0), 0) {
- | ^^^^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-5500-1.ast.stderr b/src/test/ui/issues/issue-5500-1.ast.stderr
deleted file mode 100644
index fb0f978..0000000
--- a/src/test/ui/issues/issue-5500-1.ast.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0594]: cannot assign to field `_iter.node` of immutable binding
- --> $DIR/issue-5500-1.rs:12:5
- |
-LL | let _iter = TrieMapIterator{node: &a};
- | ----- help: make this binding mutable: `mut _iter`
-LL | / _iter.node = &
-LL | |
-LL | | // MIR doesn't generate an error because the code isn't reachable. This is OK
-LL | | // because the test is here to check that the compiler doesn't ICE (cf. #5500).
-LL | | panic!()
- | |____________^ cannot mutably borrow field of immutable binding
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-5500-1.mir.stderr b/src/test/ui/issues/issue-5500-1.mir.stderr
deleted file mode 100644
index fbabfbd..0000000
--- a/src/test/ui/issues/issue-5500-1.mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0594]: cannot assign to field `_iter.node` of immutable binding (Ast)
- --> $DIR/issue-5500-1.rs:12:5
- |
-LL | let _iter = TrieMapIterator{node: &a};
- | ----- help: make this binding mutable: `mut _iter`
-LL | / _iter.node = &
-LL | |
-LL | | // MIR doesn't generate an error because the code isn't reachable. This is OK
-LL | | // because the test is here to check that the compiler doesn't ICE (cf. #5500).
-LL | | panic!()
- | |____________^ cannot mutably borrow field of immutable binding
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issues/issue-5500-1.rs b/src/test/ui/issues/issue-5500-1.rs
index e804356..56f5ce9 100644
--- a/src/test/ui/issues/issue-5500-1.rs
+++ b/src/test/ui/issues/issue-5500-1.rs
@@ -1,6 +1,8 @@
-// ignore-compare-mode-nll
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=compare
+// MIR doesn't generate an error because the assignment isn't reachable. This
+// is OK because the test is here to check that the compiler doesn't ICE (cf.
+// #5500).
+
+// compile-pass
struct TrieMapIterator<'a> {
node: &'a usize
@@ -9,9 +11,5 @@
fn main() {
let a = 5;
let _iter = TrieMapIterator{node: &a};
- _iter.node = & //[ast]~ ERROR cannot assign to field `_iter.node` of immutable binding
- //[mir]~^ ERROR cannot assign to field `_iter.node` of immutable binding (Ast)
- // MIR doesn't generate an error because the code isn't reachable. This is OK
- // because the test is here to check that the compiler doesn't ICE (cf. #5500).
- panic!()
+ _iter.node = &panic!()
}
diff --git a/src/test/ui/issues/issue-55511.nll.stderr b/src/test/ui/issues/issue-55511.nll.stderr
deleted file mode 100644
index bf3e58e..0000000
--- a/src/test/ui/issues/issue-55511.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/issue-55511.rs:13:28
- |
-LL | let b = Some(Cell::new(&a));
- | ^^ borrowed value does not live long enough
-...
-LL | <() as Foo<'static>>::C => { }
- | ----------------------- type annotation requires that `a` is borrowed for `'static`
-...
-LL | }
- | - `a` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issues/issue-55511.stderr b/src/test/ui/issues/issue-55511.stderr
index 24668f0..bf3e58e 100644
--- a/src/test/ui/issues/issue-55511.stderr
+++ b/src/test/ui/issues/issue-55511.stderr
@@ -1,13 +1,14 @@
error[E0597]: `a` does not live long enough
- --> $DIR/issue-55511.rs:13:29
+ --> $DIR/issue-55511.rs:13:28
|
LL | let b = Some(Cell::new(&a));
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | <() as Foo<'static>>::C => { }
+ | ----------------------- type annotation requires that `a` is borrowed for `'static`
...
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `a` dropped here while still borrowed
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-6801.nll.stderr b/src/test/ui/issues/issue-6801.nll.stderr
deleted file mode 100644
index dbb8e65..0000000
--- a/src/test/ui/issues/issue-6801.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/issue-6801.rs:19:13
- |
-LL | let sq = || { *x * *x };
- | -- - borrow occurs due to use in closure
- | |
- | borrow of `x` occurs here
-LL |
-LL | twice(x);
- | ^ move out of `x` occurs here
-LL | invoke(sq);
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/issues/issue-6801.stderr b/src/test/ui/issues/issue-6801.stderr
index 482e487..dbb8e65 100644
--- a/src/test/ui/issues/issue-6801.stderr
+++ b/src/test/ui/issues/issue-6801.stderr
@@ -2,10 +2,14 @@
--> $DIR/issue-6801.rs:19:13
|
LL | let sq = || { *x * *x };
- | -- borrow of `x` occurs here
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `x` occurs here
LL |
LL | twice(x);
| ^ move out of `x` occurs here
+LL | invoke(sq);
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr
deleted file mode 100644
index 0e2fc0a..0000000
--- a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/borrowck-let-suggestion.rs:2:17
- |
-LL | let mut x = vec![1].iter();
- | ^^^^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary which is freed while still in use
-LL |
-LL | x.use_mut();
- | - borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
- = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.rs b/src/test/ui/lifetimes/borrowck-let-suggestion.rs
index 1deb0457..3d591a5 100644
--- a/src/test/ui/lifetimes/borrowck-let-suggestion.rs
+++ b/src/test/ui/lifetimes/borrowck-let-suggestion.rs
@@ -1,6 +1,6 @@
fn f() {
let mut x = vec![1].iter();
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
x.use_mut();
}
diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr
index 7a95137..0e2fc0a 100644
--- a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr
+++ b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr
@@ -1,17 +1,17 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/borrowck-let-suggestion.rs:2:17
|
LL | let mut x = vec![1].iter();
- | ^^^^^^^ - temporary value dropped here while still borrowed
+ | ^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
-...
-LL | }
- | - temporary value needs to live until here
+ | creates a temporary which is freed while still in use
+LL |
+LL | x.use_mut();
+ | - borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr
deleted file mode 100644
index 8376ee8..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/liveness-assign-imm-local-in-loop.rs:9:9
- |
-LL | let v: isize;
- | - help: make this binding mutable: `mut v`
-...
-LL | v = 1;
- | ^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr
deleted file mode 100644
index db2a482..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/liveness-assign-imm-local-in-loop.rs:9:9
- |
-LL | v = 1;
- | ^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr
deleted file mode 100644
index 8376ee8..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/liveness-assign-imm-local-in-loop.rs:9:9
- |
-LL | let v: isize;
- | - help: make this binding mutable: `mut v`
-...
-LL | v = 1;
- | ^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs
index 59447ba..c9e1851 100644
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs
@@ -1,16 +1,10 @@
-// revisions: ast mir
-//[mir]compile-flags: -Zborrowck=mir
-
fn test() {
let v: isize;
- //[mir]~^ HELP make this binding mutable
- //[mir]~| SUGGESTION mut v
+ //~^ HELP make this binding mutable
+ //~| SUGGESTION mut v
loop {
- v = 1; //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `v`
- //[ast]~| NOTE cannot assign twice to immutable variable
- //[mir]~| NOTE cannot assign twice to immutable variable
- v.clone(); // just to prevent liveness warnings
+ v = 1; //~ ERROR cannot assign twice to immutable variable `v`
+ //~| NOTE cannot assign twice to immutable variable
}
}
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.stderr
new file mode 100644
index 0000000..69dff73
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.stderr
@@ -0,0 +1,12 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-in-loop.rs:6:9
+ |
+LL | let v: isize;
+ | - help: make this binding mutable: `mut v`
+...
+LL | v = 1;
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr
deleted file mode 100644
index a6a1c73a..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/liveness-assign-imm-local-in-op-eq.rs:10:5
- |
-LL | let v: isize;
- | - help: make this binding mutable: `mut v`
-...
-LL | v = 2;
- | ----- first assignment to `v`
-LL |
-LL | v += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr
deleted file mode 100644
index b287edf..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/liveness-assign-imm-local-in-op-eq.rs:10:5
- |
-LL | v = 2;
- | ----- first assignment to `v`
-LL |
-LL | v += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr
deleted file mode 100644
index a6a1c73a..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/liveness-assign-imm-local-in-op-eq.rs:10:5
- |
-LL | let v: isize;
- | - help: make this binding mutable: `mut v`
-...
-LL | v = 2;
- | ----- first assignment to `v`
-LL |
-LL | v += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs
index a2677f4..f24f7d2 100644
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs
@@ -1,16 +1,10 @@
-// revisions: ast mir
-//[mir]compile-flags: -Zborrowck=mir
-
fn test() {
let v: isize;
- //[mir]~^ HELP make this binding mutable
- //[mir]~| SUGGESTION mut v
- v = 2; //[ast]~ NOTE first assignment
- //[mir]~^ NOTE first assignment
- v += 1; //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `v`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign twice to immutable
+ //~^ HELP make this binding mutable
+ //~| SUGGESTION mut v
+ v = 2; //~ NOTE first assignment
+ v += 1; //~ ERROR cannot assign twice to immutable variable `v`
+ //~| NOTE cannot assign twice to immutable
v.clone();
}
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.stderr
new file mode 100644
index 0000000..182958d
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.stderr
@@ -0,0 +1,14 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-in-op-eq.rs:6:5
+ |
+LL | let v: isize;
+ | - help: make this binding mutable: `mut v`
+...
+LL | v = 2;
+ | ----- first assignment to `v`
+LL | v += 1;
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr
deleted file mode 100644
index 8316ffd..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/liveness-assign-imm-local-with-drop.rs:10:5
- |
-LL | let b = Box::new(1);
- | -
- | |
- | first assignment to `b`
- | help: make this binding mutable: `mut b`
-...
-LL | b = Box::new(2);
- | ^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr
deleted file mode 100644
index 108ca48..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/liveness-assign-imm-local-with-drop.rs:10:5
- |
-LL | let b = Box::new(1);
- | - first assignment to `b`
-...
-LL | b = Box::new(2);
- | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr
deleted file mode 100644
index 8316ffd..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `b`
- --> $DIR/liveness-assign-imm-local-with-drop.rs:10:5
- |
-LL | let b = Box::new(1);
- | -
- | |
- | first assignment to `b`
- | help: make this binding mutable: `mut b`
-...
-LL | b = Box::new(2);
- | ^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs
index 4a81dcd..8963e32 100644
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs
@@ -1,16 +1,10 @@
-// revisions: ast mir
-//[mir]compile-flags: -Zborrowck=mir
-
fn test() {
- let b = Box::new(1); //[ast]~ NOTE first assignment
- //[mir]~^ NOTE first assignment
- //[mir]~| HELP make this binding mutable
- //[mir]~| SUGGESTION mut b
+ let b = Box::new(1); //~ NOTE first assignment
+ //~| HELP make this binding mutable
+ //~| SUGGESTION mut b
drop(b);
- b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `b`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign twice to immutable
+ b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
+ //~| NOTE cannot assign twice to immutable
drop(b);
}
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.stderr
new file mode 100644
index 0000000..7c4af62
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/liveness-assign-imm-local-with-drop.rs:6:5
+ |
+LL | let b = Box::new(1);
+ | -
+ | |
+ | first assignment to `b`
+ | help: make this binding mutable: `mut b`
+...
+LL | b = Box::new(2);
+ | ^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr
deleted file mode 100644
index 5fa06f9..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/liveness-assign-imm-local-with-init.rs:10:5
- |
-LL | let v: isize = 1;
- | -
- | |
- | first assignment to `v`
- | help: make this binding mutable: `mut v`
-...
-LL | v = 2;
- | ^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr
deleted file mode 100644
index 34fb160..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/liveness-assign-imm-local-with-init.rs:10:5
- |
-LL | let v: isize = 1;
- | - first assignment to `v`
-...
-LL | v = 2;
- | ^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr
deleted file mode 100644
index 5fa06f9..0000000
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `v`
- --> $DIR/liveness-assign-imm-local-with-init.rs:10:5
- |
-LL | let v: isize = 1;
- | -
- | |
- | first assignment to `v`
- | help: make this binding mutable: `mut v`
-...
-LL | v = 2;
- | ^^^^^ cannot assign twice to immutable variable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs
index 2c59aaf..4ab222a 100644
--- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs
@@ -1,16 +1,10 @@
-// revisions: ast mir
-//[mir]compile-flags: -Zborrowck=mir
-
fn test() {
- let v: isize = 1; //[ast]~ NOTE first assignment
- //[mir]~^ NOTE first assignment
- //[mir]~| HELP make this binding mutable
- //[mir]~| SUGGESTION mut v
+ let v: isize = 1; //~ NOTE first assignment
+ //~| HELP make this binding mutable
+ //~| SUGGESTION mut v
v.clone();
- v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `v`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign twice to immutable
+ v = 2; //~ ERROR cannot assign twice to immutable variable `v`
+ //~| NOTE cannot assign twice to immutable
v.clone();
}
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.stderr
new file mode 100644
index 0000000..6f5d557
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-with-init.rs:6:5
+ |
+LL | let v: isize = 1;
+ | -
+ | |
+ | first assignment to `v`
+ | help: make this binding mutable: `mut v`
+...
+LL | v = 2;
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr b/src/test/ui/liveness/liveness-move-call-arg.nll.stderr
deleted file mode 100644
index ab4460a..0000000
--- a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/liveness-move-call-arg.rs:9:14
- |
-LL | let x: Box<isize> = box 25;
- | - move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-LL | loop {
-LL | take(x);
- | ^ value moved here, in previous iteration of loop
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/liveness/liveness-move-call-arg.stderr b/src/test/ui/liveness/liveness-move-call-arg.stderr
index c50c01e..ab4460a 100644
--- a/src/test/ui/liveness/liveness-move-call-arg.stderr
+++ b/src/test/ui/liveness/liveness-move-call-arg.stderr
@@ -1,10 +1,11 @@
error[E0382]: use of moved value: `x`
--> $DIR/liveness-move-call-arg.rs:9:14
|
+LL | let x: Box<isize> = box 25;
+ | - move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+LL | loop {
LL | take(x);
- | ^ value moved here in previous iteration of loop
- |
- = note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ | ^ value moved here, in previous iteration of loop
error: aborting due to previous error
diff --git a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr b/src/test/ui/liveness/liveness-move-in-loop.nll.stderr
deleted file mode 100644
index 150c1ec..0000000
--- a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0382]: use of moved value: `y`
- --> $DIR/liveness-move-in-loop.rs:11:25
- |
-LL | let y: Box<isize> = box 42;
- | - move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-...
-LL | x = y;
- | ^ value moved here, in previous iteration of loop
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/liveness/liveness-move-in-loop.stderr b/src/test/ui/liveness/liveness-move-in-loop.stderr
index 52e83a6..150c1ec 100644
--- a/src/test/ui/liveness/liveness-move-in-loop.stderr
+++ b/src/test/ui/liveness/liveness-move-in-loop.stderr
@@ -1,10 +1,11 @@
error[E0382]: use of moved value: `y`
--> $DIR/liveness-move-in-loop.rs:11:25
|
+LL | let y: Box<isize> = box 42;
+ | - move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+...
LL | x = y;
- | ^ value moved here in previous iteration of loop
- |
- = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ | ^ value moved here, in previous iteration of loop
error: aborting due to previous error
diff --git a/src/test/ui/liveness/liveness-move-in-while.nll.stderr b/src/test/ui/liveness/liveness-move-in-while.nll.stderr
deleted file mode 100644
index e1eed1b..0000000
--- a/src/test/ui/liveness/liveness-move-in-while.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0382]: borrow of moved value: `y`
- --> $DIR/liveness-move-in-while.rs:7:24
- |
-LL | let y: Box<isize> = box 42;
- | - move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-...
-LL | println!("{}", y);
- | ^ value borrowed here after move
-LL | while true { while true { while true { x = y; x.clone(); } } }
- | - value moved here, in previous iteration of loop
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/liveness/liveness-move-in-while.rs b/src/test/ui/liveness/liveness-move-in-while.rs
index a43e759..420d131 100644
--- a/src/test/ui/liveness/liveness-move-in-while.rs
+++ b/src/test/ui/liveness/liveness-move-in-while.rs
@@ -4,8 +4,7 @@
let y: Box<isize> = box 42;
let mut x: Box<isize>;
loop {
- println!("{}", y); //~ ERROR use of moved value: `y`
+ println!("{}", y); //~ ERROR borrow of moved value: `y`
while true { while true { while true { x = y; x.clone(); } } }
- //~^ ERROR use of moved value: `y`
}
}
diff --git a/src/test/ui/liveness/liveness-move-in-while.stderr b/src/test/ui/liveness/liveness-move-in-while.stderr
index 61b4cd8..e1eed1b 100644
--- a/src/test/ui/liveness/liveness-move-in-while.stderr
+++ b/src/test/ui/liveness/liveness-move-in-while.stderr
@@ -1,21 +1,14 @@
-error[E0382]: use of moved value: `y`
+error[E0382]: borrow of moved value: `y`
--> $DIR/liveness-move-in-while.rs:7:24
|
+LL | let y: Box<isize> = box 42;
+ | - move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+...
LL | println!("{}", y);
- | ^ value used here after move
+ | ^ value borrowed here after move
LL | while true { while true { while true { x = y; x.clone(); } } }
- | - value moved here
- |
- = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ | - value moved here, in previous iteration of loop
-error[E0382]: use of moved value: `y`
- --> $DIR/liveness-move-in-while.rs:8:52
- |
-LL | while true { while true { while true { x = y; x.clone(); } } }
- | ^ value moved here in previous iteration of loop
- |
- = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/liveness/liveness-use-after-move.nll.stderr b/src/test/ui/liveness/liveness-use-after-move.nll.stderr
deleted file mode 100644
index 383b89a..0000000
--- a/src/test/ui/liveness/liveness-use-after-move.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/liveness-use-after-move.rs:6:20
- |
-LL | let x: Box<_> = box 5;
- | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-LL | let y = x;
- | - value moved here
-LL | println!("{}", *x);
- | ^^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/liveness/liveness-use-after-move.rs b/src/test/ui/liveness/liveness-use-after-move.rs
index 157587c..5263e29 100644
--- a/src/test/ui/liveness/liveness-use-after-move.rs
+++ b/src/test/ui/liveness/liveness-use-after-move.rs
@@ -3,6 +3,6 @@
fn main() {
let x: Box<_> = box 5;
let y = x;
- println!("{}", *x); //~ ERROR use of moved value: `*x`
+ println!("{}", *x); //~ ERROR borrow of moved value: `x`
y.clone();
}
diff --git a/src/test/ui/liveness/liveness-use-after-move.stderr b/src/test/ui/liveness/liveness-use-after-move.stderr
index ce192ae..383b89a 100644
--- a/src/test/ui/liveness/liveness-use-after-move.stderr
+++ b/src/test/ui/liveness/liveness-use-after-move.stderr
@@ -1,12 +1,12 @@
-error[E0382]: use of moved value: `*x`
+error[E0382]: borrow of moved value: `x`
--> $DIR/liveness-use-after-move.rs:6:20
|
+LL | let x: Box<_> = box 5;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | let y = x;
- | - value moved here
+ | - value moved here
LL | println!("{}", *x);
- | ^^ value used here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
error: aborting due to previous error
diff --git a/src/test/ui/liveness/liveness-use-after-send.nll.stderr b/src/test/ui/liveness/liveness-use-after-send.nll.stderr
deleted file mode 100644
index ccf9499..0000000
--- a/src/test/ui/liveness/liveness-use-after-send.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: borrow of moved value: `message`
- --> $DIR/liveness-use-after-send.rs:16:20
- |
-LL | fn test00_start(ch: Chan<Box<isize>>, message: Box<isize>, _count: Box<isize>) {
- | ------- move occurs because `message` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-LL | send(ch, message);
- | ------- value moved here
-LL | println!("{}", message);
- | ^^^^^^^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/liveness/liveness-use-after-send.rs b/src/test/ui/liveness/liveness-use-after-send.rs
index 7f2cc3c..6fcd91a 100644
--- a/src/test/ui/liveness/liveness-use-after-send.rs
+++ b/src/test/ui/liveness/liveness-use-after-send.rs
@@ -13,7 +13,7 @@
// message after the send deinitializes it
fn test00_start(ch: Chan<Box<isize>>, message: Box<isize>, _count: Box<isize>) {
send(ch, message);
- println!("{}", message); //~ ERROR use of moved value: `message`
+ println!("{}", message); //~ ERROR borrow of moved value: `message`
}
fn main() { panic!(); }
diff --git a/src/test/ui/liveness/liveness-use-after-send.stderr b/src/test/ui/liveness/liveness-use-after-send.stderr
index 2817328..ccf9499 100644
--- a/src/test/ui/liveness/liveness-use-after-send.stderr
+++ b/src/test/ui/liveness/liveness-use-after-send.stderr
@@ -1,12 +1,12 @@
-error[E0382]: use of moved value: `message`
+error[E0382]: borrow of moved value: `message`
--> $DIR/liveness-use-after-send.rs:16:20
|
+LL | fn test00_start(ch: Chan<Box<isize>>, message: Box<isize>, _count: Box<isize>) {
+ | ------- move occurs because `message` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
LL | send(ch, message);
| ------- value moved here
LL | println!("{}", message);
- | ^^^^^^^ value used here after move
- |
- = note: move occurs because `message` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ | ^^^^^^^ value borrowed here after move
error: aborting due to previous error
diff --git a/src/test/ui/loops/loop-proper-liveness.nll.stderr b/src/test/ui/loops/loop-proper-liveness.nll.stderr
deleted file mode 100644
index c877206..0000000
--- a/src/test/ui/loops/loop-proper-liveness.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: borrow of possibly uninitialized variable: `x`
- --> $DIR/loop-proper-liveness.rs:9:22
- |
-LL | println!("{:?}", x);
- | ^ use of possibly uninitialized `x`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/loops/loop-proper-liveness.rs b/src/test/ui/loops/loop-proper-liveness.rs
index fd9d661..b8f76fb 100644
--- a/src/test/ui/loops/loop-proper-liveness.rs
+++ b/src/test/ui/loops/loop-proper-liveness.rs
@@ -6,7 +6,7 @@
'a: loop {
x = loop { break 'a };
}
- println!("{:?}", x); //~ ERROR use of possibly uninitialized variable
+ println!("{:?}", x); //~ ERROR borrow of possibly uninitialized variable
}
// test2 and test3 should not fail.
diff --git a/src/test/ui/loops/loop-proper-liveness.stderr b/src/test/ui/loops/loop-proper-liveness.stderr
index 392b961..c877206 100644
--- a/src/test/ui/loops/loop-proper-liveness.stderr
+++ b/src/test/ui/loops/loop-proper-liveness.stderr
@@ -1,4 +1,4 @@
-error[E0381]: use of possibly uninitialized variable: `x`
+error[E0381]: borrow of possibly uninitialized variable: `x`
--> $DIR/loop-proper-liveness.rs:9:22
|
LL | println!("{:?}", x);
diff --git a/src/test/ui/macros/span-covering-argument-1.nll.stderr b/src/test/ui/macros/span-covering-argument-1.nll.stderr
deleted file mode 100644
index 2ac8811..0000000
--- a/src/test/ui/macros/span-covering-argument-1.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0596]: cannot borrow `foo` as mutable, as it is not declared as mutable
- --> $DIR/span-covering-argument-1.rs:5:14
- |
-LL | let $s = 0;
- | -- help: consider changing this to be mutable: `mut foo`
-LL | *&mut $s = 0;
- | ^^^^^^^ cannot borrow as mutable
-...
-LL | bad!(foo whatever);
- | ------------------- in this macro invocation
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/macros/span-covering-argument-1.rs b/src/test/ui/macros/span-covering-argument-1.rs
index 0256aaf..9b9506c 100644
--- a/src/test/ui/macros/span-covering-argument-1.rs
+++ b/src/test/ui/macros/span-covering-argument-1.rs
@@ -3,7 +3,7 @@
{
let $s = 0;
*&mut $s = 0;
- //~^ ERROR cannot borrow immutable local variable `foo` as mutable [E0596]
+ //~^ ERROR cannot borrow `foo` as mutable, as it is not declared as mutable [E0596]
}
}
}
diff --git a/src/test/ui/macros/span-covering-argument-1.stderr b/src/test/ui/macros/span-covering-argument-1.stderr
index 345b880..2ac8811 100644
--- a/src/test/ui/macros/span-covering-argument-1.stderr
+++ b/src/test/ui/macros/span-covering-argument-1.stderr
@@ -1,10 +1,10 @@
-error[E0596]: cannot borrow immutable local variable `foo` as mutable
- --> $DIR/span-covering-argument-1.rs:5:19
+error[E0596]: cannot borrow `foo` as mutable, as it is not declared as mutable
+ --> $DIR/span-covering-argument-1.rs:5:14
|
LL | let $s = 0;
- | -- help: make this binding mutable: `mut $s`
+ | -- help: consider changing this to be mutable: `mut foo`
LL | *&mut $s = 0;
- | ^^ cannot borrow mutably
+ | ^^^^^^^ cannot borrow as mutable
...
LL | bad!(foo whatever);
| ------------------- in this macro invocation
diff --git a/src/test/ui/methods/method-self-arg-2.nll.stderr b/src/test/ui/methods/method-self-arg-2.nll.stderr
deleted file mode 100644
index 946e71e..0000000
--- a/src/test/ui/methods/method-self-arg-2.nll.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/method-self-arg-2.rs:15:14
- |
-LL | let y = &mut x;
- | ------ mutable borrow occurs here
-LL | Foo::bar(&x);
- | ^^ immutable borrow occurs here
-LL | y.use_mut();
- | - mutable borrow later used here
-
-error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/method-self-arg-2.rs:20:14
- |
-LL | let y = &mut x;
- | ------ first mutable borrow occurs here
-LL | Foo::baz(&mut x);
- | ^^^^^^ second mutable borrow occurs here
-LL | y.use_mut();
- | - first borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0499, E0502.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/methods/method-self-arg-2.stderr b/src/test/ui/methods/method-self-arg-2.stderr
index c2f7032..946e71e 100644
--- a/src/test/ui/methods/method-self-arg-2.stderr
+++ b/src/test/ui/methods/method-self-arg-2.stderr
@@ -1,24 +1,22 @@
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/method-self-arg-2.rs:15:15
+ --> $DIR/method-self-arg-2.rs:15:14
|
LL | let y = &mut x;
- | - mutable borrow occurs here
+ | ------ mutable borrow occurs here
LL | Foo::bar(&x);
- | ^ immutable borrow occurs here
-...
-LL | }
- | - mutable borrow ends here
+ | ^^ immutable borrow occurs here
+LL | y.use_mut();
+ | - mutable borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
- --> $DIR/method-self-arg-2.rs:20:19
+ --> $DIR/method-self-arg-2.rs:20:14
|
LL | let y = &mut x;
- | - first mutable borrow occurs here
+ | ------ first mutable borrow occurs here
LL | Foo::baz(&mut x);
- | ^ second mutable borrow occurs here
+ | ^^^^^^ second mutable borrow occurs here
LL | y.use_mut();
-LL | }
- | - first borrow ends here
+ | - first borrow later used here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/moves/move-guard-same-consts.nll.stderr b/src/test/ui/moves/move-guard-same-consts.nll.stderr
deleted file mode 100644
index 0945fbe..0000000
--- a/src/test/ui/moves/move-guard-same-consts.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/move-guard-same-consts.rs:20:24
- |
-LL | let x: Box<_> = box 1;
- | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-...
-LL | (1, 2) if take(x) => (),
- | - value moved here
-LL | (1, 2) if take(x) => (),
- | ^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/move-guard-same-consts.stderr b/src/test/ui/moves/move-guard-same-consts.stderr
index 65f6f12..0945fbe 100644
--- a/src/test/ui/moves/move-guard-same-consts.stderr
+++ b/src/test/ui/moves/move-guard-same-consts.stderr
@@ -1,12 +1,13 @@
error[E0382]: use of moved value: `x`
--> $DIR/move-guard-same-consts.rs:20:24
|
+LL | let x: Box<_> = box 1;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+...
LL | (1, 2) if take(x) => (),
| - value moved here
LL | (1, 2) if take(x) => (),
| ^ value used here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/moves/move-in-guard-1.nll.stderr b/src/test/ui/moves/move-in-guard-1.nll.stderr
deleted file mode 100644
index 542fd16..0000000
--- a/src/test/ui/moves/move-in-guard-1.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/move-in-guard-1.rs:10:24
- |
-LL | let x: Box<_> = box 1;
- | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-...
-LL | (1, _) if take(x) => (),
- | - value moved here
-LL | (_, 2) if take(x) => (),
- | ^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/move-in-guard-1.stderr b/src/test/ui/moves/move-in-guard-1.stderr
index af49fa8..542fd16 100644
--- a/src/test/ui/moves/move-in-guard-1.stderr
+++ b/src/test/ui/moves/move-in-guard-1.stderr
@@ -1,12 +1,13 @@
error[E0382]: use of moved value: `x`
--> $DIR/move-in-guard-1.rs:10:24
|
+LL | let x: Box<_> = box 1;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+...
LL | (1, _) if take(x) => (),
| - value moved here
LL | (_, 2) if take(x) => (),
| ^ value used here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/moves/move-in-guard-2.nll.stderr b/src/test/ui/moves/move-in-guard-2.nll.stderr
deleted file mode 100644
index 8bd4052..0000000
--- a/src/test/ui/moves/move-in-guard-2.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/move-in-guard-2.rs:10:24
- |
-LL | let x: Box<_> = box 1;
- | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-...
-LL | (_, 2) if take(x) => (),
- | ^ value moved here, in previous iteration of loop
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/move-in-guard-2.stderr b/src/test/ui/moves/move-in-guard-2.stderr
index 5228abe..8bd4052 100644
--- a/src/test/ui/moves/move-in-guard-2.stderr
+++ b/src/test/ui/moves/move-in-guard-2.stderr
@@ -1,10 +1,11 @@
error[E0382]: use of moved value: `x`
--> $DIR/move-in-guard-2.rs:10:24
|
+LL | let x: Box<_> = box 1;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+...
LL | (_, 2) if take(x) => (),
- | ^ value moved here in previous iteration of loop
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+ | ^ value moved here, in previous iteration of loop
error: aborting due to previous error
diff --git a/src/test/ui/moves/move-into-dead-array-1.nll.stderr b/src/test/ui/moves/move-into-dead-array-1.nll.stderr
deleted file mode 100644
index 33da0e54..0000000
--- a/src/test/ui/moves/move-into-dead-array-1.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0381]: use of possibly uninitialized variable: `a`
- --> $DIR/move-into-dead-array-1.rs:14:5
- |
-LL | a[i] = d();
- | ^^^^ use of possibly uninitialized `a`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/moves/move-into-dead-array-1.stderr b/src/test/ui/moves/move-into-dead-array-1.stderr
index 3a1bbe9..33da0e54 100644
--- a/src/test/ui/moves/move-into-dead-array-1.stderr
+++ b/src/test/ui/moves/move-into-dead-array-1.stderr
@@ -2,7 +2,7 @@
--> $DIR/move-into-dead-array-1.rs:14:5
|
LL | a[i] = d();
- | ^^^^^^^^^^ use of possibly uninitialized `a`
+ | ^^^^ use of possibly uninitialized `a`
error: aborting due to previous error
diff --git a/src/test/ui/moves/move-into-dead-array-2.nll.stderr b/src/test/ui/moves/move-into-dead-array-2.nll.stderr
deleted file mode 100644
index 19e476c..0000000
--- a/src/test/ui/moves/move-into-dead-array-2.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: use of moved value: `a`
- --> $DIR/move-into-dead-array-2.rs:14:5
- |
-LL | fn foo(mut a: [D; 4], i: usize) {
- | ----- move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait
-LL | drop(a);
- | - value moved here
-LL | a[i] = d();
- | ^^^^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/move-into-dead-array-2.stderr b/src/test/ui/moves/move-into-dead-array-2.stderr
index 4521fa9..19e476c 100644
--- a/src/test/ui/moves/move-into-dead-array-2.stderr
+++ b/src/test/ui/moves/move-into-dead-array-2.stderr
@@ -1,12 +1,12 @@
error[E0382]: use of moved value: `a`
--> $DIR/move-into-dead-array-2.rs:14:5
|
+LL | fn foo(mut a: [D; 4], i: usize) {
+ | ----- move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait
LL | drop(a);
| - value moved here
LL | a[i] = d();
- | ^^^^^^^^^^ value used here after move
- |
- = note: move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait
+ | ^^^^ value used here after move
error: aborting due to previous error
diff --git a/src/test/ui/moves/move-out-of-slice-1.nll.stderr b/src/test/ui/moves/move-out-of-slice-1.nll.stderr
deleted file mode 100644
index b4b1fe9..0000000
--- a/src/test/ui/moves/move-out-of-slice-1.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0508]: cannot move out of type `[A]`, a non-copy slice
- --> $DIR/move-out-of-slice-1.rs:7:11
- |
-LL | match a {
- | ^ cannot move out of here
-LL | box [a] => {},
- | - data moved here
- |
-note: move occurs because `a` has type `A`, which does not implement the `Copy` trait
- --> $DIR/move-out-of-slice-1.rs:8:14
- |
-LL | box [a] => {},
- | ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/moves/move-out-of-slice-1.rs b/src/test/ui/moves/move-out-of-slice-1.rs
index 3e09060..982648f 100644
--- a/src/test/ui/moves/move-out-of-slice-1.rs
+++ b/src/test/ui/moves/move-out-of-slice-1.rs
@@ -4,8 +4,8 @@
fn main() {
let a: Box<[A]> = Box::new([A]);
- match a {
- box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice
+ match a { //~ ERROR cannot move out of type `[A]`, a non-copy slice
+ box [a] => {},
_ => {}
}
}
diff --git a/src/test/ui/moves/move-out-of-slice-1.stderr b/src/test/ui/moves/move-out-of-slice-1.stderr
index f84e3a3..b4b1fe9 100644
--- a/src/test/ui/moves/move-out-of-slice-1.stderr
+++ b/src/test/ui/moves/move-out-of-slice-1.stderr
@@ -1,11 +1,16 @@
error[E0508]: cannot move out of type `[A]`, a non-copy slice
- --> $DIR/move-out-of-slice-1.rs:8:13
+ --> $DIR/move-out-of-slice-1.rs:7:11
+ |
+LL | match a {
+ | ^ cannot move out of here
+LL | box [a] => {},
+ | - data moved here
+ |
+note: move occurs because `a` has type `A`, which does not implement the `Copy` trait
+ --> $DIR/move-out-of-slice-1.rs:8:14
|
LL | box [a] => {},
- | ^-^
- | ||
- | |hint: to prevent move, use `ref a` or `ref mut a`
- | cannot move out of here
+ | ^
error: aborting due to previous error
diff --git a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr
deleted file mode 100644
index 888ef33..0000000
--- a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error[E0382]: use of moved value: `x.0`
- --> $DIR/move-out-of-tuple-field.rs:8:13
- |
-LL | let y = x.0;
- | --- value moved here
-LL | let z = x.0;
- | ^^^ value used here after move
- |
- = note: move occurs because `x.0` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `x.0`
- --> $DIR/move-out-of-tuple-field.rs:12:13
- |
-LL | let y = x.0;
- | --- value moved here
-LL | let z = x.0;
- | ^^^ value used here after move
- |
- = note: move occurs because `x.0` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/move-out-of-tuple-field.stderr b/src/test/ui/moves/move-out-of-tuple-field.stderr
index 89662c8..888ef33 100644
--- a/src/test/ui/moves/move-out-of-tuple-field.stderr
+++ b/src/test/ui/moves/move-out-of-tuple-field.stderr
@@ -1,20 +1,20 @@
error[E0382]: use of moved value: `x.0`
- --> $DIR/move-out-of-tuple-field.rs:8:9
+ --> $DIR/move-out-of-tuple-field.rs:8:13
|
LL | let y = x.0;
- | - value moved here
+ | --- value moved here
LL | let z = x.0;
- | ^ value used here after move
+ | ^^^ value used here after move
|
= note: move occurs because `x.0` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x.0`
- --> $DIR/move-out-of-tuple-field.rs:12:9
+ --> $DIR/move-out-of-tuple-field.rs:12:13
|
LL | let y = x.0;
- | - value moved here
+ | --- value moved here
LL | let z = x.0;
- | ^ value used here after move
+ | ^^^ value used here after move
|
= note: move occurs because `x.0` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr
deleted file mode 100644
index 71a3c45..0000000
--- a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-access-to-field.rs:11:12
- |
-LL | let x = vec!["hi".to_string()];
- | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
-LL | consume(x.into_iter().next().unwrap());
- | - value moved here
-LL | touch(&x[0]);
- | ^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.rs b/src/test/ui/moves/moves-based-on-type-access-to-field.rs
index c7ea357..e2003ed 100644
--- a/src/test/ui/moves/moves-based-on-type-access-to-field.rs
+++ b/src/test/ui/moves/moves-based-on-type-access-to-field.rs
@@ -8,7 +8,7 @@
fn f20() {
let x = vec!["hi".to_string()];
consume(x.into_iter().next().unwrap());
- touch(&x[0]); //~ ERROR use of moved value: `x`
+ touch(&x[0]); //~ ERROR borrow of moved value: `x`
}
fn main() {}
diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr
index ed4d69f..71a3c45 100644
--- a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr
+++ b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr
@@ -1,12 +1,12 @@
-error[E0382]: use of moved value: `x`
+error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-access-to-field.rs:11:12
|
+LL | let x = vec!["hi".to_string()];
+ | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
LL | consume(x.into_iter().next().unwrap());
| - value moved here
LL | touch(&x[0]);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
+ | ^ value borrowed here after move
error: aborting due to previous error
diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr
deleted file mode 100644
index b83a15c..0000000
--- a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/moves-based-on-type-block-bad.rs:24:19
- |
-LL | match hellothere.x {
- | ^^^^^^^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider borrowing here: `&hellothere.x`
-...
-LL | box E::Bar(x) => println!("{}", x.to_string()),
- | - data moved here
- |
-note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
- --> $DIR/moves-based-on-type-block-bad.rs:27:28
- |
-LL | box E::Bar(x) => println!("{}", x.to_string()),
- | ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.stderr
index f5328ed..b83a15c 100644
--- a/src/test/ui/moves/moves-based-on-type-block-bad.stderr
+++ b/src/test/ui/moves/moves-based-on-type-block-bad.stderr
@@ -2,10 +2,19 @@
--> $DIR/moves-based-on-type-block-bad.rs:24:19
|
LL | match hellothere.x {
- | ^^^^^^^^^^ cannot move out of borrowed content
+ | ^^^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&hellothere.x`
...
LL | box E::Bar(x) => println!("{}", x.to_string()),
- | - hint: to prevent move, use `ref x` or `ref mut x`
+ | - data moved here
+ |
+note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/moves-based-on-type-block-bad.rs:27:28
+ |
+LL | box E::Bar(x) => println!("{}", x.to_string()),
+ | ^
error: aborting due to previous error
diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr
deleted file mode 100644
index 3a05a13..0000000
--- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-capture-clause-bad.rs:8:20
- |
-LL | let x = "Hello world!".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-LL | thread::spawn(move|| {
- | ------ value moved into closure here
-LL | println!("{}", x);
- | - variable moved due to use in closure
-LL | });
-LL | println!("{}", x);
- | ^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs
index d5f44a0..b2f6835 100644
--- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs
+++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs
@@ -5,5 +5,5 @@
thread::spawn(move|| {
println!("{}", x);
});
- println!("{}", x); //~ ERROR use of moved value
+ println!("{}", x); //~ ERROR borrow of moved value
}
diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr
index 39119ff..3a05a13 100644
--- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr
+++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr
@@ -1,13 +1,15 @@
-error[E0382]: use of moved value: `x`
+error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-capture-clause-bad.rs:8:20
|
+LL | let x = "Hello world!".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | thread::spawn(move|| {
- | ------ value moved (into closure) here
-...
+ | ------ value moved into closure here
+LL | println!("{}", x);
+ | - variable moved due to use in closure
+LL | });
LL | println!("{}", x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^ value borrowed here after move
error: aborting due to previous error
diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr
deleted file mode 100644
index fb8562d..0000000
--- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0382]: use of moved value: `node`
- --> $DIR/moves-based-on-type-cyclic-types-issue-4821.rs:13:13
- |
-LL | Some(right) => consume(right),
- | ----- value moved here
-...
-LL | consume(node) + r
- | ^^^^ value used here after partial move
- |
- = note: move occurs because value has type `std::boxed::Box<List>`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs
index 4417fb9..b070671 100644
--- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs
+++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs
@@ -10,7 +10,7 @@
Some(right) => consume(right),
None => 0
};
- consume(node) + r //~ ERROR use of partially moved value: `node`
+ consume(node) + r //~ ERROR use of moved value: `node`
}
fn consume(v: Box<List>) -> isize {
diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr
index 8b904c7..fb8562d 100644
--- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr
+++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr
@@ -1,13 +1,13 @@
-error[E0382]: use of partially moved value: `node`
+error[E0382]: use of moved value: `node`
--> $DIR/moves-based-on-type-cyclic-types-issue-4821.rs:13:13
|
LL | Some(right) => consume(right),
| ----- value moved here
...
LL | consume(node) + r
- | ^^^^ value used here after move
+ | ^^^^ value used here after partial move
|
- = note: move occurs because the value has type `std::boxed::Box<List>`, which does not implement the `Copy` trait
+ = note: move occurs because value has type `std::boxed::Box<List>`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr
deleted file mode 100644
index 25f88fe..0000000
--- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:11:11
- |
-LL | let x = "hi".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-LL | let _y = Foo { f:x };
- | - value moved here
-LL |
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:20:11
- |
-LL | let x = "hi".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-LL | let _y = Foo { f:(((x))) };
- | ------- value moved here
-LL |
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs
index 7c7ca00..0b44ca5 100644
--- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs
+++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs
@@ -6,20 +6,20 @@
fn f00() {
let x = "hi".to_string();
+ //~^ NOTE move occurs because `x` has type `std::string::String`
let _y = Foo { f:x };
//~^ NOTE value moved here
- touch(&x); //~ ERROR use of moved value: `x`
- //~^ NOTE value used here after move
- //~| NOTE move occurs because `x` has type `std::string::String`
+ touch(&x); //~ ERROR borrow of moved value: `x`
+ //~^ NOTE value borrowed here after move
}
fn f05() {
let x = "hi".to_string();
+ //~^ NOTE move occurs because `x` has type `std::string::String`
let _y = Foo { f:(((x))) };
//~^ NOTE value moved here
- touch(&x); //~ ERROR use of moved value: `x`
- //~^ NOTE value used here after move
- //~| NOTE move occurs because `x` has type `std::string::String`
+ touch(&x); //~ ERROR borrow of moved value: `x`
+ //~^ NOTE value borrowed here after move
}
fn f10() {
diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr
index edf521a..d7a7cea 100644
--- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr
+++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr
@@ -1,24 +1,26 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:11:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:12:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+LL |
LL | let _y = Foo { f:x };
| - value moved here
LL |
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:20:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:21:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+LL |
LL | let _y = Foo { f:(((x))) };
| ------- value moved here
LL |
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
error: aborting due to 2 previous errors
diff --git a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr
deleted file mode 100644
index 67fae60..0000000
--- a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr
+++ /dev/null
@@ -1,123 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:12:11
- |
-LL | let x = "hi".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-LL | let _y = Foo { f:x };
- | - value moved here
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:18:11
- |
-LL | let x = "hi".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-LL | let _y = (x, 3);
- | - value moved here
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:35:11
- |
-LL | let x = "hi".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-...
-LL | x
- | - value moved here
-...
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `y`
- --> $DIR/moves-based-on-type-exprs.rs:36:11
- |
-LL | let y = "ho".to_string();
- | - move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
-...
-LL | y
- | - value moved here
-...
-LL | touch(&y);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:46:11
- |
-LL | let x = "hi".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-...
-LL | true => x,
- | - value moved here
-...
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `y`
- --> $DIR/moves-based-on-type-exprs.rs:47:11
- |
-LL | let y = "ho".to_string();
- | - move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
-...
-LL | false => y
- | - value moved here
-...
-LL | touch(&y);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:58:11
- |
-LL | let x = "hi".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-...
-LL | _ if guard(x) => 10,
- | - value moved here
-...
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:65:11
- |
-LL | let x = "hi".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-LL | let _y = [x];
- | - value moved here
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:71:11
- |
-LL | let x = "hi".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-LL | let _y = vec![x];
- | - value moved here
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:77:11
- |
-LL | let x = vec!["hi".to_string()];
- | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
-LL | let _y = x.into_iter().next().unwrap();
- | - value moved here
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:83:11
- |
-LL | let x = vec!["hi".to_string()];
- | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
-LL | let _y = [x.into_iter().next().unwrap(); 1];
- | - value moved here
-LL | touch(&x);
- | ^^ value borrowed here after move
-
-error: aborting due to 11 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-exprs.rs b/src/test/ui/moves/moves-based-on-type-exprs.rs
index b058f83..4a52d8d 100644
--- a/src/test/ui/moves/moves-based-on-type-exprs.rs
+++ b/src/test/ui/moves/moves-based-on-type-exprs.rs
@@ -9,13 +9,13 @@
fn f10() {
let x = "hi".to_string();
let _y = Foo { f:x };
- touch(&x); //~ ERROR use of moved value: `x`
+ touch(&x); //~ ERROR borrow of moved value: `x`
}
fn f20() {
let x = "hi".to_string();
let _y = (x, 3);
- touch(&x); //~ ERROR use of moved value: `x`
+ touch(&x); //~ ERROR borrow of moved value: `x`
}
fn f21() {
@@ -32,8 +32,8 @@
} else {
y
};
- touch(&x); //~ ERROR use of moved value: `x`
- touch(&y); //~ ERROR use of moved value: `y`
+ touch(&x); //~ ERROR borrow of moved value: `x`
+ touch(&y); //~ ERROR borrow of moved value: `y`
}
fn f40(cond: bool) {
@@ -43,8 +43,8 @@
true => x,
false => y
};
- touch(&x); //~ ERROR use of moved value: `x`
- touch(&y); //~ ERROR use of moved value: `y`
+ touch(&x); //~ ERROR borrow of moved value: `x`
+ touch(&y); //~ ERROR borrow of moved value: `y`
}
fn f50(cond: bool) {
@@ -55,32 +55,32 @@
true => 10,
false => 20,
};
- touch(&x); //~ ERROR use of moved value: `x`
+ touch(&x); //~ ERROR borrow of moved value: `x`
touch(&y);
}
fn f70() {
let x = "hi".to_string();
let _y = [x];
- touch(&x); //~ ERROR use of moved value: `x`
+ touch(&x); //~ ERROR borrow of moved value: `x`
}
fn f80() {
let x = "hi".to_string();
let _y = vec![x];
- touch(&x); //~ ERROR use of moved value: `x`
+ touch(&x); //~ ERROR borrow of moved value: `x`
}
fn f100() {
let x = vec!["hi".to_string()];
let _y = x.into_iter().next().unwrap();
- touch(&x); //~ ERROR use of moved value: `x`
+ touch(&x); //~ ERROR borrow of moved value: `x`
}
fn f110() {
let x = vec!["hi".to_string()];
let _y = [x.into_iter().next().unwrap(); 1];
- touch(&x); //~ ERROR use of moved value: `x`
+ touch(&x); //~ ERROR borrow of moved value: `x`
}
fn f120() {
diff --git a/src/test/ui/moves/moves-based-on-type-exprs.stderr b/src/test/ui/moves/moves-based-on-type-exprs.stderr
index 6cb297c..67fae60 100644
--- a/src/test/ui/moves/moves-based-on-type-exprs.stderr
+++ b/src/test/ui/moves/moves-based-on-type-exprs.stderr
@@ -1,117 +1,122 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:12:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:12:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = Foo { f:x };
| - value moved here
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:18:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:18:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = (x, 3);
| - value moved here
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:35:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:35:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | x
| - value moved here
...
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `y`
- --> $DIR/moves-based-on-type-exprs.rs:36:12
+error[E0382]: borrow of moved value: `y`
+ --> $DIR/moves-based-on-type-exprs.rs:36:11
|
+LL | let y = "ho".to_string();
+ | - move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | y
| - value moved here
...
LL | touch(&y);
- | ^ value used here after move
- |
- = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:46:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:46:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | true => x,
| - value moved here
...
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `y`
- --> $DIR/moves-based-on-type-exprs.rs:47:12
+error[E0382]: borrow of moved value: `y`
+ --> $DIR/moves-based-on-type-exprs.rs:47:11
|
+LL | let y = "ho".to_string();
+ | - move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | false => y
| - value moved here
...
LL | touch(&y);
- | ^ value used here after move
- |
- = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:58:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:58:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | _ if guard(x) => 10,
| - value moved here
...
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:65:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:65:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = [x];
| - value moved here
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:71:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:71:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = vec![x];
| - value moved here
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:77:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:77:11
|
+LL | let x = vec!["hi".to_string()];
+ | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
LL | let _y = x.into_iter().next().unwrap();
| - value moved here
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/moves-based-on-type-exprs.rs:83:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:83:11
|
+LL | let x = vec!["hi".to_string()];
+ | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
LL | let _y = [x.into_iter().next().unwrap(); 1];
| - value moved here
LL | touch(&x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
error: aborting due to 11 previous errors
diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr
deleted file mode 100644
index 322999a..0000000
--- a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/moves-based-on-type-match-bindings.rs:16:11
- |
-LL | Foo {f} => {}
- | - value moved here
-...
-LL | touch(&x);
- | ^^ value borrowed here after partial move
- |
- = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.rs b/src/test/ui/moves/moves-based-on-type-match-bindings.rs
index 59e5a8f..1290d4a 100644
--- a/src/test/ui/moves/moves-based-on-type-match-bindings.rs
+++ b/src/test/ui/moves/moves-based-on-type-match-bindings.rs
@@ -13,8 +13,8 @@
Foo {f} => {}
};
- touch(&x); //~ ERROR use of partially moved value: `x`
- //~^ value used here after move
+ touch(&x); //~ ERROR borrow of moved value: `x`
+ //~^ value borrowed here after partial move
//~| move occurs because `x.f` has type `std::string::String`
}
diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr
index 9174cfa..322999a 100644
--- a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr
+++ b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr
@@ -1,11 +1,11 @@
-error[E0382]: use of partially moved value: `x`
- --> $DIR/moves-based-on-type-match-bindings.rs:16:12
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-match-bindings.rs:16:11
|
LL | Foo {f} => {}
| - value moved here
...
LL | touch(&x);
- | ^ value used here after move
+ | ^^ value borrowed here after partial move
|
= note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait
diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr
deleted file mode 100644
index 0568a2e..0000000
--- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0507]: cannot move out of captured variable in an `Fn` closure
- --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:11:28
- |
-LL | let i = box 3;
- | - captured outer variable
-LL | let _f = to_fn(|| test(i));
- | ^ cannot move out of captured variable in an `Fn` closure
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr
index 654881d..0568a2e 100644
--- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr
+++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr
@@ -1,10 +1,10 @@
-error[E0507]: cannot move out of captured outer variable in an `Fn` closure
+error[E0507]: cannot move out of captured variable in an `Fn` closure
--> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:11:28
|
LL | let i = box 3;
| - captured outer variable
LL | let _f = to_fn(|| test(i));
- | ^ cannot move out of captured outer variable in an `Fn` closure
+ | ^ cannot move out of captured variable in an `Fn` closure
error: aborting due to previous error
diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr
deleted file mode 100644
index 483c364..0000000
--- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0499]: cannot borrow `*f` as mutable more than once at a time
- --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:20:27
- |
-LL | (f.c)(f, true);
- | ----- ^ second mutable borrow occurs here
- | |
- | first mutable borrow occurs here
- | first borrow later used by call
-
-error[E0382]: borrow of moved value: `f`
- --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:32:5
- |
-LL | fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) {
- | - ----- move occurs because `f` has type `F`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | let mut r = R {c: Box::new(f)};
- | - value moved here
-LL | f(&mut r, false)
- | ^ value borrowed here after move
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0382, E0499.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs
index 737a131..3fa1187 100644
--- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs
+++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs
@@ -29,7 +29,7 @@
fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) {
let mut r = R {c: Box::new(f)};
- f(&mut r, false) //~ ERROR use of moved value
+ f(&mut r, false) //~ ERROR borrow of moved value
}
fn main() { innocent_looking_victim() }
diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr
index bdc7365..483c364 100644
--- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr
+++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr
@@ -2,20 +2,22 @@
--> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:20:27
|
LL | (f.c)(f, true);
- | ----- ^ - first borrow ends here
- | | |
- | | second mutable borrow occurs here
+ | ----- ^ second mutable borrow occurs here
+ | |
| first mutable borrow occurs here
+ | first borrow later used by call
-error[E0382]: use of moved value: `f`
+error[E0382]: borrow of moved value: `f`
--> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:32:5
|
+LL | fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) {
+ | - ----- move occurs because `f` has type `F`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | let mut r = R {c: Box::new(f)};
| - value moved here
LL | f(&mut r, false)
- | ^ value used here after move
- |
- = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
+ | ^ value borrowed here after move
error: aborting due to 2 previous errors
diff --git a/src/test/ui/moves/moves-sru-moved-field.nll.stderr b/src/test/ui/moves/moves-sru-moved-field.nll.stderr
deleted file mode 100644
index a012c2d..0000000
--- a/src/test/ui/moves/moves-sru-moved-field.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: use of moved value: `f.moved`
- --> $DIR/moves-sru-moved-field.rs:20:14
- |
-LL | let _b = Foo {noncopyable: g, ..f};
- | ------------------------- value moved here
-LL | let _c = Foo {noncopyable: h, ..f};
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ value used here after move
- |
- = note: move occurs because `f.moved` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-sru-moved-field.stderr b/src/test/ui/moves/moves-sru-moved-field.stderr
index aac399e..a012c2d 100644
--- a/src/test/ui/moves/moves-sru-moved-field.stderr
+++ b/src/test/ui/moves/moves-sru-moved-field.stderr
@@ -1,10 +1,10 @@
error[E0382]: use of moved value: `f.moved`
- --> $DIR/moves-sru-moved-field.rs:20:37
+ --> $DIR/moves-sru-moved-field.rs:20:14
|
LL | let _b = Foo {noncopyable: g, ..f};
- | - value moved here
+ | ------------------------- value moved here
LL | let _c = Foo {noncopyable: h, ..f};
- | ^ value used here after move
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ value used here after move
|
= note: move occurs because `f.moved` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
diff --git a/src/test/ui/mut/mut-cant-alias.nll.stderr b/src/test/ui/mut/mut-cant-alias.nll.stderr
deleted file mode 100644
index d56e45d..0000000
--- a/src/test/ui/mut/mut-cant-alias.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0499]: cannot borrow `b` as mutable more than once at a time
- --> $DIR/mut-cant-alias.rs:9:20
- |
-LL | let b1 = &mut *b;
- | - first mutable borrow occurs here
-LL | let b2 = &mut *b;
- | ^ second mutable borrow occurs here
-LL | b1.use_mut();
- | -- first borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/mut/mut-cant-alias.stderr b/src/test/ui/mut/mut-cant-alias.stderr
index 5fc194b..d56e45d 100644
--- a/src/test/ui/mut/mut-cant-alias.stderr
+++ b/src/test/ui/mut/mut-cant-alias.stderr
@@ -6,8 +6,7 @@
LL | let b2 = &mut *b;
| ^ second mutable borrow occurs here
LL | b1.use_mut();
-LL | }
- | - first borrow ends here
+ | -- first borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr
deleted file mode 100644
index 0b67a6d..0000000
--- a/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/mut-pattern-internal-mutability.rs:8:5
- |
-LL | let &mut x = foo;
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0506]: cannot assign to `*foo` because it is borrowed
- --> $DIR/mut-pattern-internal-mutability.rs:17:5
- |
-LL | let &mut ref x = foo;
- | ----- borrow of `*foo` occurs here
-LL | *foo += 1;
- | ^^^^^^^^^ assignment to borrowed `*foo` occurs here
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0384, E0506.
-For more information about an error, try `rustc --explain E0384`.
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr
deleted file mode 100644
index 737e9f3..0000000
--- a/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/mut-pattern-internal-mutability.rs:8:5
- |
-LL | let &mut x = foo;
- | - first assignment to `x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0506]: cannot assign to `*foo` because it is borrowed
- --> $DIR/mut-pattern-internal-mutability.rs:17:5
- |
-LL | let &mut ref x = foo;
- | ----- borrow of `*foo` occurs here
-LL | *foo += 1;
- | ^^^^^^^^^ assignment to borrowed `*foo` occurs here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0384, E0506.
-For more information about an error, try `rustc --explain E0384`.
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr
deleted file mode 100644
index 0b67a6d..0000000
--- a/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/mut-pattern-internal-mutability.rs:8:5
- |
-LL | let &mut x = foo;
- | -
- | |
- | first assignment to `x`
- | help: make this binding mutable: `mut x`
-LL | x += 1;
- | ^^^^^^ cannot assign twice to immutable variable
-
-error[E0506]: cannot assign to `*foo` because it is borrowed
- --> $DIR/mut-pattern-internal-mutability.rs:17:5
- |
-LL | let &mut ref x = foo;
- | ----- borrow of `*foo` occurs here
-LL | *foo += 1;
- | ^^^^^^^^^ assignment to borrowed `*foo` occurs here
-LL |
-LL | drop(x);
- | - borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0384, E0506.
-For more information about an error, try `rustc --explain E0384`.
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.rs b/src/test/ui/mut/mut-pattern-internal-mutability.rs
index ffad623..bcee878 100644
--- a/src/test/ui/mut/mut-pattern-internal-mutability.rs
+++ b/src/test/ui/mut/mut-pattern-internal-mutability.rs
@@ -1,12 +1,8 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn main() {
let foo = &mut 1;
let &mut x = foo;
- x += 1; //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `x`
+ x += 1; //~ ERROR cannot assign twice to immutable variable `x`
// explicitly mut-ify internals
let &mut mut x = foo;
@@ -14,7 +10,6 @@
// check borrowing is detected successfully
let &mut ref x = foo;
- *foo += 1; //[ast]~ ERROR cannot assign to `*foo` because it is borrowed
- //[mir]~^ ERROR cannot assign to `*foo` because it is borrowed
+ *foo += 1; //~ ERROR cannot assign to `*foo` because it is borrowed
drop(x);
}
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.stderr
new file mode 100644
index 0000000..eaa3345
--- /dev/null
+++ b/src/test/ui/mut/mut-pattern-internal-mutability.stderr
@@ -0,0 +1,25 @@
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/mut-pattern-internal-mutability.rs:5:5
+ |
+LL | let &mut x = foo;
+ | -
+ | |
+ | first assignment to `x`
+ | help: make this binding mutable: `mut x`
+LL | x += 1;
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0506]: cannot assign to `*foo` because it is borrowed
+ --> $DIR/mut-pattern-internal-mutability.rs:13:5
+ |
+LL | let &mut ref x = foo;
+ | ----- borrow of `*foo` occurs here
+LL | *foo += 1;
+ | ^^^^^^^^^ assignment to borrowed `*foo` occurs here
+LL | drop(x);
+ | - borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0384, E0506.
+For more information about an error, try `rustc --explain E0384`.
diff --git a/src/test/ui/mut/mut-suggestion.nll.stderr b/src/test/ui/mut/mut-suggestion.nll.stderr
deleted file mode 100644
index 61656db..0000000
--- a/src/test/ui/mut/mut-suggestion.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
- --> $DIR/mut-suggestion.rs:12:5
- |
-LL | fn func(arg: S) {
- | --- help: consider changing this to be mutable: `mut arg`
-...
-LL | arg.mutate();
- | ^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `local` as mutable, as it is not declared as mutable
- --> $DIR/mut-suggestion.rs:21:5
- |
-LL | let local = S;
- | ----- help: consider changing this to be mutable: `mut local`
-...
-LL | local.mutate();
- | ^^^^^ cannot borrow as mutable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/mut/mut-suggestion.rs b/src/test/ui/mut/mut-suggestion.rs
index 0d95a8b..3104b20 100644
--- a/src/test/ui/mut/mut-suggestion.rs
+++ b/src/test/ui/mut/mut-suggestion.rs
@@ -7,18 +7,16 @@
}
fn func(arg: S) {
- //~^ HELP make this binding mutable
+ //~^ HELP consider changing this to be mutable
//~| SUGGESTION mut arg
arg.mutate();
- //~^ ERROR cannot borrow immutable argument
- //~| cannot borrow mutably
+ //~^ ERROR cannot borrow `arg` as mutable, as it is not declared as mutable
}
fn main() {
let local = S;
- //~^ HELP make this binding mutable
+ //~^ HELP consider changing this to be mutable
//~| SUGGESTION mut local
local.mutate();
- //~^ ERROR cannot borrow immutable local variable
- //~| cannot borrow mutably
+ //~^ ERROR cannot borrow `local` as mutable, as it is not declared as mutable
}
diff --git a/src/test/ui/mut/mut-suggestion.stderr b/src/test/ui/mut/mut-suggestion.stderr
index 1998ec1e..245eaff 100644
--- a/src/test/ui/mut/mut-suggestion.stderr
+++ b/src/test/ui/mut/mut-suggestion.stderr
@@ -1,20 +1,20 @@
-error[E0596]: cannot borrow immutable argument `arg` as mutable
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/mut-suggestion.rs:12:5
|
LL | fn func(arg: S) {
- | --- help: make this binding mutable: `mut arg`
+ | --- help: consider changing this to be mutable: `mut arg`
...
LL | arg.mutate();
- | ^^^ cannot borrow mutably
+ | ^^^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable local variable `local` as mutable
- --> $DIR/mut-suggestion.rs:21:5
+error[E0596]: cannot borrow `local` as mutable, as it is not declared as mutable
+ --> $DIR/mut-suggestion.rs:20:5
|
LL | let local = S;
- | ----- help: make this binding mutable: `mut local`
+ | ----- help: consider changing this to be mutable: `mut local`
...
LL | local.mutate();
- | ^^^^^ cannot borrow mutably
+ | ^^^^^ cannot borrow as mutable
error: aborting due to 2 previous errors
diff --git a/src/test/ui/mut/mutable-class-fields-2.nll.stderr b/src/test/ui/mut/mutable-class-fields-2.nll.stderr
deleted file mode 100644
index a27a82f..0000000
--- a/src/test/ui/mut/mutable-class-fields-2.nll.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error[E0594]: cannot assign to `self.how_hungry` which is behind a `&` reference
- --> $DIR/mutable-class-fields-2.rs:9:5
- |
-LL | pub fn eat(&self) {
- | ----- help: consider changing this to be a mutable reference: `&mut self`
-LL | self.how_hungry -= 5;
- | ^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/mut/mutable-class-fields-2.stderr b/src/test/ui/mut/mutable-class-fields-2.stderr
index 4b3ab2f..a27a82f 100644
--- a/src/test/ui/mut/mutable-class-fields-2.stderr
+++ b/src/test/ui/mut/mutable-class-fields-2.stderr
@@ -1,10 +1,10 @@
-error[E0594]: cannot assign to field `self.how_hungry` of immutable binding
+error[E0594]: cannot assign to `self.how_hungry` which is behind a `&` reference
--> $DIR/mutable-class-fields-2.rs:9:5
|
LL | pub fn eat(&self) {
- | ----- use `&mut self` here to make mutable
+ | ----- help: consider changing this to be a mutable reference: `&mut self`
LL | self.how_hungry -= 5;
- | ^^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
+ | ^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
error: aborting due to previous error
diff --git a/src/test/ui/mut/mutable-class-fields.ast.nll.stderr b/src/test/ui/mut/mutable-class-fields.ast.nll.stderr
deleted file mode 100644
index b233ed2..0000000
--- a/src/test/ui/mut/mutable-class-fields.ast.nll.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable
- --> $DIR/mutable-class-fields.rs:18:3
- |
-LL | let nyan : Cat = cat(52, 99);
- | ---- help: consider changing this to be mutable: `mut nyan`
-LL | nyan.how_hungry = 0;
- | ^^^^^^^^^^^^^^^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/mut/mutable-class-fields.ast.stderr b/src/test/ui/mut/mutable-class-fields.ast.stderr
deleted file mode 100644
index 44f7361..0000000
--- a/src/test/ui/mut/mutable-class-fields.ast.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error[E0594]: cannot assign to field `nyan.how_hungry` of immutable binding
- --> $DIR/mutable-class-fields.rs:18:3
- |
-LL | let nyan : Cat = cat(52, 99);
- | ---- help: make this binding mutable: `mut nyan`
-LL | nyan.how_hungry = 0;
- | ^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/mut/mutable-class-fields.mir.stderr b/src/test/ui/mut/mutable-class-fields.mir.stderr
deleted file mode 100644
index b233ed2..0000000
--- a/src/test/ui/mut/mutable-class-fields.mir.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable
- --> $DIR/mutable-class-fields.rs:18:3
- |
-LL | let nyan : Cat = cat(52, 99);
- | ---- help: consider changing this to be mutable: `mut nyan`
-LL | nyan.how_hungry = 0;
- | ^^^^^^^^^^^^^^^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/mut/mutable-class-fields.rs b/src/test/ui/mut/mutable-class-fields.rs
index 2a729a5..30768a1 100644
--- a/src/test/ui/mut/mutable-class-fields.rs
+++ b/src/test/ui/mut/mutable-class-fields.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
struct Cat {
meows : usize,
how_hungry : isize,
@@ -15,6 +12,5 @@
fn main() {
let nyan : Cat = cat(52, 99);
- nyan.how_hungry = 0; //[ast]~ ERROR cannot assign
- //[mir]~^ ERROR cannot assign
+ nyan.how_hungry = 0; //~ ERROR cannot assign
}
diff --git a/src/test/ui/mut/mutable-class-fields.stderr b/src/test/ui/mut/mutable-class-fields.stderr
new file mode 100644
index 0000000..5391ccc
--- /dev/null
+++ b/src/test/ui/mut/mutable-class-fields.stderr
@@ -0,0 +1,10 @@
+error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable
+ --> $DIR/mutable-class-fields.rs:15:3
+ |
+LL | let nyan : Cat = cat(52, 99);
+ | ---- help: consider changing this to be mutable: `mut nyan`
+LL | nyan.how_hungry = 0;
+ | ^^^^^^^^^^^^^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/nll/cannot-move-block-spans.nll.stderr b/src/test/ui/nll/cannot-move-block-spans.nll.stderr
deleted file mode 100644
index c8dd07d..0000000
--- a/src/test/ui/nll/cannot-move-block-spans.nll.stderr
+++ /dev/null
@@ -1,85 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/cannot-move-block-spans.rs:5:15
- |
-LL | let x = { *r };
- | ^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `r`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/cannot-move-block-spans.rs:6:22
- |
-LL | let y = unsafe { *r };
- | ^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `r`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/cannot-move-block-spans.rs:7:26
- |
-LL | let z = loop { break *r; };
- | ^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `r`
-
-error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
- --> $DIR/cannot-move-block-spans.rs:11:15
- |
-LL | let x = { arr[0] };
- | ^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&arr[0]`
-
-error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
- --> $DIR/cannot-move-block-spans.rs:12:22
- |
-LL | let y = unsafe { arr[0] };
- | ^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&arr[0]`
-
-error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
- --> $DIR/cannot-move-block-spans.rs:13:26
- |
-LL | let z = loop { break arr[0]; };
- | ^^^^^^
- | |
- | cannot move out of here
- | help: consider borrowing here: `&arr[0]`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/cannot-move-block-spans.rs:17:38
- |
-LL | let x = { let mut u = 0; u += 1; *r };
- | ^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `r`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/cannot-move-block-spans.rs:18:45
- |
-LL | let y = unsafe { let mut u = 0; u += 1; *r };
- | ^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `r`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/cannot-move-block-spans.rs:19:49
- |
-LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; };
- | ^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `r`
-
-error: aborting due to 9 previous errors
-
-Some errors have detailed explanations: E0507, E0508.
-For more information about an error, try `rustc --explain E0507`.
diff --git a/src/test/ui/nll/cannot-move-block-spans.stderr b/src/test/ui/nll/cannot-move-block-spans.stderr
index 1f0d91b..c8dd07d 100644
--- a/src/test/ui/nll/cannot-move-block-spans.stderr
+++ b/src/test/ui/nll/cannot-move-block-spans.stderr
@@ -2,55 +2,82 @@
--> $DIR/cannot-move-block-spans.rs:5:15
|
LL | let x = { *r };
- | ^^ cannot move out of borrowed content
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `r`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:6:22
|
LL | let y = unsafe { *r };
- | ^^ cannot move out of borrowed content
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `r`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:7:26
|
LL | let z = loop { break *r; };
- | ^^ cannot move out of borrowed content
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `r`
error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
--> $DIR/cannot-move-block-spans.rs:11:15
|
LL | let x = { arr[0] };
- | ^^^^^^ cannot move out of here
+ | ^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider borrowing here: `&arr[0]`
error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
--> $DIR/cannot-move-block-spans.rs:12:22
|
LL | let y = unsafe { arr[0] };
- | ^^^^^^ cannot move out of here
+ | ^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider borrowing here: `&arr[0]`
error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
--> $DIR/cannot-move-block-spans.rs:13:26
|
LL | let z = loop { break arr[0]; };
- | ^^^^^^ cannot move out of here
+ | ^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider borrowing here: `&arr[0]`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:17:38
|
LL | let x = { let mut u = 0; u += 1; *r };
- | ^^ cannot move out of borrowed content
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `r`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:18:45
|
LL | let y = unsafe { let mut u = 0; u += 1; *r };
- | ^^ cannot move out of borrowed content
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `r`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:19:49
|
LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; };
- | ^^ cannot move out of borrowed content
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `r`
error: aborting due to 9 previous errors
diff --git a/src/test/ui/nll/issue-50716-1.rs b/src/test/ui/nll/issue-50716-1.rs
index db7e6b3..d963a62 100644
--- a/src/test/ui/nll/issue-50716-1.rs
+++ b/src/test/ui/nll/issue-50716-1.rs
@@ -3,11 +3,11 @@
// bounds derived from `Sized` requirements” that checks that the fixed compiler
// accepts this code fragment with both AST and MIR borrow checkers.
//
-// revisions: ast mir
+// revisions: migrate nll
//
// compile-pass
-#![cfg_attr(mir, feature(nll))]
+#![cfg_attr(nll, feature(nll))]
struct Qey<Q: ?Sized>(Q);
diff --git a/src/test/ui/nll/issue-53807.nll.stderr b/src/test/ui/nll/issue-53807.nll.stderr
deleted file mode 100644
index 2b15da3..0000000
--- a/src/test/ui/nll/issue-53807.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0382]: use of moved value
- --> $DIR/issue-53807.rs:4:21
- |
-LL | if let Some(thing) = maybe {
- | ^^^^^ value moved here, in previous iteration of loop
- |
- = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/nll/issue-53807.rs b/src/test/ui/nll/issue-53807.rs
index f69d8c1..d494f7e 100644
--- a/src/test/ui/nll/issue-53807.rs
+++ b/src/test/ui/nll/issue-53807.rs
@@ -2,8 +2,7 @@
let maybe = Some(vec![true, true]);
loop {
if let Some(thing) = maybe {
-//~^ ERROR use of partially moved value
-//~| ERROR use of moved value
+//~^ ERROR use of moved value
}
}
}
diff --git a/src/test/ui/nll/issue-53807.stderr b/src/test/ui/nll/issue-53807.stderr
index fb67014..2b15da3 100644
--- a/src/test/ui/nll/issue-53807.stderr
+++ b/src/test/ui/nll/issue-53807.stderr
@@ -1,21 +1,11 @@
-error[E0382]: use of partially moved value: `maybe`
- --> $DIR/issue-53807.rs:4:30
- |
-LL | if let Some(thing) = maybe {
- | ----- ^^^^^ value used here after move
- | |
- | value moved here
- |
- = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0`
+error[E0382]: use of moved value
--> $DIR/issue-53807.rs:4:21
|
LL | if let Some(thing) = maybe {
- | ^^^^^ value moved here in previous iteration of loop
+ | ^^^^^ value moved here, in previous iteration of loop
|
- = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
+ = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr
deleted file mode 100644
index 8412cbd..0000000
--- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0597]: `_thing1` does not live long enough
- --> $DIR/issue-54382-use-span-of-tail-of-block.rs:7:29
- |
-LL | D("other").next(&_thing1)
- | ----------------^^^^^^^^-
- | | |
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
-...
-LL | }
- | - `_thing1` dropped here while still borrowed
-LL |
-LL | ;
- | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- |
- = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr
index 8d23891..8412cbd 100644
--- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr
+++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr
@@ -1,14 +1,19 @@
error[E0597]: `_thing1` does not live long enough
- --> $DIR/issue-54382-use-span-of-tail-of-block.rs:7:30
+ --> $DIR/issue-54382-use-span-of-tail-of-block.rs:7:29
|
LL | D("other").next(&_thing1)
- | ^^^^^^^ borrowed value does not live long enough
+ | ----------------^^^^^^^^-
+ | | |
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
...
LL | }
| - `_thing1` dropped here while still borrowed
LL |
LL | ;
- | - borrowed value needs to live until here
+ | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
error: aborting due to previous error
diff --git a/src/test/ui/nll/issue-54556-niconii.nll.stderr b/src/test/ui/nll/issue-54556-niconii.nll.stderr
deleted file mode 100644
index 40cd04d..0000000
--- a/src/test/ui/nll/issue-54556-niconii.nll.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0597]: `counter` does not live long enough
- --> $DIR/issue-54556-niconii.rs:22:20
- |
-LL | if let Ok(_) = counter.lock() { }
- | ^^^^^^^-------
- | |
- | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
-...
-LL | }
- | -
- | |
- | `counter` dropped here while still borrowed
- | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::result::Result<MutexGuard<'_>, ()>`
- |
- = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/issue-54556-niconii.stderr b/src/test/ui/nll/issue-54556-niconii.stderr
index 2d0de26..40cd04d 100644
--- a/src/test/ui/nll/issue-54556-niconii.stderr
+++ b/src/test/ui/nll/issue-54556-niconii.stderr
@@ -2,12 +2,18 @@
--> $DIR/issue-54556-niconii.rs:22:20
|
LL | if let Ok(_) = counter.lock() { }
- | ^^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^-------
+ | |
+ | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
...
LL | }
- | - `counter` dropped here while still borrowed
+ | -
+ | |
+ | `counter` dropped here while still borrowed
+ | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::result::Result<MutexGuard<'_>, ()>`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
error: aborting due to previous error
diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr
deleted file mode 100644
index 0bf7648..0000000
--- a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0597]: `stmt` does not live long enough
- --> $DIR/issue-54556-stephaneyfx.rs:27:21
- |
-LL | let rows = Rows(&stmt);
- | ^^^^^ borrowed value does not live long enough
-LL | rows.map(|row| row).next()
- | ------------------- a temporary with access to the borrow is created here ...
-...
-LL | }
- | -
- | |
- | `stmt` dropped here while still borrowed
- | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::iter::Map<Rows<'_>, [closure@$DIR/issue-54556-stephaneyfx.rs:28:14: 28:23]>`
- |
- = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.stderr
index 4e581a5..0bf7648 100644
--- a/src/test/ui/nll/issue-54556-stephaneyfx.stderr
+++ b/src/test/ui/nll/issue-54556-stephaneyfx.stderr
@@ -1,13 +1,18 @@
error[E0597]: `stmt` does not live long enough
- --> $DIR/issue-54556-stephaneyfx.rs:27:22
+ --> $DIR/issue-54556-stephaneyfx.rs:27:21
|
LL | let rows = Rows(&stmt);
- | ^^^^ borrowed value does not live long enough
+ | ^^^^^ borrowed value does not live long enough
+LL | rows.map(|row| row).next()
+ | ------------------- a temporary with access to the borrow is created here ...
...
LL | }
- | - `stmt` dropped here while still borrowed
+ | -
+ | |
+ | `stmt` dropped here while still borrowed
+ | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::iter::Map<Rows<'_>, [closure@$DIR/issue-54556-stephaneyfx.rs:28:14: 28:23]>`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
error: aborting due to previous error
diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr
deleted file mode 100644
index 513dca7..0000000
--- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0597]: `_thing1` does not live long enough
- --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11
- |
-LL | D(&_thing1).end()
- | --^^^^^^^^-
- | | |
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
-LL | }
- | - `_thing1` dropped here while still borrowed
-LL |
-LL | ;
- | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- |
- = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr
index a74970f..513dca7 100644
--- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr
+++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr
@@ -1,13 +1,18 @@
error[E0597]: `_thing1` does not live long enough
- --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:12
+ --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11
|
LL | D(&_thing1).end()
- | ^^^^^^^ borrowed value does not live long enough
+ | --^^^^^^^^-
+ | | |
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
LL | }
| - `_thing1` dropped here while still borrowed
LL |
LL | ;
- | - borrowed value needs to live until here
+ | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
error: aborting due to previous error
diff --git a/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr b/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr
deleted file mode 100644
index 52d0870..0000000
--- a/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr
+++ /dev/null
@@ -1,113 +0,0 @@
-error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:10:55
- |
-LL | { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;`
- | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- | | | |
- | | | `_t1` dropped here while still borrowed
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
- |
- = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
-
-error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:13:55
- |
-LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;`
- | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- | | | |
- | | | `_t1` dropped here while still borrowed
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
- |
- = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
-
-error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55
- |
-LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;`
- | --^^^^- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- | | | |
- | | | `_t1` dropped here while still borrowed
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
- |
- = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
-
-error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:19:55
- |
-LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;`
- | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- | | | |
- | | | `_t1` dropped here while still borrowed
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
- |
- = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
-
-error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:22:55
- |
-LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;`
- | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- | | | |
- | | | `_t1` dropped here while still borrowed
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
- |
- = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
-
-error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:25:55
- |
-LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x`
- | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- | | | |
- | | | `_t1` dropped here while still borrowed
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
- |
- = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
-
-error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55
- |
-LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x`
- | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- | | | |
- | | | `_t1` dropped here while still borrowed
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
- |
- = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
-
-error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:37:55
- |
-LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;`
- | --^^^^- -
- | | | |
- | | | `_t1` dropped here while still borrowed
- | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
- |
- = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
-
-error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:40:55
- |
-LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x`
- | --^^^^- -
- | | | |
- | | | `_t1` dropped here while still borrowed
- | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
- | | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
- |
- = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr b/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr
index e9e4e51..52d0870 100644
--- a/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr
+++ b/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr
@@ -1,85 +1,112 @@
error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:10:56
+ --> $DIR/issue-54556-used-vs-unused-tails.rs:10:55
|
LL | { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;`
- | ^^^ - - borrowed value needs to live until here
- | | |
- | | `_t1` dropped here while still borrowed
- | borrowed value does not live long enough
+ | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ | | | |
+ | | | `_t1` dropped here while still borrowed
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:13:56
+ --> $DIR/issue-54556-used-vs-unused-tails.rs:13:55
|
LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;`
- | ^^^ - - borrowed value needs to live until here
- | | |
- | | `_t1` dropped here while still borrowed
- | borrowed value does not live long enough
+ | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ | | | |
+ | | | `_t1` dropped here while still borrowed
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:16:56
+ --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55
|
LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;`
- | ^^^ -- borrowed value needs to live until here
- | | |
- | | `_t1` dropped here while still borrowed
- | borrowed value does not live long enough
+ | --^^^^- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ | | | |
+ | | | `_t1` dropped here while still borrowed
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:19:56
+ --> $DIR/issue-54556-used-vs-unused-tails.rs:19:55
|
LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;`
- | ^^^ - - borrowed value needs to live until here
- | | |
- | | `_t1` dropped here while still borrowed
- | borrowed value does not live long enough
+ | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ | | | |
+ | | | `_t1` dropped here while still borrowed
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:22:56
+ --> $DIR/issue-54556-used-vs-unused-tails.rs:22:55
|
LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;`
- | ^^^ - - borrowed value needs to live until here
- | | |
- | | `_t1` dropped here while still borrowed
- | borrowed value does not live long enough
+ | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ | | | |
+ | | | `_t1` dropped here while still borrowed
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:25:56
+ --> $DIR/issue-54556-used-vs-unused-tails.rs:25:55
|
LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x`
- | ^^^ - - borrowed value needs to live until here
- | | |
- | | `_t1` dropped here while still borrowed
- | borrowed value does not live long enough
+ | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ | | | |
+ | | | `_t1` dropped here while still borrowed
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:30:56
+ --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55
|
LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x`
- | ^^^ - - borrowed value needs to live until here
- | | |
- | | `_t1` dropped here while still borrowed
- | borrowed value does not live long enough
+ | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ | | | |
+ | | | `_t1` dropped here while still borrowed
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:37:56
+ --> $DIR/issue-54556-used-vs-unused-tails.rs:37:55
|
LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;`
- | ^^^ - `_t1` dropped here while still borrowed
- | |
- | borrowed value does not live long enough
+ | --^^^^- -
+ | | | |
+ | | | `_t1` dropped here while still borrowed
+ | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped.
error[E0597]: `_t1` does not live long enough
- --> $DIR/issue-54556-used-vs-unused-tails.rs:40:56
+ --> $DIR/issue-54556-used-vs-unused-tails.rs:40:55
|
LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x`
- | ^^^ - `_t1` dropped here while still borrowed
- | |
- | borrowed value does not live long enough
+ | --^^^^- -
+ | | | |
+ | | | `_t1` dropped here while still borrowed
+ | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
+ | | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
error: aborting due to 9 previous errors
diff --git a/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr b/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr
deleted file mode 100644
index 9f27fac..0000000
--- a/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/issue-54556-wrap-it-up.rs:27:5
- |
-LL | let wrap = Wrap { p: &mut x };
- | ------ borrow of `x` occurs here
-...
-LL | x = 1;
- | ^^^^^ assignment to borrowed `x` occurs here
-LL | }
- | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/nll/issue-54556-wrap-it-up.stderr b/src/test/ui/nll/issue-54556-wrap-it-up.stderr
index c98b3a9..9f27fac 100644
--- a/src/test/ui/nll/issue-54556-wrap-it-up.stderr
+++ b/src/test/ui/nll/issue-54556-wrap-it-up.stderr
@@ -2,10 +2,12 @@
--> $DIR/issue-54556-wrap-it-up.rs:27:5
|
LL | let wrap = Wrap { p: &mut x };
- | - borrow of `x` occurs here
+ | ------ borrow of `x` occurs here
...
LL | x = 1;
| ^^^^^ assignment to borrowed `x` occurs here
+LL | }
+ | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>`
error: aborting due to previous error
diff --git a/src/test/ui/nll/issue-55850.nll.stderr b/src/test/ui/nll/issue-55850.nll.stderr
deleted file mode 100644
index 51bc30a..0000000
--- a/src/test/ui/nll/issue-55850.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0597]: `s` does not live long enough
- --> $DIR/issue-55850.rs:28:16
- |
-LL | yield &s[..]
- | ^ borrowed value does not live long enough
-LL | })
- | - `s` dropped here while still borrowed
-
-error[E0626]: borrow may still be in use when generator yields
- --> $DIR/issue-55850.rs:28:16
- |
-LL | yield &s[..]
- | -------^---- possible yield occurs here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0597, E0626.
-For more information about an error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/issue-55850.rs b/src/test/ui/nll/issue-55850.rs
index 8b58872..8a016bf8 100644
--- a/src/test/ui/nll/issue-55850.rs
+++ b/src/test/ui/nll/issue-55850.rs
@@ -26,6 +26,7 @@
GenIter(move || {
let mut s = String::new();
yield &s[..] //~ ERROR `s` does not live long enough [E0597]
+ //~| ERROR borrow may still be in use when generator yields
})
}
diff --git a/src/test/ui/nll/issue-55850.stderr b/src/test/ui/nll/issue-55850.stderr
index 7deee1d..66c2995 100644
--- a/src/test/ui/nll/issue-55850.stderr
+++ b/src/test/ui/nll/issue-55850.stderr
@@ -3,15 +3,17 @@
|
LL | yield &s[..]
| ^ borrowed value does not live long enough
+LL |
LL | })
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 25:8...
- --> $DIR/issue-55850.rs:25:8
- |
-LL | fn bug<'a>() -> impl Iterator<Item = &'a str> {
- | ^^
+ | - `s` dropped here while still borrowed
-error: aborting due to previous error
+error[E0626]: borrow may still be in use when generator yields
+ --> $DIR/issue-55850.rs:28:16
+ |
+LL | yield &s[..]
+ | -------^---- possible yield occurs here
-For more information about this error, try `rustc --explain E0597`.
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0597, E0626.
+For more information about an error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr
deleted file mode 100644
index 82a30db..0000000
--- a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-warning[E0507]: cannot move out of borrowed content
- --> $DIR/match-guards-always-borrow.rs:13:13
- |
-LL | (|| { let bar = foo; bar.take() })();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
- |
- = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
- = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
-error: compilation successful
- --> $DIR/match-guards-always-borrow.rs:47:1
- |
-LL | / fn main() {
-LL | | should_reject_destructive_mutate_in_guard();
-LL | | allow_mutate_in_arm_body();
-LL | | allow_move_into_arm_body();
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/nll/match-guards-always-borrow.ast.stderr b/src/test/ui/nll/match-guards-always-borrow.ast.stderr
deleted file mode 100644
index 0c08f20..0000000
--- a/src/test/ui/nll/match-guards-always-borrow.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error: compilation successful
- --> $DIR/match-guards-always-borrow.rs:47:1
- |
-LL | / fn main() {
-LL | | should_reject_destructive_mutate_in_guard();
-LL | | allow_mutate_in_arm_body();
-LL | | allow_move_into_arm_body();
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/nll/match-guards-always-borrow.mir.stderr b/src/test/ui/nll/match-guards-always-borrow.mir.stderr
deleted file mode 100644
index 3e90c5a..0000000
--- a/src/test/ui/nll/match-guards-always-borrow.mir.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/match-guards-always-borrow.rs:13:13
- |
-LL | (|| { let bar = foo; bar.take() })();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/nll/match-guards-always-borrow.rs b/src/test/ui/nll/match-guards-always-borrow.rs
index ec4eed6..5900dc3 100644
--- a/src/test/ui/nll/match-guards-always-borrow.rs
+++ b/src/test/ui/nll/match-guards-always-borrow.rs
@@ -1,7 +1,4 @@
-//revisions: ast mir
-//[mir] compile-flags: -Z borrowck=mir
-
-#![feature(rustc_attrs)]
+#![feature(nll)]
// Here is arielb1's basic example from rust-lang/rust#27282
// that AST borrowck is flummoxed by:
@@ -11,7 +8,7 @@
None => {},
ref mut foo if {
(|| { let bar = foo; bar.take() })();
- //[mir]~^ ERROR cannot move out of borrowed content [E0507]
+ //~^ ERROR cannot move out of borrowed content [E0507]
false } => { },
Some(s) => std::process::exit(*s),
}
@@ -39,12 +36,7 @@
}
}
-// Since this is a compile-fail test that is explicitly encoding the
-// different behavior of AST- vs MIR-borrowck where AST-borrowck does
-// not error, we need to use rustc_error to placate the test harness
-// that wants *some* error to occur.
-#[rustc_error]
-fn main() { //[ast]~ ERROR compilation successful
+fn main() {
should_reject_destructive_mutate_in_guard();
allow_mutate_in_arm_body();
allow_move_into_arm_body();
diff --git a/src/test/ui/nll/match-guards-always-borrow.stderr b/src/test/ui/nll/match-guards-always-borrow.stderr
new file mode 100644
index 0000000..2492397
--- /dev/null
+++ b/src/test/ui/nll/match-guards-always-borrow.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/match-guards-always-borrow.rs:10:13
+ |
+LL | (|| { let bar = foo; bar.take() })();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr b/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr
deleted file mode 100644
index 1f6eb9a..0000000
--- a/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/reference-carried-through-struct-field.rs:11:5
- |
-LL | let wrapper = Wrap { w: &mut x };
- | ------ borrow of `x` occurs here
-LL | x += 1;
- | ^^^^^^ use of borrowed `x`
-LL |
-LL | *wrapper.w += 1;
- | --------------- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr b/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr
deleted file mode 100644
index 3104944..0000000
--- a/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/reference-carried-through-struct-field.rs:11:5
- |
-LL | let wrapper = Wrap { w: &mut x };
- | - borrow of `x` occurs here
-LL | x += 1;
- | ^^^^^^ assignment to borrowed `x` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr b/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr
deleted file mode 100644
index 1f6eb9a..0000000
--- a/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/reference-carried-through-struct-field.rs:11:5
- |
-LL | let wrapper = Wrap { w: &mut x };
- | ------ borrow of `x` occurs here
-LL | x += 1;
- | ^^^^^^ use of borrowed `x`
-LL |
-LL | *wrapper.w += 1;
- | --------------- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/nll/reference-carried-through-struct-field.rs b/src/test/ui/nll/reference-carried-through-struct-field.rs
index f7903cb..effd610 100644
--- a/src/test/ui/nll/reference-carried-through-struct-field.rs
+++ b/src/test/ui/nll/reference-carried-through-struct-field.rs
@@ -1,15 +1,9 @@
-//revisions: ast mir
-//[mir] compile-flags: -Z borrowck=mir
-
-#![allow(unused_assignments)]
-
struct Wrap<'a> { w: &'a mut u32 }
fn foo() {
let mut x = 22;
let wrapper = Wrap { w: &mut x };
- x += 1; //[ast]~ ERROR cannot assign to `x` because it is borrowed [E0506]
- //[mir]~^ ERROR cannot use `x` because it was mutably borrowed [E0503]
+ x += 1; //~ ERROR cannot use `x` because it was mutably borrowed [E0503]
*wrapper.w += 1;
}
diff --git a/src/test/ui/nll/reference-carried-through-struct-field.stderr b/src/test/ui/nll/reference-carried-through-struct-field.stderr
new file mode 100644
index 0000000..56d878e
--- /dev/null
+++ b/src/test/ui/nll/reference-carried-through-struct-field.stderr
@@ -0,0 +1,13 @@
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/reference-carried-through-struct-field.rs:6:5
+ |
+LL | let wrapper = Wrap { w: &mut x };
+ | ------ borrow of `x` occurs here
+LL | x += 1;
+ | ^^^^^^ use of borrowed `x`
+LL | *wrapper.w += 1;
+ | --------------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/no-capture-arc.nll.stderr b/src/test/ui/no-capture-arc.nll.stderr
deleted file mode 100644
index 476b6f7..0000000
--- a/src/test/ui/no-capture-arc.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0382]: borrow of moved value: `arc_v`
- --> $DIR/no-capture-arc.rs:14:18
- |
-LL | let arc_v = Arc::new(v);
- | ----- move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
-LL |
-LL | thread::spawn(move|| {
- | ------ value moved into closure here
-LL | assert_eq!((*arc_v)[3], 4);
- | ----- variable moved due to use in closure
-...
-LL | assert_eq!((*arc_v)[2], 3);
- | ^^^^^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/no-capture-arc.rs b/src/test/ui/no-capture-arc.rs
index 06f5fb3..3f0b075 100644
--- a/src/test/ui/no-capture-arc.rs
+++ b/src/test/ui/no-capture-arc.rs
@@ -1,4 +1,4 @@
-// error-pattern: use of moved value
+// error-pattern: borrow of moved value
use std::sync::Arc;
use std::thread;
diff --git a/src/test/ui/no-capture-arc.stderr b/src/test/ui/no-capture-arc.stderr
index 0dfa5cd..476b6f7 100644
--- a/src/test/ui/no-capture-arc.stderr
+++ b/src/test/ui/no-capture-arc.stderr
@@ -1,25 +1,17 @@
-error[E0382]: use of moved value: `arc_v`
+error[E0382]: borrow of moved value: `arc_v`
--> $DIR/no-capture-arc.rs:14:18
|
+LL | let arc_v = Arc::new(v);
+ | ----- move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+LL |
LL | thread::spawn(move|| {
- | ------ value moved (into closure) here
+ | ------ value moved into closure here
+LL | assert_eq!((*arc_v)[3], 4);
+ | ----- variable moved due to use in closure
...
LL | assert_eq!((*arc_v)[2], 3);
- | ^^^^^ value used here after move
- |
- = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+ | ^^^^^ value borrowed here after move
-error[E0382]: use of moved value: `arc_v`
- --> $DIR/no-capture-arc.rs:16:23
- |
-LL | thread::spawn(move|| {
- | ------ value moved (into closure) here
-...
-LL | println!("{:?}", *arc_v);
- | ^^^^^ value used here after move
- |
- = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/no-reuse-move-arc.nll.stderr b/src/test/ui/no-reuse-move-arc.nll.stderr
deleted file mode 100644
index 3f7169e..0000000
--- a/src/test/ui/no-reuse-move-arc.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0382]: borrow of moved value: `arc_v`
- --> $DIR/no-reuse-move-arc.rs:12:18
- |
-LL | let arc_v = Arc::new(v);
- | ----- move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
-LL |
-LL | thread::spawn(move|| {
- | ------ value moved into closure here
-LL | assert_eq!((*arc_v)[3], 4);
- | ----- variable moved due to use in closure
-...
-LL | assert_eq!((*arc_v)[2], 3);
- | ^^^^^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/no-reuse-move-arc.rs b/src/test/ui/no-reuse-move-arc.rs
index b60a7f2..9c957a4 100644
--- a/src/test/ui/no-reuse-move-arc.rs
+++ b/src/test/ui/no-reuse-move-arc.rs
@@ -9,7 +9,7 @@
assert_eq!((*arc_v)[3], 4);
});
- assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v`
+ assert_eq!((*arc_v)[2], 3); //~ ERROR borrow of moved value: `arc_v`
- println!("{:?}", *arc_v); //~ ERROR use of moved value: `arc_v`
+ println!("{:?}", *arc_v);
}
diff --git a/src/test/ui/no-reuse-move-arc.stderr b/src/test/ui/no-reuse-move-arc.stderr
index d712331..3f7169e 100644
--- a/src/test/ui/no-reuse-move-arc.stderr
+++ b/src/test/ui/no-reuse-move-arc.stderr
@@ -1,25 +1,17 @@
-error[E0382]: use of moved value: `arc_v`
+error[E0382]: borrow of moved value: `arc_v`
--> $DIR/no-reuse-move-arc.rs:12:18
|
+LL | let arc_v = Arc::new(v);
+ | ----- move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+LL |
LL | thread::spawn(move|| {
- | ------ value moved (into closure) here
+ | ------ value moved into closure here
+LL | assert_eq!((*arc_v)[3], 4);
+ | ----- variable moved due to use in closure
...
LL | assert_eq!((*arc_v)[2], 3);
- | ^^^^^ value used here after move
- |
- = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+ | ^^^^^ value borrowed here after move
-error[E0382]: use of moved value: `arc_v`
- --> $DIR/no-reuse-move-arc.rs:14:23
- |
-LL | thread::spawn(move|| {
- | ------ value moved (into closure) here
-...
-LL | println!("{:?}", *arc_v);
- | ^^^^^ value used here after move
- |
- = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/not-copy-closure.nll.stderr b/src/test/ui/not-copy-closure.nll.stderr
deleted file mode 100644
index 10bf570..0000000
--- a/src/test/ui/not-copy-closure.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0382]: use of moved value: `hello`
- --> $DIR/not-copy-closure.rs:10:13
- |
-LL | let b = hello;
- | ----- value moved here
-LL | let c = hello;
- | ^^^^^ value used here after move
- |
-note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment
- --> $DIR/not-copy-closure.rs:6:9
- |
-LL | a += 1;
- | ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/not-copy-closure.stderr b/src/test/ui/not-copy-closure.stderr
index 4144753..10bf570 100644
--- a/src/test/ui/not-copy-closure.stderr
+++ b/src/test/ui/not-copy-closure.stderr
@@ -1,12 +1,12 @@
error[E0382]: use of moved value: `hello`
- --> $DIR/not-copy-closure.rs:10:9
+ --> $DIR/not-copy-closure.rs:10:13
|
LL | let b = hello;
- | - value moved here
+ | ----- value moved here
LL | let c = hello;
- | ^ value used here after move
+ | ^^^^^ value used here after move
|
-note: closure cannot be invoked more than once because it moves the variable `a` out of its environment
+note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment
--> $DIR/not-copy-closure.rs:6:9
|
LL | a += 1;
diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr
deleted file mode 100644
index 1497aa4..0000000
--- a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined
- --> $DIR/object-safety-by-value-self-use.rs:15:5
- |
-LL | t.bar()
- | ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0161`.
diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.rs b/src/test/ui/object-safety/object-safety-by-value-self-use.rs
index dc8ea64..0b70c8a 100644
--- a/src/test/ui/object-safety/object-safety-by-value-self-use.rs
+++ b/src/test/ui/object-safety/object-safety-by-value-self-use.rs
@@ -12,7 +12,7 @@
}
fn use_bar(t: Box<Bar>) {
- t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static)
+ t.bar() //~ ERROR cannot move a value of type dyn Bar
}
fn main() { }
diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr
index 0ab8816..1497aa4 100644
--- a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr
+++ b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr
@@ -1,4 +1,4 @@
-error[E0161]: cannot move a value of type (dyn Bar + 'static): the size of (dyn Bar + 'static) cannot be statically determined
+error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined
--> $DIR/object-safety-by-value-self-use.rs:15:5
|
LL | t.bar()
diff --git a/src/test/ui/once-cant-call-twice-on-heap.nll.stderr b/src/test/ui/once-cant-call-twice-on-heap.nll.stderr
deleted file mode 100644
index f98d3d8..0000000
--- a/src/test/ui/once-cant-call-twice-on-heap.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0382]: use of moved value: `blk`
- --> $DIR/once-cant-call-twice-on-heap.rs:9:5
- |
-LL | fn foo<F:FnOnce()>(blk: F) {
- | - --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | blk();
- | --- value moved here
-LL | blk();
- | ^^^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/once-cant-call-twice-on-heap.stderr b/src/test/ui/once-cant-call-twice-on-heap.stderr
index 40034da..f98d3d8 100644
--- a/src/test/ui/once-cant-call-twice-on-heap.stderr
+++ b/src/test/ui/once-cant-call-twice-on-heap.stderr
@@ -1,12 +1,14 @@
error[E0382]: use of moved value: `blk`
--> $DIR/once-cant-call-twice-on-heap.rs:9:5
|
+LL | fn foo<F:FnOnce()>(blk: F) {
+ | - --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | blk();
| --- value moved here
LL | blk();
| ^^^ value used here after move
- |
- = note: move occurs because `blk` has type `F`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/ref-suggestion.nll.stderr b/src/test/ui/ref-suggestion.nll.stderr
deleted file mode 100644
index 9ff8e21..0000000
--- a/src/test/ui/ref-suggestion.nll.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/ref-suggestion.rs:4:5
- |
-LL | let x = vec![1];
- | - move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
-LL | let y = x;
- | - value moved here
-LL | x;
- | ^ value used here after move
-
-error[E0382]: use of moved value: `x`
- --> $DIR/ref-suggestion.rs:8:5
- |
-LL | let x = vec![1];
- | - move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
-LL | let mut y = x;
- | - value moved here
-LL | x;
- | ^ value used here after move
-
-error[E0382]: use of moved value: `x`
- --> $DIR/ref-suggestion.rs:16:5
- |
-LL | (Some(y), ()) => {},
- | - value moved here
-...
-LL | x;
- | ^ value used here after partial move
- |
- = note: move occurs because value has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/ref-suggestion.rs b/src/test/ui/ref-suggestion.rs
index 346d118..49d199c 100644
--- a/src/test/ui/ref-suggestion.rs
+++ b/src/test/ui/ref-suggestion.rs
@@ -13,5 +13,5 @@
(Some(y), ()) => {},
_ => {},
}
- x; //~ ERROR use of partially moved value
+ x; //~ ERROR use of moved value
}
diff --git a/src/test/ui/ref-suggestion.stderr b/src/test/ui/ref-suggestion.stderr
index df677a6..9ff8e21 100644
--- a/src/test/ui/ref-suggestion.stderr
+++ b/src/test/ui/ref-suggestion.stderr
@@ -1,33 +1,33 @@
error[E0382]: use of moved value: `x`
--> $DIR/ref-suggestion.rs:4:5
|
+LL | let x = vec![1];
+ | - move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
LL | let y = x;
- | - value moved here
+ | - value moved here
LL | x;
| ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x`
--> $DIR/ref-suggestion.rs:8:5
|
+LL | let x = vec![1];
+ | - move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
LL | let mut y = x;
- | ----- value moved here
+ | - value moved here
LL | x;
| ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
-error[E0382]: use of partially moved value: `x`
+error[E0382]: use of moved value: `x`
--> $DIR/ref-suggestion.rs:16:5
|
LL | (Some(y), ()) => {},
| - value moved here
...
LL | x;
- | ^ value used here after move
+ | ^ value used here after partial move
|
- = note: move occurs because the value has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+ = note: move occurs because value has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
error: aborting due to 3 previous errors
diff --git a/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs b/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs
index 24676fe..5cbfe6e 100644
--- a/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs
+++ b/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs
@@ -9,13 +9,6 @@
// rust-lang/rust#56537
// compile-pass
-// We are already testing NLL explicitly via the revision system below.
-// ignore-compare-mode-nll
-
-// revisions: ll nll migrate
-//[ll] compile-flags:-Zborrowck=ast
-//[nll] compile-flags:-Zborrowck=mir -Z two-phase-borrows
-//[migrate] compile-flags:-Zborrowck=migrate -Z two-phase-borrows
fn willy_no_annot<'w>(p: &'w str, q: &str) -> &'w str {
let free_dumb = |_x| { p }; // no type annotation at all
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr
deleted file mode 100644
index 8fb1ebb..0000000
--- a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:26
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:9
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:26
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:9
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0373`.
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr
deleted file mode 100644
index 27d8ce4a..0000000
--- a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:43
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | --------- ^ borrowed value does not live long enough
- | |
- | capture occurs here
-...
-LL | });
- | - borrowed value dropped before borrower
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `y` does not live long enough
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:54
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | --------- ^ borrowed value does not live long enough
- | |
- | capture occurs here
-...
-LL | });
- | - borrowed value dropped before borrower
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr
deleted file mode 100644
index 8fb1ebb..0000000
--- a/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:26
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:9
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:26
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-big.rs:71:9
- |
-LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0373`.
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.rs b/src/test/ui/regions/region-borrow-params-issue-29793-big.rs
index f21140b..83b1a6e 100644
--- a/src/test/ui/regions/region-borrow-params-issue-29793-big.rs
+++ b/src/test/ui/regions/region-borrow-params-issue-29793-big.rs
@@ -6,10 +6,6 @@
// behavior (because the improperly accepted closure was actually
// able to be invoked).
-// ignore-tidy-linelength
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
struct WrapA<F>(Option<F>);
impl<F> WrapA<F> {
@@ -69,10 +65,8 @@
fn main() {
let mut w = WrapA::new().set(|x: usize, y: usize| {
WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
- //[ast]~^ ERROR `x` does not live long enough
- //[ast]~| ERROR `y` does not live long enough
- //[mir]~^^^ ERROR closure may outlive the current function
- //[mir]~| ERROR closure may outlive the current function
+ //~^ ERROR closure may outlive the current function
+ //~| ERROR closure may outlive the current function
});
w.handle(); // This works
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.stderr
new file mode 100644
index 0000000..328e602
--- /dev/null
+++ b/src/test/ui/regions/region-borrow-params-issue-29793-big.stderr
@@ -0,0 +1,39 @@
+error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
+ --> $DIR/region-borrow-params-issue-29793-big.rs:67:26
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^ - `x` is borrowed here
+ | |
+ | may outlive borrowed value `x`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-big.rs:67:9
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
+ |
+LL | WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^^^^^^
+
+error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
+ --> $DIR/region-borrow-params-issue-29793-big.rs:67:26
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^ - `y` is borrowed here
+ | |
+ | may outlive borrowed value `y`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-big.rs:67:9
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
+ |
+LL | WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0373`.
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-small.nll.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-small.nll.stderr
deleted file mode 100644
index 18610b7..0000000
--- a/src/test/ui/regions/region-borrow-params-issue-29793-small.nll.stderr
+++ /dev/null
@@ -1,363 +0,0 @@
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:9:17
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:12:16
- |
-LL | return f;
- | ^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:9:17
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:12:16
- |
-LL | return f;
- | ^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:24:17
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:27:9
- |
-LL | f
- | ^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:24:17
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:27:9
- |
-LL | f
- | ^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:55:17
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:58:16
- |
-LL | return Box::new(f);
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:55:17
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:58:16
- |
-LL | return Box::new(f);
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:66:17
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:69:9
- |
-LL | Box::new(f)
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:66:17
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:69:9
- |
-LL | Box::new(f)
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:90:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:93:20
- |
-LL | return Box::new(f);
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:90:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:93:20
- |
-LL | return Box::new(f);
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:104:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:107:13
- |
-LL | Box::new(f)
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:104:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:107:13
- |
-LL | Box::new(f)
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:132:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:135:20
- |
-LL | return Box::new(f);
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:132:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:135:20
- |
-LL | return Box::new(f);
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:147:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:150:13
- |
-LL | Box::new(f)
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:147:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:150:13
- |
-LL | Box::new(f)
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:175:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:178:20
- |
-LL | return Box::new(f);
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:175:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:178:20
- |
-LL | return Box::new(f);
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:189:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `x` is borrowed here
- | |
- | may outlive borrowed value `x`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:192:13
- |
-LL | Box::new(f)
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/region-borrow-params-issue-29793-small.rs:189:21
- |
-LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^ - `y` is borrowed here
- | |
- | may outlive borrowed value `y`
- |
-note: closure is returned here
- --> $DIR/region-borrow-params-issue-29793-small.rs:192:13
- |
-LL | Box::new(f)
- | ^^^^^^^^^^^
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | ^^^^^^^^^^^^^^
-
-error: aborting due to 20 previous errors
-
-For more information about this error, try `rustc --explain E0373`.
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-small.rs b/src/test/ui/regions/region-borrow-params-issue-29793-small.rs
index 08ed79c..0d8c9fb 100644
--- a/src/test/ui/regions/region-borrow-params-issue-29793-small.rs
+++ b/src/test/ui/regions/region-borrow-params-issue-29793-small.rs
@@ -7,8 +7,8 @@
fn escaping_borrow_of_closure_params_1() {
let g = |x: usize, y:usize| {
let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- //~^ ERROR `x` does not live long enough
- //~| ERROR `y` does not live long enough
+ //~^ ERROR E0373
+ //~| ERROR E0373
return f;
};
@@ -22,8 +22,8 @@
fn escaping_borrow_of_closure_params_2() {
let g = |x: usize, y:usize| {
let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- //~^ ERROR `x` does not live long enough
- //~| ERROR `y` does not live long enough
+ //~^ ERROR E0373
+ //~| ERROR E0373
f
};
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-small.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-small.stderr
index c2c2d64..18610b7 100644
--- a/src/test/ui/regions/region-borrow-params-issue-29793-small.stderr
+++ b/src/test/ui/regions/region-borrow-params-issue-29793-small.stderr
@@ -1,54 +1,74 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/region-borrow-params-issue-29793-small.rs:9:34
+error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
+ --> $DIR/region-borrow-params-issue-29793-small.rs:9:17
|
LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | --------- ^ borrowed value does not live long enough
+ | ^^^^^^^^^ - `x` is borrowed here
| |
- | capture occurs here
-...
-LL | };
- | - borrowed value dropped before borrower
+ | may outlive borrowed value `x`
|
- = note: values in a scope are dropped in the opposite order they are created
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:12:16
+ |
+LL | return f;
+ | ^
+help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
+ |
+LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^^^^^^
-error[E0597]: `y` does not live long enough
- --> $DIR/region-borrow-params-issue-29793-small.rs:9:45
+error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
+ --> $DIR/region-borrow-params-issue-29793-small.rs:9:17
|
LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | --------- ^ borrowed value does not live long enough
+ | ^^^^^^^^^ - `y` is borrowed here
| |
- | capture occurs here
-...
-LL | };
- | - borrowed value dropped before borrower
+ | may outlive borrowed value `y`
|
- = note: values in a scope are dropped in the opposite order they are created
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:12:16
+ |
+LL | return f;
+ | ^
+help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
+ |
+LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^^^^^^
-error[E0597]: `x` does not live long enough
- --> $DIR/region-borrow-params-issue-29793-small.rs:24:34
+error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
+ --> $DIR/region-borrow-params-issue-29793-small.rs:24:17
|
LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | --------- ^ borrowed value does not live long enough
+ | ^^^^^^^^^ - `x` is borrowed here
| |
- | capture occurs here
-...
-LL | };
- | - borrowed value dropped before borrower
+ | may outlive borrowed value `x`
|
- = note: values in a scope are dropped in the opposite order they are created
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:27:9
+ |
+LL | f
+ | ^
+help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
+ |
+LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^^^^^^
-error[E0597]: `y` does not live long enough
- --> $DIR/region-borrow-params-issue-29793-small.rs:24:45
+error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
+ --> $DIR/region-borrow-params-issue-29793-small.rs:24:17
|
LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
- | --------- ^ borrowed value does not live long enough
+ | ^^^^^^^^^ - `y` is borrowed here
| |
- | capture occurs here
-...
-LL | };
- | - borrowed value dropped before borrower
+ | may outlive borrowed value `y`
|
- = note: values in a scope are dropped in the opposite order they are created
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:27:9
+ |
+LL | f
+ | ^
+help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
+ |
+LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
+ | ^^^^^^^^^^^^^^
error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
--> $DIR/region-borrow-params-issue-29793-small.rs:55:17
@@ -57,6 +77,12 @@
| ^^^^^^^^^ - `x` is borrowed here
| |
| may outlive borrowed value `x`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:58:16
+ |
+LL | return Box::new(f);
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -69,6 +95,12 @@
| ^^^^^^^^^ - `y` is borrowed here
| |
| may outlive borrowed value `y`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:58:16
+ |
+LL | return Box::new(f);
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -81,6 +113,12 @@
| ^^^^^^^^^ - `x` is borrowed here
| |
| may outlive borrowed value `x`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:69:9
+ |
+LL | Box::new(f)
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -93,6 +131,12 @@
| ^^^^^^^^^ - `y` is borrowed here
| |
| may outlive borrowed value `y`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:69:9
+ |
+LL | Box::new(f)
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -105,6 +149,12 @@
| ^^^^^^^^^ - `x` is borrowed here
| |
| may outlive borrowed value `x`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:93:20
+ |
+LL | return Box::new(f);
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -117,6 +167,12 @@
| ^^^^^^^^^ - `y` is borrowed here
| |
| may outlive borrowed value `y`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:93:20
+ |
+LL | return Box::new(f);
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -129,6 +185,12 @@
| ^^^^^^^^^ - `x` is borrowed here
| |
| may outlive borrowed value `x`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:107:13
+ |
+LL | Box::new(f)
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -141,6 +203,12 @@
| ^^^^^^^^^ - `y` is borrowed here
| |
| may outlive borrowed value `y`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:107:13
+ |
+LL | Box::new(f)
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -153,6 +221,12 @@
| ^^^^^^^^^ - `x` is borrowed here
| |
| may outlive borrowed value `x`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:135:20
+ |
+LL | return Box::new(f);
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -165,6 +239,12 @@
| ^^^^^^^^^ - `y` is borrowed here
| |
| may outlive borrowed value `y`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:135:20
+ |
+LL | return Box::new(f);
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -177,6 +257,12 @@
| ^^^^^^^^^ - `x` is borrowed here
| |
| may outlive borrowed value `x`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:150:13
+ |
+LL | Box::new(f)
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -189,6 +275,12 @@
| ^^^^^^^^^ - `y` is borrowed here
| |
| may outlive borrowed value `y`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:150:13
+ |
+LL | Box::new(f)
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -201,6 +293,12 @@
| ^^^^^^^^^ - `x` is borrowed here
| |
| may outlive borrowed value `x`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:178:20
+ |
+LL | return Box::new(f);
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -213,6 +311,12 @@
| ^^^^^^^^^ - `y` is borrowed here
| |
| may outlive borrowed value `y`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:178:20
+ |
+LL | return Box::new(f);
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -225,6 +329,12 @@
| ^^^^^^^^^ - `x` is borrowed here
| |
| may outlive borrowed value `x`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:192:13
+ |
+LL | Box::new(f)
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -237,6 +347,12 @@
| ^^^^^^^^^ - `y` is borrowed here
| |
| may outlive borrowed value `y`
+ |
+note: closure is returned here
+ --> $DIR/region-borrow-params-issue-29793-small.rs:192:13
+ |
+LL | Box::new(f)
+ | ^^^^^^^^^^^
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
LL | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
@@ -244,5 +360,4 @@
error: aborting due to 20 previous errors
-Some errors have detailed explanations: E0373, E0597.
-For more information about an error, try `rustc --explain E0373`.
+For more information about this error, try `rustc --explain E0373`.
diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr
deleted file mode 100644
index d455902..0000000
--- a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-warning: function cannot return without recursing
- --> $DIR/region-bound-on-closure-outlives-call.rs:1:1
- |
-LL | fn call_rec<F>(mut f: F) -> usize where F: FnMut(usize) -> usize {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
-LL |
-LL | (|x| f(x))(call_rec(f))
- | ----------- recursive call site
- |
- = note: #[warn(unconditional_recursion)] on by default
- = help: a `loop` may express intention better if this is on purpose
-
-error[E0505]: cannot move out of `f` because it is borrowed
- --> $DIR/region-bound-on-closure-outlives-call.rs:3:25
- |
-LL | (|x| f(x))(call_rec(f))
- | --- - ^ move out of `f` occurs here
- | | |
- | | borrow occurs due to use in closure
- | borrow of `f` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr
index cb888ab..d455902 100644
--- a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr
+++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr
@@ -14,8 +14,9 @@
--> $DIR/region-bound-on-closure-outlives-call.rs:3:25
|
LL | (|x| f(x))(call_rec(f))
- | --- ^ move out of `f` occurs here
- | |
+ | --- - ^ move out of `f` occurs here
+ | | |
+ | | borrow occurs due to use in closure
| borrow of `f` occurs here
error: aborting due to previous error
diff --git a/src/test/ui/regions/region-object-lifetime-5.nll.stderr b/src/test/ui/regions/region-object-lifetime-5.nll.stderr
deleted file mode 100644
index b86f6e3..0000000
--- a/src/test/ui/regions/region-object-lifetime-5.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return value referencing local data `*x`
- --> $DIR/region-object-lifetime-5.rs:11:5
- |
-LL | x.borrowed()
- | -^^^^^^^^^^^
- | |
- | returns a value referencing data owned by the current function
- | `*x` is borrowed here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/region-object-lifetime-5.rs b/src/test/ui/regions/region-object-lifetime-5.rs
index 5009b2b..bd68aeb 100644
--- a/src/test/ui/regions/region-object-lifetime-5.rs
+++ b/src/test/ui/regions/region-object-lifetime-5.rs
@@ -8,7 +8,7 @@
// Here, the object is bounded by an anonymous lifetime and returned
// as `&'static`, so you get an error.
fn owned_receiver(x: Box<Foo>) -> &'static () {
- x.borrowed() //~ ERROR `*x` does not live long enough
+ x.borrowed() //~ ERROR cannot return value referencing local data `*x`
}
fn main() {}
diff --git a/src/test/ui/regions/region-object-lifetime-5.stderr b/src/test/ui/regions/region-object-lifetime-5.stderr
index 1efaee1..b86f6e3 100644
--- a/src/test/ui/regions/region-object-lifetime-5.stderr
+++ b/src/test/ui/regions/region-object-lifetime-5.stderr
@@ -1,13 +1,12 @@
-error[E0597]: `*x` does not live long enough
+error[E0515]: cannot return value referencing local data `*x`
--> $DIR/region-object-lifetime-5.rs:11:5
|
LL | x.borrowed()
- | ^ borrowed value does not live long enough
-LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | -^^^^^^^^^^^
+ | |
+ | returns a value referencing data owned by the current function
+ | `*x` is borrowed here
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-addr-of-arg.nll.stderr b/src/test/ui/regions/regions-addr-of-arg.nll.stderr
deleted file mode 100644
index e772892..0000000
--- a/src/test/ui/regions/regions-addr-of-arg.nll.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/regions-addr-of-arg.rs:5:30
- |
-LL | let _p: &'static isize = &a;
- | -------------- ^^ borrowed value does not live long enough
- | |
- | type annotation requires that `a` is borrowed for `'static`
-LL | }
- | - `a` dropped here while still borrowed
-
-error[E0515]: cannot return reference to function parameter `a`
- --> $DIR/regions-addr-of-arg.rs:13:5
- |
-LL | &a
- | ^^ returns a reference to data owned by the current function
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0515, E0597.
-For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-addr-of-arg.rs b/src/test/ui/regions/regions-addr-of-arg.rs
index 06f16be..1805141 100644
--- a/src/test/ui/regions/regions-addr-of-arg.rs
+++ b/src/test/ui/regions/regions-addr-of-arg.rs
@@ -10,7 +10,7 @@
}
fn zed<'a>(a: isize) -> &'a isize {
- &a //~ ERROR `a` does not live long enough
+ &a //~ ERROR cannot return reference to function parameter `a`
}
fn main() {
diff --git a/src/test/ui/regions/regions-addr-of-arg.stderr b/src/test/ui/regions/regions-addr-of-arg.stderr
index 3e76a7d..e772892 100644
--- a/src/test/ui/regions/regions-addr-of-arg.stderr
+++ b/src/test/ui/regions/regions-addr-of-arg.stderr
@@ -1,27 +1,20 @@
error[E0597]: `a` does not live long enough
- --> $DIR/regions-addr-of-arg.rs:5:31
+ --> $DIR/regions-addr-of-arg.rs:5:30
|
LL | let _p: &'static isize = &a;
- | ^ borrowed value does not live long enough
+ | -------------- ^^ borrowed value does not live long enough
+ | |
+ | type annotation requires that `a` is borrowed for `'static`
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `a` dropped here while still borrowed
-error[E0597]: `a` does not live long enough
- --> $DIR/regions-addr-of-arg.rs:13:6
+error[E0515]: cannot return reference to function parameter `a`
+ --> $DIR/regions-addr-of-arg.rs:13:5
|
LL | &a
- | ^ borrowed value does not live long enough
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 12:8...
- --> $DIR/regions-addr-of-arg.rs:12:8
- |
-LL | fn zed<'a>(a: isize) -> &'a isize {
- | ^^
+ | ^^ returns a reference to data owned by the current function
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+Some errors have detailed explanations: E0515, E0597.
+For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr
deleted file mode 100644
index 2c55634..0000000
--- a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
- --> $DIR/regions-adjusted-lvalue-op.rs:14:16
- |
-LL | v[0].oh_no(&v);
- | - ----- ^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
- --> $DIR/regions-adjusted-lvalue-op.rs:15:16
- |
-LL | (*v).oh_no(&v);
- | - ----- ^^ immutable borrow occurs here
- | | |
- | | mutable borrow later used by call
- | mutable borrow occurs here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr
index 2c4c75f..2c55634 100644
--- a/src/test/ui/regions/regions-adjusted-lvalue-op.stderr
+++ b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr
@@ -1,19 +1,19 @@
error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
- --> $DIR/regions-adjusted-lvalue-op.rs:14:17
+ --> $DIR/regions-adjusted-lvalue-op.rs:14:16
|
LL | v[0].oh_no(&v);
- | - ^- mutable borrow ends here
- | | |
- | | immutable borrow occurs here
+ | - ----- ^^ immutable borrow occurs here
+ | | |
+ | | mutable borrow later used by call
| mutable borrow occurs here
error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
- --> $DIR/regions-adjusted-lvalue-op.rs:15:17
+ --> $DIR/regions-adjusted-lvalue-op.rs:15:16
|
LL | (*v).oh_no(&v);
- | - ^- mutable borrow ends here
- | | |
- | | immutable borrow occurs here
+ | - ----- ^^ immutable borrow occurs here
+ | | |
+ | | mutable borrow later used by call
| mutable borrow occurs here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.ast.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.ast.stderr
deleted file mode 100644
index 76ead4e..0000000
--- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.ast.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
- --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:45:13
- |
-LL | let _x: &'a WithAssoc<TheType<'b>> = loop { };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: the pointer is valid for the lifetime 'a as defined on the function body at 37:15
- --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:37:15
- |
-LL | fn with_assoc<'a,'b>() {
- | ^^
-note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 37:18
- --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:37:18
- |
-LL | fn with_assoc<'a,'b>() {
- | ^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr
new file mode 100644
index 0000000..f31f25b
--- /dev/null
+++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:43:12
+ |
+LL | let _: &'a WithAssoc<TheType<'b>> = loop { };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 37:15
+ --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:37:15
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 37:18
+ --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:37:18
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.mir.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.mir.stderr
deleted file mode 100644
index ad94d37..0000000
--- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.mir.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error: lifetime may not live long enough
- --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:45:13
- |
-LL | fn with_assoc<'a,'b>() {
- | -- -- lifetime `'b` defined here
- | |
- | lifetime `'a` defined here
-...
-LL | let _x: &'a WithAssoc<TheType<'b>> = loop { };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr
new file mode 100644
index 0000000..867eafe
--- /dev/null
+++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr
@@ -0,0 +1,13 @@
+error: lifetime may not live long enough
+ --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:43:12
+ |
+LL | fn with_assoc<'a,'b>() {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+...
+LL | let _: &'a WithAssoc<TheType<'b>> = loop { };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs
index 1d53492..97c5559 100644
--- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs
+++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs
@@ -3,8 +3,8 @@
// outlive the location in which the type appears, even when the
// associted type is in a supertype. Issue #22246.
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
+// revisions: migrate nll
+//[nll]compile-flags: -Z borrowck=mir
#![allow(dead_code)]
@@ -40,11 +40,9 @@
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
// which is &'b (), must outlive 'a.
- // FIXME (#54943) NLL doesn't enforce WF condition in unreachable code if
- // `_x` is changed to `_`
- let _x: &'a WithAssoc<TheType<'b>> = loop { };
- //[ast]~^ ERROR reference has a longer lifetime
- //[mir]~^^ ERROR lifetime may not live long enough
+ let _: &'a WithAssoc<TheType<'b>> = loop { };
+ //[migrate]~^ ERROR reference has a longer lifetime
+ //[nll]~^^ ERROR lifetime may not live long enough
}
fn main() {
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr
deleted file mode 100644
index aa92c59..0000000
--- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
- --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:42:13
- |
-LL | let _x: &'a WithAssoc<TheType<'b>> = loop { };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: the pointer is valid for the lifetime 'a as defined on the function body at 34:15
- --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:34:15
- |
-LL | fn with_assoc<'a,'b>() {
- | ^^
-note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 34:18
- --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:34:18
- |
-LL | fn with_assoc<'a,'b>() {
- | ^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr
deleted file mode 100644
index 8e119c4..0000000
--- a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return value referencing local data `*v`
- --> $DIR/regions-close-object-into-object-1.rs:12:5
- |
-LL | box B(&*v) as Box<X>
- | ^^^^^^---^^^^^^^^^^^
- | | |
- | | `*v` is borrowed here
- | returns a value referencing data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-1.rs b/src/test/ui/regions/regions-close-object-into-object-1.rs
index 7a862f9..5518c6a 100644
--- a/src/test/ui/regions/regions-close-object-into-object-1.rs
+++ b/src/test/ui/regions/regions-close-object-into-object-1.rs
@@ -9,7 +9,7 @@
impl<'a, T> X for B<'a, T> {}
fn f<'a, T:'static, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
- box B(&*v) as Box<X> //~ ERROR `*v` does not live long enough
+ box B(&*v) as Box<X> //~ ERROR cannot return value referencing local data `*v`
}
fn main() {}
diff --git a/src/test/ui/regions/regions-close-object-into-object-1.stderr b/src/test/ui/regions/regions-close-object-into-object-1.stderr
index c7bde8d..8e119c4 100644
--- a/src/test/ui/regions/regions-close-object-into-object-1.stderr
+++ b/src/test/ui/regions/regions-close-object-into-object-1.stderr
@@ -1,13 +1,12 @@
-error[E0597]: `*v` does not live long enough
- --> $DIR/regions-close-object-into-object-1.rs:12:12
+error[E0515]: cannot return value referencing local data `*v`
+ --> $DIR/regions-close-object-into-object-1.rs:12:5
|
LL | box B(&*v) as Box<X>
- | ^^ borrowed value does not live long enough
-LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ^^^^^^---^^^^^^^^^^^
+ | | |
+ | | `*v` is borrowed here
+ | returns a value referencing data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr
deleted file mode 100644
index 9ea1363..0000000
--- a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return value referencing local data `*v`
- --> $DIR/regions-close-object-into-object-3.rs:11:5
- |
-LL | box B(&*v) as Box<X>
- | ^^^^^^---^^^^^^^^^^^
- | | |
- | | `*v` is borrowed here
- | returns a value referencing data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-3.rs b/src/test/ui/regions/regions-close-object-into-object-3.rs
index cafbf09..6f6b3a1 100644
--- a/src/test/ui/regions/regions-close-object-into-object-3.rs
+++ b/src/test/ui/regions/regions-close-object-into-object-3.rs
@@ -8,7 +8,7 @@
impl<'a, T> X for B<'a, T> {}
fn h<'a, T, U:'static>(v: Box<A<U>+'static>) -> Box<X+'static> {
- box B(&*v) as Box<X> //~ ERROR `*v` does not live long enough
+ box B(&*v) as Box<X> //~ ERROR cannot return value referencing local data `*v`
}
fn main() {}
diff --git a/src/test/ui/regions/regions-close-object-into-object-3.stderr b/src/test/ui/regions/regions-close-object-into-object-3.stderr
index 122e57a..9ea1363 100644
--- a/src/test/ui/regions/regions-close-object-into-object-3.stderr
+++ b/src/test/ui/regions/regions-close-object-into-object-3.stderr
@@ -1,13 +1,12 @@
-error[E0597]: `*v` does not live long enough
- --> $DIR/regions-close-object-into-object-3.rs:11:12
+error[E0515]: cannot return value referencing local data `*v`
+ --> $DIR/regions-close-object-into-object-3.rs:11:5
|
LL | box B(&*v) as Box<X>
- | ^^ borrowed value does not live long enough
-LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ^^^^^^---^^^^^^^^^^^
+ | | |
+ | | `*v` is borrowed here
+ | returns a value referencing data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-creating-enums.nll.stderr b/src/test/ui/regions/regions-creating-enums.nll.stderr
deleted file mode 100644
index a95d846..0000000
--- a/src/test/ui/regions/regions-creating-enums.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0515]: cannot return reference to temporary value
- --> $DIR/regions-creating-enums.rs:23:16
- |
-LL | return &Ast::Num((*f)(x));
- | ^-----------------
- | ||
- | |temporary value created here
- | returns a reference to data owned by the current function
-
-error[E0515]: cannot return reference to temporary value
- --> $DIR/regions-creating-enums.rs:28:16
- |
-LL | return &Ast::Add(m_x, m_y);
- | ^------------------
- | ||
- | |temporary value created here
- | returns a reference to data owned by the current function
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-creating-enums.rs b/src/test/ui/regions/regions-creating-enums.rs
index ea8d437..6ed68f8 100644
--- a/src/test/ui/regions/regions-creating-enums.rs
+++ b/src/test/ui/regions/regions-creating-enums.rs
@@ -20,12 +20,12 @@
fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize {
match *x {
Ast::Num(x) => {
- return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough
+ return &Ast::Num((*f)(x)); //~ ERROR cannot return reference to temporary value
}
Ast::Add(x, y) => {
let m_x = map_nums(x, f);
let m_y = map_nums(y, f);
- return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough
+ return &Ast::Add(m_x, m_y); //~ ERROR cannot return reference to temporary value
}
}
}
diff --git a/src/test/ui/regions/regions-creating-enums.stderr b/src/test/ui/regions/regions-creating-enums.stderr
index bb11be9..a95d846 100644
--- a/src/test/ui/regions/regions-creating-enums.stderr
+++ b/src/test/ui/regions/regions-creating-enums.stderr
@@ -1,33 +1,21 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/regions-creating-enums.rs:23:17
+error[E0515]: cannot return reference to temporary value
+ --> $DIR/regions-creating-enums.rs:23:16
|
LL | return &Ast::Num((*f)(x));
- | ^^^^^^^^^^^^^^^^^- temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:13...
- --> $DIR/regions-creating-enums.rs:20:13
- |
-LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize {
- | ^^
- = note: consider using a `let` binding to increase its lifetime
+ | ^-----------------
+ | ||
+ | |temporary value created here
+ | returns a reference to data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/regions-creating-enums.rs:28:17
+error[E0515]: cannot return reference to temporary value
+ --> $DIR/regions-creating-enums.rs:28:16
|
LL | return &Ast::Add(m_x, m_y);
- | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:13...
- --> $DIR/regions-creating-enums.rs:20:13
- |
-LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize {
- | ^^
- = note: consider using a `let` binding to increase its lifetime
+ | ^------------------
+ | ||
+ | |temporary value created here
+ | returns a reference to data owned by the current function
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.ast.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr
similarity index 100%
rename from src/test/ui/regions/regions-free-region-ordering-caller.ast.stderr
rename to src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.mir.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr
similarity index 100%
rename from src/test/ui/regions/regions-free-region-ordering-caller.mir.stderr
rename to src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.rs b/src/test/ui/regions/regions-free-region-ordering-caller.rs
index 621e6e7..c0b12f2 100644
--- a/src/test/ui/regions/regions-free-region-ordering-caller.rs
+++ b/src/test/ui/regions/regions-free-region-ordering-caller.rs
@@ -2,25 +2,25 @@
// than the thing it points at and ensure that they result in
// errors. See also regions-free-region-ordering-callee.rs
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
+// revisions: migrate nll
+//[nll]compile-flags: -Z borrowck=mir
struct Paramd<'a> { x: &'a usize }
fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
- let z: Option<&'b &'a usize> = None;//[ast]~ ERROR E0623
- //[mir]~^ ERROR lifetime may not live long enough
+ let z: Option<&'b &'a usize> = None;//[migrate]~ ERROR E0623
+ //[nll]~^ ERROR lifetime may not live long enough
}
fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
let y: Paramd<'a> = Paramd { x: a };
- let z: Option<&'b Paramd<'a>> = None;//[ast]~ ERROR E0623
- //[mir]~^ ERROR lifetime may not live long enough
+ let z: Option<&'b Paramd<'a>> = None;//[migrate]~ ERROR E0623
+ //[nll]~^ ERROR lifetime may not live long enough
}
fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
- let z: Option<&'a &'b usize> = None;//[ast]~ ERROR E0623
- //[mir]~^ ERROR lifetime may not live long enough
+ let z: Option<&'a &'b usize> = None;//[migrate]~ ERROR E0623
+ //[nll]~^ ERROR lifetime may not live long enough
}
fn main() {}
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr
deleted file mode 100644
index 8042b17..0000000
--- a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/regions-free-region-ordering-caller1.rs:9:27
- |
-LL | fn call1<'a>(x: &'a usize) {
- | -- lifetime `'a` defined here
-...
-LL | let z: &'a & usize = &(&y);
- | ----------- ^^^^ creates a temporary which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'a`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0597]: `y` does not live long enough
- --> $DIR/regions-free-region-ordering-caller1.rs:9:27
- |
-LL | fn call1<'a>(x: &'a usize) {
- | -- lifetime `'a` defined here
-...
-LL | let z: &'a & usize = &(&y);
- | ----------- ^^^^ borrowed value does not live long enough
- | |
- | type annotation requires that `y` is borrowed for `'a`
-...
-LL | }
- | - `y` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0597, E0716.
-For more information about an error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.rs b/src/test/ui/regions/regions-free-region-ordering-caller1.rs
index d9251c0..f324556 100644
--- a/src/test/ui/regions/regions-free-region-ordering-caller1.rs
+++ b/src/test/ui/regions/regions-free-region-ordering-caller1.rs
@@ -7,7 +7,7 @@
// &'a &'z usize requires that 'a <= 'z:
let y: usize = 3;
let z: &'a & usize = &(&y);
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
//~^^ ERROR `y` does not live long enough
}
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.stderr b/src/test/ui/regions/regions-free-region-ordering-caller1.stderr
index 08aaa35..8042b17 100644
--- a/src/test/ui/regions/regions-free-region-ordering-caller1.stderr
+++ b/src/test/ui/regions/regions-free-region-ordering-caller1.stderr
@@ -1,33 +1,32 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/regions-free-region-ordering-caller1.rs:9:27
|
+LL | fn call1<'a>(x: &'a usize) {
+ | -- lifetime `'a` defined here
+...
LL | let z: &'a & usize = &(&y);
- | ^^^^ temporary value does not live long enough
+ | ----------- ^^^^ creates a temporary which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'a`
...
LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 5:10...
- --> $DIR/regions-free-region-ordering-caller1.rs:5:10
- |
-LL | fn call1<'a>(x: &'a usize) {
- | ^^
+ | - temporary value is freed at the end of this statement
error[E0597]: `y` does not live long enough
- --> $DIR/regions-free-region-ordering-caller1.rs:9:29
- |
-LL | let z: &'a & usize = &(&y);
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 5:10...
- --> $DIR/regions-free-region-ordering-caller1.rs:5:10
+ --> $DIR/regions-free-region-ordering-caller1.rs:9:27
|
LL | fn call1<'a>(x: &'a usize) {
- | ^^
+ | -- lifetime `'a` defined here
+...
+LL | let z: &'a & usize = &(&y);
+ | ----------- ^^^^ borrowed value does not live long enough
+ | |
+ | type annotation requires that `y` is borrowed for `'a`
+...
+LL | }
+ | - `y` dropped here while still borrowed
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+Some errors have detailed explanations: E0597, E0716.
+For more information about an error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr
deleted file mode 100644
index 2c7a6e8..0000000
--- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return value referencing local data `*p`
- --> $DIR/regions-infer-borrow-scope-too-big.rs:13:12
- |
-LL | let xc = x_coord(&*p);
- | --- `*p` is borrowed here
-LL | assert_eq!(*xc, 3);
-LL | return xc;
- | ^^ returns a value referencing data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs b/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs
index 3bf1c67..250b41d 100644
--- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs
+++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs
@@ -8,9 +8,9 @@
}
fn foo<'a>(p: Box<Point>) -> &'a isize {
- let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough
+ let xc = x_coord(&*p);
assert_eq!(*xc, 3);
- return xc;
+ return xc; //~ ERROR cannot return value referencing local data `*p`
}
fn main() {}
diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr
index ed4bc15..2c7a6e8 100644
--- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr
+++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr
@@ -1,18 +1,12 @@
-error[E0597]: `*p` does not live long enough
- --> $DIR/regions-infer-borrow-scope-too-big.rs:11:23
+error[E0515]: cannot return value referencing local data `*p`
+ --> $DIR/regions-infer-borrow-scope-too-big.rs:13:12
|
LL | let xc = x_coord(&*p);
- | ^^ borrowed value does not live long enough
-...
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 10:8...
- --> $DIR/regions-infer-borrow-scope-too-big.rs:10:8
- |
-LL | fn foo<'a>(p: Box<Point>) -> &'a isize {
- | ^^
+ | --- `*p` is borrowed here
+LL | assert_eq!(*xc, 3);
+LL | return xc;
+ | ^^ returns a value referencing data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr
deleted file mode 100644
index 803d0d7..0000000
--- a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/regions-infer-proc-static-upvar.rs:10:13
- |
-LL | let y = &x;
- | ^^ borrowed value does not live long enough
-LL | / foo(move|| {
-LL | | let _a = *y;
-LL | | });
- | |______- argument requires that `x` is borrowed for `'static`
-LL | }
- | - `x` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr
index 21b2e88..803d0d7 100644
--- a/src/test/ui/regions/regions-infer-proc-static-upvar.stderr
+++ b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr
@@ -1,13 +1,14 @@
error[E0597]: `x` does not live long enough
- --> $DIR/regions-infer-proc-static-upvar.rs:10:14
+ --> $DIR/regions-infer-proc-static-upvar.rs:10:13
|
-LL | let y = &x;
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+LL | let y = &x;
+ | ^^ borrowed value does not live long enough
+LL | / foo(move|| {
+LL | | let _a = *y;
+LL | | });
+ | |______- argument requires that `x` is borrowed for `'static`
+LL | }
+ | - `x` dropped here while still borrowed
error: aborting due to previous error
diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr
deleted file mode 100644
index 7984f4f..0000000
--- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:16:3
- |
-LL | let testValue = &id(Test);
- | -------- temporary value created here
-LL |
-LL | testValue
- | ^^^^^^^^^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:22:3
- |
-LL | let testValue = &id(MyEnum::Variant1);
- | -------------------- temporary value created here
-LL |
-LL | testValue
- | ^^^^^^^^^ returns a value referencing data owned by the current function
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs
index 2d21a51..1b25294 100644
--- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs
+++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs
@@ -12,14 +12,14 @@
fn structLifetime<'a>() -> &'a Test {
let testValue = &id(Test);
- //~^ ERROR borrowed value does not live long enough
testValue
+ //~^ ERROR cannot return value referencing temporary value
}
fn variantLifetime<'a>() -> &'a MyEnum {
let testValue = &id(MyEnum::Variant1);
- //~^ ERROR borrowed value does not live long enough
testValue
+ //~^ ERROR cannot return value referencing temporary value
}
diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr
index c0bfc47..b4bf2ab 100644
--- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr
+++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr
@@ -1,33 +1,19 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:14:20
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:15:3
|
LL | let testValue = &id(Test);
- | ^^^^^^^^ temporary value does not live long enough
-...
-LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:19...
- --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:13:19
- |
-LL | fn structLifetime<'a>() -> &'a Test {
- | ^^
+ | -------- temporary value created here
+LL | testValue
+ | ^^^^^^^^^ returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:20:20
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:21:3
|
LL | let testValue = &id(MyEnum::Variant1);
- | ^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-...
-LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 19:20...
- --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:19:20
- |
-LL | fn variantLifetime<'a>() -> &'a MyEnum {
- | ^^
+ | -------------------- temporary value created here
+LL | testValue
+ | ^^^^^^^^^ returns a value referencing data owned by the current function
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-nested-fns-2.nll.stderr b/src/test/ui/regions/regions-nested-fns-2.nll.stderr
deleted file mode 100644
index 8627dac..0000000
--- a/src/test/ui/regions/regions-nested-fns-2.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0597]: `y` does not live long enough
- --> $DIR/regions-nested-fns-2.rs:8:25
- |
-LL | |z| {
- | --- value captured here
-LL |
-LL | if false { &y } else { z }
- | -^
- | ||
- | |borrowed value does not live long enough
- | returning this value requires that `y` is borrowed for `'static`
-LL | });
-LL | }
- | - `y` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-nested-fns-2.rs b/src/test/ui/regions/regions-nested-fns-2.rs
index 1b51880..3b3e26c 100644
--- a/src/test/ui/regions/regions-nested-fns-2.rs
+++ b/src/test/ui/regions/regions-nested-fns-2.rs
@@ -4,8 +4,8 @@
let y = 3;
ignore(
|z| {
- //~^ ERROR E0373
if false { &y } else { z }
+ //~^ ERROR `y` does not live long enough
});
}
diff --git a/src/test/ui/regions/regions-nested-fns-2.stderr b/src/test/ui/regions/regions-nested-fns-2.stderr
index 08bab6e..43c8d12 100644
--- a/src/test/ui/regions/regions-nested-fns-2.stderr
+++ b/src/test/ui/regions/regions-nested-fns-2.stderr
@@ -1,16 +1,17 @@
-error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
- --> $DIR/regions-nested-fns-2.rs:6:9
+error[E0597]: `y` does not live long enough
+ --> $DIR/regions-nested-fns-2.rs:7:25
|
LL | |z| {
- | ^^^ may outlive borrowed value `y`
-LL |
+ | --- value captured here
LL | if false { &y } else { z }
- | - `y` is borrowed here
-help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
- |
-LL | move |z| {
- | ^^^^^^^^
+ | -^
+ | ||
+ | |borrowed value does not live long enough
+ | returning this value requires that `y` is borrowed for `'static`
+...
+LL | }
+ | - `y` dropped here while still borrowed
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0373`.
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.ast.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr
similarity index 100%
rename from src/test/ui/regions/regions-outlives-projection-container-hrtb.ast.stderr
rename to src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr
diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.mir.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr
similarity index 100%
rename from src/test/ui/regions/regions-outlives-projection-container-hrtb.mir.stderr
rename to src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr
diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs b/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs
index 2871d96..407a4fd 100644
--- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs
+++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs
@@ -1,8 +1,8 @@
// Test that structs with higher-ranked where clauses don't generate
// "outlives" requirements. Issue #22246.
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
+// revisions: migrate nll
+//[nll]compile-flags: -Z borrowck=mir
#![allow(dead_code)]
@@ -33,8 +33,8 @@
// We get an error because 'b:'a does not hold:
let _: &'a WithHrAssoc<TheType<'b>> = loop { };
- //[ast]~^ ERROR reference has a longer lifetime
- //[mir]~^^ ERROR lifetime may not live long enough
+ //[migrate]~^ ERROR reference has a longer lifetime
+ //[nll]~^^ ERROR lifetime may not live long enough
}
///////////////////////////////////////////////////////////////////////////
@@ -55,8 +55,8 @@
// below to be well-formed, it is not related to the HR relation.
let _: &'a WithHrAssocSub<TheType<'b>> = loop { };
- //[ast]~^ ERROR reference has a longer lifetime
- //[mir]~^^ ERROR lifetime may not live long enough
+ //[migrate]~^ ERROR reference has a longer lifetime
+ //[nll]~^^ ERROR lifetime may not live long enough
}
diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr
deleted file mode 100644
index 856e28f..0000000
--- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0491]: in type `&'a WithHrAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
- --> $DIR/regions-outlives-projection-container-hrtb.rs:32:12
- |
-LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: the pointer is valid for the lifetime 'a as defined on the function body at 29:15
- --> $DIR/regions-outlives-projection-container-hrtb.rs:29:15
- |
-LL | fn with_assoc<'a,'b>() {
- | ^^
-note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 29:18
- --> $DIR/regions-outlives-projection-container-hrtb.rs:29:18
- |
-LL | fn with_assoc<'a,'b>() {
- | ^^
-
-error[E0491]: in type `&'a WithHrAssocSub<TheType<'b>>`, reference has a longer lifetime than the data it references
- --> $DIR/regions-outlives-projection-container-hrtb.rs:53:12
- |
-LL | let _: &'a WithHrAssocSub<TheType<'b>> = loop { };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: the pointer is valid for the lifetime 'a as defined on the function body at 49:19
- --> $DIR/regions-outlives-projection-container-hrtb.rs:49:19
- |
-LL | fn with_assoc_sub<'a,'b>() {
- | ^^
-note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 49:22
- --> $DIR/regions-outlives-projection-container-hrtb.rs:49:22
- |
-LL | fn with_assoc_sub<'a,'b>() {
- | ^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.ast.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr
similarity index 100%
rename from src/test/ui/regions/regions-outlives-projection-container-wc.ast.stderr
rename to src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr
diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.mir.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr
similarity index 100%
rename from src/test/ui/regions/regions-outlives-projection-container-wc.mir.stderr
rename to src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr
diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.rs b/src/test/ui/regions/regions-outlives-projection-container-wc.rs
index 3762221..5037ea5 100644
--- a/src/test/ui/regions/regions-outlives-projection-container-wc.rs
+++ b/src/test/ui/regions/regions-outlives-projection-container-wc.rs
@@ -3,8 +3,8 @@
// outlive the location in which the type appears, even when the
// constraint is in a where clause not a bound. Issue #22246.
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
+// revisions: migrate nll
+//[nll]compile-flags: -Z borrowck=mir
#![allow(dead_code)]
@@ -35,8 +35,8 @@
// which is &'b (), must outlive 'a.
let _: &'a WithAssoc<TheType<'b>> = loop { };
- //[ast]~^ ERROR reference has a longer lifetime
- //[mir]~^^ ERROR lifetime may not live long enough
+ //[migrate]~^ ERROR reference has a longer lifetime
+ //[nll]~^^ ERROR lifetime may not live long enough
}
fn main() {
diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.stderr
deleted file mode 100644
index 0d73d3d..0000000
--- a/src/test/ui/regions/regions-outlives-projection-container-wc.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
- --> $DIR/regions-outlives-projection-container-wc.rs:34:12
- |
-LL | let _: &'a WithAssoc<TheType<'b>> = loop { };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: the pointer is valid for the lifetime 'a as defined on the function body at 28:15
- --> $DIR/regions-outlives-projection-container-wc.rs:28:15
- |
-LL | fn with_assoc<'a,'b>() {
- | ^^
-note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 28:18
- --> $DIR/regions-outlives-projection-container-wc.rs:28:18
- |
-LL | fn with_assoc<'a,'b>() {
- | ^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr
deleted file mode 100644
index f77d94a..0000000
--- a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `line` does not live long enough
- --> $DIR/regions-pattern-typing-issue-19552.rs:5:14
- |
-LL | match [&*line] {
- | ^^^^ borrowed value does not live long enough
-LL | [ word ] => { assert_static(word); }
- | ------------------- argument requires that `line` is borrowed for `'static`
-LL | }
-LL | }
- | - `line` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr
index 3e3201d..f77d94a 100644
--- a/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr
+++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr
@@ -3,11 +3,11 @@
|
LL | match [&*line] {
| ^^^^ borrowed value does not live long enough
-...
+LL | [ word ] => { assert_static(word); }
+ | ------------------- argument requires that `line` is borrowed for `'static`
+LL | }
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `line` dropped here while still borrowed
error: aborting due to previous error
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr
deleted file mode 100644
index b1c5878..0000000
--- a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0506]: cannot assign to `a1` because it is borrowed
- --> $DIR/regions-pattern-typing-issue-19997.rs:10:13
- |
-LL | match (&a1,) {
- | --- borrow of `a1` occurs here
-LL | (&ref b0,) => {
-LL | a1 = &f;
- | ^^^^^^^ assignment to borrowed `a1` occurs here
-LL |
-LL | drop(b0);
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr
deleted file mode 100644
index 0074d2b..0000000
--- a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0506]: cannot assign to `a1` because it is borrowed
- --> $DIR/regions-pattern-typing-issue-19997.rs:10:13
- |
-LL | match (&a1,) {
- | -- borrow of `a1` occurs here
-LL | (&ref b0,) => {
-LL | a1 = &f;
- | ^^^^^^^ assignment to borrowed `a1` occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr
deleted file mode 100644
index b1c5878..0000000
--- a/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0506]: cannot assign to `a1` because it is borrowed
- --> $DIR/regions-pattern-typing-issue-19997.rs:10:13
- |
-LL | match (&a1,) {
- | --- borrow of `a1` occurs here
-LL | (&ref b0,) => {
-LL | a1 = &f;
- | ^^^^^^^ assignment to borrowed `a1` occurs here
-LL |
-LL | drop(b0);
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.rs b/src/test/ui/regions/regions-pattern-typing-issue-19997.rs
index 35f38af..3919069 100644
--- a/src/test/ui/regions/regions-pattern-typing-issue-19997.rs
+++ b/src/test/ui/regions/regions-pattern-typing-issue-19997.rs
@@ -1,14 +1,10 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
fn main() {
let a0 = 0;
let f = 1;
let mut a1 = &a0;
match (&a1,) {
(&ref b0,) => {
- a1 = &f; //[ast]~ ERROR cannot assign
- //[mir]~^ ERROR cannot assign to `a1` because it is borrowed
+ a1 = &f; //~ ERROR cannot assign to `a1` because it is borrowed
drop(b0);
}
}
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.stderr
new file mode 100644
index 0000000..ae60e3c
--- /dev/null
+++ b/src/test/ui/regions/regions-pattern-typing-issue-19997.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `a1` because it is borrowed
+ --> $DIR/regions-pattern-typing-issue-19997.rs:7:13
+ |
+LL | match (&a1,) {
+ | --- borrow of `a1` occurs here
+LL | (&ref b0,) => {
+LL | a1 = &f;
+ | ^^^^^^^ assignment to borrowed `a1` occurs here
+LL | drop(b0);
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr
deleted file mode 100644
index ccba6c59..0000000
--- a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0515]: cannot return value referencing function parameter
- --> $DIR/regions-ref-in-fn-arg.rs:5:5
- |
-LL | fn arg_item(box ref x: Box<isize>) -> &'static isize {
- | --------- function parameter borrowed here
-LL | x
- | ^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing function parameter
- --> $DIR/regions-ref-in-fn-arg.rs:11:22
- |
-LL | with(|box ref x| x)
- | --------- ^ returns a value referencing data owned by the current function
- | |
- | function parameter borrowed here
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.rs b/src/test/ui/regions/regions-ref-in-fn-arg.rs
index cf9e7b2..d1cbd27 100644
--- a/src/test/ui/regions/regions-ref-in-fn-arg.rs
+++ b/src/test/ui/regions/regions-ref-in-fn-arg.rs
@@ -2,13 +2,13 @@
#![feature(box_syntax)]
fn arg_item(box ref x: Box<isize>) -> &'static isize {
- x //~^ ERROR borrowed value does not live long enough
+ x //~ ERROR cannot return value referencing function parameter
}
fn with<R, F>(f: F) -> R where F: FnOnce(Box<isize>) -> R { f(box 3) }
fn arg_closure() -> &'static isize {
- with(|box ref x| x) //~ ERROR borrowed value does not live long enough
+ with(|box ref x| x) //~ ERROR cannot return value referencing function parameter
}
fn main() {}
diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.stderr
index 9ecd327..ccba6c59 100644
--- a/src/test/ui/regions/regions-ref-in-fn-arg.stderr
+++ b/src/test/ui/regions/regions-ref-in-fn-arg.stderr
@@ -1,24 +1,19 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/regions-ref-in-fn-arg.rs:4:17
+error[E0515]: cannot return value referencing function parameter
+ --> $DIR/regions-ref-in-fn-arg.rs:5:5
|
LL | fn arg_item(box ref x: Box<isize>) -> &'static isize {
- | ^^^^^ borrowed value does not live long enough
+ | --------- function parameter borrowed here
LL | x
-LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ^ returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/regions-ref-in-fn-arg.rs:11:15
+error[E0515]: cannot return value referencing function parameter
+ --> $DIR/regions-ref-in-fn-arg.rs:11:22
|
LL | with(|box ref x| x)
- | ^^^^^ - borrowed value only lives until here
- | |
- | borrowed value does not live long enough
- |
- = note: borrowed value must be valid for the static lifetime...
+ | --------- ^ returns a value referencing data owned by the current function
+ | |
+ | function parameter borrowed here
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-ret.nll.stderr b/src/test/ui/regions/regions-ret.nll.stderr
deleted file mode 100644
index 0e4875a..0000000
--- a/src/test/ui/regions/regions-ret.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return reference to temporary value
- --> $DIR/regions-ret.rs:4:12
- |
-LL | return &id(3);
- | ^-----
- | ||
- | |temporary value created here
- | returns a reference to data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-ret.rs b/src/test/ui/regions/regions-ret.rs
index a094d1a..580545e 100644
--- a/src/test/ui/regions/regions-ret.rs
+++ b/src/test/ui/regions/regions-ret.rs
@@ -1,7 +1,7 @@
fn id<T>(x: T) -> T { x }
fn f(_x: &isize) -> &isize {
- return &id(3); //~ ERROR borrowed value does not live long enough
+ return &id(3); //~ ERROR cannot return reference to temporary value
}
fn main() {
diff --git a/src/test/ui/regions/regions-ret.stderr b/src/test/ui/regions/regions-ret.stderr
index 77820a3..0e4875a 100644
--- a/src/test/ui/regions/regions-ret.stderr
+++ b/src/test/ui/regions/regions-ret.stderr
@@ -1,20 +1,12 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/regions-ret.rs:4:13
+error[E0515]: cannot return reference to temporary value
+ --> $DIR/regions-ret.rs:4:12
|
LL | return &id(3);
- | ^^^^^- temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
-note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 3:1...
- --> $DIR/regions-ret.rs:3:1
- |
-LL | / fn f(_x: &isize) -> &isize {
-LL | | return &id(3);
-LL | | }
- | |_^
- = note: consider using a `let` binding to increase its lifetime
+ | ^-----
+ | ||
+ | |temporary value created here
+ | returns a reference to data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr
deleted file mode 100644
index 9d87fe2..0000000
--- a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0515]: cannot return reference to temporary value
- --> $DIR/regions-return-stack-allocated-vec.rs:4:5
- |
-LL | &[x]
- | ^---
- | ||
- | |temporary value created here
- | returns a reference to data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.rs b/src/test/ui/regions/regions-return-stack-allocated-vec.rs
index 8d071db..97fbdbf 100644
--- a/src/test/ui/regions/regions-return-stack-allocated-vec.rs
+++ b/src/test/ui/regions/regions-return-stack-allocated-vec.rs
@@ -1,7 +1,7 @@
// Test that we cannot return a stack allocated slice
fn function(x: isize) -> &'static [isize] {
- &[x] //~ ERROR borrowed value does not live long enough
+ &[x] //~ ERROR cannot return reference to temporary value
}
fn main() {
diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr
index 3256294..9d87fe2 100644
--- a/src/test/ui/regions/regions-return-stack-allocated-vec.stderr
+++ b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr
@@ -1,13 +1,12 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/regions-return-stack-allocated-vec.rs:4:6
+error[E0515]: cannot return reference to temporary value
+ --> $DIR/regions-return-stack-allocated-vec.rs:4:5
|
LL | &[x]
- | ^^^ temporary value does not live long enough
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ^---
+ | ||
+ | |temporary value created here
+ | returns a reference to data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-static-bound.ll.stderr b/src/test/ui/regions/regions-static-bound.migrate.stderr
similarity index 100%
rename from src/test/ui/regions/regions-static-bound.ll.stderr
rename to src/test/ui/regions/regions-static-bound.migrate.stderr
diff --git a/src/test/ui/regions/regions-static-bound.rs b/src/test/ui/regions/regions-static-bound.rs
index c1a15e5..1db5488 100644
--- a/src/test/ui/regions/regions-static-bound.rs
+++ b/src/test/ui/regions/regions-static-bound.rs
@@ -1,4 +1,4 @@
-// revisions: ll nll
+// revisions: migrate nll
//[nll] compile-flags:-Zborrowck=mir
fn static_id<'a,'b>(t: &'a ()) -> &'static ()
@@ -6,14 +6,14 @@
fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static ()
where 'a: 'b, 'b: 'static { t }
fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
- t //[ll]~ ERROR E0312
+ t //[migrate]~ ERROR E0312
//[nll]~^ ERROR lifetime may not live long enough
}
fn error(u: &(), v: &()) {
- static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
+ static_id(&u); //[migrate]~ ERROR explicit lifetime required in the type of `u` [E0621]
//[nll]~^ ERROR explicit lifetime required in the type of `u` [E0621]
- static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
+ static_id_indirect(&v); //[migrate]~ ERROR explicit lifetime required in the type of `v` [E0621]
//[nll]~^ ERROR explicit lifetime required in the type of `v` [E0621]
}
diff --git a/src/test/ui/regions/regions-steal-closure.nll.stderr b/src/test/ui/regions/regions-steal-closure.nll.stderr
deleted file mode 100644
index 5b0efaf..0000000
--- a/src/test/ui/regions/regions-steal-closure.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0597]: `i` does not live long enough
- --> $DIR/regions-steal-closure.rs:14:28
- |
-LL | let mut cl_box = {
- | ---------- borrow later stored here
-LL | let mut i = 3;
-LL | box_it(Box::new(|| i += 1))
- | -- ^ borrowed value does not live long enough
- | |
- | value captured here
-LL | };
- | - `i` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-steal-closure.stderr b/src/test/ui/regions/regions-steal-closure.stderr
index 8cfd5b5..5b0efaf 100644
--- a/src/test/ui/regions/regions-steal-closure.stderr
+++ b/src/test/ui/regions/regions-steal-closure.stderr
@@ -1,15 +1,15 @@
error[E0597]: `i` does not live long enough
--> $DIR/regions-steal-closure.rs:14:28
|
+LL | let mut cl_box = {
+ | ---------- borrow later stored here
+LL | let mut i = 3;
LL | box_it(Box::new(|| i += 1))
| -- ^ borrowed value does not live long enough
| |
- | capture occurs here
+ | value captured here
LL | };
- | - borrowed value only lives until here
-LL | cl_box.cl.call_mut(());
-LL | }
- | - borrowed value needs to live until here
+ | - `i` dropped here while still borrowed
error: aborting due to previous error
diff --git a/src/test/ui/regions/regions-trait-variance.nll.stderr b/src/test/ui/regions/regions-trait-variance.nll.stderr
deleted file mode 100644
index 56c9f89..0000000
--- a/src/test/ui/regions/regions-trait-variance.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0515]: cannot return value referencing local data `*b`
- --> $DIR/regions-trait-variance.rs:38:5
- |
-LL | let bb: &B = &*b;
- | --- `*b` is borrowed here
-LL | make_a(bb)
- | ^^^^^^^^^^ returns a value referencing data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-trait-variance.rs b/src/test/ui/regions/regions-trait-variance.rs
index d5462b2..73baa84 100644
--- a/src/test/ui/regions/regions-trait-variance.rs
+++ b/src/test/ui/regions/regions-trait-variance.rs
@@ -34,8 +34,8 @@
let b: Box<B> = box B {
i: 1,
};
- let bb: &B = &*b; //~ ERROR `*b` does not live long enough
- make_a(bb)
+ let bb: &B = &*b;
+ make_a(bb) //~ ERROR cannot return value referencing local data `*b`
}
fn main() {
diff --git a/src/test/ui/regions/regions-trait-variance.stderr b/src/test/ui/regions/regions-trait-variance.stderr
index 32c89b8..56c9f89 100644
--- a/src/test/ui/regions/regions-trait-variance.stderr
+++ b/src/test/ui/regions/regions-trait-variance.stderr
@@ -1,18 +1,11 @@
-error[E0597]: `*b` does not live long enough
- --> $DIR/regions-trait-variance.rs:37:19
+error[E0515]: cannot return value referencing local data `*b`
+ --> $DIR/regions-trait-variance.rs:38:5
|
LL | let bb: &B = &*b;
- | ^^ borrowed value does not live long enough
+ | --- `*b` is borrowed here
LL | make_a(bb)
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 33:16...
- --> $DIR/regions-trait-variance.rs:33:16
- |
-LL | fn make_make_a<'a>() -> A<'a> {
- | ^^
+ | ^^^^^^^^^^ returns a value referencing data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr
deleted file mode 100644
index 146fb8f..0000000
--- a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/regions-var-type-out-of-scope.rs:9:14
- |
-LL | x = &id(3);
- | ^^^^^- temporary value is freed at the end of this statement
- | |
- | creates a temporary which is freed while still in use
-LL | assert_eq!(*x, 3);
- | ------------------ borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
- = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.rs b/src/test/ui/regions/regions-var-type-out-of-scope.rs
index e972163..aba55e9 100644
--- a/src/test/ui/regions/regions-var-type-out-of-scope.rs
+++ b/src/test/ui/regions/regions-var-type-out-of-scope.rs
@@ -6,7 +6,7 @@
let mut x;
if cond {
- x = &id(3); //~ ERROR borrowed value does not live long enough
+ x = &id(3); //~ ERROR temporary value dropped while borrowed
assert_eq!(*x, 3);
}
}
diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.stderr
index 0363fe0..146fb8f 100644
--- a/src/test/ui/regions/regions-var-type-out-of-scope.stderr
+++ b/src/test/ui/regions/regions-var-type-out-of-scope.stderr
@@ -1,16 +1,16 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/regions-var-type-out-of-scope.rs:9:14
|
LL | x = &id(3);
- | ^^^^^- temporary value dropped here while still borrowed
+ | ^^^^^- temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
-...
-LL | }
- | - temporary value needs to live until here
+ | creates a temporary which is freed while still in use
+LL | assert_eq!(*x, 3);
+ | ------------------ borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
+ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2015.stderr b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2015.stderr
index 4c17ce2..34e8b0e 100644
--- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2015.stderr
+++ b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2015.stderr
@@ -1,9 +1,10 @@
-error[E0008]: cannot bind by-move into a pattern guard
- --> $DIR/feature-gate.rs:33:16
+error: compilation successful
+ --> $DIR/feature-gate.rs:41:1
|
-LL | A { a: v } if *v == 42 => v,
- | ^ moves value into pattern guard
+LL | / fn main() {
+LL | | foo(107)
+LL | | }
+ | |_^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0008`.
diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2018.stderr b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2018.stderr
index 4bde9b0..34e8b0e 100644
--- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2018.stderr
+++ b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_2018.stderr
@@ -1,5 +1,5 @@
error: compilation successful
- --> $DIR/feature-gate.rs:42:1
+ --> $DIR/feature-gate.rs:41:1
|
LL | / fn main() {
LL | | foo(107)
diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_feature_nll.stderr b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_feature_nll.stderr
index 4bde9b0..34e8b0e 100644
--- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_feature_nll.stderr
+++ b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_feature_nll.stderr
@@ -1,5 +1,5 @@
error: compilation successful
- --> $DIR/feature-gate.rs:42:1
+ --> $DIR/feature-gate.rs:41:1
|
LL | / fn main() {
LL | | foo(107)
diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_znll.stderr b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_znll.stderr
index 4bde9b0..34e8b0e 100644
--- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_znll.stderr
+++ b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.gate_and_znll.stderr
@@ -1,5 +1,5 @@
error: compilation successful
- --> $DIR/feature-gate.rs:42:1
+ --> $DIR/feature-gate.rs:41:1
|
LL | / fn main() {
LL | | foo(107)
diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.no_gate.stderr b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.no_gate.stderr
index 4c17ce2..2a1a04b 100644
--- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.no_gate.stderr
+++ b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.no_gate.stderr
@@ -3,6 +3,8 @@
|
LL | A { a: v } if *v == 42 => v,
| ^ moves value into pattern guard
+ |
+ = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
error: aborting due to previous error
diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.rs b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.rs
index f6df4d0..97f90f7 100644
--- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.rs
+++ b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.rs
@@ -32,7 +32,6 @@
A { a: v } if *v == 42 => v,
//[no_gate]~^ ERROR cannot bind by-move into a pattern guard
- //[gate_and_2015]~^^ ERROR cannot bind by-move into a pattern guard
_ => Box::new(0)
};
@@ -42,6 +41,7 @@
fn main() {
foo(107)
}
-//[gate_and_2018]~^^^ ERROR compilation successful
-//[gate_and_znll]~^^^^ ERROR compilation successful
-//[gate_and_feature_nll]~^^^^^ ERROR compilation successful
+//[gate_and_2015]~^^^ ERROR compilation successful
+//[gate_and_2018]~^^^^ ERROR compilation successful
+//[gate_and_znll]~^^^^^ ERROR compilation successful
+//[gate_and_feature_nll]~^^^^^^ ERROR compilation successful
diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr
deleted file mode 100644
index 0457292..0000000
--- a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-issue-49631.rs:20:9
- |
-LL | while let Some(Ok(string)) = foo.get() {
- | --- immutable borrow occurs here
-LL | foo.mutate();
- | ^^^^^^^^^^^^ mutable borrow occurs here
-LL |
-LL | println!("foo={:?}", *string);
- | ------- immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
index e946d41..0457292 100644
--- a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
+++ b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
@@ -2,11 +2,12 @@
--> $DIR/borrowck-issue-49631.rs:20:9
|
LL | while let Some(Ok(string)) = foo.get() {
- | --- - immutable borrow ends here
- | |
- | immutable borrow occurs here
+ | --- immutable borrow occurs here
LL | foo.mutate();
- | ^^^ mutable borrow occurs here
+ | ^^^^^^^^^^^^ mutable borrow occurs here
+LL |
+LL | println!("foo={:?}", *string);
+ | ------- immutable borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr
deleted file mode 100644
index 9d53e6d7..0000000
--- a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0594]: cannot assign to `*x` which is behind a `&` reference
- --> $DIR/enum.rs:9:5
- |
-LL | *x += 1;
- | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `*x` which is behind a `&` reference
- --> $DIR/enum.rs:13:9
- |
-LL | *x += 1;
- | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `*x` which is behind a `&` reference
- --> $DIR/enum.rs:19:9
- |
-LL | *x += 1;
- | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.rs b/src/test/ui/rfc-2005-default-binding-mode/enum.rs
index 7609345..af82d36 100644
--- a/src/test/ui/rfc-2005-default-binding-mode/enum.rs
+++ b/src/test/ui/rfc-2005-default-binding-mode/enum.rs
@@ -6,17 +6,17 @@
pub fn main() {
let Wrap(x) = &Wrap(3);
- *x += 1; //~ ERROR cannot assign to immutable
+ *x += 1; //~ ERROR cannot assign to `*x` which is behind a `&` reference
if let Some(x) = &Some(3) {
- *x += 1; //~ ERROR cannot assign to immutable
+ *x += 1; //~ ERROR cannot assign to `*x` which is behind a `&` reference
} else {
panic!();
}
while let Some(x) = &Some(3) {
- *x += 1; //~ ERROR cannot assign to immutable
+ *x += 1; //~ ERROR cannot assign to `*x` which is behind a `&` reference
break;
}
}
diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr
index 286ae09..9d53e6d7 100644
--- a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr
+++ b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr
@@ -1,20 +1,20 @@
-error[E0594]: cannot assign to immutable borrowed content `*x`
+error[E0594]: cannot assign to `*x` which is behind a `&` reference
--> $DIR/enum.rs:9:5
|
LL | *x += 1;
- | ^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-error[E0594]: cannot assign to immutable borrowed content `*x`
+error[E0594]: cannot assign to `*x` which is behind a `&` reference
--> $DIR/enum.rs:13:9
|
LL | *x += 1;
- | ^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-error[E0594]: cannot assign to immutable borrowed content `*x`
+error[E0594]: cannot assign to `*x` which is behind a `&` reference
--> $DIR/enum.rs:19:9
|
LL | *x += 1;
- | ^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
error: aborting due to 3 previous errors
diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr
deleted file mode 100644
index 5eace3d..0000000
--- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0594]: cannot assign to `*n` which is behind a `&` reference
- --> $DIR/explicit-mut.rs:7:13
- |
-LL | *n += 1;
- | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `*n` which is behind a `&` reference
- --> $DIR/explicit-mut.rs:15:13
- |
-LL | *n += 1;
- | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `*n` which is behind a `&` reference
- --> $DIR/explicit-mut.rs:23:13
- |
-LL | *n += 1;
- | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs
index 73efdde..212fd94 100644
--- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs
+++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs
@@ -4,7 +4,7 @@
fn main() {
match &&Some(5i32) {
Some(n) => {
- *n += 1; //~ ERROR cannot assign to immutable
+ *n += 1; //~ ERROR cannot assign to `*n` which is behind a `&` reference
let _ = n;
}
None => {},
@@ -12,7 +12,7 @@
match &mut &Some(5i32) {
Some(n) => {
- *n += 1; //~ ERROR cannot assign to immutable
+ *n += 1; //~ ERROR cannot assign to `*n` which is behind a `&` reference
let _ = n;
}
None => {},
@@ -20,7 +20,7 @@
match &&mut Some(5i32) {
Some(n) => {
- *n += 1; //~ ERROR cannot assign to immutable
+ *n += 1; //~ ERROR cannot assign to `*n` which is behind a `&` reference
let _ = n;
}
None => {},
diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr
index 75738c2..5eace3d 100644
--- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr
+++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr
@@ -1,20 +1,20 @@
-error[E0594]: cannot assign to immutable borrowed content `*n`
+error[E0594]: cannot assign to `*n` which is behind a `&` reference
--> $DIR/explicit-mut.rs:7:13
|
LL | *n += 1;
- | ^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written
-error[E0594]: cannot assign to immutable borrowed content `*n`
+error[E0594]: cannot assign to `*n` which is behind a `&` reference
--> $DIR/explicit-mut.rs:15:13
|
LL | *n += 1;
- | ^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written
-error[E0594]: cannot assign to immutable borrowed content `*n`
+error[E0594]: cannot assign to `*n` which is behind a `&` reference
--> $DIR/explicit-mut.rs:23:13
|
LL | *n += 1;
- | ^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written
error: aborting due to 3 previous errors
diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr
deleted file mode 100644
index 5f0b3a1..0000000
--- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0382]: use of moved value: `a`
- --> $DIR/dbg-macro-move-semantics.rs:9:18
- |
-LL | let a = NoCopy(0);
- | - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
-LL | let _ = dbg!(a);
- | ------- value moved here
-LL | let _ = dbg!(a);
- | ^ value used here after move
- |
- = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs
index e6ddb3d..9f3c567 100644
--- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs
+++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs
@@ -7,5 +7,4 @@
let a = NoCopy(0);
let _ = dbg!(a);
let _ = dbg!(a); //~ ERROR use of moved value
- //~^ ERROR use of moved value
}
diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
index cfc318c..5f0b3a1 100644
--- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
+++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
@@ -1,25 +1,15 @@
error[E0382]: use of moved value: `a`
--> $DIR/dbg-macro-move-semantics.rs:9:18
|
+LL | let a = NoCopy(0);
+ | - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
LL | let _ = dbg!(a);
| ------- value moved here
LL | let _ = dbg!(a);
| ^ value used here after move
|
- = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-error[E0382]: use of moved value: `a`
- --> $DIR/dbg-macro-move-semantics.rs:9:13
- |
-LL | let _ = dbg!(a);
- | ------- value moved here
-LL | let _ = dbg!(a);
- | ^^^^^^^ value used here after move
- |
- = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
- = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/slice-mut-2.nll.stderr b/src/test/ui/slice-mut-2.nll.stderr
deleted file mode 100644
index bad0268..0000000
--- a/src/test/ui/slice-mut-2.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/slice-mut-2.rs:7:18
- |
-LL | let x: &[isize] = &[1, 2, 3, 4, 5];
- | ---------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4, 5]`
-...
-LL | let _ = &mut x[2..4];
- | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/slice-mut-2.rs b/src/test/ui/slice-mut-2.rs
index 9586103..216edbb 100644
--- a/src/test/ui/slice-mut-2.rs
+++ b/src/test/ui/slice-mut-2.rs
@@ -4,5 +4,5 @@
let x: &[isize] = &[1, 2, 3, 4, 5];
// Can't mutably slice an immutable slice
let slice: &mut [isize] = &mut [0, 1];
- let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable
+ let _ = &mut x[2..4]; //~ERROR cannot borrow `*x` as mutable, as it is behind a `&` reference
}
diff --git a/src/test/ui/slice-mut-2.stderr b/src/test/ui/slice-mut-2.stderr
index 78dbfa5..bad0268 100644
--- a/src/test/ui/slice-mut-2.stderr
+++ b/src/test/ui/slice-mut-2.stderr
@@ -1,8 +1,11 @@
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/slice-mut-2.rs:7:18
|
+LL | let x: &[isize] = &[1, 2, 3, 4, 5];
+ | ---------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4, 5]`
+...
LL | let _ = &mut x[2..4];
- | ^ cannot borrow as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to previous error
diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr
deleted file mode 100644
index 8fceef6..0000000
--- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr
+++ /dev/null
@@ -1,88 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:53:24
- |
-LL | fn deref_mut_field1(x: Own<Point>) {
- | - help: consider changing this to be mutable: `mut x`
-LL | let __isize = &mut x.y;
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:65:10
- |
-LL | fn deref_extend_mut_field1(x: &Own<Point>) -> &mut isize {
- | ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>`
-LL | &mut x.y
- | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:78:19
- |
-LL | let _x = &mut x.x;
- | - first mutable borrow occurs here
-LL | let _y = &mut x.y;
- | ^ second mutable borrow occurs here
-LL | use_mut(_x);
- | -- first borrow later used here
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:5
- |
-LL | fn assign_field1<'a>(x: Own<Point>) {
- | - help: consider changing this to be mutable: `mut x`
-LL | x.y = 3;
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:92:5
- |
-LL | fn assign_field2<'a>(x: &'a Own<Point>) {
- | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<Point>`
-LL | x.y = 3;
- | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:101:5
- |
-LL | let _p: &mut Point = &mut **x;
- | -- first mutable borrow occurs here
-LL | x.y = 3;
- | ^ second mutable borrow occurs here
-LL | use_mut(_p);
- | -- first borrow later used here
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:109:5
- |
-LL | fn deref_mut_method1(x: Own<Point>) {
- | - help: consider changing this to be mutable: `mut x`
-LL | x.set(0, 0);
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:121:5
- |
-LL | fn deref_extend_mut_method1(x: &Own<Point>) -> &mut isize {
- | ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>`
-LL | x.y_mut()
- | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:129:6
- |
-LL | fn assign_method1<'a>(x: Own<Point>) {
- | - help: consider changing this to be mutable: `mut x`
-LL | *x.y_mut() = 3;
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:133:6
- |
-LL | fn assign_method2<'a>(x: &'a Own<Point>) {
- | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<Point>`
-LL | *x.y_mut() = 3;
- | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to 10 previous errors
-
-Some errors have detailed explanations: E0499, E0596.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
index 5f33771..8fceef6 100644
--- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
+++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
@@ -1,18 +1,18 @@
-error[E0596]: cannot borrow immutable argument `x` as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:53:24
|
LL | fn deref_mut_field1(x: Own<Point>) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | let __isize = &mut x.y;
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:65:10
|
LL | fn deref_extend_mut_field1(x: &Own<Point>) -> &mut isize {
- | ----------- use `&mut Own<Point>` here to make mutable
+ | ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>`
LL | &mut x.y
- | ^ cannot borrow as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error[E0499]: cannot borrow `*x` as mutable more than once at a time
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:78:19
@@ -22,24 +22,23 @@
LL | let _y = &mut x.y;
| ^ second mutable borrow occurs here
LL | use_mut(_x);
-LL | }
- | - first borrow ends here
+ | -- first borrow later used here
-error[E0596]: cannot borrow immutable argument `x` as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:5
|
LL | fn assign_field1<'a>(x: Own<Point>) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | x.y = 3;
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:92:5
|
LL | fn assign_field2<'a>(x: &'a Own<Point>) {
- | -------------- use `&'a mut Own<Point>` here to make mutable
+ | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<Point>`
LL | x.y = 3;
- | ^ cannot borrow as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error[E0499]: cannot borrow `*x` as mutable more than once at a time
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:101:5
@@ -49,40 +48,39 @@
LL | x.y = 3;
| ^ second mutable borrow occurs here
LL | use_mut(_p);
-LL | }
- | - first borrow ends here
+ | -- first borrow later used here
-error[E0596]: cannot borrow immutable argument `x` as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:109:5
|
LL | fn deref_mut_method1(x: Own<Point>) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | x.set(0, 0);
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:121:5
|
LL | fn deref_extend_mut_method1(x: &Own<Point>) -> &mut isize {
- | ----------- use `&mut Own<Point>` here to make mutable
+ | ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>`
LL | x.y_mut()
- | ^ cannot borrow as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow immutable argument `x` as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:129:6
|
LL | fn assign_method1<'a>(x: Own<Point>) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | *x.y_mut() = 3;
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:133:6
|
LL | fn assign_method2<'a>(x: &'a Own<Point>) {
- | -------------- use `&'a mut Own<Point>` here to make mutable
+ | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<Point>`
LL | *x.y_mut() = 3;
- | ^ cannot borrow as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to 10 previous errors
diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr
deleted file mode 100644
index 3ebfba7..0000000
--- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:29:25
- |
-LL | fn deref_mut1(x: Own<isize>) {
- | - help: consider changing this to be mutable: `mut x`
-LL | let __isize = &mut *x;
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:41:11
- |
-LL | fn deref_extend_mut1<'a>(x: &'a Own<isize>) -> &'a mut isize {
- | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<isize>`
-LL | &mut **x
- | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:49:6
- |
-LL | fn assign1<'a>(x: Own<isize>) {
- | - help: consider changing this to be mutable: `mut x`
-LL | *x = 3;
- | ^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:53:6
- |
-LL | fn assign2<'a>(x: &'a Own<isize>) {
- | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<isize>`
-LL | **x = 3;
- | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr
index 77f3982..3ebfba7 100644
--- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr
+++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr
@@ -1,34 +1,34 @@
-error[E0596]: cannot borrow immutable argument `x` as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-borrow-overloaded-deref-mut.rs:29:25
|
LL | fn deref_mut1(x: Own<isize>) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | let __isize = &mut *x;
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-borrow-overloaded-deref-mut.rs:41:11
|
LL | fn deref_extend_mut1<'a>(x: &'a Own<isize>) -> &'a mut isize {
- | -------------- use `&'a mut Own<isize>` here to make mutable
+ | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<isize>`
LL | &mut **x
- | ^^ cannot borrow as mutable
+ | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow immutable argument `x` as mutable
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-borrow-overloaded-deref-mut.rs:49:6
|
LL | fn assign1<'a>(x: Own<isize>) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | *x = 3;
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-borrow-overloaded-deref-mut.rs:53:6
|
LL | fn assign2<'a>(x: &'a Own<isize>) {
- | -------------- use `&'a mut Own<isize>` here to make mutable
+ | -------------- help: consider changing this to be a mutable reference: `&'a mut Own<isize>`
LL | **x = 3;
- | ^^ cannot borrow as mutable
+ | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to 4 previous errors
diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr
deleted file mode 100644
index 51b7261..0000000
--- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr
+++ /dev/null
@@ -1,51 +0,0 @@
-error[E0499]: cannot borrow `f` as mutable more than once at a time
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:12:16
- |
-LL | f(Box::new(|| {
- | - ^^ second mutable borrow occurs here
- | |
- | first mutable borrow occurs here
- | first borrow later used by call
-LL |
-LL | f((Box::new(|| {})))
- | - second borrow occurs due to use of `f` in closure
-
-error[E0596]: cannot borrow `*f` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:25:5
- |
-LL | fn test2<F>(f: &F) where F: FnMut() {
- | -- help: consider changing this to be a mutable reference: `&mut F`
-LL | (*f)();
- | ^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `f.f` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5
- |
-LL | fn test4(f: &Test) {
- | ----- help: consider changing this to be a mutable reference: `&mut Test<'_>`
-LL | f.f.call_mut(())
- | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0507]: cannot move out of captured variable in an `FnMut` closure
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:56:13
- |
-LL | let mut f = move |g: Box<FnMut(isize)>, b: isize| {
- | ----- captured outer variable
-...
-LL | foo(f);
- | ^ cannot move out of captured variable in an `FnMut` closure
-
-error[E0505]: cannot move out of `f` because it is borrowed
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16
- |
-LL | f(Box::new(|a| {
- | - ^^^ move out of `f` occurs here
- | |
- | borrow of `f` occurs here
-LL | foo(f);
- | - move occurs due to use in closure
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0499, E0505, E0507, E0596.
-For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs
index f246f11..db48bdf 100644
--- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs
+++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs
@@ -23,7 +23,7 @@
fn test2<F>(f: &F) where F: FnMut() {
(*f)();
- //~^ ERROR cannot borrow immutable borrowed content `*f` as mutable
+ //~^ ERROR cannot borrow `*f` as mutable, as it is behind a `&` reference
}
fn test3<F>(f: &mut F) where F: FnMut() {
@@ -32,7 +32,7 @@
fn test4(f: &Test) {
f.f.call_mut(())
- //~^ ERROR: cannot borrow field `f.f` of immutable binding as mutable
+ //~^ ERROR: cannot borrow `f.f` as mutable, as it is behind a `&` reference
}
fn test5(f: &mut Test) {
@@ -53,9 +53,9 @@
let _ = s.len();
};
f(Box::new(|a| {
+ //~^ ERROR cannot move out of `f` because it is borrowed
foo(f);
- //~^ ERROR cannot move `f` into closure because it is borrowed
- //~| ERROR cannot move out of captured outer variable in an `FnMut` closure
+ //~^ ERROR cannot move out of captured variable in an `FnMut` closure
}), 3);
}
diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
index 7855c8e..847f686 100644
--- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
+++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
@@ -5,46 +5,48 @@
| - ^^ second mutable borrow occurs here
| |
| first mutable borrow occurs here
+ | first borrow later used by call
LL |
LL | f((Box::new(|| {})))
- | - borrow occurs due to use of `f` in closure
-LL | }));
- | - first borrow ends here
+ | - second borrow occurs due to use of `f` in closure
-error[E0596]: cannot borrow immutable borrowed content `*f` as mutable
+error[E0596]: cannot borrow `*f` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:25:5
|
LL | fn test2<F>(f: &F) where F: FnMut() {
- | -- use `&mut F` here to make mutable
+ | -- help: consider changing this to be a mutable reference: `&mut F`
LL | (*f)();
- | ^^^^ cannot borrow as mutable
+ | ^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow field `f.f` of immutable binding as mutable
+error[E0596]: cannot borrow `f.f` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5
|
LL | fn test4(f: &Test) {
- | ----- use `&mut Test` here to make mutable
+ | ----- help: consider changing this to be a mutable reference: `&mut Test<'_>`
LL | f.f.call_mut(())
- | ^^^ cannot mutably borrow field of immutable binding
+ | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0504]: cannot move `f` into closure because it is borrowed
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:56:13
- |
-LL | f(Box::new(|a| {
- | - borrow of `f` occurs here
-LL | foo(f);
- | ^ move into closure occurs here
-
-error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:56:13
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13
|
LL | let mut f = move |g: Box<FnMut(isize)>, b: isize| {
| ----- captured outer variable
...
LL | foo(f);
- | ^ cannot move out of captured outer variable in an `FnMut` closure
+ | ^ cannot move out of captured variable in an `FnMut` closure
+
+error[E0505]: cannot move out of `f` because it is borrowed
+ --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16
+ |
+LL | f(Box::new(|a| {
+ | - ^^^ move out of `f` occurs here
+ | |
+ | borrow of `f` occurs here
+LL |
+LL | foo(f);
+ | - move occurs due to use in closure
error: aborting due to 5 previous errors
-Some errors have detailed explanations: E0499, E0504, E0507, E0596.
+Some errors have detailed explanations: E0499, E0505, E0507, E0596.
For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr
deleted file mode 100644
index 6b5e077..0000000
--- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-call-method-from-mut-aliasable.rs:17:5
- |
-LL | fn b(x: &Foo) {
- | ---- help: consider changing this to be a mutable reference: `&mut Foo`
-LL | x.f();
-LL | x.h();
- | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr
index 440c5c9..6b5e077 100644
--- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr
+++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr
@@ -1,11 +1,11 @@
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-call-method-from-mut-aliasable.rs:17:5
|
LL | fn b(x: &Foo) {
- | ---- use `&mut Foo` here to make mutable
+ | ---- help: consider changing this to be a mutable reference: `&mut Foo`
LL | x.f();
LL | x.h();
- | ^ cannot borrow as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to previous error
diff --git a/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr b/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr
deleted file mode 100644
index 9133d48..0000000
--- a/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-fn-in-const-b.rs:7:9
- |
-LL | fn broken(x: &Vec<String>) {
- | ------------ help: consider changing this to be a mutable reference: `&mut std::vec::Vec<std::string::String>`
-LL | x.push(format!("this is broken"));
- | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/span/borrowck-fn-in-const-b.stderr b/src/test/ui/span/borrowck-fn-in-const-b.stderr
index 4a30bdf..9133d48 100644
--- a/src/test/ui/span/borrowck-fn-in-const-b.stderr
+++ b/src/test/ui/span/borrowck-fn-in-const-b.stderr
@@ -1,10 +1,10 @@
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-fn-in-const-b.rs:7:9
|
LL | fn broken(x: &Vec<String>) {
- | ------------ use `&mut Vec<String>` here to make mutable
+ | ------------ help: consider changing this to be a mutable reference: `&mut std::vec::Vec<std::string::String>`
LL | x.push(format!("this is broken"));
- | ^ cannot borrow as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to previous error
diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr
deleted file mode 100644
index f5f1193..0000000
--- a/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/borrowck-let-suggestion-suffixes.rs:19:14
- |
-LL | v3.push(&id('x')); // statement 6
- | ^^^^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary which is freed while still in use
-...
-LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref();
- | -- borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/borrowck-let-suggestion-suffixes.rs:29:18
- |
-LL | v4.push(&id('y'));
- | ^^^^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary which is freed while still in use
-...
-LL | v4.use_ref();
- | -- borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/borrowck-let-suggestion-suffixes.rs:40:14
- |
-LL | v5.push(&id('z'));
- | ^^^^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary which is freed while still in use
-...
-LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref();
- | -- borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
index 4b14907..4744f37 100644
--- a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
+++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
@@ -1,4 +1,3 @@
-#![feature(rustc_attrs)]
fn id<T>(x: T) -> T { x }
fn f() {
@@ -7,51 +6,52 @@
let mut v2 = Vec::new(); // statement 2
- let young = ['y']; // statement 3
+ {
+ let young = ['y']; // statement 3
- v2.push(&young[0]); // statement 4
- //~^ ERROR `young[..]` does not live long enough
- //~| NOTE borrowed value does not live long enough
- //~| NOTE values in a scope are dropped in the opposite order they are created
+ v2.push(&young[0]); // statement 4
+ //~^ ERROR `young[_]` does not live long enough
+ //~| NOTE borrowed value does not live long enough
+ } //~ NOTE `young[_]` dropped here while still borrowed
let mut v3 = Vec::new(); // statement 5
v3.push(&id('x')); // statement 6
- //~^ ERROR borrowed value does not live long enough
- //~| NOTE temporary value does not live long enough
- //~| NOTE temporary value dropped here while still borrowed
- //~| NOTE consider using a `let` binding to increase its lifetime
+ //~^ ERROR temporary value dropped while borrowed
+ //~| NOTE creates a temporary which is freed while still in use
+ //~| NOTE temporary value is freed at the end of this statement
+ //~| NOTE consider using a `let` binding to create a longer lived value
{
let mut v4 = Vec::new(); // (sub) statement 0
v4.push(&id('y'));
- //~^ ERROR borrowed value does not live long enough
- //~| NOTE temporary value does not live long enough
- //~| NOTE temporary value dropped here while still borrowed
- //~| NOTE consider using a `let` binding to increase its lifetime
+ //~^ ERROR temporary value dropped while borrowed
+ //~| NOTE creates a temporary which is freed while still in use
+ //~| NOTE temporary value is freed at the end of this statement
+ //~| NOTE consider using a `let` binding to create a longer lived value
v4.use_ref();
+ //~^ NOTE borrow later used here
} // (statement 7)
- //~^ NOTE temporary value needs to live until here
let mut v5 = Vec::new(); // statement 8
v5.push(&id('z'));
- //~^ ERROR borrowed value does not live long enough
- //~| NOTE temporary value does not live long enough
- //~| NOTE temporary value dropped here while still borrowed
- //~| NOTE consider using a `let` binding to increase its lifetime
+ //~^ ERROR temporary value dropped while borrowed
+ //~| NOTE creates a temporary which is freed while still in use
+ //~| NOTE temporary value is freed at the end of this statement
+ //~| NOTE consider using a `let` binding to create a longer lived value
v1.push(&old[0]);
(v1, v2, v3, /* v4 is above. */ v5).use_ref();
+ //~^ NOTE borrow later used here
+ //~| NOTE borrow later used here
+ //~| NOTE borrow later used here
}
-//~^ NOTE `young[..]` dropped here while still borrowed
-//~| NOTE temporary value needs to live until here
-//~| NOTE temporary value needs to live until here
-fn main() { #![rustc_error] // rust-lang/rust#49855
+fn main() {
f();
}
diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr
index 8bf542e..7ba909d 100644
--- a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr
+++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr
@@ -1,53 +1,55 @@
-error[E0597]: `young[..]` does not live long enough
- --> $DIR/borrowck-let-suggestion-suffixes.rs:12:14
+error[E0597]: `young[_]` does not live long enough
+ --> $DIR/borrowck-let-suggestion-suffixes.rs:12:17
|
-LL | v2.push(&young[0]); // statement 4
- | ^^^^^^^^ borrowed value does not live long enough
+LL | v2.push(&young[0]); // statement 4
+ | ^^^^^^^^^ borrowed value does not live long enough
...
-LL | }
- | - `young[..]` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+LL | }
+ | - `young[_]` dropped here while still borrowed
+...
+LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref();
+ | -- borrow later used here
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/borrowck-let-suggestion-suffixes.rs:19:14
|
LL | v3.push(&id('x')); // statement 6
- | ^^^^^^^ - temporary value dropped here while still borrowed
+ | ^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
+ | creates a temporary which is freed while still in use
...
-LL | }
- | - temporary value needs to live until here
+LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref();
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/borrowck-let-suggestion-suffixes.rs:29:18
|
LL | v4.push(&id('y'));
- | ^^^^^^^ - temporary value dropped here while still borrowed
+ | ^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
+ | creates a temporary which is freed while still in use
...
-LL | } // (statement 7)
- | - temporary value needs to live until here
+LL | v4.use_ref();
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/borrowck-let-suggestion-suffixes.rs:40:14
|
LL | v5.push(&id('z'));
- | ^^^^^^^ - temporary value dropped here while still borrowed
+ | ^^^^^^^ - temporary value is freed at the end of this statement
| |
- | temporary value does not live long enough
+ | creates a temporary which is freed while still in use
...
-LL | }
- | - temporary value needs to live until here
+LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref();
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0597`.
+Some errors have detailed explanations: E0597, E0716.
+For more information about an error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/borrowck-object-mutability.nll.stderr b/src/test/ui/span/borrowck-object-mutability.nll.stderr
deleted file mode 100644
index fe6014c..0000000
--- a/src/test/ui/span/borrowck-object-mutability.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
- --> $DIR/borrowck-object-mutability.rs:8:5
- |
-LL | fn borrowed_receiver(x: &Foo) {
- | ---- help: consider changing this to be a mutable reference: `&mut dyn Foo`
-LL | x.borrowed();
-LL | x.borrowed_mut();
- | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable
- --> $DIR/borrowck-object-mutability.rs:18:5
- |
-LL | fn owned_receiver(x: Box<Foo>) {
- | - help: consider changing this to be mutable: `mut x`
-LL | x.borrowed();
-LL | x.borrowed_mut();
- | ^ cannot borrow as mutable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/span/borrowck-object-mutability.stderr b/src/test/ui/span/borrowck-object-mutability.stderr
index 073a70e..fe6014c 100644
--- a/src/test/ui/span/borrowck-object-mutability.stderr
+++ b/src/test/ui/span/borrowck-object-mutability.stderr
@@ -1,17 +1,17 @@
-error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-object-mutability.rs:8:5
|
LL | fn borrowed_receiver(x: &Foo) {
- | ---- use `&mut Foo` here to make mutable
+ | ---- help: consider changing this to be a mutable reference: `&mut dyn Foo`
LL | x.borrowed();
LL | x.borrowed_mut();
- | ^ cannot borrow as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow immutable `Box` content `*x` as mutable
+error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable
--> $DIR/borrowck-object-mutability.rs:18:5
|
LL | fn owned_receiver(x: Box<Foo>) {
- | - help: make this binding mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | x.borrowed();
LL | x.borrowed_mut();
| ^ cannot borrow as mutable
diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr b/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr
deleted file mode 100644
index 4f529ce..0000000
--- a/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/borrowck-ref-into-rvalue.rs:3:11
- |
-LL | match Some("Hello".to_string()) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
-...
-LL | }
- | - temporary value is freed at the end of this statement
-LL | println!("{}", *msg);
- | ---- borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.rs b/src/test/ui/span/borrowck-ref-into-rvalue.rs
index aeaebf0..c11aa1a 100644
--- a/src/test/ui/span/borrowck-ref-into-rvalue.rs
+++ b/src/test/ui/span/borrowck-ref-into-rvalue.rs
@@ -1,8 +1,8 @@
fn main() {
let msg;
match Some("Hello".to_string()) {
+ //~^ ERROR temporary value dropped while borrowed
Some(ref m) => {
- //~^ ERROR borrowed value does not live long enough
msg = m;
},
None => { panic!() }
diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.stderr b/src/test/ui/span/borrowck-ref-into-rvalue.stderr
index b8e79be..4f529ce 100644
--- a/src/test/ui/span/borrowck-ref-into-rvalue.stderr
+++ b/src/test/ui/span/borrowck-ref-into-rvalue.stderr
@@ -1,17 +1,16 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/borrowck-ref-into-rvalue.rs:4:14
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/borrowck-ref-into-rvalue.rs:3:11
|
-LL | Some(ref m) => {
- | ^^^^^ borrowed value does not live long enough
+LL | match Some("Hello".to_string()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
...
LL | }
- | - borrowed value dropped here while still borrowed
+ | - temporary value is freed at the end of this statement
LL | println!("{}", *msg);
-LL | }
- | - borrowed value needs to live until here
+ | ---- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/span/destructor-restrictions.nll.stderr b/src/test/ui/span/destructor-restrictions.nll.stderr
deleted file mode 100644
index a3c6cfb..0000000
--- a/src/test/ui/span/destructor-restrictions.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0597]: `*a` does not live long enough
- --> $DIR/destructor-restrictions.rs:8:10
- |
-LL | *a.borrow() + 1
- | ^---------
- | |
- | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
-LL | };
- | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, i32>`
- | |
- | `*a` dropped here while still borrowed
- |
- = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/destructor-restrictions.stderr b/src/test/ui/span/destructor-restrictions.stderr
index a82e24b..a3c6cfb 100644
--- a/src/test/ui/span/destructor-restrictions.stderr
+++ b/src/test/ui/span/destructor-restrictions.stderr
@@ -2,11 +2,16 @@
--> $DIR/destructor-restrictions.rs:8:10
|
LL | *a.borrow() + 1
- | ^ borrowed value does not live long enough
+ | ^---------
+ | |
+ | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
LL | };
- | -- borrowed value needs to live until here
+ | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, i32>`
| |
| `*a` dropped here while still borrowed
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
error: aborting due to previous error
diff --git a/src/test/ui/span/dropck-object-cycle.nll.stderr b/src/test/ui/span/dropck-object-cycle.nll.stderr
deleted file mode 100644
index cfaf470..0000000
--- a/src/test/ui/span/dropck-object-cycle.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0597]: `*m` does not live long enough
- --> $DIR/dropck-object-cycle.rs:27:31
- |
-LL | assert_eq!(object_invoke1(&*m), (4,5));
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `*m` dropped here while still borrowed
- | borrow might be used here, when `m` is dropped and runs the destructor for type `std::boxed::Box<dyn Trait<'_>>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/dropck-object-cycle.stderr b/src/test/ui/span/dropck-object-cycle.stderr
index 3fc5285..cfaf470 100644
--- a/src/test/ui/span/dropck-object-cycle.stderr
+++ b/src/test/ui/span/dropck-object-cycle.stderr
@@ -1,13 +1,14 @@
error[E0597]: `*m` does not live long enough
- --> $DIR/dropck-object-cycle.rs:27:32
+ --> $DIR/dropck-object-cycle.rs:27:31
|
LL | assert_eq!(object_invoke1(&*m), (4,5));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `*m` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `*m` dropped here while still borrowed
+ | borrow might be used here, when `m` is dropped and runs the destructor for type `std::boxed::Box<dyn Trait<'_>>`
error: aborting due to previous error
diff --git a/src/test/ui/span/dropck_arr_cycle_checked.nll.stderr b/src/test/ui/span/dropck_arr_cycle_checked.nll.stderr
deleted file mode 100644
index e9caae6..0000000
--- a/src/test/ui/span/dropck_arr_cycle_checked.nll.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0597]: `b2` does not live long enough
- --> $DIR/dropck_arr_cycle_checked.rs:93:24
- |
-LL | b1.a[0].v.set(Some(&b2));
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `b2` dropped here while still borrowed
- | borrow might be used here, when `b1` is dropped and runs the destructor for type `B<'_>`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `b3` does not live long enough
- --> $DIR/dropck_arr_cycle_checked.rs:95:24
- |
-LL | b1.a[1].v.set(Some(&b3));
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `b3` dropped here while still borrowed
- | borrow might be used here, when `b1` is dropped and runs the destructor for type `B<'_>`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `b1` does not live long enough
- --> $DIR/dropck_arr_cycle_checked.rs:101:24
- |
-LL | b3.a[0].v.set(Some(&b1));
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `b1` dropped here while still borrowed
- | borrow might be used here, when `b1` is dropped and runs the destructor for type `B<'_>`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/dropck_arr_cycle_checked.rs b/src/test/ui/span/dropck_arr_cycle_checked.rs
index 3514501..ac31e49 100644
--- a/src/test/ui/span/dropck_arr_cycle_checked.rs
+++ b/src/test/ui/span/dropck_arr_cycle_checked.rs
@@ -95,13 +95,10 @@
b1.a[1].v.set(Some(&b3));
//~^ ERROR `b3` does not live long enough
b2.a[0].v.set(Some(&b2));
- //~^ ERROR `b2` does not live long enough
b2.a[1].v.set(Some(&b3));
- //~^ ERROR `b3` does not live long enough
b3.a[0].v.set(Some(&b1));
//~^ ERROR `b1` does not live long enough
b3.a[1].v.set(Some(&b2));
- //~^ ERROR `b2` does not live long enough
}
fn main() {
diff --git a/src/test/ui/span/dropck_arr_cycle_checked.stderr b/src/test/ui/span/dropck_arr_cycle_checked.stderr
index b2bacc7..068c779 100644
--- a/src/test/ui/span/dropck_arr_cycle_checked.stderr
+++ b/src/test/ui/span/dropck_arr_cycle_checked.stderr
@@ -1,69 +1,43 @@
error[E0597]: `b2` does not live long enough
- --> $DIR/dropck_arr_cycle_checked.rs:93:25
+ --> $DIR/dropck_arr_cycle_checked.rs:93:24
|
LL | b1.a[0].v.set(Some(&b2));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `b2` dropped here while still borrowed
+ | -
+ | |
+ | `b2` dropped here while still borrowed
+ | borrow might be used here, when `b1` is dropped and runs the destructor for type `B<'_>`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `b3` does not live long enough
- --> $DIR/dropck_arr_cycle_checked.rs:95:25
+ --> $DIR/dropck_arr_cycle_checked.rs:95:24
|
LL | b1.a[1].v.set(Some(&b3));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `b3` dropped here while still borrowed
+ | -
+ | |
+ | `b3` dropped here while still borrowed
+ | borrow might be used here, when `b1` is dropped and runs the destructor for type `B<'_>`
|
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `b2` does not live long enough
- --> $DIR/dropck_arr_cycle_checked.rs:97:25
- |
-LL | b2.a[0].v.set(Some(&b2));
- | ^^ borrowed value does not live long enough
-...
-LL | }
- | - `b2` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `b3` does not live long enough
- --> $DIR/dropck_arr_cycle_checked.rs:99:25
- |
-LL | b2.a[1].v.set(Some(&b3));
- | ^^ borrowed value does not live long enough
-...
-LL | }
- | - `b3` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `b1` does not live long enough
- --> $DIR/dropck_arr_cycle_checked.rs:101:25
+ --> $DIR/dropck_arr_cycle_checked.rs:99:24
|
LL | b3.a[0].v.set(Some(&b1));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `b1` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `b1` dropped here while still borrowed
+ | borrow might be used here, when `b1` is dropped and runs the destructor for type `B<'_>`
-error[E0597]: `b2` does not live long enough
- --> $DIR/dropck_arr_cycle_checked.rs:103:25
- |
-LL | b3.a[1].v.set(Some(&b2));
- | ^^ borrowed value does not live long enough
-LL |
-LL | }
- | - `b2` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 6 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr
deleted file mode 100644
index 07ae138..0000000
--- a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error[E0597]: `d2` does not live long enough
- --> $DIR/dropck_direct_cycle_with_drop.rs:36:19
- |
-LL | d1.p.set(Some(&d2));
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `d2` dropped here while still borrowed
- | borrow might be used here, when `d1` is dropped and runs the `Drop` code for type `D`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `d1` does not live long enough
- --> $DIR/dropck_direct_cycle_with_drop.rs:38:19
- |
-LL | d2.p.set(Some(&d1));
- | ^^^ borrowed value does not live long enough
-LL |
-LL | }
- | -
- | |
- | `d1` dropped here while still borrowed
- | borrow might be used here, when `d1` is dropped and runs the `Drop` code for type `D`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr
index 4979242..07ae138 100644
--- a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr
+++ b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr
@@ -1,24 +1,28 @@
error[E0597]: `d2` does not live long enough
- --> $DIR/dropck_direct_cycle_with_drop.rs:36:20
+ --> $DIR/dropck_direct_cycle_with_drop.rs:36:19
|
LL | d1.p.set(Some(&d2));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `d2` dropped here while still borrowed
+ | -
+ | |
+ | `d2` dropped here while still borrowed
+ | borrow might be used here, when `d1` is dropped and runs the `Drop` code for type `D`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `d1` does not live long enough
- --> $DIR/dropck_direct_cycle_with_drop.rs:38:20
+ --> $DIR/dropck_direct_cycle_with_drop.rs:38:19
|
LL | d2.p.set(Some(&d1));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
LL |
LL | }
- | - `d1` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `d1` dropped here while still borrowed
+ | borrow might be used here, when `d1` is dropped and runs the `Drop` code for type `D`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/span/dropck_misc_variants.nll.stderr b/src/test/ui/span/dropck_misc_variants.nll.stderr
deleted file mode 100644
index 76e9057..0000000
--- a/src/test/ui/span/dropck_misc_variants.nll.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0597]: `bomb` does not live long enough
- --> $DIR/dropck_misc_variants.rs:23:36
- |
-LL | _w = Wrap::<&[&str]>(NoisyDrop(&bomb));
- | ^^^^^ borrowed value does not live long enough
-LL | }
- | -
- | |
- | `bomb` dropped here while still borrowed
- | borrow might be used here, when `_w` is dropped and runs the destructor for type `Wrap<&[&str]>`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `v` does not live long enough
- --> $DIR/dropck_misc_variants.rs:31:27
- |
-LL | let u = NoisyDrop(&v);
- | ^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `v` dropped here while still borrowed
- | borrow might be used here, when `_w` is dropped and runs the destructor for closure
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/dropck_misc_variants.stderr b/src/test/ui/span/dropck_misc_variants.stderr
index b2de455..76e9057 100644
--- a/src/test/ui/span/dropck_misc_variants.stderr
+++ b/src/test/ui/span/dropck_misc_variants.stderr
@@ -1,23 +1,29 @@
error[E0597]: `bomb` does not live long enough
- --> $DIR/dropck_misc_variants.rs:23:37
+ --> $DIR/dropck_misc_variants.rs:23:36
|
LL | _w = Wrap::<&[&str]>(NoisyDrop(&bomb));
- | ^^^^ borrowed value does not live long enough
+ | ^^^^^ borrowed value does not live long enough
LL | }
- | - `bomb` dropped here while still borrowed
+ | -
+ | |
+ | `bomb` dropped here while still borrowed
+ | borrow might be used here, when `_w` is dropped and runs the destructor for type `Wrap<&[&str]>`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `v` does not live long enough
- --> $DIR/dropck_misc_variants.rs:31:28
+ --> $DIR/dropck_misc_variants.rs:31:27
|
LL | let u = NoisyDrop(&v);
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
...
LL | }
- | - `v` dropped here while still borrowed
+ | -
+ | |
+ | `v` dropped here while still borrowed
+ | borrow might be used here, when `_w` is dropped and runs the destructor for closure
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to 2 previous errors
diff --git a/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr b/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr
deleted file mode 100644
index 0569251..0000000
--- a/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0597]: `c2` does not live long enough
- --> $DIR/dropck_vec_cycle_checked.rs:98:24
- |
-LL | c1.v[0].v.set(Some(&c2));
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `c2` dropped here while still borrowed
- | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `c3` does not live long enough
- --> $DIR/dropck_vec_cycle_checked.rs:100:24
- |
-LL | c1.v[1].v.set(Some(&c3));
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `c3` dropped here while still borrowed
- | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `c1` does not live long enough
- --> $DIR/dropck_vec_cycle_checked.rs:106:24
- |
-LL | c3.v[0].v.set(Some(&c1));
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `c1` dropped here while still borrowed
- | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/dropck_vec_cycle_checked.rs b/src/test/ui/span/dropck_vec_cycle_checked.rs
index c80e038..bacd99c 100644
--- a/src/test/ui/span/dropck_vec_cycle_checked.rs
+++ b/src/test/ui/span/dropck_vec_cycle_checked.rs
@@ -100,13 +100,10 @@
c1.v[1].v.set(Some(&c3));
//~^ ERROR `c3` does not live long enough
c2.v[0].v.set(Some(&c2));
- //~^ ERROR `c2` does not live long enough
c2.v[1].v.set(Some(&c3));
- //~^ ERROR `c3` does not live long enough
c3.v[0].v.set(Some(&c1));
//~^ ERROR `c1` does not live long enough
c3.v[1].v.set(Some(&c2));
- //~^ ERROR `c2` does not live long enough
}
fn main() {
diff --git a/src/test/ui/span/dropck_vec_cycle_checked.stderr b/src/test/ui/span/dropck_vec_cycle_checked.stderr
index 7f90238..7ff991c 100644
--- a/src/test/ui/span/dropck_vec_cycle_checked.stderr
+++ b/src/test/ui/span/dropck_vec_cycle_checked.stderr
@@ -1,69 +1,43 @@
error[E0597]: `c2` does not live long enough
- --> $DIR/dropck_vec_cycle_checked.rs:98:25
+ --> $DIR/dropck_vec_cycle_checked.rs:98:24
|
LL | c1.v[0].v.set(Some(&c2));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `c2` dropped here while still borrowed
+ | -
+ | |
+ | `c2` dropped here while still borrowed
+ | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `c3` does not live long enough
- --> $DIR/dropck_vec_cycle_checked.rs:100:25
+ --> $DIR/dropck_vec_cycle_checked.rs:100:24
|
LL | c1.v[1].v.set(Some(&c3));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `c3` dropped here while still borrowed
+ | -
+ | |
+ | `c3` dropped here while still borrowed
+ | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
|
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c2` does not live long enough
- --> $DIR/dropck_vec_cycle_checked.rs:102:25
- |
-LL | c2.v[0].v.set(Some(&c2));
- | ^^ borrowed value does not live long enough
-...
-LL | }
- | - `c2` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error[E0597]: `c3` does not live long enough
- --> $DIR/dropck_vec_cycle_checked.rs:104:25
- |
-LL | c2.v[1].v.set(Some(&c3));
- | ^^ borrowed value does not live long enough
-...
-LL | }
- | - `c3` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `c1` does not live long enough
- --> $DIR/dropck_vec_cycle_checked.rs:106:25
+ --> $DIR/dropck_vec_cycle_checked.rs:104:24
|
LL | c3.v[0].v.set(Some(&c1));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `c1` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `c1` dropped here while still borrowed
+ | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
-error[E0597]: `c2` does not live long enough
- --> $DIR/dropck_vec_cycle_checked.rs:108:25
- |
-LL | c3.v[1].v.set(Some(&c2));
- | ^^ borrowed value does not live long enough
-LL |
-LL | }
- | - `c2` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 6 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-11925.nll.stderr b/src/test/ui/span/issue-11925.nll.stderr
deleted file mode 100644
index 1d317fc..0000000
--- a/src/test/ui/span/issue-11925.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0515]: cannot return reference to local data `x`
- --> $DIR/issue-11925.rs:8:35
- |
-LL | let f = to_fn_once(move|| &x);
- | ^^ returns a reference to data owned by the current function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/span/issue-11925.rs b/src/test/ui/span/issue-11925.rs
index 276aaa1..0f6472b 100644
--- a/src/test/ui/span/issue-11925.rs
+++ b/src/test/ui/span/issue-11925.rs
@@ -5,7 +5,7 @@
fn main() {
let r = {
let x: Box<_> = box 42;
- let f = to_fn_once(move|| &x); //~ ERROR does not live long enough
+ let f = to_fn_once(move|| &x); //~ ERROR cannot return reference to local data `x`
f()
};
diff --git a/src/test/ui/span/issue-11925.stderr b/src/test/ui/span/issue-11925.stderr
index c750222..1d317fc 100644
--- a/src/test/ui/span/issue-11925.stderr
+++ b/src/test/ui/span/issue-11925.stderr
@@ -1,15 +1,9 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/issue-11925.rs:8:36
+error[E0515]: cannot return reference to local data `x`
+ --> $DIR/issue-11925.rs:8:35
|
LL | let f = to_fn_once(move|| &x);
- | ^
- | |
- | borrowed value does not live long enough
- | `x` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
+ | ^^ returns a reference to data owned by the current function
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/span/issue-15480.nll.stderr b/src/test/ui/span/issue-15480.nll.stderr
deleted file mode 100644
index 23ee225..0000000
--- a/src/test/ui/span/issue-15480.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/issue-15480.rs:5:10
- |
-LL | &id(3)
- | ^^^^^ creates a temporary which is freed while still in use
-LL | ];
- | - temporary value is freed at the end of this statement
-...
-LL | for &&x in &v {
- | -- borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/span/issue-15480.rs b/src/test/ui/span/issue-15480.rs
index c102423..b286d94 100644
--- a/src/test/ui/span/issue-15480.rs
+++ b/src/test/ui/span/issue-15480.rs
@@ -4,7 +4,7 @@
let v = vec![
&id(3)
];
- //~^^ ERROR borrowed value does not live long enough
+ //~^^ ERROR temporary value dropped while borrowed
for &&x in &v {
println!("{}", x + 3);
diff --git a/src/test/ui/span/issue-15480.stderr b/src/test/ui/span/issue-15480.stderr
index c5e3899..23ee225 100644
--- a/src/test/ui/span/issue-15480.stderr
+++ b/src/test/ui/span/issue-15480.stderr
@@ -1,16 +1,16 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/issue-15480.rs:5:10
|
LL | &id(3)
- | ^^^^^ temporary value does not live long enough
+ | ^^^^^ creates a temporary which is freed while still in use
LL | ];
- | - temporary value dropped here while still borrowed
+ | - temporary value is freed at the end of this statement
...
-LL | }
- | - temporary value needs to live until here
+LL | for &&x in &v {
+ | -- borrow later used here
|
- = note: consider using a `let` binding to increase its lifetime
+ = note: consider using a `let` binding to create a longer lived value
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr
deleted file mode 100644
index 4696945..0000000
--- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-error[E0597]: `y` does not live long enough
- --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:10:5
- |
-LL | y.borrow().clone()
- | ^---------
- | |
- | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
-LL | }
- | -
- | |
- | `y` dropped here while still borrowed
- | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, std::string::String>`
- |
- = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
-
-error[E0597]: `y` does not live long enough
- --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:17:9
- |
-LL | y.borrow().clone()
- | ^---------
- | |
- | borrowed value does not live long enough
- | a temporary with access to the borrow is created here ...
-LL | };
- | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, std::string::String>`
- | |
- | `y` dropped here while still borrowed
- |
- = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
index f18f0da..4696945 100644
--- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
+++ b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
@@ -2,21 +2,32 @@
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:10:5
|
LL | y.borrow().clone()
- | ^ borrowed value does not live long enough
+ | ^---------
+ | |
+ | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
LL | }
- | - `y` dropped here while still borrowed
+ | -
+ | |
+ | `y` dropped here while still borrowed
+ | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, std::string::String>`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
error[E0597]: `y` does not live long enough
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:17:9
|
LL | y.borrow().clone()
- | ^ borrowed value does not live long enough
+ | ^---------
+ | |
+ | borrowed value does not live long enough
+ | a temporary with access to the borrow is created here ...
LL | };
- | -- borrowed value needs to live until here
+ | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, std::string::String>`
| |
| `y` dropped here while still borrowed
+ |
+ = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
error: aborting due to 2 previous errors
diff --git a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.nll.stderr b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.nll.stderr
deleted file mode 100644
index 809e60a..0000000
--- a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:28:18
- |
-LL | _d = D_Child(&d1);
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `d1` dropped here while still borrowed
- | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_Child`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr
index ad90fcd..809e60a 100644
--- a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr
+++ b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr
@@ -1,13 +1,16 @@
error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:28:19
+ --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:28:18
|
LL | _d = D_Child(&d1);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `d1` dropped here while still borrowed
+ | -
+ | |
+ | `d1` dropped here while still borrowed
+ | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_Child`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to previous error
diff --git a/src/test/ui/span/issue-24805-dropck-trait-has-items.nll.stderr b/src/test/ui/span/issue-24805-dropck-trait-has-items.nll.stderr
deleted file mode 100644
index 2e21706..0000000
--- a/src/test/ui/span/issue-24805-dropck-trait-has-items.nll.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24805-dropck-trait-has-items.rs:37:26
- |
-LL | _d = D_HasSelfMethod(&d1);
- | ^^^ borrowed value does not live long enough
-LL | }
- | -
- | |
- | `d1` dropped here while still borrowed
- | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_HasSelfMethod`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24805-dropck-trait-has-items.rs:43:33
- |
-LL | _d = D_HasMethodWithSelfArg(&d1);
- | ^^^ borrowed value does not live long enough
-LL | }
- | -
- | |
- | `d1` dropped here while still borrowed
- | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_HasMethodWithSelfArg`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24805-dropck-trait-has-items.rs:49:20
- |
-LL | _d = D_HasType(&d1);
- | ^^^ borrowed value does not live long enough
-LL | }
- | -
- | |
- | `d1` dropped here while still borrowed
- | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_HasType`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr b/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr
index 3de4014..2e21706 100644
--- a/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr
+++ b/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr
@@ -1,32 +1,41 @@
error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24805-dropck-trait-has-items.rs:37:27
+ --> $DIR/issue-24805-dropck-trait-has-items.rs:37:26
|
LL | _d = D_HasSelfMethod(&d1);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
LL | }
- | - `d1` dropped here while still borrowed
+ | -
+ | |
+ | `d1` dropped here while still borrowed
+ | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_HasSelfMethod`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24805-dropck-trait-has-items.rs:43:34
+ --> $DIR/issue-24805-dropck-trait-has-items.rs:43:33
|
LL | _d = D_HasMethodWithSelfArg(&d1);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
LL | }
- | - `d1` dropped here while still borrowed
+ | -
+ | |
+ | `d1` dropped here while still borrowed
+ | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_HasMethodWithSelfArg`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24805-dropck-trait-has-items.rs:49:21
+ --> $DIR/issue-24805-dropck-trait-has-items.rs:49:20
|
LL | _d = D_HasType(&d1);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
LL | }
- | - `d1` dropped here while still borrowed
+ | -
+ | |
+ | `d1` dropped here while still borrowed
+ | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_HasType`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to 3 previous errors
diff --git a/src/test/ui/span/issue-24895-copy-clone-dropck.nll.stderr b/src/test/ui/span/issue-24895-copy-clone-dropck.nll.stderr
deleted file mode 100644
index 18a3dc9..0000000
--- a/src/test/ui/span/issue-24895-copy-clone-dropck.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24895-copy-clone-dropck.rs:27:14
- |
-LL | d2 = D(S(&d1, "inner"), "d2");
- | ^^^ borrowed value does not live long enough
-LL | }
- | -
- | |
- | `d1` dropped here while still borrowed
- | borrow might be used here, when `d2` is dropped and runs the `Drop` code for type `D`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-24895-copy-clone-dropck.stderr b/src/test/ui/span/issue-24895-copy-clone-dropck.stderr
index 9185919..18a3dc9 100644
--- a/src/test/ui/span/issue-24895-copy-clone-dropck.stderr
+++ b/src/test/ui/span/issue-24895-copy-clone-dropck.stderr
@@ -1,12 +1,15 @@
error[E0597]: `d1` does not live long enough
- --> $DIR/issue-24895-copy-clone-dropck.rs:27:15
+ --> $DIR/issue-24895-copy-clone-dropck.rs:27:14
|
LL | d2 = D(S(&d1, "inner"), "d2");
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
LL | }
- | - `d1` dropped here while still borrowed
+ | -
+ | |
+ | `d1` dropped here while still borrowed
+ | borrow might be used here, when `d2` is dropped and runs the `Drop` code for type `D`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to previous error
diff --git a/src/test/ui/span/issue-25199.nll.stderr b/src/test/ui/span/issue-25199.nll.stderr
deleted file mode 100644
index d70a4af..0000000
--- a/src/test/ui/span/issue-25199.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0597]: `container` does not live long enough
- --> $DIR/issue-25199.rs:70:27
- |
-LL | let test = Test{test: &container};
- | ^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `container` dropped here while still borrowed
- | borrow might be used here, when `container` is dropped and runs the destructor for type `Container<'_>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-25199.rs b/src/test/ui/span/issue-25199.rs
index 4ef5745..ed69044 100644
--- a/src/test/ui/span/issue-25199.rs
+++ b/src/test/ui/span/issue-25199.rs
@@ -71,5 +71,4 @@
//~^ ERROR `container` does not live long enough
println!("container.v[30]: {:?}", container.v.v[30]);
container.store(test);
- //~^ ERROR `container` does not live long enough
}
diff --git a/src/test/ui/span/issue-25199.stderr b/src/test/ui/span/issue-25199.stderr
index 6d8320b..d70a4af 100644
--- a/src/test/ui/span/issue-25199.stderr
+++ b/src/test/ui/span/issue-25199.stderr
@@ -1,25 +1,15 @@
error[E0597]: `container` does not live long enough
- --> $DIR/issue-25199.rs:70:28
+ --> $DIR/issue-25199.rs:70:27
|
LL | let test = Test{test: &container};
- | ^^^^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^^^^ borrowed value does not live long enough
...
LL | }
- | - `container` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `container` dropped here while still borrowed
+ | borrow might be used here, when `container` is dropped and runs the destructor for type `Container<'_>`
-error[E0597]: `container` does not live long enough
- --> $DIR/issue-25199.rs:73:5
- |
-LL | container.store(test);
- | ^^^^^^^^^ borrowed value does not live long enough
-LL |
-LL | }
- | - `container` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-26656.nll.stderr b/src/test/ui/span/issue-26656.nll.stderr
deleted file mode 100644
index 1e939c4..0000000
--- a/src/test/ui/span/issue-26656.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0597]: `ticking` does not live long enough
- --> $DIR/issue-26656.rs:40:35
- |
-LL | zook.button = B::BigRedButton(&ticking);
- | ^^^^^^^^ borrowed value does not live long enough
-LL | }
- | -
- | |
- | `ticking` dropped here while still borrowed
- | borrow might be used here, when `zook` is dropped and runs the `Drop` code for type `Zook`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-26656.stderr b/src/test/ui/span/issue-26656.stderr
index ba2befb..1e939c4 100644
--- a/src/test/ui/span/issue-26656.stderr
+++ b/src/test/ui/span/issue-26656.stderr
@@ -1,12 +1,15 @@
error[E0597]: `ticking` does not live long enough
- --> $DIR/issue-26656.rs:40:36
+ --> $DIR/issue-26656.rs:40:35
|
LL | zook.button = B::BigRedButton(&ticking);
- | ^^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^^ borrowed value does not live long enough
LL | }
- | - `ticking` dropped here while still borrowed
+ | -
+ | |
+ | `ticking` dropped here while still borrowed
+ | borrow might be used here, when `zook` is dropped and runs the `Drop` code for type `Zook`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to previous error
diff --git a/src/test/ui/span/issue-29106.nll.stderr b/src/test/ui/span/issue-29106.nll.stderr
deleted file mode 100644
index 3b403de..0000000
--- a/src/test/ui/span/issue-29106.nll.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/issue-29106.rs:16:26
- |
-LL | y = Arc::new(Foo(&x));
- | ^^ borrowed value does not live long enough
-LL | }
- | -
- | |
- | `x` dropped here while still borrowed
- | borrow might be used here, when `y` is dropped and runs the `Drop` code for type `std::sync::Arc`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `x` does not live long enough
- --> $DIR/issue-29106.rs:23:25
- |
-LL | y = Rc::new(Foo(&x));
- | ^^ borrowed value does not live long enough
-LL | }
- | -
- | |
- | `x` dropped here while still borrowed
- | borrow might be used here, when `y` is dropped and runs the `Drop` code for type `std::rc::Rc`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-29106.stderr b/src/test/ui/span/issue-29106.stderr
index bb2f846..3b403de 100644
--- a/src/test/ui/span/issue-29106.stderr
+++ b/src/test/ui/span/issue-29106.stderr
@@ -1,22 +1,28 @@
error[E0597]: `x` does not live long enough
- --> $DIR/issue-29106.rs:16:27
+ --> $DIR/issue-29106.rs:16:26
|
LL | y = Arc::new(Foo(&x));
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | }
- | - `x` dropped here while still borrowed
+ | -
+ | |
+ | `x` dropped here while still borrowed
+ | borrow might be used here, when `y` is dropped and runs the `Drop` code for type `std::sync::Arc`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `x` does not live long enough
- --> $DIR/issue-29106.rs:23:26
+ --> $DIR/issue-29106.rs:23:25
|
LL | y = Rc::new(Foo(&x));
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | }
- | - `x` dropped here while still borrowed
+ | -
+ | |
+ | `x` dropped here while still borrowed
+ | borrow might be used here, when `y` is dropped and runs the `Drop` code for type `std::rc::Rc`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to 2 previous errors
diff --git a/src/test/ui/span/issue-36537.nll.stderr b/src/test/ui/span/issue-36537.nll.stderr
deleted file mode 100644
index edb804e..0000000
--- a/src/test/ui/span/issue-36537.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/issue-36537.rs:5:9
- |
-LL | p = &a;
- | ^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `a` dropped here while still borrowed
-LL | p.use_ref();
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-36537.stderr b/src/test/ui/span/issue-36537.stderr
index d3bcbb2..edb804e 100644
--- a/src/test/ui/span/issue-36537.stderr
+++ b/src/test/ui/span/issue-36537.stderr
@@ -1,14 +1,13 @@
error[E0597]: `a` does not live long enough
- --> $DIR/issue-36537.rs:5:14
+ --> $DIR/issue-36537.rs:5:9
|
LL | p = &a;
- | ^ borrowed value does not live long enough
+ | ^^^^^^ borrowed value does not live long enough
...
LL | }
| - `a` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
+LL | p.use_ref();
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/span/issue-40157.nll.stderr b/src/test/ui/span/issue-40157.nll.stderr
deleted file mode 100644
index 0b365c3..0000000
--- a/src/test/ui/span/issue-40157.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0597]: `foo` does not live long enough
- --> $DIR/issue-40157.rs:2:53
- |
-LL | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
- | ------------------------^^^---------
- | | | |
- | | | `foo` dropped here while still borrowed
- | | borrowed value does not live long enough
- | borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue-40157.stderr b/src/test/ui/span/issue-40157.stderr
index 55fc8d8..0b365c3 100644
--- a/src/test/ui/span/issue-40157.stderr
+++ b/src/test/ui/span/issue-40157.stderr
@@ -2,13 +2,11 @@
--> $DIR/issue-40157.rs:2:53
|
LL | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
- | -----------------------------------------------^^^----------------------
- | | | |
- | | | `foo` dropped here while still borrowed
- | | borrowed value does not live long enough
- | borrowed value needs to live until here
- |
- = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+ | ------------------------^^^---------
+ | | | |
+ | | | `foo` dropped here while still borrowed
+ | | borrowed value does not live long enough
+ | borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/span/issue28498-reject-ex1.nll.stderr b/src/test/ui/span/issue28498-reject-ex1.nll.stderr
deleted file mode 100644
index 86e2d8c..0000000
--- a/src/test/ui/span/issue28498-reject-ex1.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0713]: borrow may still be in use when destructor runs
- --> $DIR/issue28498-reject-ex1.rs:34:29
- |
-LL | foo.data[0].1.set(Some(&foo.data[1]));
- | ^^^^^^^^
-...
-LL | }
- | -
- | |
- | here, drop of `foo` needs exclusive access to `foo.data`, because the type `Foo<Concrete<'_>>` implements the `Drop` trait
- | borrow might be used here, when `foo` is dropped and runs the `Drop` code for type `Foo`
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0713`.
diff --git a/src/test/ui/span/issue28498-reject-ex1.rs b/src/test/ui/span/issue28498-reject-ex1.rs
index 05104d1..4d1b412 100644
--- a/src/test/ui/span/issue28498-reject-ex1.rs
+++ b/src/test/ui/span/issue28498-reject-ex1.rs
@@ -32,7 +32,6 @@
foo.data.push(Concrete(0, Cell::new(None)));
foo.data[0].1.set(Some(&foo.data[1]));
- //~^ ERROR `foo.data` does not live long enough
+ //~^ ERROR borrow may still be in use when destructor runs
foo.data[1].1.set(Some(&foo.data[0]));
- //~^ ERROR `foo.data` does not live long enough
}
diff --git a/src/test/ui/span/issue28498-reject-ex1.stderr b/src/test/ui/span/issue28498-reject-ex1.stderr
index 1438b95..86e2d8c 100644
--- a/src/test/ui/span/issue28498-reject-ex1.stderr
+++ b/src/test/ui/span/issue28498-reject-ex1.stderr
@@ -1,25 +1,17 @@
-error[E0597]: `foo.data` does not live long enough
+error[E0713]: borrow may still be in use when destructor runs
--> $DIR/issue28498-reject-ex1.rs:34:29
|
LL | foo.data[0].1.set(Some(&foo.data[1]));
- | ^^^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^^
...
LL | }
- | - `foo.data` dropped here while still borrowed
+ | -
+ | |
+ | here, drop of `foo` needs exclusive access to `foo.data`, because the type `Foo<Concrete<'_>>` implements the `Drop` trait
+ | borrow might be used here, when `foo` is dropped and runs the `Drop` code for type `Foo`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: consider using a `let` binding to create a longer lived value
-error[E0597]: `foo.data` does not live long enough
- --> $DIR/issue28498-reject-ex1.rs:36:29
- |
-LL | foo.data[1].1.set(Some(&foo.data[0]));
- | ^^^^^^^^ borrowed value does not live long enough
-LL |
-LL | }
- | - `foo.data` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+error: aborting due to previous error
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0713`.
diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.nll.stderr b/src/test/ui/span/issue28498-reject-lifetime-param.nll.stderr
deleted file mode 100644
index 3273b51..0000000
--- a/src/test/ui/span/issue28498-reject-lifetime-param.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0597]: `first_dropped` does not live long enough
- --> $DIR/issue28498-reject-lifetime-param.rs:34:19
- |
-LL | foo1 = Foo(1, &first_dropped);
- | ^^^^^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `first_dropped` dropped here while still borrowed
- | borrow might be used here, when `foo1` is dropped and runs the `Drop` code for type `Foo`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.rs b/src/test/ui/span/issue28498-reject-lifetime-param.rs
index 062636a..9bc0176 100644
--- a/src/test/ui/span/issue28498-reject-lifetime-param.rs
+++ b/src/test/ui/span/issue28498-reject-lifetime-param.rs
@@ -29,8 +29,7 @@
last_dropped = ScribbleOnDrop(format!("last"));
first_dropped = ScribbleOnDrop(format!("first"));
- foo0 = Foo(0, &last_dropped);
- //~^ ERROR `last_dropped` does not live long enough
+ foo0 = Foo(0, &last_dropped); // OK
foo1 = Foo(1, &first_dropped);
//~^ ERROR `first_dropped` does not live long enough
diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.stderr b/src/test/ui/span/issue28498-reject-lifetime-param.stderr
index 0e51729..1dcb40e 100644
--- a/src/test/ui/span/issue28498-reject-lifetime-param.stderr
+++ b/src/test/ui/span/issue28498-reject-lifetime-param.stderr
@@ -1,25 +1,17 @@
-error[E0597]: `last_dropped` does not live long enough
- --> $DIR/issue28498-reject-lifetime-param.rs:32:20
- |
-LL | foo0 = Foo(0, &last_dropped);
- | ^^^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `last_dropped` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
error[E0597]: `first_dropped` does not live long enough
- --> $DIR/issue28498-reject-lifetime-param.rs:34:20
+ --> $DIR/issue28498-reject-lifetime-param.rs:33:19
|
LL | foo1 = Foo(1, &first_dropped);
- | ^^^^^^^^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^^^^^^^^ borrowed value does not live long enough
...
LL | }
- | - `first_dropped` dropped here while still borrowed
+ | -
+ | |
+ | `first_dropped` dropped here while still borrowed
+ | borrow might be used here, when `foo1` is dropped and runs the `Drop` code for type `Foo`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.nll.stderr b/src/test/ui/span/issue28498-reject-passed-to-fn.nll.stderr
deleted file mode 100644
index ae08e3e..0000000
--- a/src/test/ui/span/issue28498-reject-passed-to-fn.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0597]: `first_dropped` does not live long enough
- --> $DIR/issue28498-reject-passed-to-fn.rs:36:19
- |
-LL | foo1 = Foo(1, &first_dropped, Box::new(callback));
- | ^^^^^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `first_dropped` dropped here while still borrowed
- | borrow might be used here, when `foo1` is dropped and runs the `Drop` code for type `Foo`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.rs b/src/test/ui/span/issue28498-reject-passed-to-fn.rs
index 27a757e..c59de5d 100644
--- a/src/test/ui/span/issue28498-reject-passed-to-fn.rs
+++ b/src/test/ui/span/issue28498-reject-passed-to-fn.rs
@@ -31,8 +31,7 @@
last_dropped = ScribbleOnDrop(format!("last"));
first_dropped = ScribbleOnDrop(format!("first"));
- foo0 = Foo(0, &last_dropped, Box::new(callback));
- //~^ ERROR `last_dropped` does not live long enough
+ foo0 = Foo(0, &last_dropped, Box::new(callback)); // OK
foo1 = Foo(1, &first_dropped, Box::new(callback));
//~^ ERROR `first_dropped` does not live long enough
diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr b/src/test/ui/span/issue28498-reject-passed-to-fn.stderr
index 80533c7..214a6f6 100644
--- a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr
+++ b/src/test/ui/span/issue28498-reject-passed-to-fn.stderr
@@ -1,25 +1,17 @@
-error[E0597]: `last_dropped` does not live long enough
- --> $DIR/issue28498-reject-passed-to-fn.rs:34:20
- |
-LL | foo0 = Foo(0, &last_dropped, Box::new(callback));
- | ^^^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `last_dropped` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
error[E0597]: `first_dropped` does not live long enough
- --> $DIR/issue28498-reject-passed-to-fn.rs:36:20
+ --> $DIR/issue28498-reject-passed-to-fn.rs:35:19
|
LL | foo1 = Foo(1, &first_dropped, Box::new(callback));
- | ^^^^^^^^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^^^^^^^^ borrowed value does not live long enough
...
LL | }
- | - `first_dropped` dropped here while still borrowed
+ | -
+ | |
+ | `first_dropped` dropped here while still borrowed
+ | borrow might be used here, when `foo1` is dropped and runs the `Drop` code for type `Foo`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue28498-reject-trait-bound.nll.stderr b/src/test/ui/span/issue28498-reject-trait-bound.nll.stderr
deleted file mode 100644
index 600fd53..0000000
--- a/src/test/ui/span/issue28498-reject-trait-bound.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0597]: `first_dropped` does not live long enough
- --> $DIR/issue28498-reject-trait-bound.rs:36:19
- |
-LL | foo1 = Foo(1, &first_dropped);
- | ^^^^^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `first_dropped` dropped here while still borrowed
- | borrow might be used here, when `foo1` is dropped and runs the `Drop` code for type `Foo`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/issue28498-reject-trait-bound.rs b/src/test/ui/span/issue28498-reject-trait-bound.rs
index 3ea67d1..8813180 100644
--- a/src/test/ui/span/issue28498-reject-trait-bound.rs
+++ b/src/test/ui/span/issue28498-reject-trait-bound.rs
@@ -31,8 +31,7 @@
last_dropped = ScribbleOnDrop(format!("last"));
first_dropped = ScribbleOnDrop(format!("first"));
- foo0 = Foo(0, &last_dropped);
- //~^ ERROR `last_dropped` does not live long enough
+ foo0 = Foo(0, &last_dropped); // OK
foo1 = Foo(1, &first_dropped);
//~^ ERROR `first_dropped` does not live long enough
diff --git a/src/test/ui/span/issue28498-reject-trait-bound.stderr b/src/test/ui/span/issue28498-reject-trait-bound.stderr
index 3ce4dd9..d4fe291 100644
--- a/src/test/ui/span/issue28498-reject-trait-bound.stderr
+++ b/src/test/ui/span/issue28498-reject-trait-bound.stderr
@@ -1,25 +1,17 @@
-error[E0597]: `last_dropped` does not live long enough
- --> $DIR/issue28498-reject-trait-bound.rs:34:20
- |
-LL | foo0 = Foo(0, &last_dropped);
- | ^^^^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `last_dropped` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
-
error[E0597]: `first_dropped` does not live long enough
- --> $DIR/issue28498-reject-trait-bound.rs:36:20
+ --> $DIR/issue28498-reject-trait-bound.rs:35:19
|
LL | foo1 = Foo(1, &first_dropped);
- | ^^^^^^^^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^^^^^^^^ borrowed value does not live long enough
...
LL | }
- | - `first_dropped` dropped here while still borrowed
+ | -
+ | |
+ | `first_dropped` dropped here while still borrowed
+ | borrow might be used here, when `foo1` is dropped and runs the `Drop` code for type `Foo`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/mut-arg-hint.nll.stderr b/src/test/ui/span/mut-arg-hint.nll.stderr
deleted file mode 100644
index 8027cf6..0000000
--- a/src/test/ui/span/mut-arg-hint.nll.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
- --> $DIR/mut-arg-hint.rs:3:9
- |
-LL | fn foo(mut a: &String) {
- | ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL | a.push_str("bar");
- | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
- --> $DIR/mut-arg-hint.rs:8:5
- |
-LL | pub fn foo<'a>(mut a: &'a String) {
- | ---------- help: consider changing this to be a mutable reference: `&'a mut String`
-LL | a.push_str("foo");
- | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
- --> $DIR/mut-arg-hint.rs:15:9
- |
-LL | pub fn foo(mut a: &String) {
- | ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL | a.push_str("foo");
- | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/span/mut-arg-hint.rs b/src/test/ui/span/mut-arg-hint.rs
index 3d46613..d7ff1f0 100644
--- a/src/test/ui/span/mut-arg-hint.rs
+++ b/src/test/ui/span/mut-arg-hint.rs
@@ -1,18 +1,18 @@
trait B {
fn foo(mut a: &String) {
- a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content
+ a.push_str("bar"); //~ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
}
}
pub fn foo<'a>(mut a: &'a String) {
- a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content
+ a.push_str("foo"); //~ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
}
struct A {}
impl A {
pub fn foo(mut a: &String) {
- a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content
+ a.push_str("foo"); //~ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
}
}
diff --git a/src/test/ui/span/mut-arg-hint.stderr b/src/test/ui/span/mut-arg-hint.stderr
index ce57861..8027cf6 100644
--- a/src/test/ui/span/mut-arg-hint.stderr
+++ b/src/test/ui/span/mut-arg-hint.stderr
@@ -1,26 +1,26 @@
-error[E0596]: cannot borrow immutable borrowed content `*a` as mutable
+error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
--> $DIR/mut-arg-hint.rs:3:9
|
LL | fn foo(mut a: &String) {
- | ------- use `&mut String` here to make mutable
+ | ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
LL | a.push_str("bar");
- | ^ cannot borrow as mutable
+ | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow immutable borrowed content `*a` as mutable
+error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
--> $DIR/mut-arg-hint.rs:8:5
|
LL | pub fn foo<'a>(mut a: &'a String) {
- | ---------- use `&'a mut String` here to make mutable
+ | ---------- help: consider changing this to be a mutable reference: `&'a mut String`
LL | a.push_str("foo");
- | ^ cannot borrow as mutable
+ | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0596]: cannot borrow immutable borrowed content `*a` as mutable
+error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
--> $DIR/mut-arg-hint.rs:15:9
|
LL | pub fn foo(mut a: &String) {
- | ------- use `&mut String` here to make mutable
+ | ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
LL | a.push_str("foo");
- | ^ cannot borrow as mutable
+ | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to 3 previous errors
diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr
deleted file mode 100644
index 21b2946..0000000
--- a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `b` does not live long enough
- --> $DIR/mut-ptr-cant-outlive-ref.rs:8:15
- |
-LL | p = &*b;
- | ^ borrowed value does not live long enough
-LL | }
- | - `b` dropped here while still borrowed
-LL |
-LL | p.use_ref();
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr
index f6cf568..21b2946 100644
--- a/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr
+++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr
@@ -5,9 +5,9 @@
| ^ borrowed value does not live long enough
LL | }
| - `b` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
+LL |
+LL | p.use_ref();
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/span/range-2.nll.stderr b/src/test/ui/span/range-2.nll.stderr
deleted file mode 100644
index 8ca8156..0000000
--- a/src/test/ui/span/range-2.nll.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/range-2.rs:7:9
- |
-LL | let r = {
- | - borrow later stored here
-...
-LL | &a..&b
- | ^^ borrowed value does not live long enough
-LL | };
- | - `a` dropped here while still borrowed
-
-error[E0597]: `b` does not live long enough
- --> $DIR/range-2.rs:7:13
- |
-LL | let r = {
- | - borrow later stored here
-...
-LL | &a..&b
- | ^^ borrowed value does not live long enough
-LL | };
- | - `b` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/range-2.stderr b/src/test/ui/span/range-2.stderr
index 7d0edd6..8ca8156 100644
--- a/src/test/ui/span/range-2.stderr
+++ b/src/test/ui/span/range-2.stderr
@@ -1,24 +1,24 @@
error[E0597]: `a` does not live long enough
- --> $DIR/range-2.rs:7:10
+ --> $DIR/range-2.rs:7:9
|
+LL | let r = {
+ | - borrow later stored here
+...
LL | &a..&b
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | };
| - `a` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
error[E0597]: `b` does not live long enough
- --> $DIR/range-2.rs:7:14
+ --> $DIR/range-2.rs:7:13
|
+LL | let r = {
+ | - borrow later stored here
+...
LL | &a..&b
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | };
| - `b` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.nll.stderr b/src/test/ui/span/regionck-unboxed-closure-lifetimes.nll.stderr
deleted file mode 100644
index 8e9cd59..0000000
--- a/src/test/ui/span/regionck-unboxed-closure-lifetimes.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `c` does not live long enough
- --> $DIR/regionck-unboxed-closure-lifetimes.rs:8:21
- |
-LL | let c_ref = &c;
- | ^^ borrowed value does not live long enough
-...
-LL | }
- | - `c` dropped here while still borrowed
-LL | f.use_mut();
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr b/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr
index b3f0966..8e9cd59 100644
--- a/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr
+++ b/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr
@@ -1,14 +1,13 @@
error[E0597]: `c` does not live long enough
- --> $DIR/regionck-unboxed-closure-lifetimes.rs:8:22
+ --> $DIR/regionck-unboxed-closure-lifetimes.rs:8:21
|
LL | let c_ref = &c;
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
...
LL | }
| - `c` dropped here while still borrowed
LL | f.use_mut();
-LL | }
- | - borrowed value needs to live until here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr
deleted file mode 100644
index 2be2d0f..0000000
--- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:12:27
- |
-LL | let ss: &isize = &id(1);
- | ^^^^^ creates a temporary which is freed while still in use
-...
-LL | }
- | - temporary value is freed at the end of this statement
-LL | }
- | - borrow might be used here, when `blah` is dropped and runs the destructor for type `std::boxed::Box<dyn Foo>`
- |
- = note: consider using a `let` binding to create a longer lived value
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs
index 9ca352a..13e651f 100644
--- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs
+++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs
@@ -10,7 +10,7 @@
let blah;
{
let ss: &isize = &id(1);
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
blah = box ss as Box<Foo>;
}
}
diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr
index 8a853e7..2be2d0f 100644
--- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr
+++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr
@@ -1,14 +1,16 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/regions-close-over-borrowed-ref-in-obj.rs:12:27
|
LL | let ss: &isize = &id(1);
- | ^^^^^ temporary value does not live long enough
+ | ^^^^^ creates a temporary which is freed while still in use
...
LL | }
- | - temporary value dropped here while still borrowed
+ | - temporary value is freed at the end of this statement
LL | }
- | - temporary value needs to live until here
+ | - borrow might be used here, when `blah` is dropped and runs the destructor for type `std::boxed::Box<dyn Foo>`
+ |
+ = note: consider using a `let` binding to create a longer lived value
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.nll.stderr b/src/test/ui/span/regions-close-over-type-parameter-2.nll.stderr
deleted file mode 100644
index 2e584d9..0000000
--- a/src/test/ui/span/regions-close-over-type-parameter-2.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0597]: `tmp0` does not live long enough
- --> $DIR/regions-close-over-type-parameter-2.rs:23:20
- |
-LL | let tmp1 = &tmp0;
- | ^^^^^ borrowed value does not live long enough
-LL | repeater3(tmp1)
- | --------------- borrow later captured here by trait object
-LL | };
- | - `tmp0` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.stderr b/src/test/ui/span/regions-close-over-type-parameter-2.stderr
index 5ee155c..2e584d9 100644
--- a/src/test/ui/span/regions-close-over-type-parameter-2.stderr
+++ b/src/test/ui/span/regions-close-over-type-parameter-2.stderr
@@ -1,13 +1,12 @@
error[E0597]: `tmp0` does not live long enough
- --> $DIR/regions-close-over-type-parameter-2.rs:23:21
+ --> $DIR/regions-close-over-type-parameter-2.rs:23:20
|
LL | let tmp1 = &tmp0;
- | ^^^^ borrowed value does not live long enough
+ | ^^^^^ borrowed value does not live long enough
LL | repeater3(tmp1)
+ | --------------- borrow later captured here by trait object
LL | };
- | -- borrowed value needs to live until here
- | |
- | `tmp0` dropped here while still borrowed
+ | - `tmp0` dropped here while still borrowed
error: aborting due to previous error
diff --git a/src/test/ui/span/regions-escape-loop-via-variable.nll.stderr b/src/test/ui/span/regions-escape-loop-via-variable.nll.stderr
deleted file mode 100644
index 42df668..0000000
--- a/src/test/ui/span/regions-escape-loop-via-variable.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/regions-escape-loop-via-variable.rs:11:13
- |
-LL | let x = 1 + *p;
- | -- borrow later used here
-LL | p = &x;
- | ^^ borrowed value does not live long enough
-LL | }
- | - `x` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/regions-escape-loop-via-variable.stderr b/src/test/ui/span/regions-escape-loop-via-variable.stderr
index ef36b81..42df668 100644
--- a/src/test/ui/span/regions-escape-loop-via-variable.stderr
+++ b/src/test/ui/span/regions-escape-loop-via-variable.stderr
@@ -1,13 +1,12 @@
error[E0597]: `x` does not live long enough
- --> $DIR/regions-escape-loop-via-variable.rs:11:14
+ --> $DIR/regions-escape-loop-via-variable.rs:11:13
|
+LL | let x = 1 + *p;
+ | -- borrow later used here
LL | p = &x;
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | }
| - `x` dropped here while still borrowed
-LL |
-LL | }
- | - borrowed value needs to live until here
error: aborting due to previous error
diff --git a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr b/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr
deleted file mode 100644
index b47250d..0000000
--- a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr
+++ /dev/null
@@ -1,49 +0,0 @@
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/regions-escape-loop-via-vec.rs:5:11
- |
-LL | let mut _y = vec![&mut x];
- | ------ borrow of `x` occurs here
-LL | while x < 10 {
- | ^ use of borrowed `x`
-LL | let mut z = x;
-LL | _y.push(&mut z);
- | -- borrow later used here
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/regions-escape-loop-via-vec.rs:6:21
- |
-LL | let mut _y = vec![&mut x];
- | ------ borrow of `x` occurs here
-LL | while x < 10 {
-LL | let mut z = x;
- | ^ use of borrowed `x`
-LL | _y.push(&mut z);
- | -- borrow later used here
-
-error[E0597]: `z` does not live long enough
- --> $DIR/regions-escape-loop-via-vec.rs:7:17
- |
-LL | _y.push(&mut z);
- | -- ^^^^^^ borrowed value does not live long enough
- | |
- | borrow later used here
-...
-LL | }
- | - `z` dropped here while still borrowed
-
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/regions-escape-loop-via-vec.rs:9:9
- |
-LL | let mut _y = vec![&mut x];
- | ------ borrow of `x` occurs here
-...
-LL | _y.push(&mut z);
- | -- borrow later used here
-LL |
-LL | x += 1;
- | ^^^^^^ use of borrowed `x`
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0503, E0597.
-For more information about an error, try `rustc --explain E0503`.
diff --git a/src/test/ui/span/regions-escape-loop-via-vec.rs b/src/test/ui/span/regions-escape-loop-via-vec.rs
index 52f3dc3..1fceb09 100644
--- a/src/test/ui/span/regions-escape-loop-via-vec.rs
+++ b/src/test/ui/span/regions-escape-loop-via-vec.rs
@@ -6,7 +6,7 @@
let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
_y.push(&mut z);
//~^ ERROR `z` does not live long enough
- x += 1; //~ ERROR cannot assign
+ x += 1; //~ ERROR cannot use `x` because it was mutably borrowed
}
}
diff --git a/src/test/ui/span/regions-escape-loop-via-vec.stderr b/src/test/ui/span/regions-escape-loop-via-vec.stderr
index 9e46f86..b47250d 100644
--- a/src/test/ui/span/regions-escape-loop-via-vec.stderr
+++ b/src/test/ui/span/regions-escape-loop-via-vec.stderr
@@ -1,41 +1,49 @@
-error[E0597]: `z` does not live long enough
- --> $DIR/regions-escape-loop-via-vec.rs:7:22
- |
-LL | _y.push(&mut z);
- | ^ borrowed value does not live long enough
-...
-LL | }
- | - `z` dropped here while still borrowed
-LL | }
- | - borrowed value needs to live until here
-
error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/regions-escape-loop-via-vec.rs:5:11
|
LL | let mut _y = vec![&mut x];
- | - borrow of `x` occurs here
+ | ------ borrow of `x` occurs here
LL | while x < 10 {
| ^ use of borrowed `x`
+LL | let mut z = x;
+LL | _y.push(&mut z);
+ | -- borrow later used here
error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/regions-escape-loop-via-vec.rs:6:13
+ --> $DIR/regions-escape-loop-via-vec.rs:6:21
|
LL | let mut _y = vec![&mut x];
- | - borrow of `x` occurs here
+ | ------ borrow of `x` occurs here
LL | while x < 10 {
LL | let mut z = x;
- | ^^^^^ use of borrowed `x`
+ | ^ use of borrowed `x`
+LL | _y.push(&mut z);
+ | -- borrow later used here
-error[E0506]: cannot assign to `x` because it is borrowed
+error[E0597]: `z` does not live long enough
+ --> $DIR/regions-escape-loop-via-vec.rs:7:17
+ |
+LL | _y.push(&mut z);
+ | -- ^^^^^^ borrowed value does not live long enough
+ | |
+ | borrow later used here
+...
+LL | }
+ | - `z` dropped here while still borrowed
+
+error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/regions-escape-loop-via-vec.rs:9:9
|
LL | let mut _y = vec![&mut x];
- | - borrow of `x` occurs here
+ | ------ borrow of `x` occurs here
...
+LL | _y.push(&mut z);
+ | -- borrow later used here
+LL |
LL | x += 1;
- | ^^^^^^ assignment to borrowed `x` occurs here
+ | ^^^^^^ use of borrowed `x`
error: aborting due to 4 previous errors
-Some errors have detailed explanations: E0503, E0506, E0597.
+Some errors have detailed explanations: E0503, E0597.
For more information about an error, try `rustc --explain E0503`.
diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.nll.stderr b/src/test/ui/span/regions-infer-borrow-scope-within-loop.nll.stderr
deleted file mode 100644
index fd67c65..0000000
--- a/src/test/ui/span/regions-infer-borrow-scope-within-loop.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `*x` does not live long enough
- --> $DIR/regions-infer-borrow-scope-within-loop.rs:13:20
- |
-LL | y = borrow(&*x);
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | - `*x` dropped here while still borrowed
-LL | assert!(*y != 0);
- | -- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr b/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr
index 94abbce..fd67c65 100644
--- a/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr
+++ b/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr
@@ -1,14 +1,13 @@
error[E0597]: `*x` does not live long enough
- --> $DIR/regions-infer-borrow-scope-within-loop.rs:13:21
+ --> $DIR/regions-infer-borrow-scope-within-loop.rs:13:20
|
LL | y = borrow(&*x);
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
| - `*x` dropped here while still borrowed
LL | assert!(*y != 0);
-LL | }
- | - borrowed value needs to live until here
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.nll.stderr b/src/test/ui/span/send-is-not-static-ensures-scoping.nll.stderr
deleted file mode 100644
index 65d10c1..0000000
--- a/src/test/ui/span/send-is-not-static-ensures-scoping.nll.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/send-is-not-static-ensures-scoping.rs:16:17
- |
-LL | let bad = {
- | --- borrow later stored here
-LL | let x = 1;
-LL | let y = &x;
- | ^^ borrowed value does not live long enough
-...
-LL | };
- | - `x` dropped here while still borrowed
-
-error[E0597]: `y` does not live long enough
- --> $DIR/send-is-not-static-ensures-scoping.rs:20:22
- |
-LL | let bad = {
- | --- borrow later stored here
-...
-LL | scoped(|| {
- | -- value captured here
-LL | let _z = y;
- | ^ borrowed value does not live long enough
-...
-LL | };
- | - `y` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.stderr b/src/test/ui/span/send-is-not-static-ensures-scoping.stderr
index 4702628..65d10c1 100644
--- a/src/test/ui/span/send-is-not-static-ensures-scoping.stderr
+++ b/src/test/ui/span/send-is-not-static-ensures-scoping.stderr
@@ -1,28 +1,28 @@
error[E0597]: `x` does not live long enough
- --> $DIR/send-is-not-static-ensures-scoping.rs:16:18
+ --> $DIR/send-is-not-static-ensures-scoping.rs:16:17
|
+LL | let bad = {
+ | --- borrow later stored here
+LL | let x = 1;
LL | let y = &x;
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
...
LL | };
| - `x` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
error[E0597]: `y` does not live long enough
--> $DIR/send-is-not-static-ensures-scoping.rs:20:22
|
+LL | let bad = {
+ | --- borrow later stored here
+...
LL | scoped(|| {
- | -- capture occurs here
+ | -- value captured here
LL | let _z = y;
| ^ borrowed value does not live long enough
...
LL | };
- | - borrowed value only lives until here
-...
-LL | }
- | - borrowed value needs to live until here
+ | - `y` dropped here while still borrowed
error: aborting due to 2 previous errors
diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.nll.stderr b/src/test/ui/span/send-is-not-static-std-sync-2.nll.stderr
deleted file mode 100644
index bcd07e1..0000000
--- a/src/test/ui/span/send-is-not-static-std-sync-2.nll.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/send-is-not-static-std-sync-2.rs:11:20
- |
-LL | let lock = {
- | ---- borrow later stored here
-LL | let x = 1;
-LL | Mutex::new(&x)
- | ^^ borrowed value does not live long enough
-LL | };
- | - `x` dropped here while still borrowed
-
-error[E0597]: `x` does not live long enough
- --> $DIR/send-is-not-static-std-sync-2.rs:21:21
- |
-LL | let lock = {
- | ---- borrow later stored here
-LL | let x = 1;
-LL | RwLock::new(&x)
- | ^^ borrowed value does not live long enough
-LL | };
- | - `x` dropped here while still borrowed
-
-error[E0597]: `x` does not live long enough
- --> $DIR/send-is-not-static-std-sync-2.rs:31:25
- |
-LL | let (_tx, rx) = {
- | --- borrow later used here
-...
-LL | let _ = tx.send(&x);
- | ^^ borrowed value does not live long enough
-LL | (tx, rx)
-LL | };
- | - `x` dropped here while still borrowed
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.stderr b/src/test/ui/span/send-is-not-static-std-sync-2.stderr
index 4172731..bcd07e1 100644
--- a/src/test/ui/span/send-is-not-static-std-sync-2.stderr
+++ b/src/test/ui/span/send-is-not-static-std-sync-2.stderr
@@ -1,36 +1,36 @@
error[E0597]: `x` does not live long enough
- --> $DIR/send-is-not-static-std-sync-2.rs:11:21
+ --> $DIR/send-is-not-static-std-sync-2.rs:11:20
|
+LL | let lock = {
+ | ---- borrow later stored here
+LL | let x = 1;
LL | Mutex::new(&x)
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | };
| - `x` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
error[E0597]: `x` does not live long enough
- --> $DIR/send-is-not-static-std-sync-2.rs:21:22
+ --> $DIR/send-is-not-static-std-sync-2.rs:21:21
|
+LL | let lock = {
+ | ---- borrow later stored here
+LL | let x = 1;
LL | RwLock::new(&x)
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | };
| - `x` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
error[E0597]: `x` does not live long enough
- --> $DIR/send-is-not-static-std-sync-2.rs:31:26
+ --> $DIR/send-is-not-static-std-sync-2.rs:31:25
|
+LL | let (_tx, rx) = {
+ | --- borrow later used here
+...
LL | let _ = tx.send(&x);
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
LL | (tx, rx)
LL | };
| - `x` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
error: aborting due to 3 previous errors
diff --git a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr b/src/test/ui/span/send-is-not-static-std-sync.nll.stderr
deleted file mode 100644
index d00b157..0000000
--- a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr
+++ /dev/null
@@ -1,72 +0,0 @@
-error[E0505]: cannot move out of `y` because it is borrowed
- --> $DIR/send-is-not-static-std-sync.rs:13:10
- |
-LL | *lock.lock().unwrap() = &*y;
- | --- borrow of `*y` occurs here
-LL | drop(y);
- | ^ move out of `y` occurs here
-...
-LL | *lock.lock().unwrap() = &z;
- | ---- borrow later used here
-
-error[E0597]: `z` does not live long enough
- --> $DIR/send-is-not-static-std-sync.rs:16:33
- |
-LL | *lock.lock().unwrap() = &z;
- | ^^ borrowed value does not live long enough
-LL | }
- | - `z` dropped here while still borrowed
-LL |
-LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use)
- | ---- borrow later used here
-
-error[E0505]: cannot move out of `y` because it is borrowed
- --> $DIR/send-is-not-static-std-sync.rs:27:10
- |
-LL | *lock.write().unwrap() = &*y;
- | --- borrow of `*y` occurs here
-LL | drop(y);
- | ^ move out of `y` occurs here
-...
-LL | *lock.write().unwrap() = &z;
- | ---- borrow later used here
-
-error[E0597]: `z` does not live long enough
- --> $DIR/send-is-not-static-std-sync.rs:30:34
- |
-LL | *lock.write().unwrap() = &z;
- | ^^ borrowed value does not live long enough
-LL | }
- | - `z` dropped here while still borrowed
-LL |
-LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use)
- | ---- borrow later used here
-
-error[E0505]: cannot move out of `y` because it is borrowed
- --> $DIR/send-is-not-static-std-sync.rs:43:10
- |
-LL | tx.send(&*y);
- | --- borrow of `*y` occurs here
-LL | drop(y);
- | ^ move out of `y` occurs here
-...
-LL | tx.send(&z).unwrap();
- | -- borrow later used here
-
-error[E0597]: `z` does not live long enough
- --> $DIR/send-is-not-static-std-sync.rs:46:17
- |
-LL | tx.send(&z).unwrap();
- | ^^ borrowed value does not live long enough
-LL | }
- | - `z` dropped here while still borrowed
-...
-LL | }
- | - borrow might be used here, when `tx` is dropped and runs the `Drop` code for type `std::sync::mpsc::Sender`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to 6 previous errors
-
-Some errors have detailed explanations: E0505, E0597.
-For more information about an error, try `rustc --explain E0505`.
diff --git a/src/test/ui/span/send-is-not-static-std-sync.stderr b/src/test/ui/span/send-is-not-static-std-sync.stderr
index e302487..d00b157 100644
--- a/src/test/ui/span/send-is-not-static-std-sync.stderr
+++ b/src/test/ui/span/send-is-not-static-std-sync.stderr
@@ -1,59 +1,70 @@
-error[E0597]: `z` does not live long enough
- --> $DIR/send-is-not-static-std-sync.rs:16:34
- |
-LL | *lock.lock().unwrap() = &z;
- | ^ borrowed value does not live long enough
-LL | }
- | - `z` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
-
error[E0505]: cannot move out of `y` because it is borrowed
--> $DIR/send-is-not-static-std-sync.rs:13:10
|
LL | *lock.lock().unwrap() = &*y;
- | -- borrow of `*y` occurs here
+ | --- borrow of `*y` occurs here
LL | drop(y);
| ^ move out of `y` occurs here
+...
+LL | *lock.lock().unwrap() = &z;
+ | ---- borrow later used here
error[E0597]: `z` does not live long enough
- --> $DIR/send-is-not-static-std-sync.rs:30:35
+ --> $DIR/send-is-not-static-std-sync.rs:16:33
|
-LL | *lock.write().unwrap() = &z;
- | ^ borrowed value does not live long enough
+LL | *lock.lock().unwrap() = &z;
+ | ^^ borrowed value does not live long enough
LL | }
| - `z` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
+LL |
+LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use)
+ | ---- borrow later used here
error[E0505]: cannot move out of `y` because it is borrowed
--> $DIR/send-is-not-static-std-sync.rs:27:10
|
LL | *lock.write().unwrap() = &*y;
- | -- borrow of `*y` occurs here
+ | --- borrow of `*y` occurs here
LL | drop(y);
| ^ move out of `y` occurs here
+...
+LL | *lock.write().unwrap() = &z;
+ | ---- borrow later used here
error[E0597]: `z` does not live long enough
- --> $DIR/send-is-not-static-std-sync.rs:46:18
+ --> $DIR/send-is-not-static-std-sync.rs:30:34
|
-LL | tx.send(&z).unwrap();
- | ^ borrowed value does not live long enough
+LL | *lock.write().unwrap() = &z;
+ | ^^ borrowed value does not live long enough
LL | }
| - `z` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
+LL |
+LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use)
+ | ---- borrow later used here
error[E0505]: cannot move out of `y` because it is borrowed
--> $DIR/send-is-not-static-std-sync.rs:43:10
|
LL | tx.send(&*y);
- | -- borrow of `*y` occurs here
+ | --- borrow of `*y` occurs here
LL | drop(y);
| ^ move out of `y` occurs here
+...
+LL | tx.send(&z).unwrap();
+ | -- borrow later used here
+
+error[E0597]: `z` does not live long enough
+ --> $DIR/send-is-not-static-std-sync.rs:46:17
+ |
+LL | tx.send(&z).unwrap();
+ | ^^ borrowed value does not live long enough
+LL | }
+ | - `z` dropped here while still borrowed
+...
+LL | }
+ | - borrow might be used here, when `tx` is dropped and runs the `Drop` code for type `std::sync::mpsc::Sender`
+ |
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to 6 previous errors
diff --git a/src/test/ui/span/slice-borrow.nll.stderr b/src/test/ui/span/slice-borrow.nll.stderr
deleted file mode 100644
index 84d0c84..0000000
--- a/src/test/ui/span/slice-borrow.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/slice-borrow.rs:6:28
- |
-LL | let x: &[isize] = &vec![1, 2, 3, 4, 5];
- | ^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
-...
-LL | }
- | - temporary value is freed at the end of this statement
-LL | y.use_ref();
- | - borrow later used here
- |
- = note: consider using a `let` binding to create a longer lived value
- = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/span/slice-borrow.rs b/src/test/ui/span/slice-borrow.rs
index 23e5303..38cd7ac 100644
--- a/src/test/ui/span/slice-borrow.rs
+++ b/src/test/ui/span/slice-borrow.rs
@@ -4,7 +4,7 @@
let y;
{
let x: &[isize] = &vec![1, 2, 3, 4, 5];
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
y = &x[1..];
}
y.use_ref();
diff --git a/src/test/ui/span/slice-borrow.stderr b/src/test/ui/span/slice-borrow.stderr
index a03cac5..84d0c84 100644
--- a/src/test/ui/span/slice-borrow.stderr
+++ b/src/test/ui/span/slice-borrow.stderr
@@ -1,17 +1,17 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/slice-borrow.rs:6:28
|
LL | let x: &[isize] = &vec![1, 2, 3, 4, 5];
- | ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+ | ^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
...
LL | }
- | - temporary value dropped here while still borrowed
+ | - temporary value is freed at the end of this statement
LL | y.use_ref();
-LL | }
- | - temporary value needs to live until here
+ | - borrow later used here
|
+ = note: consider using a `let` binding to create a longer lived value
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr
deleted file mode 100644
index f87c32d..0000000
--- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error[E0597]: `c2` does not live long enough
- --> $DIR/vec-must-not-hide-type-from-dropck.rs:117:24
- |
-LL | c1.v[0].v.set(Some(&c2));
- | ^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `c2` dropped here while still borrowed
- | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `c1` does not live long enough
- --> $DIR/vec-must-not-hide-type-from-dropck.rs:119:24
- |
-LL | c2.v[0].v.set(Some(&c1));
- | ^^^ borrowed value does not live long enough
-LL |
-LL | }
- | -
- | |
- | `c1` dropped here while still borrowed
- | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr
index b957243..f87c32d 100644
--- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr
+++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr
@@ -1,24 +1,28 @@
error[E0597]: `c2` does not live long enough
- --> $DIR/vec-must-not-hide-type-from-dropck.rs:117:25
+ --> $DIR/vec-must-not-hide-type-from-dropck.rs:117:24
|
LL | c1.v[0].v.set(Some(&c2));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
- | - `c2` dropped here while still borrowed
+ | -
+ | |
+ | `c2` dropped here while still borrowed
+ | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `c1` does not live long enough
- --> $DIR/vec-must-not-hide-type-from-dropck.rs:119:25
+ --> $DIR/vec-must-not-hide-type-from-dropck.rs:119:24
|
LL | c2.v[0].v.set(Some(&c1));
- | ^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
LL |
LL | }
- | - `c1` dropped here while still borrowed
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `c1` dropped here while still borrowed
+ | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/span/vec_refs_data_with_early_death.nll.stderr b/src/test/ui/span/vec_refs_data_with_early_death.nll.stderr
deleted file mode 100644
index 684e784..0000000
--- a/src/test/ui/span/vec_refs_data_with_early_death.nll.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/vec_refs_data_with_early_death.rs:17:12
- |
-LL | v.push(&x);
- | ^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `x` dropped here while still borrowed
- | borrow might be used here, when `v` is dropped and runs the `Drop` code for type `Bag`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error[E0597]: `y` does not live long enough
- --> $DIR/vec_refs_data_with_early_death.rs:19:12
- |
-LL | v.push(&y);
- | ^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `y` dropped here while still borrowed
- | borrow might be used here, when `v` is dropped and runs the `Drop` code for type `Bag`
- |
- = note: values in a scope are dropped in the opposite order they are defined
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/vec_refs_data_with_early_death.stderr b/src/test/ui/span/vec_refs_data_with_early_death.stderr
index 65fd6b5..684e784 100644
--- a/src/test/ui/span/vec_refs_data_with_early_death.stderr
+++ b/src/test/ui/span/vec_refs_data_with_early_death.stderr
@@ -1,24 +1,30 @@
error[E0597]: `x` does not live long enough
- --> $DIR/vec_refs_data_with_early_death.rs:17:13
+ --> $DIR/vec_refs_data_with_early_death.rs:17:12
|
LL | v.push(&x);
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
...
LL | }
- | - `x` dropped here while still borrowed
+ | -
+ | |
+ | `x` dropped here while still borrowed
+ | borrow might be used here, when `v` is dropped and runs the `Drop` code for type `Bag`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error[E0597]: `y` does not live long enough
- --> $DIR/vec_refs_data_with_early_death.rs:19:13
+ --> $DIR/vec_refs_data_with_early_death.rs:19:12
|
LL | v.push(&y);
- | ^ borrowed value does not live long enough
+ | ^^ borrowed value does not live long enough
...
LL | }
- | - `y` dropped here while still borrowed
+ | -
+ | |
+ | `y` dropped here while still borrowed
+ | borrow might be used here, when `v` is dropped and runs the `Drop` code for type `Bag`
|
- = note: values in a scope are dropped in the opposite order they are created
+ = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to 2 previous errors
diff --git a/src/test/ui/span/wf-method-late-bound-regions.nll.stderr b/src/test/ui/span/wf-method-late-bound-regions.nll.stderr
deleted file mode 100644
index 6b0b008..0000000
--- a/src/test/ui/span/wf-method-late-bound-regions.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `pointer` does not live long enough
- --> $DIR/wf-method-late-bound-regions.rs:20:18
- |
-LL | let dangling = {
- | -------- borrow later stored here
-LL | let pointer = Box::new(42);
-LL | f2.xmute(&pointer)
- | ^^^^^^^^ borrowed value does not live long enough
-LL | };
- | - `pointer` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/span/wf-method-late-bound-regions.stderr b/src/test/ui/span/wf-method-late-bound-regions.stderr
index a30e0f4..6b0b008 100644
--- a/src/test/ui/span/wf-method-late-bound-regions.stderr
+++ b/src/test/ui/span/wf-method-late-bound-regions.stderr
@@ -1,13 +1,13 @@
error[E0597]: `pointer` does not live long enough
- --> $DIR/wf-method-late-bound-regions.rs:20:19
+ --> $DIR/wf-method-late-bound-regions.rs:20:18
|
+LL | let dangling = {
+ | -------- borrow later stored here
+LL | let pointer = Box::new(42);
LL | f2.xmute(&pointer)
- | ^^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^^ borrowed value does not live long enough
LL | };
| - `pointer` dropped here while still borrowed
-...
-LL | }
- | - borrowed value needs to live until here
error: aborting due to previous error
diff --git a/src/test/ui/static/static-drop-scope.nll.stderr b/src/test/ui/static/static-drop-scope.nll.stderr
deleted file mode 100644
index 8a23dad1..0000000
--- a/src/test/ui/static/static-drop-scope.nll.stderr
+++ /dev/null
@@ -1,71 +0,0 @@
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/static-drop-scope.rs:9:60
- |
-LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
- | ^^^^^^^^ statics cannot evaluate destructors
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/static-drop-scope.rs:9:60
- |
-LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
- | ------^^^^^^^^-
- | | | |
- | | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
- | using this value as a static requires that borrow lasts for `'static`
-
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/static-drop-scope.rs:13:59
- |
-LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
- | ^^^^^^^^ constants cannot evaluate destructors
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/static-drop-scope.rs:13:59
- |
-LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
- | ------^^^^^^^^-
- | | | |
- | | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
- | using this value as a constant requires that borrow lasts for `'static`
-
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/static-drop-scope.rs:17:28
- |
-LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1;
- | ^^^^^^^^^^^^^ statics cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/static-drop-scope.rs:20:27
- |
-LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1;
- | ^^^^^^^^^^^^^ constants cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/static-drop-scope.rs:23:24
- |
-LL | const fn const_drop<T>(_: T) {}
- | ^ constant functions cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/static-drop-scope.rs:27:5
- |
-LL | (x, ()).1
- | ^^^^^^^ constant functions cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/static-drop-scope.rs:31:34
- |
-LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
- | ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
- --> $DIR/static-drop-scope.rs:36:43
- |
-LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
- | ^^^^^^^^^^^ constants cannot evaluate destructors
-
-error: aborting due to 10 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/static/static-drop-scope.rs b/src/test/ui/static/static-drop-scope.rs
index e5a9f2a..0de28d5 100644
--- a/src/test/ui/static/static-drop-scope.rs
+++ b/src/test/ui/static/static-drop-scope.rs
@@ -8,11 +8,11 @@
static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
//~^ ERROR destructors cannot be evaluated at compile-time
-//~| ERROR borrowed value does not live long enoug
+//~| ERROR temporary value dropped while borrowed
const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
//~^ ERROR destructors cannot be evaluated at compile-time
-//~| ERROR borrowed value does not live long enoug
+//~| ERROR temporary value dropped while borrowed
static EARLY_DROP_S: i32 = (WithDtor, 0).1;
//~^ ERROR destructors cannot be evaluated at compile-time
diff --git a/src/test/ui/static/static-drop-scope.stderr b/src/test/ui/static/static-drop-scope.stderr
index 9793a1d..8a23dad1 100644
--- a/src/test/ui/static/static-drop-scope.stderr
+++ b/src/test/ui/static/static-drop-scope.stderr
@@ -4,15 +4,15 @@
LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
| ^^^^^^^^ statics cannot evaluate destructors
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/static-drop-scope.rs:9:60
|
LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
- | ^^^^^^^^- temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ------^^^^^^^^-
+ | | | |
+ | | | temporary value is freed at the end of this statement
+ | | creates a temporary which is freed while still in use
+ | using this value as a static requires that borrow lasts for `'static`
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/static-drop-scope.rs:13:59
@@ -20,15 +20,15 @@
LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
| ^^^^^^^^ constants cannot evaluate destructors
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/static-drop-scope.rs:13:59
|
LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
- | ^^^^^^^^- temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
- = note: borrowed value must be valid for the static lifetime...
+ | ------^^^^^^^^-
+ | | | |
+ | | | temporary value is freed at the end of this statement
+ | | creates a temporary which is freed while still in use
+ | using this value as a constant requires that borrow lasts for `'static`
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/static-drop-scope.rs:17:28
@@ -68,4 +68,4 @@
error: aborting due to 10 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/static/static-lifetime-bound.nll.stderr b/src/test/ui/static/static-lifetime-bound.nll.stderr
deleted file mode 100644
index 90d7282..0000000
--- a/src/test/ui/static/static-lifetime-bound.nll.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-warning: unnecessary lifetime parameter `'a`
- --> $DIR/static-lifetime-bound.rs:1:6
- |
-LL | fn f<'a: 'static>(_: &'a i32) {}
- | ^^^^^^^^^^^
- |
- = help: you can use the `'static` lifetime directly, in place of `'a`
-
-error[E0597]: `x` does not live long enough
- --> $DIR/static-lifetime-bound.rs:5:7
- |
-LL | f(&x);
- | --^^-
- | | |
- | | borrowed value does not live long enough
- | argument requires that `x` is borrowed for `'static`
-LL | }
- | - `x` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/static/static-lifetime-bound.stderr b/src/test/ui/static/static-lifetime-bound.stderr
index b9aa4d8..90d7282 100644
--- a/src/test/ui/static/static-lifetime-bound.stderr
+++ b/src/test/ui/static/static-lifetime-bound.stderr
@@ -7,14 +7,15 @@
= help: you can use the `'static` lifetime directly, in place of `'a`
error[E0597]: `x` does not live long enough
- --> $DIR/static-lifetime-bound.rs:5:8
+ --> $DIR/static-lifetime-bound.rs:5:7
|
LL | f(&x);
- | ^ borrowed value does not live long enough
+ | --^^-
+ | | |
+ | | borrowed value does not live long enough
+ | argument requires that `x` is borrowed for `'static`
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `x` dropped here while still borrowed
error: aborting due to previous error
diff --git a/src/test/ui/static/static-reference-to-fn-2.nll.stderr b/src/test/ui/static/static-reference-to-fn-2.nll.stderr
deleted file mode 100644
index 26f214b..0000000
--- a/src/test/ui/static/static-reference-to-fn-2.nll.stderr
+++ /dev/null
@@ -1,47 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/static-reference-to-fn-2.rs:18:22
- |
-LL | fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
- | ----- has type `&mut StateMachineIter<'1>`
-LL | self_.statefn = &id(state2 as StateMachineFunc);
- | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
- | | |
- | | creates a temporary which is freed while still in use
- | assignment requires that borrow lasts for `'1`
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/static-reference-to-fn-2.rs:24:22
- |
-LL | fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
- | ----- has type `&mut StateMachineIter<'1>`
-LL | self_.statefn = &id(state3 as StateMachineFunc);
- | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
- | | |
- | | creates a temporary which is freed while still in use
- | assignment requires that borrow lasts for `'1`
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/static-reference-to-fn-2.rs:30:22
- |
-LL | fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
- | ----- has type `&mut StateMachineIter<'1>`
-LL | self_.statefn = &id(finished as StateMachineFunc);
- | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
- | | |
- | | creates a temporary which is freed while still in use
- | assignment requires that borrow lasts for `'1`
-
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/static-reference-to-fn-2.rs:40:5
- |
-LL | / StateMachineIter {
-LL | | statefn: &id(state1 as StateMachineFunc)
- | | ------------------------------ temporary value created here
-LL | |
-LL | | }
- | |_____^ returns a value referencing data owned by the current function
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0515, E0716.
-For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/static/static-reference-to-fn-2.rs b/src/test/ui/static/static-reference-to-fn-2.rs
index 8e66532..6693667 100644
--- a/src/test/ui/static/static-reference-to-fn-2.rs
+++ b/src/test/ui/static/static-reference-to-fn-2.rs
@@ -16,19 +16,19 @@
fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
self_.statefn = &id(state2 as StateMachineFunc);
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
return Some("state1");
}
fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
self_.statefn = &id(state3 as StateMachineFunc);
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
return Some("state2");
}
fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
self_.statefn = &id(finished as StateMachineFunc);
- //~^ ERROR borrowed value does not live long enough
+ //~^ ERROR temporary value dropped while borrowed
return Some("state3");
}
@@ -38,8 +38,8 @@
fn state_iter() -> StateMachineIter<'static> {
StateMachineIter {
+ //~^ ERROR cannot return value referencing temporary value
statefn: &id(state1 as StateMachineFunc)
- //~^ ERROR borrowed value does not live long enough
}
}
diff --git a/src/test/ui/static/static-reference-to-fn-2.stderr b/src/test/ui/static/static-reference-to-fn-2.stderr
index 17d4a36..028e11a 100644
--- a/src/test/ui/static/static-reference-to-fn-2.stderr
+++ b/src/test/ui/static/static-reference-to-fn-2.stderr
@@ -1,71 +1,47 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/static-reference-to-fn-2.rs:18:22
|
+LL | fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
+ | ----- has type `&mut StateMachineIter<'1>`
LL | self_.statefn = &id(state2 as StateMachineFunc);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
-note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 17:1...
- --> $DIR/static-reference-to-fn-2.rs:17:1
- |
-LL | / fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
-LL | | self_.statefn = &id(state2 as StateMachineFunc);
-LL | |
-LL | | return Some("state1");
-LL | | }
- | |_^
- = note: consider using a `let` binding to increase its lifetime
+ | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+ | | |
+ | | creates a temporary which is freed while still in use
+ | assignment requires that borrow lasts for `'1`
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/static-reference-to-fn-2.rs:24:22
|
+LL | fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
+ | ----- has type `&mut StateMachineIter<'1>`
LL | self_.statefn = &id(state3 as StateMachineFunc);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
-note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 23:1...
- --> $DIR/static-reference-to-fn-2.rs:23:1
- |
-LL | / fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
-LL | | self_.statefn = &id(state3 as StateMachineFunc);
-LL | |
-LL | | return Some("state2");
-LL | | }
- | |_^
- = note: consider using a `let` binding to increase its lifetime
+ | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+ | | |
+ | | creates a temporary which is freed while still in use
+ | assignment requires that borrow lasts for `'1`
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/static-reference-to-fn-2.rs:30:22
|
+LL | fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
+ | ----- has type `&mut StateMachineIter<'1>`
LL | self_.statefn = &id(finished as StateMachineFunc);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
- | |
- | temporary value does not live long enough
- |
-note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 29:1...
- --> $DIR/static-reference-to-fn-2.rs:29:1
- |
-LL | / fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
-LL | | self_.statefn = &id(finished as StateMachineFunc);
-LL | |
-LL | | return Some("state3");
-LL | | }
- | |_^
- = note: consider using a `let` binding to increase its lifetime
+ | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+ | | |
+ | | creates a temporary which is freed while still in use
+ | assignment requires that borrow lasts for `'1`
-error[E0597]: borrowed value does not live long enough
- --> $DIR/static-reference-to-fn-2.rs:41:19
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/static-reference-to-fn-2.rs:40:5
|
-LL | statefn: &id(state1 as StateMachineFunc)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-...
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+LL | / StateMachineIter {
+LL | |
+LL | | statefn: &id(state1 as StateMachineFunc)
+ | | ------------------------------ temporary value created here
+LL | | }
+ | |_____^ returns a value referencing data owned by the current function
error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0597`.
+Some errors have detailed explanations: E0515, E0716.
+For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/static/static-region-bound.nll.stderr b/src/test/ui/static/static-region-bound.nll.stderr
deleted file mode 100644
index 1526125..0000000
--- a/src/test/ui/static/static-region-bound.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/static-region-bound.rs:10:14
- |
-LL | let x = &id(3);
- | ^^^^^ creates a temporary which is freed while still in use
-LL | f(x);
- | ---- argument requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/static/static-region-bound.rs b/src/test/ui/static/static-region-bound.rs
index ee41137..f133133 100644
--- a/src/test/ui/static/static-region-bound.rs
+++ b/src/test/ui/static/static-region-bound.rs
@@ -7,6 +7,6 @@
fn main() {
let x: Box<_> = box 3;
f(x);
- let x = &id(3); //~ ERROR borrowed value does not live long enough
+ let x = &id(3); //~ ERROR temporary value dropped while borrowed
f(x);
}
diff --git a/src/test/ui/static/static-region-bound.stderr b/src/test/ui/static/static-region-bound.stderr
index f6bbfce..1526125 100644
--- a/src/test/ui/static/static-region-bound.stderr
+++ b/src/test/ui/static/static-region-bound.stderr
@@ -1,14 +1,13 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
--> $DIR/static-region-bound.rs:10:14
|
LL | let x = &id(3);
- | ^^^^^ temporary value does not live long enough
+ | ^^^^^ creates a temporary which is freed while still in use
LL | f(x);
+ | ---- argument requires that borrow lasts for `'static`
LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - temporary value is freed at the end of this statement
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/std-uncopyable-atomics.nll.stderr b/src/test/ui/std-uncopyable-atomics.nll.stderr
deleted file mode 100644
index 8241f6f..0000000
--- a/src/test/ui/std-uncopyable-atomics.nll.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/std-uncopyable-atomics.rs:9:13
- |
-LL | let x = *&x;
- | ^^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `&x`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/std-uncopyable-atomics.rs:11:13
- |
-LL | let x = *&x;
- | ^^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `&x`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/std-uncopyable-atomics.rs:13:13
- |
-LL | let x = *&x;
- | ^^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `&x`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/std-uncopyable-atomics.rs:15:13
- |
-LL | let x = *&x;
- | ^^^
- | |
- | cannot move out of borrowed content
- | help: consider removing the `*`: `&x`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/std-uncopyable-atomics.stderr b/src/test/ui/std-uncopyable-atomics.stderr
index 7f01434..8241f6f 100644
--- a/src/test/ui/std-uncopyable-atomics.stderr
+++ b/src/test/ui/std-uncopyable-atomics.stderr
@@ -5,7 +5,7 @@
| ^^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&*&x`
+ | help: consider removing the `*`: `&x`
error[E0507]: cannot move out of borrowed content
--> $DIR/std-uncopyable-atomics.rs:11:13
@@ -14,7 +14,7 @@
| ^^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&*&x`
+ | help: consider removing the `*`: `&x`
error[E0507]: cannot move out of borrowed content
--> $DIR/std-uncopyable-atomics.rs:13:13
@@ -23,7 +23,7 @@
| ^^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&*&x`
+ | help: consider removing the `*`: `&x`
error[E0507]: cannot move out of borrowed content
--> $DIR/std-uncopyable-atomics.rs:15:13
@@ -32,7 +32,7 @@
| ^^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&*&x`
+ | help: consider removing the `*`: `&x`
error: aborting due to 4 previous errors
diff --git a/src/test/ui/suggestions/borrow-for-loop-head.nll.stderr b/src/test/ui/suggestions/borrow-for-loop-head.nll.stderr
deleted file mode 100644
index 10287f5..0000000
--- a/src/test/ui/suggestions/borrow-for-loop-head.nll.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0505]: cannot move out of `a` because it is borrowed
- --> $DIR/borrow-for-loop-head.rs:4:18
- |
-LL | for i in &a {
- | -- borrow of `a` occurs here
-LL | for j in a {
- | ^ move out of `a` occurs here
-
-error[E0382]: use of moved value: `a`
- --> $DIR/borrow-for-loop-head.rs:4:18
- |
-LL | let a = vec![1, 2, 3];
- | - move occurs because `a` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
-LL | for i in &a {
-LL | for j in a {
- | ^ value moved here, in previous iteration of loop
-help: consider borrowing this to avoid moving it into the for loop
- |
-LL | for j in &a {
- | ^^
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0382, E0505.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/suggestions/borrow-for-loop-head.stderr b/src/test/ui/suggestions/borrow-for-loop-head.stderr
index ecf3512..10287f5 100644
--- a/src/test/ui/suggestions/borrow-for-loop-head.stderr
+++ b/src/test/ui/suggestions/borrow-for-loop-head.stderr
@@ -2,17 +2,18 @@
--> $DIR/borrow-for-loop-head.rs:4:18
|
LL | for i in &a {
- | - borrow of `a` occurs here
+ | -- borrow of `a` occurs here
LL | for j in a {
| ^ move out of `a` occurs here
error[E0382]: use of moved value: `a`
--> $DIR/borrow-for-loop-head.rs:4:18
|
+LL | let a = vec![1, 2, 3];
+ | - move occurs because `a` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+LL | for i in &a {
LL | for j in a {
- | ^ value moved here in previous iteration of loop
- |
- = note: move occurs because `a` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+ | ^ value moved here, in previous iteration of loop
help: consider borrowing this to avoid moving it into the for loop
|
LL | for j in &a {
diff --git a/src/test/ui/thread-local-in-ctfe.nll.stderr b/src/test/ui/thread-local-in-ctfe.nll.stderr
deleted file mode 100644
index 33cef3e..0000000
--- a/src/test/ui/thread-local-in-ctfe.nll.stderr
+++ /dev/null
@@ -1,55 +0,0 @@
-error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-in-ctfe.rs:6:17
- |
-LL | static B: u32 = A;
- | ^
-
-error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-in-ctfe.rs:9:18
- |
-LL | static C: &u32 = &A;
- | ^^
-
-warning[E0712]: thread-local variable borrowed past end of function
- --> $DIR/thread-local-in-ctfe.rs:9:18
- |
-LL | static C: &u32 = &A;
- | ^^- end of enclosing function is here
- | |
- | thread-local variables cannot be borrowed beyond the end of the function
- |
- = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
- = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
-error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-in-ctfe.rs:12:16
- |
-LL | const D: u32 = A;
- | ^
-
-error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-in-ctfe.rs:15:17
- |
-LL | const E: &u32 = &A;
- | ^^
-
-warning[E0712]: thread-local variable borrowed past end of function
- --> $DIR/thread-local-in-ctfe.rs:15:17
- |
-LL | const E: &u32 = &A;
- | ^^- end of enclosing function is here
- | |
- | thread-local variables cannot be borrowed beyond the end of the function
- |
- = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
- = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
-
-error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-in-ctfe.rs:19:5
- |
-LL | A
- | ^
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/thread-local-in-ctfe.rs b/src/test/ui/thread-local-in-ctfe.rs
index 313d39d..7ca1a2e 100644
--- a/src/test/ui/thread-local-in-ctfe.rs
+++ b/src/test/ui/thread-local-in-ctfe.rs
@@ -8,12 +8,18 @@
static C: &u32 = &A;
//~^ ERROR thread-local statics cannot be accessed at compile-time
+//~| WARNING thread-local variable borrowed past end of function
+//~| WARNING this error has been downgraded to a warning
+//~| WARNING this warning will become a hard error in the future
const D: u32 = A;
//~^ ERROR thread-local statics cannot be accessed at compile-time
const E: &u32 = &A;
//~^ ERROR thread-local statics cannot be accessed at compile-time
+//~| WARNING thread-local variable borrowed past end of function
+//~| WARNING this error has been downgraded to a warning
+//~| WARNING this warning will become a hard error in the future
const fn f() -> u32 {
A
diff --git a/src/test/ui/thread-local-in-ctfe.stderr b/src/test/ui/thread-local-in-ctfe.stderr
index 2b60ec1..bba5b0c 100644
--- a/src/test/ui/thread-local-in-ctfe.stderr
+++ b/src/test/ui/thread-local-in-ctfe.stderr
@@ -10,23 +10,46 @@
LL | static C: &u32 = &A;
| ^^
+warning[E0712]: thread-local variable borrowed past end of function
+ --> $DIR/thread-local-in-ctfe.rs:9:18
+ |
+LL | static C: &u32 = &A;
+ | ^^- end of enclosing function is here
+ | |
+ | thread-local variables cannot be borrowed beyond the end of the function
+ |
+ = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+ = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-in-ctfe.rs:12:16
+ --> $DIR/thread-local-in-ctfe.rs:15:16
|
LL | const D: u32 = A;
| ^
error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-in-ctfe.rs:15:17
+ --> $DIR/thread-local-in-ctfe.rs:18:17
|
LL | const E: &u32 = &A;
| ^^
+warning[E0712]: thread-local variable borrowed past end of function
+ --> $DIR/thread-local-in-ctfe.rs:18:17
+ |
+LL | const E: &u32 = &A;
+ | ^^- end of enclosing function is here
+ | |
+ | thread-local variables cannot be borrowed beyond the end of the function
+ |
+ = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
+ = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
+
error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-in-ctfe.rs:19:5
+ --> $DIR/thread-local-in-ctfe.rs:25:5
|
LL | A
| ^
error: aborting due to 5 previous errors
+For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/thread-local-mutation.nll.stderr b/src/test/ui/thread-local-mutation.nll.stderr
deleted file mode 100644
index 7f7738b..0000000
--- a/src/test/ui/thread-local-mutation.nll.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error[E0594]: cannot assign to immutable static item `S`
- --> $DIR/thread-local-mutation.rs:11:5
- |
-LL | S = "after";
- | ^^^^^^^^^^^ cannot assign
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/thread-local-mutation.stderr b/src/test/ui/thread-local-mutation.stderr
index 8f9022f..7f7738b 100644
--- a/src/test/ui/thread-local-mutation.stderr
+++ b/src/test/ui/thread-local-mutation.stderr
@@ -1,8 +1,8 @@
-error[E0594]: cannot assign to immutable thread-local static item
+error[E0594]: cannot assign to immutable static item `S`
--> $DIR/thread-local-mutation.rs:11:5
|
LL | S = "after";
- | ^^^^^^^^^^^
+ | ^^^^^^^^^^^ cannot assign
error: aborting due to previous error
diff --git a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr
deleted file mode 100644
index 4ee3e4c..0000000
--- a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0597]: `person` does not live long enough
- --> $DIR/trait-coercion-generic-regions.rs:17:24
- |
-LL | let person: &str = &person;
- | ^^^^^^^
- | |
- | borrowed value does not live long enough
- | assignment requires that `person` is borrowed for `'static`
-LL | let s: Box<Trait<&'static str>> = Box::new(Struct { person: person });
-LL | }
- | - `person` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/traits/trait-coercion-generic-regions.stderr b/src/test/ui/traits/trait-coercion-generic-regions.stderr
index 2a9ca4f..4ee3e4c 100644
--- a/src/test/ui/traits/trait-coercion-generic-regions.stderr
+++ b/src/test/ui/traits/trait-coercion-generic-regions.stderr
@@ -1,13 +1,14 @@
error[E0597]: `person` does not live long enough
- --> $DIR/trait-coercion-generic-regions.rs:17:25
+ --> $DIR/trait-coercion-generic-regions.rs:17:24
|
LL | let person: &str = &person;
- | ^^^^^^ borrowed value does not live long enough
+ | ^^^^^^^
+ | |
+ | borrowed value does not live long enough
+ | assignment requires that `person` is borrowed for `'static`
LL | let s: Box<Trait<&'static str>> = Box::new(Struct { person: person });
LL | }
- | - borrowed value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
+ | - `person` dropped here while still borrowed
error: aborting due to previous error
diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr
deleted file mode 100644
index aac119a..0000000
--- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference
- --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:6:5
- |
-LL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy {
- | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32`
-LL | *t
- | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference
- --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:10:6
- |
-LL | fn copy_reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy {
- | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32`
-LL | {*t}
- | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr
index adaeb9b..aac119a 100644
--- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr
+++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr
@@ -1,19 +1,19 @@
-error[E0389]: cannot borrow data mutably in a `&` reference
+error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference
--> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:6:5
|
LL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy {
- | --------------- use `&'a mut &'a mut i32` here to make mutable
+ | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32`
LL | *t
- | ^^ assignment into an immutable reference
+ | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable
-error[E0389]: cannot borrow data mutably in a `&` reference
+error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference
--> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:10:6
|
LL | fn copy_reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy {
- | --------------- use `&'a mut &'a mut i32` here to make mutable
+ | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32`
LL | {*t}
- | ^^ assignment into an immutable reference
+ | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0389`.
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr
deleted file mode 100644
index 934d057..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0507]: cannot move out of captured variable in an `Fn` closure
- --> $DIR/unboxed-closure-illegal-move.rs:15:31
- |
-LL | let x = Box::new(0);
- | - captured outer variable
-LL | let f = to_fn(|| drop(x));
- | ^ cannot move out of captured variable in an `Fn` closure
-
-error[E0507]: cannot move out of captured variable in an `FnMut` closure
- --> $DIR/unboxed-closure-illegal-move.rs:19:35
- |
-LL | let x = Box::new(0);
- | - captured outer variable
-LL | let f = to_fn_mut(|| drop(x));
- | ^ cannot move out of captured variable in an `FnMut` closure
-
-error[E0507]: cannot move out of captured variable in an `Fn` closure
- --> $DIR/unboxed-closure-illegal-move.rs:28:36
- |
-LL | let x = Box::new(0);
- | - captured outer variable
-LL | let f = to_fn(move || drop(x));
- | ^ cannot move out of captured variable in an `Fn` closure
-
-error[E0507]: cannot move out of captured variable in an `FnMut` closure
- --> $DIR/unboxed-closure-illegal-move.rs:32:40
- |
-LL | let x = Box::new(0);
- | - captured outer variable
-LL | let f = to_fn_mut(move || drop(x));
- | ^ cannot move out of captured variable in an `FnMut` closure
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr
index 7620f6a..934d057 100644
--- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr
@@ -1,34 +1,34 @@
-error[E0507]: cannot move out of captured outer variable in an `Fn` closure
+error[E0507]: cannot move out of captured variable in an `Fn` closure
--> $DIR/unboxed-closure-illegal-move.rs:15:31
|
LL | let x = Box::new(0);
| - captured outer variable
LL | let f = to_fn(|| drop(x));
- | ^ cannot move out of captured outer variable in an `Fn` closure
+ | ^ cannot move out of captured variable in an `Fn` closure
-error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
--> $DIR/unboxed-closure-illegal-move.rs:19:35
|
LL | let x = Box::new(0);
| - captured outer variable
LL | let f = to_fn_mut(|| drop(x));
- | ^ cannot move out of captured outer variable in an `FnMut` closure
+ | ^ cannot move out of captured variable in an `FnMut` closure
-error[E0507]: cannot move out of captured outer variable in an `Fn` closure
+error[E0507]: cannot move out of captured variable in an `Fn` closure
--> $DIR/unboxed-closure-illegal-move.rs:28:36
|
LL | let x = Box::new(0);
| - captured outer variable
LL | let f = to_fn(move || drop(x));
- | ^ cannot move out of captured outer variable in an `Fn` closure
+ | ^ cannot move out of captured variable in an `Fn` closure
-error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
--> $DIR/unboxed-closure-illegal-move.rs:32:40
|
LL | let x = Box::new(0);
| - captured outer variable
LL | let f = to_fn_mut(move || drop(x));
- | ^ cannot move out of captured outer variable in an `FnMut` closure
+ | ^ cannot move out of captured variable in an `FnMut` closure
error: aborting due to 4 previous errors
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr
deleted file mode 100644
index 296cba1..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr
+++ /dev/null
@@ -1,74 +0,0 @@
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:9:13
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-LL | move || x = 1;
- | ^^^^^ cannot assign
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:10:17
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-LL | move || x = 1;
-LL | move || set(&mut x);
- | ^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:11:13
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | move || x = 1;
- | ^^^^^ cannot assign
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:12:17
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | move || set(&mut x);
- | ^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:13:8
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | || x = 1;
- | ^^^^^ cannot assign
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:15:12
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | || set(&mut x);
- | ^^^^^^ cannot borrow as mutable
-
-error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:16:8
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | || x = 1;
- | ^^^^^ cannot assign
-
-error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:18:12
- |
-LL | let x = 0;
- | - help: consider changing this to be mutable: `mut x`
-...
-LL | || set(&mut x);
- | ^^^^^^ cannot borrow as mutable
-
-error: aborting due to 8 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs
index 5d59cec..3eba9c4 100644
--- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs
+++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs
@@ -11,9 +11,7 @@
move || x = 1; //~ ERROR cannot assign
move || set(&mut x); //~ ERROR cannot borrow
|| x = 1; //~ ERROR cannot assign
- // FIXME: this should be `cannot borrow` (issue #18330)
- || set(&mut x); //~ ERROR cannot assign
+ || set(&mut x); //~ ERROR cannot borrow
|| x = 1; //~ ERROR cannot assign
- // FIXME: this should be `cannot borrow` (issue #18330)
- || set(&mut x); //~ ERROR cannot assign
+ || set(&mut x); //~ ERROR cannot borrow
}
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr
index 946a994..9fd8aa5 100644
--- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr
@@ -1,69 +1,74 @@
-error[E0595]: closure cannot assign to immutable local variable `x`
- --> $DIR/unboxed-closure-immutable-capture.rs:13:5
- |
-LL | let x = 0;
- | - help: make this binding mutable: `mut x`
-...
-LL | || x = 1;
- | ^^ cannot borrow mutably
-
-error[E0595]: closure cannot assign to immutable local variable `x`
- --> $DIR/unboxed-closure-immutable-capture.rs:15:5
- |
-LL | let x = 0;
- | - help: make this binding mutable: `mut x`
-...
-LL | || set(&mut x);
- | ^^ cannot borrow mutably
-
-error[E0595]: closure cannot assign to immutable local variable `x`
- --> $DIR/unboxed-closure-immutable-capture.rs:16:5
- |
-LL | let x = 0;
- | - help: make this binding mutable: `mut x`
-...
-LL | || x = 1;
- | ^^ cannot borrow mutably
-
-error[E0595]: closure cannot assign to immutable local variable `x`
- --> $DIR/unboxed-closure-immutable-capture.rs:18:5
- |
-LL | let x = 0;
- | - help: make this binding mutable: `mut x`
-...
-LL | || set(&mut x);
- | ^^ cannot borrow mutably
-
-error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/unboxed-closure-immutable-capture.rs:9:13
|
LL | let x = 0;
- | - help: consider making `x` mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
LL | move || x = 1;
- | ^^^^^
+ | ^^^^^ cannot assign
-error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:10:22
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:10:17
|
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+LL | move || x = 1;
LL | move || set(&mut x);
- | ^
+ | ^^^^^^ cannot borrow as mutable
-error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/unboxed-closure-immutable-capture.rs:11:13
|
LL | let x = 0;
- | - help: consider making `x` mutable: `mut x`
+ | - help: consider changing this to be mutable: `mut x`
...
LL | move || x = 1;
- | ^^^^^
+ | ^^^^^ cannot assign
-error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable
- --> $DIR/unboxed-closure-immutable-capture.rs:12:22
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:12:17
|
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
LL | move || set(&mut x);
- | ^
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:13:8
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | || x = 1;
+ | ^^^^^ cannot assign
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:14:12
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | || set(&mut x);
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:15:8
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | || x = 1;
+ | ^^^^^ cannot assign
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:16:12
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | || set(&mut x);
+ | ^^^^^^ cannot borrow as mutable
error: aborting due to 8 previous errors
-Some errors have detailed explanations: E0595, E0596.
-For more information about an error, try `rustc --explain E0595`.
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr
deleted file mode 100644
index b40b2f6..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0597]: `x` does not live long enough
- --> $DIR/unboxed-closure-region.rs:8:12
- |
-LL | let _f = {
- | -- borrow later stored here
-LL | let x = 0;
-LL | || x
- | -- ^ borrowed value does not live long enough
- | |
- | value captured here
-LL | };
- | - `x` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr
index f710342..b40b2f6 100644
--- a/src/test/ui/unboxed-closures/unboxed-closure-region.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr
@@ -1,15 +1,15 @@
error[E0597]: `x` does not live long enough
--> $DIR/unboxed-closure-region.rs:8:12
|
+LL | let _f = {
+ | -- borrow later stored here
+LL | let x = 0;
LL | || x
| -- ^ borrowed value does not live long enough
| |
- | capture occurs here
+ | value captured here
LL | };
- | - borrowed value only lives until here
-LL | _f;
-LL | }
- | - borrowed value needs to live until here
+ | - `x` dropped here while still borrowed
error: aborting due to previous error
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr
deleted file mode 100644
index 21d6b4f..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/unboxed-closures-borrow-conflict.rs:9:14
- |
-LL | let f = || x += 1;
- | -- - borrow occurs due to use of `x` in closure
- | |
- | borrow of `x` occurs here
-LL | let _y = x;
- | ^ use of borrowed `x`
-LL | f;
- | - borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr
index ac0e4ff..21d6b4f 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr
@@ -1,10 +1,14 @@
error[E0503]: cannot use `x` because it was mutably borrowed
- --> $DIR/unboxed-closures-borrow-conflict.rs:9:9
+ --> $DIR/unboxed-closures-borrow-conflict.rs:9:14
|
LL | let f = || x += 1;
- | -- borrow of `x` occurs here
+ | -- - borrow occurs due to use of `x` in closure
+ | |
+ | borrow of `x` occurs here
LL | let _y = x;
- | ^^ use of borrowed `x`
+ | ^ use of borrowed `x`
+LL | f;
+ | - borrow later used here
error: aborting due to previous error
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr
deleted file mode 100644
index 706e590..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr
+++ /dev/null
@@ -1,62 +0,0 @@
-error[E0597]: `factorial` does not live long enough
- --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:15:17
- |
-LL | let f = |x: u32| -> u32 {
- | --------------- value captured here
-LL | let g = factorial.as_ref().unwrap();
- | ^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | -
- | |
- | `factorial` dropped here while still borrowed
- | borrow might be used here, when `factorial` is dropped and runs the destructor for type `std::option::Option<std::boxed::Box<dyn std::ops::Fn(u32) -> u32>>`
-
-error[E0506]: cannot assign to `factorial` because it is borrowed
- --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:20:5
- |
-LL | let f = |x: u32| -> u32 {
- | --------------- borrow of `factorial` occurs here
-LL | let g = factorial.as_ref().unwrap();
- | --------- borrow occurs due to use in closure
-...
-LL | factorial = Some(Box::new(f));
- | ^^^^^^^^^
- | |
- | assignment to borrowed `factorial` occurs here
- | borrow later used here
-
-error[E0597]: `factorial` does not live long enough
- --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:28:17
- |
-LL | let mut factorial: Option<Box<Fn(u32) -> u32 + 'static>> = None;
- | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static`
-LL |
-LL | let f = |x: u32| -> u32 {
- | --------------- value captured here
-LL |
-LL | let g = factorial.as_ref().unwrap();
- | ^^^^^^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `factorial` dropped here while still borrowed
-
-error[E0506]: cannot assign to `factorial` because it is borrowed
- --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:32:5
- |
-LL | let mut factorial: Option<Box<Fn(u32) -> u32 + 'static>> = None;
- | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static`
-LL |
-LL | let f = |x: u32| -> u32 {
- | --------------- borrow of `factorial` occurs here
-LL |
-LL | let g = factorial.as_ref().unwrap();
- | --------- borrow occurs due to use in closure
-...
-LL | factorial = Some(Box::new(f));
- | ^^^^^^^^^ assignment to borrowed `factorial` occurs here
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0506, E0597.
-For more information about an error, try `rustc --explain E0506`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs
index b72482a..82dc536 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs
+++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs
@@ -18,18 +18,20 @@
};
factorial = Some(Box::new(f));
+ //~^ ERROR cannot assign to `factorial` because it is borrowed
}
fn b() {
let mut factorial: Option<Box<Fn(u32) -> u32 + 'static>> = None;
let f = |x: u32| -> u32 {
- //~^ ERROR closure may outlive the current function, but it borrows `factorial`
let g = factorial.as_ref().unwrap();
+ //~^ ERROR `factorial` does not live long enough
if x == 0 {1} else {x * g(x-1)}
};
factorial = Some(Box::new(f));
+ //~^ ERROR cannot assign to `factorial` because it is borrowed
}
fn main() { }
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr
index abd17ab..8d39fb0 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr
@@ -2,29 +2,59 @@
--> $DIR/unboxed-closures-failed-recursive-fn-1.rs:15:17
|
LL | let f = |x: u32| -> u32 {
- | --------------- capture occurs here
+ | --------------- value captured here
LL | let g = factorial.as_ref().unwrap();
| ^^^^^^^^^ borrowed value does not live long enough
...
LL | }
- | - borrowed value dropped before borrower
- |
- = note: values in a scope are dropped in the opposite order they are created
+ | -
+ | |
+ | `factorial` dropped here while still borrowed
+ | borrow might be used here, when `factorial` is dropped and runs the destructor for type `std::option::Option<std::boxed::Box<dyn std::ops::Fn(u32) -> u32>>`
-error[E0373]: closure may outlive the current function, but it borrows `factorial`, which is owned by the current function
- --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:26:13
+error[E0506]: cannot assign to `factorial` because it is borrowed
+ --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:20:5
|
LL | let f = |x: u32| -> u32 {
- | ^^^^^^^^^^^^^^^ may outlive borrowed value `factorial`
-LL |
+ | --------------- borrow of `factorial` occurs here
LL | let g = factorial.as_ref().unwrap();
- | --------- `factorial` is borrowed here
-help: to force the closure to take ownership of `factorial` (and any other referenced variables), use the `move` keyword
+ | --------- borrow occurs due to use in closure
+...
+LL | factorial = Some(Box::new(f));
+ | ^^^^^^^^^
+ | |
+ | assignment to borrowed `factorial` occurs here
+ | borrow later used here
+
+error[E0597]: `factorial` does not live long enough
+ --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:28:17
|
-LL | let f = move |x: u32| -> u32 {
- | ^^^^^^^^^^^^^^^^^^^^
+LL | let mut factorial: Option<Box<Fn(u32) -> u32 + 'static>> = None;
+ | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static`
+LL |
+LL | let f = |x: u32| -> u32 {
+ | --------------- value captured here
+LL | let g = factorial.as_ref().unwrap();
+ | ^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `factorial` dropped here while still borrowed
-error: aborting due to 2 previous errors
+error[E0506]: cannot assign to `factorial` because it is borrowed
+ --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:33:5
+ |
+LL | let mut factorial: Option<Box<Fn(u32) -> u32 + 'static>> = None;
+ | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static`
+LL |
+LL | let f = |x: u32| -> u32 {
+ | --------------- borrow of `factorial` occurs here
+LL | let g = factorial.as_ref().unwrap();
+ | --------- borrow occurs due to use in closure
+...
+LL | factorial = Some(Box::new(f));
+ | ^^^^^^^^^ assignment to borrowed `factorial` occurs here
-Some errors have detailed explanations: E0373, E0597.
-For more information about an error, try `rustc --explain E0373`.
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0506, E0597.
+For more information about an error, try `rustc --explain E0506`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr
deleted file mode 100644
index 1e1172c..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable
- --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:17:9
- |
-LL | let tick1 = || {
- | ----- help: consider changing this to be mutable: `mut tick1`
-...
-LL | tick1();
- | ^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable
- --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:20:5
- |
-LL | let tick2 = || {
- | ----- help: consider changing this to be mutable: `mut tick2`
-...
-LL | tick2();
- | ^^^^^ cannot borrow as mutable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs
index aaa692c..6401b5e 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs
@@ -11,10 +11,9 @@
};
// In turn, tick2 must be inferred to FnMut so that it can call
- // tick1, but we forgot the mut. The error message we currently
- // get seems... suboptimal.
- let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1`
- tick1();
+ // tick1, but we forgot the mut.
+ let tick2 = || {
+ tick1(); //~ ERROR cannot borrow `tick1` as mutable
};
tick2(); //~ ERROR cannot borrow
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr
index 2b4ac41..5dea424 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr
@@ -1,22 +1,21 @@
-error[E0595]: closure cannot assign to immutable local variable `tick1`
- --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:16:17
+error[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:16:9
|
LL | let tick1 = || {
- | ----- help: make this binding mutable: `mut tick1`
+ | ----- help: consider changing this to be mutable: `mut tick1`
...
-LL | let tick2 = || {
- | ^^ cannot borrow mutably
+LL | tick1();
+ | ^^^^^ cannot borrow as mutable
-error[E0596]: cannot borrow immutable local variable `tick2` as mutable
- --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:20:5
+error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:19:5
|
LL | let tick2 = || {
- | ----- help: make this binding mutable: `mut tick2`
+ | ----- help: consider changing this to be mutable: `mut tick2`
...
LL | tick2();
- | ^^^^^ cannot borrow mutably
+ | ^^^^^ cannot borrow as mutable
error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0595, E0596.
-For more information about an error, try `rustc --explain E0595`.
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr
deleted file mode 100644
index eb39862..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable
- --> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:7:5
- |
-LL | let tick = || counter += 1;
- | ---- help: consider changing this to be mutable: `mut tick`
-LL | tick();
- | ^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs
index de3f9839..5c0ceb2 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs
@@ -4,5 +4,5 @@
fn main() {
let mut counter = 0;
let tick = || counter += 1;
- tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable
+ tick(); //~ ERROR cannot borrow `tick` as mutable, as it is not declared as mutable
}
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr
index 33e2154..eb39862 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr
@@ -1,10 +1,10 @@
-error[E0596]: cannot borrow immutable local variable `tick` as mutable
+error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable
--> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:7:5
|
LL | let tick = || counter += 1;
- | ---- help: make this binding mutable: `mut tick`
+ | ---- help: consider changing this to be mutable: `mut tick`
LL | tick();
- | ^^^^ cannot borrow mutably
+ | ^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr
deleted file mode 100644
index b9d76d9..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable
- --> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:7:5
- |
-LL | let tick = move || counter += 1;
- | ---- help: consider changing this to be mutable: `mut tick`
-LL | tick();
- | ^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs
index b011c5a..144a674 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs
@@ -4,5 +4,5 @@
fn main() {
let mut counter = 0;
let tick = move || counter += 1;
- tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable
+ tick(); //~ ERROR cannot borrow `tick` as mutable, as it is not declared as mutable
}
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr
index 585577a..b9d76d9 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr
@@ -1,10 +1,10 @@
-error[E0596]: cannot borrow immutable local variable `tick` as mutable
+error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable
--> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:7:5
|
LL | let tick = move || counter += 1;
- | ---- help: make this binding mutable: `mut tick`
+ | ---- help: consider changing this to be mutable: `mut tick`
LL | tick();
- | ^^^^ cannot borrow mutably
+ | ^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr
deleted file mode 100644
index fef6c23..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr
+++ /dev/null
@@ -1,44 +0,0 @@
-error[E0594]: cannot assign to `n`, as it is not declared as mutable
- --> $DIR/unboxed-closures-mutate-upvar.rs:15:9
- |
-LL | let n = 0;
- | - help: consider changing this to be mutable: `mut n`
-LL | let mut f = to_fn_mut(|| {
-LL | n += 1;
- | ^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `n`, as it is not declared as mutable
- --> $DIR/unboxed-closures-mutate-upvar.rs:32:9
- |
-LL | let n = 0;
- | - help: consider changing this to be mutable: `mut n`
-...
-LL | n += 1;
- | ^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `n`, as it is not declared as mutable
- --> $DIR/unboxed-closures-mutate-upvar.rs:46:9
- |
-LL | let n = 0;
- | - help: consider changing this to be mutable: `mut n`
-LL | let mut f = to_fn(move || {
-LL | n += 1;
- | ^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `n`, as it is a captured variable in a `Fn` closure
- --> $DIR/unboxed-closures-mutate-upvar.rs:53:9
- |
-LL | n += 1;
- | ^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/unboxed-closures-mutate-upvar.rs:52:23
- |
-LL | let mut f = to_fn(move || {
- | _______________________^
-LL | | n += 1;
-LL | | });
- | |_____^
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs
index 3bea922..57e6d30 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs
+++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs
@@ -11,8 +11,8 @@
fn a() {
let n = 0;
- let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign
- n += 1;
+ let mut f = to_fn_mut(|| {
+ n += 1; //~ ERROR cannot assign to `n`, as it is not declared as mutable
});
}
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr
index 14a77df..fef6c23 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr
@@ -1,44 +1,37 @@
-error[E0595]: closure cannot assign to immutable local variable `n`
- --> $DIR/unboxed-closures-mutate-upvar.rs:14:27
+error[E0594]: cannot assign to `n`, as it is not declared as mutable
+ --> $DIR/unboxed-closures-mutate-upvar.rs:15:9
|
LL | let n = 0;
- | - help: make this binding mutable: `mut n`
+ | - help: consider changing this to be mutable: `mut n`
LL | let mut f = to_fn_mut(|| {
- | ^^ cannot borrow mutably
+LL | n += 1;
+ | ^^^^^^ cannot assign
-error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
+error[E0594]: cannot assign to `n`, as it is not declared as mutable
--> $DIR/unboxed-closures-mutate-upvar.rs:32:9
|
LL | let n = 0;
- | - help: consider making `n` mutable: `mut n`
+ | - help: consider changing this to be mutable: `mut n`
...
LL | n += 1;
- | ^^^^^^
+ | ^^^^^^ cannot assign
-error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `n`, as it is not declared as mutable
--> $DIR/unboxed-closures-mutate-upvar.rs:46:9
|
+LL | let n = 0;
+ | - help: consider changing this to be mutable: `mut n`
+LL | let mut f = to_fn(move || {
LL | n += 1;
- | ^^^^^^
- |
- = note: `Fn` closures cannot capture their enclosing environment for modifications
-help: consider changing this closure to take self by mutable reference
- --> $DIR/unboxed-closures-mutate-upvar.rs:45:23
- |
-LL | let mut f = to_fn(move || {
- | _______________________^
-LL | | n += 1;
-LL | | });
- | |_____^
+ | ^^^^^^ cannot assign
-error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+error[E0594]: cannot assign to `n`, as it is a captured variable in a `Fn` closure
--> $DIR/unboxed-closures-mutate-upvar.rs:53:9
|
LL | n += 1;
- | ^^^^^^
+ | ^^^^^^ cannot assign
|
- = note: `Fn` closures cannot capture their enclosing environment for modifications
-help: consider changing this closure to take self by mutable reference
+help: consider changing this to accept closures that implement `FnMut`
--> $DIR/unboxed-closures-mutate-upvar.rs:52:23
|
LL | let mut f = to_fn(move || {
@@ -49,4 +42,3 @@
error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0595`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr
deleted file mode 100644
index a438ec2..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0594]: cannot assign to `counter`, as it is a captured variable in a `Fn` closure
- --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:14:9
- |
-LL | counter += 1;
- | ^^^^^^^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:13:10
- |
-LL | call(|| {
- | __________^
-LL | | counter += 1;
-LL | |
-LL | |
-LL | | });
- | |_____^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr
deleted file mode 100644
index 0788350..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
- --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:14:9
- |
-LL | counter += 1;
- | ^^^^^^^^^^^^
- |
-help: consider changing this closure to take self by mutable reference
- --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:13:10
- |
-LL | call(|| {
- | __________^
-LL | | counter += 1;
-LL | |
-LL | |
-LL | | });
- | |_____^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0387`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr
deleted file mode 100644
index a438ec2..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0594]: cannot assign to `counter`, as it is a captured variable in a `Fn` closure
- --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:14:9
- |
-LL | counter += 1;
- | ^^^^^^^^^^^^ cannot assign
- |
-help: consider changing this to accept closures that implement `FnMut`
- --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:13:10
- |
-LL | call(|| {
- | __________^
-LL | | counter += 1;
-LL | |
-LL | |
-LL | | });
- | |_____^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs
index a5dcb57..174ad24 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs
+++ b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs
@@ -1,6 +1,3 @@
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
// Test that a by-ref `FnMut` closure gets an error when it tries to
// mutate a value.
@@ -12,7 +9,6 @@
let mut counter = 0;
call(|| {
counter += 1;
- //[ast]~^ ERROR cannot assign to data in a captured outer variable in an `Fn` closure
- //[mir]~^^ ERROR cannot assign to `counter`
+ //~^ ERROR cannot assign to `counter`
});
}
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.stderr
new file mode 100644
index 0000000..2bc1f01
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.stderr
@@ -0,0 +1,18 @@
+error[E0594]: cannot assign to `counter`, as it is a captured variable in a `Fn` closure
+ --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:11:9
+ |
+LL | counter += 1;
+ | ^^^^^^^^^^^^ cannot assign
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:10:10
+ |
+LL | call(|| {
+ | __________^
+LL | | counter += 1;
+LL | |
+LL | | });
+ | |_____^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr
deleted file mode 100644
index 830f6bc..0000000
--- a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0499]: cannot borrow `*self` as mutable more than once at a time
- --> $DIR/unboxed-closures-recursive-fn-using-fn-mut.rs:22:21
- |
-LL | (self.func)(self, arg)
- | ----------- ^^^^ second mutable borrow occurs here
- | |
- | first mutable borrow occurs here
- | first borrow later used by call
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr
index f881d19..830f6bc 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr
@@ -2,10 +2,10 @@
--> $DIR/unboxed-closures-recursive-fn-using-fn-mut.rs:22:21
|
LL | (self.func)(self, arg)
- | ----------- ^^^^ - first borrow ends here
- | | |
- | | second mutable borrow occurs here
+ | ----------- ^^^^ second mutable borrow occurs here
+ | |
| first mutable borrow occurs here
+ | first borrow later used by call
error: aborting due to previous error
diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr
deleted file mode 100644
index 2f4c921..0000000
--- a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr
+++ /dev/null
@@ -1,70 +0,0 @@
-error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0`)
- --> $DIR/union-borrow-move-parent-sibling.rs:15:13
- |
-LL | let a = &mut u.x.0;
- | ---------- mutable borrow occurs here (via `u.x.0`)
-LL | let b = &u.y;
- | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0` -- occurs here
-LL | use_borrow(a);
- | - mutable borrow later used here
- |
- = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0`
-
-error[E0382]: use of moved value: `u`
- --> $DIR/union-borrow-move-parent-sibling.rs:22:13
- |
-LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
- | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
-LL | let a = u.x.0;
- | ----- value moved here
-LL | let b = u.y;
- | ^^^ value used here after move
-
-error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`)
- --> $DIR/union-borrow-move-parent-sibling.rs:28:13
- |
-LL | let a = &mut (u.x.0).0;
- | -------------- mutable borrow occurs here (via `u.x.0.0`)
-LL | let b = &u.y;
- | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0.0` -- occurs here
-LL | use_borrow(a);
- | - mutable borrow later used here
- |
- = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0.0`
-
-error[E0382]: use of moved value: `u`
- --> $DIR/union-borrow-move-parent-sibling.rs:35:13
- |
-LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
- | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
-LL | let a = (u.x.0).0;
- | --------- value moved here
-LL | let b = u.y;
- | ^^^ value used here after move
-
-error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `*u.y`)
- --> $DIR/union-borrow-move-parent-sibling.rs:41:13
- |
-LL | let a = &mut *u.y;
- | --------- mutable borrow occurs here (via `*u.y`)
-LL | let b = &u.x;
- | ^^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here
-LL | use_borrow(a);
- | - mutable borrow later used here
- |
- = note: `u.x` is a field of the union `U`, so it overlaps the field `*u.y`
-
-error[E0382]: use of moved value: `u`
- --> $DIR/union-borrow-move-parent-sibling.rs:48:13
- |
-LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
- | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
-LL | let a = *u.y;
- | ---- value moved here
-LL | let b = u.x;
- | ^^^ value used here after move
-
-error: aborting due to 6 previous errors
-
-Some errors have detailed explanations: E0382, E0502.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.rs b/src/test/ui/union/union-borrow-move-parent-sibling.rs
index 43abbd3..1b6052f 100644
--- a/src/test/ui/union/union-borrow-move-parent-sibling.rs
+++ b/src/test/ui/union/union-borrow-move-parent-sibling.rs
@@ -12,27 +12,27 @@
unsafe fn parent_sibling_borrow() {
let mut u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
let a = &mut u.x.0;
- let b = &u.y; //~ ERROR cannot borrow `u.y`
+ let b = &u.y; //~ ERROR cannot borrow `u` (via `u.y`)
use_borrow(a);
}
unsafe fn parent_sibling_move() {
let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
let a = u.x.0;
- let b = u.y; //~ ERROR use of moved value: `u.y`
+ let b = u.y; //~ ERROR use of moved value: `u`
}
unsafe fn grandparent_sibling_borrow() {
let mut u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
let a = &mut (u.x.0).0;
- let b = &u.y; //~ ERROR cannot borrow `u.y`
+ let b = &u.y; //~ ERROR cannot borrow `u` (via `u.y`)
use_borrow(a);
}
unsafe fn grandparent_sibling_move() {
let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
let a = (u.x.0).0;
- let b = u.y; //~ ERROR use of moved value: `u.y`
+ let b = u.y; //~ ERROR use of moved value: `u`
}
unsafe fn deref_sibling_borrow() {
@@ -45,7 +45,7 @@
unsafe fn deref_sibling_move() {
let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
let a = *u.y;
- let b = u.x; //~ ERROR use of moved value: `u.x`
+ let b = u.x; //~ ERROR use of moved value: `u`
}
diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.stderr
index a7df3d5..2f4c921 100644
--- a/src/test/ui/union/union-borrow-move-parent-sibling.stderr
+++ b/src/test/ui/union/union-borrow-move-parent-sibling.stderr
@@ -1,65 +1,68 @@
-error[E0502]: cannot borrow `u.y` as immutable because `u.x.0` is also borrowed as mutable
- --> $DIR/union-borrow-move-parent-sibling.rs:15:14
+error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0`)
+ --> $DIR/union-borrow-move-parent-sibling.rs:15:13
|
LL | let a = &mut u.x.0;
- | ----- mutable borrow occurs here
+ | ---------- mutable borrow occurs here (via `u.x.0`)
LL | let b = &u.y;
- | ^^^ immutable borrow occurs here
+ | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0` -- occurs here
LL | use_borrow(a);
-LL | }
- | - mutable borrow ends here
-
-error[E0382]: use of moved value: `u.y`
- --> $DIR/union-borrow-move-parent-sibling.rs:22:9
+ | - mutable borrow later used here
|
+ = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0`
+
+error[E0382]: use of moved value: `u`
+ --> $DIR/union-borrow-move-parent-sibling.rs:22:13
+ |
+LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
+ | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
LL | let a = u.x.0;
- | - value moved here
+ | ----- value moved here
LL | let b = u.y;
- | ^ value used here after move
- |
- = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
+ | ^^^ value used here after move
-error[E0502]: cannot borrow `u.y` as immutable because `u.x.0.0` is also borrowed as mutable
- --> $DIR/union-borrow-move-parent-sibling.rs:28:14
+error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`)
+ --> $DIR/union-borrow-move-parent-sibling.rs:28:13
|
LL | let a = &mut (u.x.0).0;
- | --------- mutable borrow occurs here
+ | -------------- mutable borrow occurs here (via `u.x.0.0`)
LL | let b = &u.y;
- | ^^^ immutable borrow occurs here
+ | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0.0` -- occurs here
LL | use_borrow(a);
-LL | }
- | - mutable borrow ends here
-
-error[E0382]: use of moved value: `u.y`
- --> $DIR/union-borrow-move-parent-sibling.rs:35:9
+ | - mutable borrow later used here
|
+ = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0.0`
+
+error[E0382]: use of moved value: `u`
+ --> $DIR/union-borrow-move-parent-sibling.rs:35:13
+ |
+LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
+ | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
LL | let a = (u.x.0).0;
- | - value moved here
+ | --------- value moved here
LL | let b = u.y;
- | ^ value used here after move
- |
- = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
+ | ^^^ value used here after move
-error[E0502]: cannot borrow `u` (via `u.x`) as immutable because `u` is also borrowed as mutable (via `*u.y`)
- --> $DIR/union-borrow-move-parent-sibling.rs:41:14
+error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `*u.y`)
+ --> $DIR/union-borrow-move-parent-sibling.rs:41:13
|
LL | let a = &mut *u.y;
- | ---- mutable borrow occurs here (via `*u.y`)
+ | --------- mutable borrow occurs here (via `*u.y`)
LL | let b = &u.x;
- | ^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here
+ | ^^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here
LL | use_borrow(a);
-LL | }
- | - mutable borrow ends here
+ | - mutable borrow later used here
+ |
+ = note: `u.x` is a field of the union `U`, so it overlaps the field `*u.y`
-error[E0382]: use of moved value: `u.x`
- --> $DIR/union-borrow-move-parent-sibling.rs:48:9
+error[E0382]: use of moved value: `u`
+ --> $DIR/union-borrow-move-parent-sibling.rs:48:13
|
+LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
+ | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
LL | let a = *u.y;
- | - value moved here
+ | ---- value moved here
LL | let b = u.x;
- | ^ value used here after move
- |
- = note: move occurs because `u.x` has type `[type error]`, which does not implement the `Copy` trait
+ | ^^^ value used here after move
error: aborting due to 6 previous errors
diff --git a/src/test/ui/unop-move-semantics.nll.stderr b/src/test/ui/unop-move-semantics.nll.stderr
deleted file mode 100644
index 5122d16..0000000
--- a/src/test/ui/unop-move-semantics.nll.stderr
+++ /dev/null
@@ -1,52 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/unop-move-semantics.rs:8:5
- |
-LL | fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) {
- | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
- | |
- | consider adding a `Copy` constraint to this type argument
-LL | !x;
- | - value moved here
-LL |
-LL | x.clone();
- | ^ value borrowed here after move
-
-error[E0505]: cannot move out of `x` because it is borrowed
- --> $DIR/unop-move-semantics.rs:15:6
- |
-LL | let m = &x;
- | -- borrow of `x` occurs here
-...
-LL | !x;
- | ^ move out of `x` occurs here
-...
-LL | use_mut(n); use_imm(m);
- | - borrow later used here
-
-error[E0505]: cannot move out of `y` because it is borrowed
- --> $DIR/unop-move-semantics.rs:17:6
- |
-LL | let n = &mut y;
- | ------ borrow of `y` occurs here
-...
-LL | !y;
- | ^ move out of `y` occurs here
-LL | use_mut(n); use_imm(m);
- | - borrow later used here
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/unop-move-semantics.rs:24:6
- |
-LL | !*m;
- | ^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/unop-move-semantics.rs:26:6
- |
-LL | !*n;
- | ^^ cannot move out of borrowed content
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0382, E0505, E0507.
-For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/unop-move-semantics.rs b/src/test/ui/unop-move-semantics.rs
index 24bd89d..80f737e 100644
--- a/src/test/ui/unop-move-semantics.rs
+++ b/src/test/ui/unop-move-semantics.rs
@@ -5,7 +5,7 @@
fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) {
!x;
- x.clone(); //~ ERROR: use of moved value
+ x.clone(); //~ ERROR: borrow of moved value
}
fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr
index 90e1bfd..5122d16 100644
--- a/src/test/ui/unop-move-semantics.stderr
+++ b/src/test/ui/unop-move-semantics.stderr
@@ -1,31 +1,38 @@
-error[E0382]: use of moved value: `x`
+error[E0382]: borrow of moved value: `x`
--> $DIR/unop-move-semantics.rs:8:5
|
+LL | fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) {
+ | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | !x;
| - value moved here
LL |
LL | x.clone();
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
+ | ^ value borrowed here after move
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/unop-move-semantics.rs:15:6
|
LL | let m = &x;
- | - borrow of `x` occurs here
+ | -- borrow of `x` occurs here
...
LL | !x;
| ^ move out of `x` occurs here
+...
+LL | use_mut(n); use_imm(m);
+ | - borrow later used here
error[E0505]: cannot move out of `y` because it is borrowed
--> $DIR/unop-move-semantics.rs:17:6
|
LL | let n = &mut y;
- | - borrow of `y` occurs here
+ | ------ borrow of `y` occurs here
...
LL | !y;
| ^ move out of `y` occurs here
+LL | use_mut(n); use_imm(m);
+ | - borrow later used here
error[E0507]: cannot move out of borrowed content
--> $DIR/unop-move-semantics.rs:24:6
diff --git a/src/test/ui/unsized-locals/borrow-after-move.nll.stderr b/src/test/ui/unsized-locals/borrow-after-move.nll.stderr
deleted file mode 100644
index 010e182..0000000
--- a/src/test/ui/unsized-locals/borrow-after-move.nll.stderr
+++ /dev/null
@@ -1,57 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/borrow-after-move.rs:20:24
- |
-LL | let y = *x;
- | -- value moved here
-LL | drop_unsized(y);
-LL | println!("{}", &x);
- | ^^ value borrowed here after partial move
- |
- = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
-
-error[E0382]: borrow of moved value: `y`
- --> $DIR/borrow-after-move.rs:22:24
- |
-LL | let y = *x;
- | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
-LL | drop_unsized(y);
- | - value moved here
-...
-LL | println!("{}", &y);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/borrow-after-move.rs:30:24
- |
-LL | let y = *x;
- | -- value moved here
-LL | y.foo();
-LL | println!("{}", &x);
- | ^^ value borrowed here after partial move
- |
- = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
-
-error[E0382]: borrow of moved value: `y`
- --> $DIR/borrow-after-move.rs:32:24
- |
-LL | let y = *x;
- | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
-LL | y.foo();
- | - value moved here
-...
-LL | println!("{}", &y);
- | ^^ value borrowed here after move
-
-error[E0382]: borrow of moved value: `x`
- --> $DIR/borrow-after-move.rs:39:24
- |
-LL | x.foo();
- | - value moved here
-LL | println!("{}", &x);
- | ^^ value borrowed here after partial move
- |
- = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/unsized-locals/borrow-after-move.rs b/src/test/ui/unsized-locals/borrow-after-move.rs
index 587a218..3299fdf 100644
--- a/src/test/ui/unsized-locals/borrow-after-move.rs
+++ b/src/test/ui/unsized-locals/borrow-after-move.rs
@@ -18,9 +18,9 @@
let y = *x;
drop_unsized(y);
println!("{}", &x);
- //~^ERROR use of moved value
+ //~^ERROR borrow of moved value
println!("{}", &y);
- //~^ERROR use of moved value
+ //~^ERROR borrow of moved value
}
{
@@ -28,15 +28,15 @@
let y = *x;
y.foo();
println!("{}", &x);
- //~^ERROR use of moved value
+ //~^ERROR borrow of moved value
println!("{}", &y);
- //~^ERROR use of moved value
+ //~^ERROR borrow of moved value
}
{
let x = "hello".to_owned().into_boxed_str();
x.foo();
println!("{}", &x);
- //~^ERROR use of moved value
+ //~^ERROR borrow of moved value
}
}
diff --git a/src/test/ui/unsized-locals/borrow-after-move.stderr b/src/test/ui/unsized-locals/borrow-after-move.stderr
index 8eea01f..010e182 100644
--- a/src/test/ui/unsized-locals/borrow-after-move.stderr
+++ b/src/test/ui/unsized-locals/borrow-after-move.stderr
@@ -1,54 +1,54 @@
-error[E0382]: use of moved value: `x`
- --> $DIR/borrow-after-move.rs:20:25
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/borrow-after-move.rs:20:24
|
LL | let y = *x;
- | - value moved here
+ | -- value moved here
LL | drop_unsized(y);
LL | println!("{}", &x);
- | ^ value used here after move
+ | ^^ value borrowed here after partial move
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
-error[E0382]: use of moved value: `y`
- --> $DIR/borrow-after-move.rs:22:25
+error[E0382]: borrow of moved value: `y`
+ --> $DIR/borrow-after-move.rs:22:24
|
+LL | let y = *x;
+ | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | drop_unsized(y);
| - value moved here
...
LL | println!("{}", &y);
- | ^ value used here after move
- |
- = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/borrow-after-move.rs:30:25
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/borrow-after-move.rs:30:24
|
LL | let y = *x;
- | - value moved here
+ | -- value moved here
LL | y.foo();
LL | println!("{}", &x);
- | ^ value used here after move
+ | ^^ value borrowed here after partial move
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
-error[E0382]: use of moved value: `y`
- --> $DIR/borrow-after-move.rs:32:25
+error[E0382]: borrow of moved value: `y`
+ --> $DIR/borrow-after-move.rs:32:24
|
+LL | let y = *x;
+ | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | y.foo();
| - value moved here
...
LL | println!("{}", &y);
- | ^ value used here after move
- |
- = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait
+ | ^^ value borrowed here after move
-error[E0382]: use of moved value: `x`
- --> $DIR/borrow-after-move.rs:39:25
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/borrow-after-move.rs:39:24
|
LL | x.foo();
| - value moved here
LL | println!("{}", &x);
- | ^ value used here after move
+ | ^^ value borrowed here after partial move
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
diff --git a/src/test/ui/unsized-locals/double-move.nll.stderr b/src/test/ui/unsized-locals/double-move.nll.stderr
deleted file mode 100644
index 47fa0d4..0000000
--- a/src/test/ui/unsized-locals/double-move.nll.stderr
+++ /dev/null
@@ -1,63 +0,0 @@
-error[E0382]: use of moved value: `y`
- --> $DIR/double-move.rs:20:22
- |
-LL | let y = *x;
- | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
-LL | drop_unsized(y);
- | - value moved here
-LL | drop_unsized(y);
- | ^ value used here after move
-
-error[E0382]: use of moved value: `x`
- --> $DIR/double-move.rs:26:22
- |
-LL | let _y = *x;
- | -- value moved here
-LL | drop_unsized(x);
- | ^ value used here after partial move
- |
- = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `*x`
- --> $DIR/double-move.rs:32:18
- |
-LL | let x = "hello".to_owned().into_boxed_str();
- | - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
-LL | drop_unsized(x);
- | - value moved here
-LL | let _y = *x;
- | ^^ value used here after move
-
-error[E0382]: use of moved value: `y`
- --> $DIR/double-move.rs:39:9
- |
-LL | let y = *x;
- | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
-LL | y.foo();
- | - value moved here
-LL | y.foo();
- | ^ value used here after move
-
-error[E0382]: use of moved value: `*x`
- --> $DIR/double-move.rs:45:9
- |
-LL | let _y = *x;
- | -- value moved here
-LL | x.foo();
- | ^ value used here after move
- |
- = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
-
-error[E0382]: use of moved value: `*x`
- --> $DIR/double-move.rs:51:18
- |
-LL | x.foo();
- | - value moved here
-LL | let _y = *x;
- | ^^ value used here after move
- |
- = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/unsized-locals/double-move.stderr b/src/test/ui/unsized-locals/double-move.stderr
index e6573af..47fa0d4 100644
--- a/src/test/ui/unsized-locals/double-move.stderr
+++ b/src/test/ui/unsized-locals/double-move.stderr
@@ -1,60 +1,60 @@
error[E0382]: use of moved value: `y`
--> $DIR/double-move.rs:20:22
|
+LL | let y = *x;
+ | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | drop_unsized(y);
| - value moved here
LL | drop_unsized(y);
| ^ value used here after move
- |
- = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x`
--> $DIR/double-move.rs:26:22
|
LL | let _y = *x;
- | -- value moved here
+ | -- value moved here
LL | drop_unsized(x);
- | ^ value used here after move
+ | ^ value used here after partial move
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `*x`
- --> $DIR/double-move.rs:32:13
+ --> $DIR/double-move.rs:32:18
|
+LL | let x = "hello".to_owned().into_boxed_str();
+ | - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
LL | drop_unsized(x);
| - value moved here
LL | let _y = *x;
- | ^^ value used here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
+ | ^^ value used here after move
error[E0382]: use of moved value: `y`
--> $DIR/double-move.rs:39:9
|
+LL | let y = *x;
+ | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | y.foo();
| - value moved here
LL | y.foo();
| ^ value used here after move
- |
- = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `*x`
--> $DIR/double-move.rs:45:9
|
LL | let _y = *x;
- | -- value moved here
+ | -- value moved here
LL | x.foo();
| ^ value used here after move
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `*x`
- --> $DIR/double-move.rs:51:13
+ --> $DIR/double-move.rs:51:18
|
LL | x.foo();
| - value moved here
LL | let _y = *x;
- | ^^ value used here after move
+ | ^^ value used here after move
|
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
diff --git a/src/test/ui/unsized-locals/unsized-exprs2.nll.stderr b/src/test/ui/unsized-locals/unsized-exprs2.nll.stderr
deleted file mode 100644
index a94414e..0000000
--- a/src/test/ui/unsized-locals/unsized-exprs2.nll.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0508]: cannot move out of type `[u8]`, a non-copy slice
- --> $DIR/unsized-exprs2.rs:22:19
- |
-LL | udrop::<[u8]>(foo()[..]);
- | ^^^^^^^^^ cannot move out of here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/unsized-locals/unsized-exprs2.rs b/src/test/ui/unsized-locals/unsized-exprs2.rs
index 3fb5a00..534439a 100644
--- a/src/test/ui/unsized-locals/unsized-exprs2.rs
+++ b/src/test/ui/unsized-locals/unsized-exprs2.rs
@@ -20,5 +20,5 @@
fn main() {
udrop::<[u8]>(foo()[..]);
- //~^ERROR cannot move out of indexed content
+ //~^ERROR cannot move out of type `[u8]`, a non-copy slice
}
diff --git a/src/test/ui/unsized-locals/unsized-exprs2.stderr b/src/test/ui/unsized-locals/unsized-exprs2.stderr
index d7cb4bf..a94414e 100644
--- a/src/test/ui/unsized-locals/unsized-exprs2.stderr
+++ b/src/test/ui/unsized-locals/unsized-exprs2.stderr
@@ -1,9 +1,9 @@
-error[E0507]: cannot move out of indexed content
+error[E0508]: cannot move out of type `[u8]`, a non-copy slice
--> $DIR/unsized-exprs2.rs:22:19
|
LL | udrop::<[u8]>(foo()[..]);
- | ^^^^^^^^^ cannot move out of indexed content
+ | ^^^^^^^^^ cannot move out of here
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0507`.
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/use/use-after-move-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-based-on-type.nll.stderr
deleted file mode 100644
index 520f88f..0000000
--- a/src/test/ui/use/use-after-move-based-on-type.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: borrow of moved value: `x`
- --> $DIR/use-after-move-based-on-type.rs:4:20
- |
-LL | let x = "Hello!".to_string();
- | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
-LL | let _y = x;
- | - value moved here
-LL | println!("{}", x);
- | ^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/use/use-after-move-based-on-type.rs b/src/test/ui/use/use-after-move-based-on-type.rs
index fc8ea6f..ba7aa03 100644
--- a/src/test/ui/use/use-after-move-based-on-type.rs
+++ b/src/test/ui/use/use-after-move-based-on-type.rs
@@ -1,5 +1,5 @@
fn main() {
let x = "Hello!".to_string();
let _y = x;
- println!("{}", x); //~ ERROR use of moved value
+ println!("{}", x); //~ ERROR borrow of moved value
}
diff --git a/src/test/ui/use/use-after-move-based-on-type.stderr b/src/test/ui/use/use-after-move-based-on-type.stderr
index b9e0aaf..520f88f 100644
--- a/src/test/ui/use/use-after-move-based-on-type.stderr
+++ b/src/test/ui/use/use-after-move-based-on-type.stderr
@@ -1,12 +1,12 @@
-error[E0382]: use of moved value: `x`
+error[E0382]: borrow of moved value: `x`
--> $DIR/use-after-move-based-on-type.rs:4:20
|
+LL | let x = "Hello!".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = x;
- | -- value moved here
+ | - value moved here
LL | println!("{}", x);
- | ^ value used here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+ | ^ value borrowed here after move
error: aborting due to previous error
diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr
deleted file mode 100644
index e16bca3..0000000
--- a/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0382]: borrow of moved value: `n`
- --> $DIR/use-after-move-implicity-coerced-object.rs:28:13
- |
-LL | let n: Box<_> = box Number { n: 42 };
- | - move occurs because `n` has type `std::boxed::Box<Number>`, which does not implement the `Copy` trait
-LL | let mut l: Box<_> = box List { list: Vec::new() };
-LL | l.push(n);
- | - value moved here
-LL | let x = n.to_string();
- | ^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.rs b/src/test/ui/use/use-after-move-implicity-coerced-object.rs
index e435069..2e465ee 100644
--- a/src/test/ui/use/use-after-move-implicity-coerced-object.rs
+++ b/src/test/ui/use/use-after-move-implicity-coerced-object.rs
@@ -26,5 +26,5 @@
let mut l: Box<_> = box List { list: Vec::new() };
l.push(n);
let x = n.to_string();
- //~^ ERROR: use of moved value: `n`
+ //~^ ERROR: borrow of moved value: `n`
}
diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr
index babff9b..e16bca3 100644
--- a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr
+++ b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr
@@ -1,12 +1,13 @@
-error[E0382]: use of moved value: `n`
+error[E0382]: borrow of moved value: `n`
--> $DIR/use-after-move-implicity-coerced-object.rs:28:13
|
+LL | let n: Box<_> = box Number { n: 42 };
+ | - move occurs because `n` has type `std::boxed::Box<Number>`, which does not implement the `Copy` trait
+LL | let mut l: Box<_> = box List { list: Vec::new() };
LL | l.push(n);
| - value moved here
LL | let x = n.to_string();
- | ^ value used here after move
- |
- = note: move occurs because `n` has type `std::boxed::Box<Number>`, which does not implement the `Copy` trait
+ | ^ value borrowed here after move
error: aborting due to previous error
diff --git a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr
deleted file mode 100644
index 9bf1175..0000000
--- a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: use of moved value: `self`
- --> $DIR/use-after-move-self-based-on-type.rs:12:16
- |
-LL | pub fn foo(self) -> isize {
- | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait
-LL | self.bar();
- | ---- value moved here
-LL | return self.x;
- | ^^^^^^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/use/use-after-move-self-based-on-type.rs b/src/test/ui/use/use-after-move-self-based-on-type.rs
index 4d84ae9..9325834 100644
--- a/src/test/ui/use/use-after-move-self-based-on-type.rs
+++ b/src/test/ui/use/use-after-move-self-based-on-type.rs
@@ -9,7 +9,7 @@
impl S {
pub fn foo(self) -> isize {
self.bar();
- return self.x; //~ ERROR use of moved value: `self.x`
+ return self.x; //~ ERROR use of moved value: `self`
}
pub fn bar(self) {}
diff --git a/src/test/ui/use/use-after-move-self-based-on-type.stderr b/src/test/ui/use/use-after-move-self-based-on-type.stderr
index d1d2606..9bf1175 100644
--- a/src/test/ui/use/use-after-move-self-based-on-type.stderr
+++ b/src/test/ui/use/use-after-move-self-based-on-type.stderr
@@ -1,12 +1,12 @@
-error[E0382]: use of moved value: `self.x`
+error[E0382]: use of moved value: `self`
--> $DIR/use-after-move-self-based-on-type.rs:12:16
|
+LL | pub fn foo(self) -> isize {
+ | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait
LL | self.bar();
| ---- value moved here
LL | return self.x;
| ^^^^^^ value used here after move
- |
- = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/use/use-after-move-self.nll.stderr b/src/test/ui/use/use-after-move-self.nll.stderr
deleted file mode 100644
index 3be0a65..0000000
--- a/src/test/ui/use/use-after-move-self.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: use of moved value: `self`
- --> $DIR/use-after-move-self.rs:10:16
- |
-LL | pub fn foo(self) -> isize {
- | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait
-LL | self.bar();
- | ---- value moved here
-LL | return *self.x;
- | ^^^^^^^ value used here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/use/use-after-move-self.rs b/src/test/ui/use/use-after-move-self.rs
index 1337d61..a6f6c45 100644
--- a/src/test/ui/use/use-after-move-self.rs
+++ b/src/test/ui/use/use-after-move-self.rs
@@ -7,7 +7,7 @@
impl S {
pub fn foo(self) -> isize {
self.bar();
- return *self.x; //~ ERROR use of moved value: `*self.x`
+ return *self.x; //~ ERROR use of moved value: `self`
}
pub fn bar(self) {}
diff --git a/src/test/ui/use/use-after-move-self.stderr b/src/test/ui/use/use-after-move-self.stderr
index 2c4bd20..3be0a65 100644
--- a/src/test/ui/use/use-after-move-self.stderr
+++ b/src/test/ui/use/use-after-move-self.stderr
@@ -1,12 +1,12 @@
-error[E0382]: use of moved value: `*self.x`
+error[E0382]: use of moved value: `self`
--> $DIR/use-after-move-self.rs:10:16
|
+LL | pub fn foo(self) -> isize {
+ | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait
LL | self.bar();
| ---- value moved here
LL | return *self.x;
| ^^^^^^^ value used here after move
- |
- = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/src/test/ui/variance/variance-issue-20533.nll.stderr b/src/test/ui/variance/variance-issue-20533.nll.stderr
deleted file mode 100644
index 008e2a0..0000000
--- a/src/test/ui/variance/variance-issue-20533.nll.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0505]: cannot move out of `a` because it is borrowed
- --> $DIR/variance-issue-20533.rs:28:14
- |
-LL | let x = foo(&a);
- | -- borrow of `a` occurs here
-LL | drop(a);
- | ^ move out of `a` occurs here
-LL | drop(x);
- | - borrow later used here
-
-error[E0505]: cannot move out of `a` because it is borrowed
- --> $DIR/variance-issue-20533.rs:34:14
- |
-LL | let x = bar(&a);
- | -- borrow of `a` occurs here
-LL | drop(a);
- | ^ move out of `a` occurs here
-LL | drop(x);
- | - borrow later used here
-
-error[E0505]: cannot move out of `a` because it is borrowed
- --> $DIR/variance-issue-20533.rs:40:14
- |
-LL | let x = baz(&a);
- | -- borrow of `a` occurs here
-LL | drop(a);
- | ^ move out of `a` occurs here
-LL | drop(x);
- | - borrow later used here
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/variance/variance-issue-20533.stderr b/src/test/ui/variance/variance-issue-20533.stderr
index bcf99bc..008e2a0 100644
--- a/src/test/ui/variance/variance-issue-20533.stderr
+++ b/src/test/ui/variance/variance-issue-20533.stderr
@@ -2,25 +2,31 @@
--> $DIR/variance-issue-20533.rs:28:14
|
LL | let x = foo(&a);
- | - borrow of `a` occurs here
+ | -- borrow of `a` occurs here
LL | drop(a);
| ^ move out of `a` occurs here
+LL | drop(x);
+ | - borrow later used here
error[E0505]: cannot move out of `a` because it is borrowed
--> $DIR/variance-issue-20533.rs:34:14
|
LL | let x = bar(&a);
- | - borrow of `a` occurs here
+ | -- borrow of `a` occurs here
LL | drop(a);
| ^ move out of `a` occurs here
+LL | drop(x);
+ | - borrow later used here
error[E0505]: cannot move out of `a` because it is borrowed
--> $DIR/variance-issue-20533.rs:40:14
|
LL | let x = baz(&a);
- | - borrow of `a` occurs here
+ | -- borrow of `a` occurs here
LL | drop(a);
| ^ move out of `a` occurs here
+LL | drop(x);
+ | - borrow later used here
error: aborting due to 3 previous errors
diff --git a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr
deleted file mode 100644
index 679fd89..0000000
--- a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0499]: cannot borrow `xs` as mutable more than once at a time
- --> $DIR/vec-mut-iter-borrow.rs:5:9
- |
-LL | for x in &mut xs {
- | -------
- | |
- | first mutable borrow occurs here
- | first borrow later used here
-LL | xs.push(1)
- | ^^ second mutable borrow occurs here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/vec/vec-mut-iter-borrow.stderr b/src/test/ui/vec/vec-mut-iter-borrow.stderr
index ec16d2b..679fd89 100644
--- a/src/test/ui/vec/vec-mut-iter-borrow.stderr
+++ b/src/test/ui/vec/vec-mut-iter-borrow.stderr
@@ -2,10 +2,10 @@
--> $DIR/vec-mut-iter-borrow.rs:5:9
|
LL | for x in &mut xs {
- | --
- | ||
- | |first borrow ends here
- | first mutable borrow occurs here
+ | -------
+ | |
+ | first mutable borrow occurs here
+ | first borrow later used here
LL | xs.push(1)
| ^^ second mutable borrow occurs here
diff --git a/src/test/ui/walk-struct-literal-with.nll.stderr b/src/test/ui/walk-struct-literal-with.nll.stderr
deleted file mode 100644
index eeb594a..0000000
--- a/src/test/ui/walk-struct-literal-with.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0382]: borrow of moved value: `start`
- --> $DIR/walk-struct-literal-with.rs:16:20
- |
-LL | let start = Mine{test:"Foo".to_string(), other_val:0};
- | ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
-LL | let end = Mine{other_val:1, ..start.make_string_bar()};
- | ----- value moved here
-LL | println!("{}", start.test);
- | ^^^^^^^^^^ value borrowed here after move
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/walk-struct-literal-with.rs b/src/test/ui/walk-struct-literal-with.rs
index 31dfd58..ee1a77e 100644
--- a/src/test/ui/walk-struct-literal-with.rs
+++ b/src/test/ui/walk-struct-literal-with.rs
@@ -13,5 +13,5 @@
fn main(){
let start = Mine{test:"Foo".to_string(), other_val:0};
let end = Mine{other_val:1, ..start.make_string_bar()};
- println!("{}", start.test); //~ ERROR use of moved value: `start.test`
+ println!("{}", start.test); //~ ERROR borrow of moved value: `start`
}
diff --git a/src/test/ui/walk-struct-literal-with.stderr b/src/test/ui/walk-struct-literal-with.stderr
index d5351eb..eeb594a 100644
--- a/src/test/ui/walk-struct-literal-with.stderr
+++ b/src/test/ui/walk-struct-literal-with.stderr
@@ -1,12 +1,12 @@
-error[E0382]: use of moved value: `start.test`
+error[E0382]: borrow of moved value: `start`
--> $DIR/walk-struct-literal-with.rs:16:20
|
+LL | let start = Mine{test:"Foo".to_string(), other_val:0};
+ | ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
LL | let end = Mine{other_val:1, ..start.make_string_bar()};
| ----- value moved here
LL | println!("{}", start.test);
- | ^^^^^^^^^^ value used here after move
- |
- = note: move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
+ | ^^^^^^^^^^ value borrowed here after move
error: aborting due to previous error
diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr
deleted file mode 100644
index fc58984..0000000
--- a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr
+++ /dev/null
@@ -1,55 +0,0 @@
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/wf-misc-methods-issue-28609.rs:22:5
- |
-LL | s.transmute_inherent(&mut 42)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^--^
- | | |
- | | temporary value created here
- | returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing local variable `four`
- --> $DIR/wf-misc-methods-issue-28609.rs:36:5
- |
-LL | s.bomb = Some(&four);
- | ----- `four` is borrowed here
-LL | &s
- | ^^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing local variable `four`
- --> $DIR/wf-misc-methods-issue-28609.rs:43:5
- |
-LL | s.bomb = Some(&four);
- | ----- `four` is borrowed here
-LL | &*s
- | ^^^ returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/wf-misc-methods-issue-28609.rs:53:5
- |
-LL | s << &mut 3
- | ^^^^^^^^^^-
- | | |
- | | temporary value created here
- | returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/wf-misc-methods-issue-28609.rs:58:5
- |
-LL | s.shl(&mut 3)
- | ^^^^^^^^^^^-^
- | | |
- | | temporary value created here
- | returns a value referencing data owned by the current function
-
-error[E0515]: cannot return value referencing temporary value
- --> $DIR/wf-misc-methods-issue-28609.rs:63:5
- |
-LL | S2::shl(s, &mut 3)
- | ^^^^^^^^^^^^^^^^-^
- | | |
- | | temporary value created here
- | returns a value referencing data owned by the current function
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.rs b/src/test/ui/wf/wf-misc-methods-issue-28609.rs
index 505d7d7..050f866 100644
--- a/src/test/ui/wf/wf-misc-methods-issue-28609.rs
+++ b/src/test/ui/wf/wf-misc-methods-issue-28609.rs
@@ -19,7 +19,7 @@
fn return_dangling_pointer_inherent(s: S2) -> &u32 {
let s = s;
- s.transmute_inherent(&mut 42) //~ ERROR does not live long enough
+ s.transmute_inherent(&mut 42) //~ ERROR cannot return value referencing temporary value
}
impl<'a, 'b> Deref for S<'a, 'b> {
@@ -32,15 +32,15 @@
fn return_dangling_pointer_coerce(s: S2) -> &u32 {
let four = 4;
let mut s = s;
- s.bomb = Some(&four); //~ ERROR does not live long enough
- &s
+ s.bomb = Some(&four);
+ &s //~ ERROR cannot return value referencing local variable `four`
}
fn return_dangling_pointer_unary_op(s: S2) -> &u32 {
let four = 4;
let mut s = s;
- s.bomb = Some(&four); //~ ERROR does not live long enough
- &*s
+ s.bomb = Some(&four);
+ &*s //~ ERROR cannot return value referencing local variable `four`
}
impl<'a, 'b> Shl<&'b u32> for S<'a, 'b> {
@@ -50,17 +50,17 @@
fn return_dangling_pointer_binary_op(s: S2) -> &u32 {
let s = s;
- s << &mut 3 //~ ERROR does not live long enough
+ s << &mut 3 //~ ERROR cannot return value referencing temporary value
}
fn return_dangling_pointer_method(s: S2) -> &u32 {
let s = s;
- s.shl(&mut 3) //~ ERROR does not live long enough
+ s.shl(&mut 3) //~ ERROR cannot return value referencing temporary value
}
fn return_dangling_pointer_ufcs(s: S2) -> &u32 {
let s = s;
- S2::shl(s, &mut 3) //~ ERROR does not live long enough
+ S2::shl(s, &mut 3) //~ ERROR cannot return value referencing temporary value
}
fn main() {
diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr
index d470aec..fc58984 100644
--- a/src/test/ui/wf/wf-misc-methods-issue-28609.stderr
+++ b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr
@@ -1,111 +1,55 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/wf-misc-methods-issue-28609.rs:22:31
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/wf-misc-methods-issue-28609.rs:22:5
|
LL | s.transmute_inherent(&mut 42)
- | ^^ temporary value does not live long enough
-LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 20:1...
- --> $DIR/wf-misc-methods-issue-28609.rs:20:1
- |
-LL | / fn return_dangling_pointer_inherent(s: S2) -> &u32 {
-LL | | let s = s;
-LL | | s.transmute_inherent(&mut 42)
-LL | | }
- | |_^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^--^
+ | | |
+ | | temporary value created here
+ | returns a value referencing data owned by the current function
-error[E0597]: `four` does not live long enough
- --> $DIR/wf-misc-methods-issue-28609.rs:35:20
+error[E0515]: cannot return value referencing local variable `four`
+ --> $DIR/wf-misc-methods-issue-28609.rs:36:5
|
LL | s.bomb = Some(&four);
- | ^^^^ borrowed value does not live long enough
+ | ----- `four` is borrowed here
LL | &s
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 32:1...
- --> $DIR/wf-misc-methods-issue-28609.rs:32:1
- |
-LL | / fn return_dangling_pointer_coerce(s: S2) -> &u32 {
-LL | | let four = 4;
-LL | | let mut s = s;
-LL | | s.bomb = Some(&four);
-LL | | &s
-LL | | }
- | |_^
+ | ^^ returns a value referencing data owned by the current function
-error[E0597]: `four` does not live long enough
- --> $DIR/wf-misc-methods-issue-28609.rs:42:20
+error[E0515]: cannot return value referencing local variable `four`
+ --> $DIR/wf-misc-methods-issue-28609.rs:43:5
|
LL | s.bomb = Some(&four);
- | ^^^^ borrowed value does not live long enough
+ | ----- `four` is borrowed here
LL | &*s
-LL | }
- | - borrowed value only lives until here
- |
-note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 39:1...
- --> $DIR/wf-misc-methods-issue-28609.rs:39:1
- |
-LL | / fn return_dangling_pointer_unary_op(s: S2) -> &u32 {
-LL | | let four = 4;
-LL | | let mut s = s;
-LL | | s.bomb = Some(&four);
-LL | | &*s
-LL | | }
- | |_^
+ | ^^^ returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/wf-misc-methods-issue-28609.rs:53:15
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/wf-misc-methods-issue-28609.rs:53:5
|
LL | s << &mut 3
- | ^ temporary value does not live long enough
-LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 51:1...
- --> $DIR/wf-misc-methods-issue-28609.rs:51:1
- |
-LL | / fn return_dangling_pointer_binary_op(s: S2) -> &u32 {
-LL | | let s = s;
-LL | | s << &mut 3
-LL | | }
- | |_^
+ | ^^^^^^^^^^-
+ | | |
+ | | temporary value created here
+ | returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/wf-misc-methods-issue-28609.rs:58:16
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/wf-misc-methods-issue-28609.rs:58:5
|
LL | s.shl(&mut 3)
- | ^ temporary value does not live long enough
-LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 56:1...
- --> $DIR/wf-misc-methods-issue-28609.rs:56:1
- |
-LL | / fn return_dangling_pointer_method(s: S2) -> &u32 {
-LL | | let s = s;
-LL | | s.shl(&mut 3)
-LL | | }
- | |_^
+ | ^^^^^^^^^^^-^
+ | | |
+ | | temporary value created here
+ | returns a value referencing data owned by the current function
-error[E0597]: borrowed value does not live long enough
- --> $DIR/wf-misc-methods-issue-28609.rs:63:21
+error[E0515]: cannot return value referencing temporary value
+ --> $DIR/wf-misc-methods-issue-28609.rs:63:5
|
LL | S2::shl(s, &mut 3)
- | ^ temporary value does not live long enough
-LL | }
- | - temporary value only lives until here
- |
-note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 61:1...
- --> $DIR/wf-misc-methods-issue-28609.rs:61:1
- |
-LL | / fn return_dangling_pointer_ufcs(s: S2) -> &u32 {
-LL | | let s = s;
-LL | | S2::shl(s, &mut 3)
-LL | | }
- | |_^
+ | ^^^^^^^^^^^^^^^^-^
+ | | |
+ | | temporary value created here
+ | returns a value referencing data owned by the current function
error: aborting due to 6 previous errors
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0515`.
diff --git a/src/test/ui/writing-to-immutable-vec.nll.stderr b/src/test/ui/writing-to-immutable-vec.nll.stderr
deleted file mode 100644
index a65765c..0000000
--- a/src/test/ui/writing-to-immutable-vec.nll.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
- --> $DIR/writing-to-immutable-vec.rs:3:5
- |
-LL | let v: Vec<isize> = vec![1, 2, 3];
- | - help: consider changing this to be mutable: `mut v`
-LL | v[1] = 4;
- | ^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/writing-to-immutable-vec.rs b/src/test/ui/writing-to-immutable-vec.rs
index ad2bf33..dbcc3f0 100644
--- a/src/test/ui/writing-to-immutable-vec.rs
+++ b/src/test/ui/writing-to-immutable-vec.rs
@@ -1,4 +1,4 @@
fn main() {
let v: Vec<isize> = vec![1, 2, 3];
- v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable
+ v[1] = 4; //~ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
}
diff --git a/src/test/ui/writing-to-immutable-vec.stderr b/src/test/ui/writing-to-immutable-vec.stderr
index 9bc82df..a65765c 100644
--- a/src/test/ui/writing-to-immutable-vec.stderr
+++ b/src/test/ui/writing-to-immutable-vec.stderr
@@ -1,10 +1,10 @@
-error[E0596]: cannot borrow immutable local variable `v` as mutable
+error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
--> $DIR/writing-to-immutable-vec.rs:3:5
|
LL | let v: Vec<isize> = vec![1, 2, 3];
- | - help: make this binding mutable: `mut v`
+ | - help: consider changing this to be mutable: `mut v`
LL | v[1] = 4;
- | ^ cannot borrow mutably
+ | ^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 6df5616..d7a5395 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1886,10 +1886,11 @@
match self.config.compare_mode {
Some(CompareMode::Nll) => {
- rustc.args(&["-Zborrowck=migrate", "-Ztwo-phase-borrows"]);
+ // FIXME(#56993) use -Zborrowck=mir
+ rustc.args(&["-Zborrowck=migrate"]);
}
Some(CompareMode::Polonius) => {
- rustc.args(&["-Zpolonius", "-Zborrowck=mir", "-Ztwo-phase-borrows"]);
+ rustc.args(&["-Zpolonius", "-Zborrowck=mir"]);
}
None => {}
}