(accepted, track_caller, "1.46.0", Some(47809), None),
/// Allows `#[doc(alias = "...")]`.
(accepted, doc_alias, "1.48.0", Some(50146), None),
+ /// Allows patterns with concurrent by-move and by-ref bindings.
+ /// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
+ (accepted, move_ref_pattern, "1.48.0", Some(68354), None),
// -------------------------------------------------------------------------
// feature-group-end: accepted features
/// For example, you can write `x @ Some(y)`.
(active, bindings_after_at, "1.41.0", Some(65490), None),
- /// Allows patterns with concurrent by-move and by-ref bindings.
- /// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
- (active, move_ref_pattern, "1.42.0", Some(68354), None),
-
/// Allows `impl const Trait for T` syntax.
(active, const_trait_impl, "1.42.0", Some(67792), None),
hir::LocalSource::AwaitDesugar => ("`await` future binding", None),
};
self.check_irrefutable(&loc.pat, msg, sp);
- self.check_patterns(false, &loc.pat);
+ self.check_patterns(&loc.pat);
}
fn visit_param(&mut self, param: &'tcx hir::Param<'tcx>) {
intravisit::walk_param(self, param);
self.check_irrefutable(¶m.pat, "function argument", None);
- self.check_patterns(false, ¶m.pat);
+ self.check_patterns(¶m.pat);
}
}
}
impl<'tcx> MatchVisitor<'_, 'tcx> {
- fn check_patterns(&mut self, has_guard: bool, pat: &Pat<'_>) {
- if !self.tcx.features().move_ref_pattern {
- check_legality_of_move_bindings(self, has_guard, pat);
- }
+ fn check_patterns(&mut self, pat: &Pat<'_>) {
pat.walk_always(|pat| check_borrow_conflicts_in_at_patterns(self, pat));
if !self.tcx.features().bindings_after_at {
check_legality_of_bindings_in_at_patterns(self, pat);
) {
for arm in arms {
// Check the arm for some things unrelated to exhaustiveness.
- self.check_patterns(arm.guard.is_some(), &arm.pat);
+ self.check_patterns(&arm.pat);
}
let mut cx = self.new_cx(scrut.hir_id);
!cx.typeck_results.node_type(hir_id).is_copy_modulo_regions(cx.tcx.at(span), cx.param_env)
}
-/// Check the legality of legality of by-move bindings.
-fn check_legality_of_move_bindings(cx: &mut MatchVisitor<'_, '_>, has_guard: bool, pat: &Pat<'_>) {
- let sess = cx.tcx.sess;
- let typeck_results = cx.typeck_results;
-
- // Find all by-ref spans.
- let mut by_ref_spans = Vec::new();
- pat.each_binding(|_, hir_id, span, _| {
- if let Some(ty::BindByReference(_)) =
- typeck_results.extract_binding_mode(sess, hir_id, span)
- {
- by_ref_spans.push(span);
- }
- });
-
- // Find bad by-move spans:
- let by_move_spans = &mut Vec::new();
- let mut check_move = |p: &Pat<'_>, sub: Option<&Pat<'_>>| {
- // Check legality of moving out of the enum.
- //
- // `x @ Foo(..)` is legal, but `x @ Foo(y)` isn't.
- if sub.map_or(false, |p| p.contains_bindings()) {
- struct_span_err!(sess, p.span, E0007, "cannot bind by-move with sub-bindings")
- .span_label(p.span, "binds an already bound by-move value by moving it")
- .emit();
- } else if !has_guard && !by_ref_spans.is_empty() {
- by_move_spans.push(p.span);
- }
- };
- pat.walk_always(|p| {
- if let hir::PatKind::Binding(.., sub) = &p.kind {
- if let Some(ty::BindByValue(_)) =
- typeck_results.extract_binding_mode(sess, p.hir_id, p.span)
- {
- if is_binding_by_move(cx, p.hir_id, p.span) {
- check_move(p, sub.as_deref());
- }
- }
- }
- });
-
- // Found some bad by-move spans, error!
- if !by_move_spans.is_empty() {
- let mut err = feature_err(
- &sess.parse_sess,
- sym::move_ref_pattern,
- by_move_spans.clone(),
- "binding by-move and by-ref in the same pattern is unstable",
- );
- for span in by_ref_spans.iter() {
- err.span_label(*span, "by-ref pattern here");
- }
- for span in by_move_spans.iter() {
- err.span_label(*span, "by-move pattern here");
- }
- err.emit();
- }
-}
-
/// Check that there are no borrow or move conflicts in `binding @ subpat` patterns.
///
/// For example, this would reject:
#![feature(or_patterns)]
#![feature(box_patterns)]
-#![feature(move_ref_pattern)]
-
enum Test {
Foo,
Bar,
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:40:9
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:38:9
|
LL | ref foo @ [.., ref mut bar] => (),
| -------^^^^^^^^-----------^
| immutable borrow, by `foo`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:124:9
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:122:9
|
LL | ref foo @ Some(box ref mut s) => (),
| -------^^^^^^^^^^^^---------^
| immutable borrow, by `foo`, occurs here
error[E0382]: borrow of moved value: `x`
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:22:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:20:5
|
LL | fn bindings_after_at_slice_patterns_move_binding(x: [String; 4]) {
| - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait
| ^^ value borrowed here after move
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:32:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:30:5
|
LL | ref mut foo @ [.., _] => Some(foo),
| --------------------- mutable borrow occurs here
| - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:54:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:52:5
|
LL | [ref foo @ .., ref bar] => Some(foo),
| ------------ immutable borrow occurs here
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:66:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:64:5
|
LL | ref foo @ [.., ref bar] => Some(foo),
| ----------------------- immutable borrow occurs here
| - immutable borrow later used here
error[E0382]: borrow of moved value: `x`
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:80:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:78:5
|
LL | fn bindings_after_at_or_patterns_move(x: Option<Test>) {
| - move occurs because `x` has type `Option<Test>`, which does not implement the `Copy` trait
| ^^ value borrowed here after move
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:90:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:88:5
|
LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo),
| ------------------------------------- immutable borrow occurs here
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:102:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:100:5
|
LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo),
| ----------------------------------------- mutable borrow occurs here
| - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:116:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:114:5
|
LL | ref foo @ Some(box ref s) => Some(foo),
| ------------------------- immutable borrow occurs here
| - immutable borrow later used here
error[E0382]: borrow of moved value: `x`
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:138:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:136:5
|
LL | fn bindings_after_at_slice_patterns_or_patterns_moves(x: [Option<Test>; 4]) {
| - move occurs because `x` has type `[Option<Test>; 4]`, which does not implement the `Copy` trait
| ^^ value borrowed here after move
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:148:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:146:5
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a),
| ------------------------------------------------- immutable borrow occurs here
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:160:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:158:5
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b),
| ---------- immutable borrow occurs here
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:174:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:172:5
|
LL | [_, ref a @ Some(box ref b), ..] => Some(a),
| ----------------------- immutable borrow occurs here
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:190:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:188:5
|
LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ------------------------------------------- immutable borrow occurs here
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:204:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:202:5
|
LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ----------------------------------------------- mutable borrow occurs here
| - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:218:5
+ --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:216:5
|
LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ------------------------------------------------------------ immutable borrow occurs here
// edition:2018
// ignore-wasm32-bare compiled with panic=abort by default
-#![feature(move_ref_pattern)]
-
#![allow(unused)]
use std::{
// ignore-wasm32-bare compiled with panic=abort by default
#![feature(generators, generator_trait, untagged_unions)]
-#![feature(move_ref_pattern)]
#![feature(bindings_after_at)]
#![allow(unused_assignments)]
+++ /dev/null
-#![feature(bindings_after_at)]
-
-fn main() {
- let x = Some("s".to_string());
- match x {
- op_string @ Some(s) => {},
- //~^ ERROR E0007
- //~| ERROR E0382
- None => {},
- }
-}
+++ /dev/null
-error[E0007]: cannot bind by-move with sub-bindings
- --> $DIR/E0007.rs:6:9
- |
-LL | op_string @ Some(s) => {},
- | ^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it
-
-error[E0382]: use of moved value
- --> $DIR/E0007.rs:6:26
- |
-LL | let x = Some("s".to_string());
- | - move occurs because `x` has type `Option<String>`, which does not implement the `Copy` trait
-LL | match x {
-LL | op_string @ Some(s) => {},
- | -----------------^-
- | | |
- | | value used here after move
- | value moved here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0007, E0382.
-For more information about an error, try `rustc --explain E0007`.
// where one side is by-ref and the other is by-move.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
struct X {
x: (),
error: cannot move out of value because it is borrowed
- --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:15:14
+ --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:14:14
|
LL | Some(ref _y @ _z) => {}
| ------^^^--
| value borrowed, by `_y`, here
error: borrow of moved value
- --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:21:14
+ --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:20:14
|
LL | Some(_z @ ref _y) => {}
| --^^^------
| move occurs because `_z` has type `X` which does not implement the `Copy` trait
error: cannot move out of value because it is borrowed
- --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:29:14
+ --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:28:14
|
LL | Some(ref mut _y @ _z) => {}
| ----------^^^--
| value borrowed, by `_y`, here
error: borrow of moved value
- --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:35:14
+ --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:34:14
|
LL | Some(_z @ ref mut _y) => {}
| --^^^----------
| move occurs because `_z` has type `X` which does not implement the `Copy` trait
error[E0382]: borrow of moved value
- --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:21:19
+ --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:20:19
|
LL | Some(_z @ ref _y) => {}
| -----^^^^^^
| ^^^
error[E0382]: borrow of moved value
- --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:35:19
+ --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:34:19
|
LL | Some(_z @ ref mut _y) => {}
| -----^^^^^^^^^^
// See issue #12534.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
fn main() {}
error[E0382]: use of moved value
- --> $DIR/bind-by-move-no-subbindings-fun-param.rs:10:12
+ --> $DIR/bind-by-move-no-subbindings-fun-param.rs:9:12
|
LL | fn f(a @ A(u): A) -> Box<u8> {
| ------^-
// Test that moving on both sides of an `@` pattern is not allowed.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
fn main() {
struct U; // Not copy!
error[E0382]: use of moved value
- --> $DIR/borrowck-move-and-move.rs:14:13
+ --> $DIR/borrowck-move-and-move.rs:13:13
|
LL | let a @ b = U;
| ----^ - move occurs because value has type `U`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/borrowck-move-and-move.rs:16:17
+ --> $DIR/borrowck-move-and-move.rs:15:17
|
LL | let a @ (b, c) = (U, U);
| --------^- ------ move occurs because value has type `(U, U)`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/borrowck-move-and-move.rs:18:17
+ --> $DIR/borrowck-move-and-move.rs:17:17
|
LL | let a @ (b, c) = (u(), u());
| --------^- ---------- move occurs because value has type `(U, U)`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/borrowck-move-and-move.rs:21:16
+ --> $DIR/borrowck-move-and-move.rs:20:16
|
LL | match Ok(U) {
| ----- move occurs because value has type `std::result::Result<U, U>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/borrowck-move-and-move.rs:21:29
+ --> $DIR/borrowck-move-and-move.rs:20:29
|
LL | match Ok(U) {
| ----- move occurs because value has type `std::result::Result<U, U>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/borrowck-move-and-move.rs:28:22
+ --> $DIR/borrowck-move-and-move.rs:27:22
|
LL | match [u(), u(), u(), u()] {
| -------------------- move occurs because value has type `[U; 4]`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/borrowck-move-and-move.rs:32:18
+ --> $DIR/borrowck-move-and-move.rs:31:18
|
LL | match [u(), u(), u(), u()] {
| -------------------- move occurs because value has type `[U; 4]`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/borrowck-move-and-move.rs:25:16
+ --> $DIR/borrowck-move-and-move.rs:24:16
|
LL | fn fun(a @ b: U) {}
| ----^
// Test `@` patterns combined with `box` patterns.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
#![feature(box_patterns)]
#[derive(Copy, Clone)]
// Test `@` patterns combined with `box` patterns.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
#![feature(box_patterns)]
#[derive(Copy, Clone)]
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-at-and-box.rs:37:9
+ --> $DIR/borrowck-pat-at-and-box.rs:36:9
|
LL | let ref a @ box b = Box::new(NC);
| -----^^^^^^^-
| value borrowed, by `a`, here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-at-and-box.rs:39:9
+ --> $DIR/borrowck-pat-at-and-box.rs:38:9
|
LL | let ref a @ box ref mut b = Box::new(nc());
| -----^^^^^^^---------
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-at-and-box.rs:41:9
+ --> $DIR/borrowck-pat-at-and-box.rs:40:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-at-and-box.rs:43:9
+ --> $DIR/borrowck-pat-at-and-box.rs:42:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-at-and-box.rs:46:9
+ --> $DIR/borrowck-pat-at-and-box.rs:45:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
| immutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-at-and-box.rs:52:9
+ --> $DIR/borrowck-pat-at-and-box.rs:51:9
|
LL | let ref mut a @ box ref b = Box::new(NC);
| ---------^^^^^^^-----
| mutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-at-and-box.rs:66:9
+ --> $DIR/borrowck-pat-at-and-box.rs:65:9
|
LL | ref mut a @ box ref b => {
| ---------^^^^^^^-----
| mutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-at-and-box.rs:58:11
+ --> $DIR/borrowck-pat-at-and-box.rs:57:11
|
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
| ---------^^^^^^^-----
| mutable borrow, by `a`, occurs here
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-at-and-box.rs:21:18
+ --> $DIR/borrowck-pat-at-and-box.rs:20:18
|
LL | let a @ box &b = Box::new(&C);
| ---------^ ------------ move occurs because value has type `Box<&C>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-at-and-box.rs:24:17
+ --> $DIR/borrowck-pat-at-and-box.rs:23:17
|
LL | let a @ box b = Box::new(C);
| --------^ ----------- move occurs because value has type `Box<C>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-at-and-box.rs:34:17
+ --> $DIR/borrowck-pat-at-and-box.rs:33:17
|
LL | match Box::new(C) {
| ----------- move occurs because value has type `Box<C>`, which does not implement the `Copy` trait
| value moved here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-at-and-box.rs:46:21
+ --> $DIR/borrowck-pat-at-and-box.rs:45:21
|
LL | let ref a @ box ref mut b = Box::new(NC);
| ------------^^^^^^^^^
| - immutable borrow later used here
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-at-and-box.rs:52:25
+ --> $DIR/borrowck-pat-at-and-box.rs:51:25
|
LL | let ref mut a @ box ref b = Box::new(NC);
| ----------------^^^^^
| -- mutable borrow later used here
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-at-and-box.rs:66:25
+ --> $DIR/borrowck-pat-at-and-box.rs:65:25
|
LL | ref mut a @ box ref b => {
| ----------------^^^^^
| -- mutable borrow later used here
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-at-and-box.rs:27:20
+ --> $DIR/borrowck-pat-at-and-box.rs:26:20
|
LL | fn f1(a @ box &b: Box<&C>) {}
| ---------^
| move occurs because value has type `Box<&C>`, which does not implement the `Copy` trait
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-at-and-box.rs:30:19
+ --> $DIR/borrowck-pat-at-and-box.rs:29:19
|
LL | fn f2(a @ box b: Box<C>) {}
| --------^
| move occurs because value has type `Box<C>`, which does not implement the `Copy` trait
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-at-and-box.rs:58:27
+ --> $DIR/borrowck-pat-at-and-box.rs:57:27
|
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
| ----------------^^^^^
// Currently this logic exists in THIR match checking as opposed to borrowck.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
fn main() {
struct U;
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse-promotion.rs:9:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse-promotion.rs:8:9
|
LL | let a @ ref b = U;
| -^^^-----
// Test that `by_move_binding @ pat_with_by_ref_bindings` is prevented.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
fn main() {
struct U;
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:29:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:28:9
|
LL | let a @ ref b = U;
| -^^^-----
| move occurs because `a` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:30:9
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| -^^^^^^^^^^^^---------^^^^^^-----^
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:14
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:30:14
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| -----^^^---------
| move occurs because `b` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:33
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:30:33
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| -^^^-----
| move occurs because `d` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:38:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:37:9
|
LL | let a @ [ref mut b, ref c] = [U, U];
| -^^^^---------^^-----^
| move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:41:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:40:9
|
LL | let a @ ref b = u();
| -^^^-----
| move occurs because `a` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:44:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:43:9
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| -^^^^^^^^^^^^---------^^^^^^-----^
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:44:14
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:43:14
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| -----^^^---------
| move occurs because `b` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:44:33
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:43:33
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| -^^^-----
| move occurs because `d` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:51:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:50:9
|
LL | let a @ [ref mut b, ref c] = [u(), u()];
| -^^^^---------^^-----^
| move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:56:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:9
|
LL | a @ Some(ref b) => {}
| -^^^^^^^^-----^
| move occurs because `a` has type `Option<U>` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:60:9
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^
| move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:19
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:60:19
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -----^^^---------
| move occurs because `b` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:38
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:60:38
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^-----
| move occurs because `d` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:71:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:70:9
|
LL | mut a @ Some([ref b, ref mut c]) => {}
| -----^^^^^^^^^-----^^---------^^
| move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:77:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:76:9
|
LL | a @ Some(ref b) => {}
| -^^^^^^^^-----^
| move occurs because `a` has type `Option<U>` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:83:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:82:9
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^
| move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:83:19
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:82:19
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -----^^^---------
| move occurs because `b` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:83:38
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:82:38
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^-----
| move occurs because `d` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:93:9
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:92:9
|
LL | mut a @ Some([ref b, ref mut c]) => {}
| -----^^^^^^^^^-----^^---------^^
| move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:13:11
|
LL | fn f1(a @ ref b: U) {}
| -^^^-----
| move occurs because `a` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:18:11
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:17:11
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| -----^^^^^^^^-----^^^^^^^^^^-----^
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:18:20
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:17:20
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| -^^^-----
| move occurs because `b` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:18:31
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:17:31
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| -----^^^-----
| move occurs because `d` has type `U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:25:11
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:11
|
LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {}
| -^^^^---------^^-----^
| move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:22
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:30:22
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| --------^^^^^^^^^
= note: move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:33
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:30:33
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| ------------------------^^^^^^^^^- ------ move occurs because value has type `(U, U)`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:37
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:30:37
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| ----^^^^^
= note: move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:38:25
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:37:25
|
LL | let a @ [ref mut b, ref c] = [U, U];
| ----------------^^^^^- ------ move occurs because value has type `[U; 2]`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:41:13
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:40:13
|
LL | let a @ ref b = u();
| ----^^^^^ --- move occurs because value has type `U`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:44:22
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:43:22
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| --------^^^^^^^^^
= note: move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:44:33
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:43:33
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| ------------------------^^^^^^^^^- ---------- move occurs because value has type `(U, U)`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:44:37
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:43:37
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| ----^^^^^
= note: move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:51:25
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:50:25
|
LL | let a @ [ref mut b, ref c] = [u(), u()];
| ----------------^^^^^- ---------- move occurs because value has type `[U; 2]`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:27
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:60:27
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| --------^^^^^^^^^
| ^^^
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:38
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:60:38
|
LL | match Some((U, U)) {
| ------------ move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:42
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:60:42
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| ----^^^^^
| ^^^
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:71:30
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:70:30
|
LL | match Some([U, U]) {
| ------------ move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:77:18
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:76:18
|
LL | match Some(u()) {
| --------- move occurs because value has type `Option<U>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:83:27
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:82:27
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| --------^^^^^^^^^
| ^^^
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:83:38
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:82:38
|
LL | match Some((u(), u())) {
| ---------------- move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:83:42
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:82:42
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| ----^^^^^
| ^^^
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:93:30
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:92:30
|
LL | match Some([u(), u()]) {
| ---------------- move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:15
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:13:15
|
LL | fn f1(a @ ref b: U) {}
| ----^^^^^
| move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:18:24
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:17:24
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| ----^^^^^
= note: move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: use of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:18:31
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:17:31
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| --------------------^^^^^^^^^^^^^-
| move occurs because value has type `(U, U)`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:18:39
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:17:39
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| --------^^^^^
= note: move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:25:27
+ --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:27
|
LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {}
| ----------------^^^^^-
// Test that `ref mut? @ pat_with_by_move_bindings` is prevented.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
fn main() {
struct U;
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:23:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:22:9
|
LL | let ref a @ b = U;
| -----^^^-
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:25:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:24:9
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:25:18
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:24:18
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
| -----^^^-----
| value borrowed, by `b`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:25:33
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:24:33
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
| -----^^^-
| value borrowed, by `d`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:29:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:28:9
|
LL | let ref mut a @ [b, mut c] = [U, U];
| ---------^^^^-^^-----^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:31:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:30:9
|
LL | let ref a @ b = u();
| -----^^^-
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:33:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:32:9
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:33:18
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:32:18
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| -----^^^-----
| value borrowed, by `b`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:33:33
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:32:33
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| -----^^^-
| value borrowed, by `d`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:37:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:36:9
|
LL | let ref mut a @ [b, mut c] = [u(), u()];
| ---------^^^^-^^-----^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:41:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:40:9
|
LL | ref a @ Some(b) => {}
| -----^^^^^^^^-^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:46:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:45:9
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:46:23
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:45:23
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-----
| value borrowed, by `b`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:46:38
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:45:38
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-
| value borrowed, by `d`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:53:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:52:9
|
LL | ref mut a @ Some([b, mut c]) => {}
| ---------^^^^^^^^^-^^-----^^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:58:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:57:9
|
LL | ref a @ Some(b) => {}
| -----^^^^^^^^-^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:63:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:62:9
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:63:23
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:62:23
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-----
| value borrowed, by `b`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:63:38
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:62:38
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-
| value borrowed, by `d`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:70:9
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:69:9
|
LL | ref mut a @ Some([b, mut c]) => {}
| ---------^^^^^^^^^-^^-----^^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:14:11
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:13:11
|
LL | fn f1(ref a @ b: U) {}
| -----^^^-
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:16:11
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:15:11
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:16:20
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:15:20
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| -----^^^-----
| value borrowed, by `b`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:16:35
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:15:35
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| -----^^^-
| value borrowed, by `d`, here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-by-move-and-ref.rs:20:11
+ --> $DIR/borrowck-pat-by-move-and-ref.rs:19:11
|
LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {}
| ---------^^^^-^^-----^
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
enum Option<T> {
None,
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:11:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:10:9
|
LL | ref mut z @ &mut Some(ref a) => {
| ---------^^^^^^^^^^^^^-----^
| mutable borrow, by `z`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:34:9
|
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
| ---------^^^^-----------------^
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:22
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:34:22
|
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
| -----^^^---------
| immutable borrow, by `b`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:38:9
|
LL | let ref a @ ref mut b = U;
| -----^^^---------
| immutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:40:9
|
LL | let ref mut a @ ref b = U;
| ---------^^^-----
| mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:43:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:42:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:45:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:44:9
|
LL | let ref mut a @ (ref b, ref c) = (U, U);
| ---------^^^^-----^^-----^
| mutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:48:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:47:9
|
LL | let ref mut a @ ref b = u();
| ---------^^^-----
| mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:53:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:52:9
|
LL | let ref a @ ref mut b = u();
| -----^^^---------
| immutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:59:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:58:9
|
LL | let ref mut a @ ref b = U;
| ---------^^^-----
| mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:63:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:62:9
|
LL | let ref a @ ref mut b = U;
| -----^^^---------
| immutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:69:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:68:9
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
| ---------^^^^^^-----^
| mutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:69:33
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:68:33
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
| ---------^^^^^^^-----^
| mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:77:9
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| -----^^^^^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:33
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:77:33
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| -----^^^^^^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:89:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:88:9
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
| -----^^^^^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:89:33
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:88:33
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
| -----^^^^^^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:96:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:95:9
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
| ---------^^^^^^-----^
| mutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:96:33
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:95:33
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
| ---------^^^^^^^-----^
| mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:102:9
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
| -----^^^^^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:33
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:102:33
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
| -----^^^^^^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:110:9
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
| ---------^^^^^^-----^
| mutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:33
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:110:33
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
| ---------^^^^^^^-----^
| mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:119:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:118:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:124:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:131:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:130:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:136:9
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:135:9
|
LL | let ref mut a @ (ref b, ref c) = (U, U);
| ---------^^^^-----^^-----^
| mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:25:11
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11
|
LL | fn f1(ref a @ ref mut b: U) {}
| -----^^^---------
| immutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:27:11
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11
|
LL | fn f2(ref mut a @ ref b: U) {}
| ---------^^^-----
| mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:29:11
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:11
|
LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {}
| -----^^^^^^^^^^^----------------^^^^^^^^
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:22
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:30:22
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
| -----^^^-------------
| immutable borrow, by `a`, occurs here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:30
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:30:30
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
| ---------^^^-
| value borrowed, by `b`, here
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:11:31
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:10:31
|
LL | ref mut z @ &mut Some(ref a) => {
| ----------------------^^^^^-
| ---------- mutable borrow later used here
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:48:21
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:47:21
|
LL | let ref mut a @ ref b = u();
| ------------^^^^^
| -------- mutable borrow later used here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:53:17
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:52:17
|
LL | let ref a @ ref mut b = u();
| --------^^^^^^^^^
| - immutable borrow later used here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:20
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:77:20
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| -----------^^^^^^^^^-
| - immutable borrow later used here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:45
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:77:45
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| ------------^^^^^^^^^-
| - immutable borrow later used here
error[E0594]: cannot assign to `*b`, as it is immutable for the pattern guard
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:89:61
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:88:61
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
| ^^^^^^ cannot assign
= note: variables bound in patterns are immutable until the end of the pattern guard
error[E0594]: cannot assign to `*a`, as it is immutable for the pattern guard
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:96:61
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:95:61
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
| ^^^^^^^^^^^ cannot assign
= note: variables bound in patterns are immutable until the end of the pattern guard
error[E0507]: cannot move out of `b` in pattern guard
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:66
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:102:66
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
| ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
error[E0507]: cannot move out of `b` in pattern guard
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:66
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:102:66
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
| ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
error[E0507]: cannot move out of `a` in pattern guard
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:66
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:110:66
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
| ^ move occurs because `a` has type `&mut std::result::Result<U, U>`, which does not implement the `Copy` trait
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
error[E0507]: cannot move out of `a` in pattern guard
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:66
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:110:66
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
| ^ move occurs because `a` has type `&mut std::result::Result<U, U>`, which does not implement the `Copy` trait
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:124:18
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:18
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| ---------^^^^^^^^^------------
| - immutable borrow later used here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:124:29
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:29
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| --------------------^^^^^^^^^-
| - immutable borrow later used here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:131:18
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:130:18
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| ---------^^^^^^^^^------------
| - immutable borrow later used here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-pat-ref-mut-and-ref.rs:131:29
+ --> $DIR/borrowck-pat-ref-mut-and-ref.rs:130:29
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| --------------------^^^^^^^^^-
// Test that `ref mut x @ ref mut y` and varieties of that are not allowed.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
fn main() {
struct U;
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:28:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:27:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:32:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:31:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:35:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:34:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:38:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:37:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:42:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:41:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:46:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:45:9
|
LL | let ref mut a @ (
| ^--------
| |_____^
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:56:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:55:9
|
LL | let ref mut a @ (
| ^--------
| |_________^
error: borrow of moved value
- --> $DIR/borrowck-pat-ref-mut-twice.rs:66:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:65:9
|
LL | let a @ (ref mut b, ref mut c) = (U, U);
| -^^^^---------^^---------^
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-ref-mut-twice.rs:70:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:69:9
|
LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
| -^^^^-^^^-^^-^^
| move occurs because `a` has type `&mut (U, [U; 2])` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-ref-mut-twice.rs:74:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:73:9
|
LL | let a @ &mut ref mut b = &mut U;
| -^^^^^^^^---------
| move occurs because `a` has type `&mut U` which does not implement the `Copy` trait
error: borrow of moved value
- --> $DIR/borrowck-pat-ref-mut-twice.rs:77:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:76:9
|
LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
| -^^^^^^^^^---------^^---------^
| move occurs because `a` has type `&mut (U, U)` which does not implement the `Copy` trait
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:82:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:81:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:82:37
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:81:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:88:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:87:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:88:37
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:87:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:95:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:94:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:95:37
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:94:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:107:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:106:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:107:37
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:106:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:11:11
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:10:11
|
LL | fn f1(ref mut a @ ref mut b: U) {}
| ---------^^^---------
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:13:11
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:12:11
|
LL | fn f2(ref mut a @ ref mut b: U) {}
| ---------^^^---------
| first mutable borrow, by `a`, occurs here
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:16:9
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:15:9
|
LL | ref mut a @ [
| ^--------
| |_________^
error: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:24:22
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:23:22
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ---------^^^-------------
| first mutable borrow, by `a`, occurs here
error: cannot move out of value because it is borrowed
- --> $DIR/borrowck-pat-ref-mut-twice.rs:24:34
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:23:34
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ---------^^^-
| value borrowed, by `b`, here
error[E0499]: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:28:21
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:27:21
|
LL | let ref mut a @ ref mut b = U;
| ------------^^^^^^^^^
| - first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:38:21
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:37:21
|
LL | let ref mut a @ ref mut b = U;
| ------------^^^^^^^^^
| ------ first borrow later used here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-ref-mut-twice.rs:66:25
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:65:25
|
LL | let a @ (ref mut b, ref mut c) = (U, U);
| ----------------^^^^^^^^^- ------ move occurs because value has type `(U, U)`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-ref-mut-twice.rs:70:21
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:69:21
|
LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
| ------------^-- -------- move occurs because value has type `&mut (U, [U; 2])`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-ref-mut-twice.rs:74:18
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:73:18
|
LL | let a @ &mut ref mut b = &mut U;
| ---------^^^^^^^^^ ------ move occurs because value has type `&mut U`, which does not implement the `Copy` trait
| value moved here
error[E0382]: borrow of moved value
- --> $DIR/borrowck-pat-ref-mut-twice.rs:77:30
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:76:30
|
LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
| ---------------------^^^^^^^^^- ----------- move occurs because value has type `&mut (U, U)`, which does not implement the `Copy` trait
| value moved here
error[E0499]: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:95:24
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:94:24
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------------^^^^^^^^^-
| ----------- first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:95:53
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:94:53
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ----------------^^^^^^^^^-
| ----------- first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:107:24
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:106:24
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------------^^^^^^^^^-
| - first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
- --> $DIR/borrowck-pat-ref-mut-twice.rs:107:53
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:106:53
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ----------------^^^^^^^^^-
// Test that mixing `Copy` and non-`Copy` types in `@` patterns is forbidden.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
#[derive(Copy, Clone)]
struct C;
error[E0382]: use of moved value
- --> $DIR/copy-and-move-mixed.rs:12:19
+ --> $DIR/copy-and-move-mixed.rs:11:19
|
LL | let a @ NC(b, c) = NC(C, C);
| ----------^- -------- move occurs because value has type `NC<C, C>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/copy-and-move-mixed.rs:15:19
+ --> $DIR/copy-and-move-mixed.rs:14:19
|
LL | let a @ NC(b, c @ NC(d, e)) = NC(C, NC(C, C));
| ----------^^^^^^^^^^^^- --------------- move occurs because value has type `NC<C, NC<C, C>>`, which does not implement the `Copy` trait
| value moved here
error[E0382]: use of moved value
- --> $DIR/copy-and-move-mixed.rs:15:29
+ --> $DIR/copy-and-move-mixed.rs:14:29
|
LL | let a @ NC(b, c @ NC(d, e)) = NC(C, NC(C, C));
| ----------^-
// this would create problems for the generalization aforementioned.
#![feature(bindings_after_at)]
-#![feature(move_ref_pattern)]
fn main() {
struct NotCopy;
error: cannot move out of value because it is borrowed
- --> $DIR/default-binding-modes-both-sides-independent.rs:28:9
+ --> $DIR/default-binding-modes-both-sides-independent.rs:27:9
|
LL | let ref a @ b = NotCopy;
| -----^^^-
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/default-binding-modes-both-sides-independent.rs:31:9
+ --> $DIR/default-binding-modes-both-sides-independent.rs:30:9
|
LL | let ref mut a @ b = NotCopy;
| ---------^^^-
| value borrowed, by `a`, here
error: cannot move out of value because it is borrowed
- --> $DIR/default-binding-modes-both-sides-independent.rs:36:12
+ --> $DIR/default-binding-modes-both-sides-independent.rs:35:12
|
LL | Ok(ref a @ b) | Err(b @ ref a) => {
| -----^^^-
| value borrowed, by `a`, here
error: borrow of moved value
- --> $DIR/default-binding-modes-both-sides-independent.rs:36:29
+ --> $DIR/default-binding-modes-both-sides-independent.rs:35:29
|
LL | Ok(ref a @ b) | Err(b @ ref a) => {
| -^^^-----
| move occurs because `b` has type `NotCopy` which does not implement the `Copy` trait
error: cannot move out of value because it is borrowed
- --> $DIR/default-binding-modes-both-sides-independent.rs:44:9
+ --> $DIR/default-binding-modes-both-sides-independent.rs:43:9
|
LL | ref a @ b => {
| -----^^^-
| value borrowed, by `a`, here
error[E0505]: cannot move out of value because it is borrowed
- --> $DIR/default-binding-modes-both-sides-independent.rs:31:21
+ --> $DIR/default-binding-modes-both-sides-independent.rs:30:21
|
LL | let ref mut a @ b = NotCopy;
| ------------^
// check-pass
-#![feature(move_ref_pattern)]
-
fn main() {}
struct U;
-#![feature(move_ref_pattern)]
-
fn main() {}
struct U;
error[E0505]: cannot move out of `arr[..]` because it is borrowed
- --> $DIR/borrowck-move-ref-pattern.rs:10:24
+ --> $DIR/borrowck-move-ref-pattern.rs:8:24
|
LL | let hold_all = &arr;
| ---- borrow of `arr` occurs here
| -------- borrow later used here
error[E0384]: cannot assign twice to immutable variable `_x1`
- --> $DIR/borrowck-move-ref-pattern.rs:11:5
+ --> $DIR/borrowck-move-ref-pattern.rs:9:5
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---
| ^^^^^^^ cannot assign twice to immutable variable
error[E0505]: cannot move out of `arr[..]` because it is borrowed
- --> $DIR/borrowck-move-ref-pattern.rs:13:10
+ --> $DIR/borrowck-move-ref-pattern.rs:11:10
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ------------ borrow of `arr[..]` occurs here
| -------- borrow later used here
error[E0502]: cannot borrow `arr[..]` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-move-ref-pattern.rs:15:16
+ --> $DIR/borrowck-move-ref-pattern.rs:13:16
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---------------- immutable borrow occurs here
| ------- immutable borrow later used here
error[E0505]: cannot move out of `arr[..]` because it is borrowed
- --> $DIR/borrowck-move-ref-pattern.rs:15:29
+ --> $DIR/borrowck-move-ref-pattern.rs:13:29
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---------------- borrow of `arr[..]` occurs here
| ------- borrow later used here
error[E0505]: cannot move out of `arr[..]` because it is borrowed
- --> $DIR/borrowck-move-ref-pattern.rs:15:34
+ --> $DIR/borrowck-move-ref-pattern.rs:13:34
|
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---------------- borrow of `arr[..]` occurs here
| ------- borrow later used here
error[E0384]: cannot assign twice to immutable variable `_x1`
- --> $DIR/borrowck-move-ref-pattern.rs:25:5
+ --> $DIR/borrowck-move-ref-pattern.rs:23:5
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ---
| ^^^^^^^ cannot assign twice to immutable variable
error[E0502]: cannot borrow `tup.0` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-move-ref-pattern.rs:26:20
+ --> $DIR/borrowck-move-ref-pattern.rs:24:20
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ------- immutable borrow occurs here
| -------- immutable borrow later used here
error[E0502]: cannot borrow `tup.0` as mutable because it is also borrowed as immutable
- --> $DIR/borrowck-move-ref-pattern.rs:27:10
+ --> $DIR/borrowck-move-ref-pattern.rs:25:10
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ------- immutable borrow occurs here
| -------- immutable borrow later used here
error[E0594]: cannot assign to `*_x0` which is behind a `&` reference
- --> $DIR/borrowck-move-ref-pattern.rs:28:5
+ --> $DIR/borrowck-move-ref-pattern.rs:26:5
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ------- help: consider changing this to be a mutable reference: `ref mut _x0`
| ^^^^^^^^ `_x0` is a `&` reference, so the data it refers to cannot be written
error[E0594]: cannot assign to `*_x2` which is behind a `&` reference
- --> $DIR/borrowck-move-ref-pattern.rs:29:5
+ --> $DIR/borrowck-move-ref-pattern.rs:27:5
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| ------- help: consider changing this to be a mutable reference: `ref mut _x2`
| ^^^^^^^^ `_x2` is a `&` reference, so the data it refers to cannot be written
error[E0382]: use of moved value: `tup.1`
- --> $DIR/borrowck-move-ref-pattern.rs:30:10
+ --> $DIR/borrowck-move-ref-pattern.rs:28:10
|
LL | let (ref _x0, _x1, ref _x2, ..) = tup;
| --- value moved here
= note: move occurs because `tup.1` has type `U`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `tup.1`
- --> $DIR/borrowck-move-ref-pattern.rs:31:20
+ --> $DIR/borrowck-move-ref-pattern.rs:29:20
|
LL | drop(tup.1);
| ----- value moved here
= note: move occurs because `tup.1` has type `U`, which does not implement the `Copy` trait
error[E0502]: cannot borrow `tup.3` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-move-ref-pattern.rs:33:20
+ --> $DIR/borrowck-move-ref-pattern.rs:31:20
|
LL | let (.., ref mut _x3) = tup;
| ----------- mutable borrow occurs here
| --- mutable borrow later used here
error[E0499]: cannot borrow `tup.3` as mutable more than once at a time
- --> $DIR/borrowck-move-ref-pattern.rs:34:20
+ --> $DIR/borrowck-move-ref-pattern.rs:32:20
|
LL | let (.., ref mut _x3) = tup;
| ----------- first mutable borrow occurs here
| --- first borrow later used here
error[E0499]: cannot borrow `tup.3` as mutable more than once at a time
- --> $DIR/borrowck-move-ref-pattern.rs:35:14
+ --> $DIR/borrowck-move-ref-pattern.rs:33:14
|
LL | let (.., ref mut _x3) = tup;
| ----------- first mutable borrow occurs here
| --- first borrow later used here
error[E0502]: cannot borrow `tup.3` as immutable because it is also borrowed as mutable
- --> $DIR/borrowck-move-ref-pattern.rs:36:14
+ --> $DIR/borrowck-move-ref-pattern.rs:34:14
|
LL | let (.., ref mut _x3) = tup;
| ----------- mutable borrow occurs here
| --- mutable borrow later used here
error[E0382]: use of moved value: `tup`
- --> $DIR/borrowck-move-ref-pattern.rs:45:14
+ --> $DIR/borrowck-move-ref-pattern.rs:43:14
|
LL | let mut tup = (U, U, U);
| ------- move occurs because `tup` has type `(U, U, U)`, which does not implement the `Copy` trait
// check-pass
-#![feature(move_ref_pattern)]
#![feature(bindings_after_at)]
fn main() {
+++ /dev/null
-fn main() {
- #[derive(Clone)]
- struct X {
- x: (),
- }
- let mut tup = (X { x: () }, X { x: () });
- match Some(tup.clone()) {
- Some((y, ref z)) => {}
- //~^ ERROR binding by-move and by-ref in the same pattern is unstable
- None => panic!(),
- }
-
- let (ref a, b) = tup.clone();
- //~^ ERROR binding by-move and by-ref in the same pattern is unstable
-
- let (a, mut b) = &tup;
- //~^ ERROR binding by-move and by-ref in the same pattern is unstable
- //~| ERROR cannot move out of a shared reference
-
- let (mut a, b) = &mut tup;
- //~^ ERROR binding by-move and by-ref in the same pattern is unstable
- //~| ERROR cannot move out of a mutable reference
-}
+++ /dev/null
-error[E0658]: binding by-move and by-ref in the same pattern is unstable
- --> $DIR/feature-gate-move_ref_pattern.rs:8:15
- |
-LL | Some((y, ref z)) => {}
- | ^ ----- by-ref pattern here
- | |
- | by-move pattern here
- |
- = note: see issue #68354 <https://github.com/rust-lang/rust/issues/68354> for more information
- = help: add `#![feature(move_ref_pattern)]` to the crate attributes to enable
-
-error[E0658]: binding by-move and by-ref in the same pattern is unstable
- --> $DIR/feature-gate-move_ref_pattern.rs:13:17
- |
-LL | let (ref a, b) = tup.clone();
- | ----- ^ by-move pattern here
- | |
- | by-ref pattern here
- |
- = note: see issue #68354 <https://github.com/rust-lang/rust/issues/68354> for more information
- = help: add `#![feature(move_ref_pattern)]` to the crate attributes to enable
-
-error[E0658]: binding by-move and by-ref in the same pattern is unstable
- --> $DIR/feature-gate-move_ref_pattern.rs:16:13
- |
-LL | let (a, mut b) = &tup;
- | - ^^^^^ by-move pattern here
- | |
- | by-ref pattern here
- |
- = note: see issue #68354 <https://github.com/rust-lang/rust/issues/68354> for more information
- = help: add `#![feature(move_ref_pattern)]` to the crate attributes to enable
-
-error[E0658]: binding by-move and by-ref in the same pattern is unstable
- --> $DIR/feature-gate-move_ref_pattern.rs:20:10
- |
-LL | let (mut a, b) = &mut tup;
- | ^^^^^ - by-ref pattern here
- | |
- | by-move pattern here
- |
- = note: see issue #68354 <https://github.com/rust-lang/rust/issues/68354> for more information
- = help: add `#![feature(move_ref_pattern)]` to the crate attributes to enable
-
-error[E0507]: cannot move out of a shared reference
- --> $DIR/feature-gate-move_ref_pattern.rs:16:22
- |
-LL | let (a, mut b) = &tup;
- | ----- ^^^^
- | |
- | data moved here
- | move occurs because `b` has type `X`, which does not implement the `Copy` trait
-
-error[E0507]: cannot move out of a mutable reference
- --> $DIR/feature-gate-move_ref_pattern.rs:20:22
- |
-LL | let (mut a, b) = &mut tup;
- | ----- ^^^^^^^^
- | |
- | data moved here
- | move occurs because `a` has type `X`, which does not implement the `Copy` trait
-
-error: aborting due to 6 previous errors
-
-Some errors have detailed explanations: E0507, E0658.
-For more information about an error, try `rustc --explain E0507`.
// check-pass
-#![feature(move_ref_pattern)]
-
enum E {
Foo(String, String, String),
}
-#![feature(move_ref_pattern)]
-
fn main() {
struct S; // Not `Copy`.
error[E0382]: borrow of moved value: `tup0`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:33:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:31:10
|
LL | let mut tup0 = (S, S);
| -------- move occurs because `tup0` has type `(S, S)`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup1`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:34:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:32:10
|
LL | let mut tup1 = (S, S, S);
| -------- move occurs because `tup1` has type `(S, S, S)`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup2`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:35:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:33:10
|
LL | let tup2 = (S, S);
| ---- move occurs because `tup2` has type `(S, S)`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup3`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:36:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:34:10
|
LL | let tup3 = (S, S, S);
| ---- move occurs because `tup3` has type `(S, S, S)`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup4`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:41:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:39:10
|
LL | let tup4 = (S, S);
| ---- move occurs because `tup4` has type `(S, S)`, which does not implement the `Copy` trait
| ^^^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr0`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:43:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:41:10
|
LL | let mut arr0 = [S, S, S];
| -------- move occurs because `arr0` has type `[S; 3]`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr1`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:44:36
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:42:36
|
LL | let mut arr1 = [S, S, S, S, S];
| -------- move occurs because `arr1` has type `[S; 5]`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr2`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:45:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:43:10
|
LL | let arr2 = [S, S, S];
| ---- move occurs because `arr2` has type `[S; 3]`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr3`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:46:36
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:44:36
|
LL | let arr3 = [S, S, S, S, S];
| ---- move occurs because `arr3` has type `[S; 5]`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup0`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:77:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:75:10
|
LL | let mut tup0: Option<(S, S)> = None;
| -------- move occurs because `tup0` has type `Option<(S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup1`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:78:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:76:10
|
LL | let mut tup1: Option<(S, S, S)> = None;
| -------- move occurs because `tup1` has type `Option<(S, S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup2`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:79:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:77:10
|
LL | let tup2: Option<(S, S)> = None;
| ---- move occurs because `tup2` has type `Option<(S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup3`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:80:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:78:10
|
LL | let tup3: Option<(S, S, S)> = None;
| ---- move occurs because `tup3` has type `Option<(S, S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup4`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:81:21
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:79:21
|
LL | let tup4: Option<(S, S)> = None;
| ---- move occurs because `tup4` has type `Option<(S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr0`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:82:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:80:10
|
LL | let mut arr0: Option<[S; 3]> = None;
| -------- move occurs because `arr0` has type `Option<[S; 3]>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr1`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:83:35
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:81:35
|
LL | let mut arr1: Option<[S; 5]> = None;
| -------- move occurs because `arr1` has type `Option<[S; 5]>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr2`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:84:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:82:10
|
LL | let arr2: Option<[S; 3]> = None;
| ---- move occurs because `arr2` has type `Option<[S; 3]>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr3`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:85:35
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:83:35
|
LL | let arr3: Option<[S; 5]> = None;
| ---- move occurs because `arr3` has type `Option<[S; 5]>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup0`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:113:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:111:10
|
LL | let mut tup0: Option<(S, S)> = None;
| -------- move occurs because `tup0` has type `Option<(S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup1`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:114:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:112:10
|
LL | let mut tup1: Option<(S, S, S)> = None;
| -------- move occurs because `tup1` has type `Option<(S, S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup2`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:115:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:113:10
|
LL | let tup2: Option<(S, S)> = None;
| ---- move occurs because `tup2` has type `Option<(S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup3`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:116:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:114:10
|
LL | let tup3: Option<(S, S, S)> = None;
| ---- move occurs because `tup3` has type `Option<(S, S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `tup4`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:117:21
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:115:21
|
LL | let tup4: Option<(S, S)> = None;
| ---- move occurs because `tup4` has type `Option<(S, S)>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr0`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:118:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:116:10
|
LL | let mut arr0: Option<[S; 3]> = None;
| -------- move occurs because `arr0` has type `Option<[S; 3]>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr1`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:119:35
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:117:35
|
LL | let mut arr1: Option<[S; 5]> = None;
| -------- move occurs because `arr1` has type `Option<[S; 5]>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr2`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:120:10
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:118:10
|
LL | let arr2: Option<[S; 3]> = None;
| ---- move occurs because `arr2` has type `Option<[S; 3]>`, which does not implement the `Copy` trait
| ^^^^^ value borrowed here after move
error[E0382]: borrow of moved value: `arr3`
- --> $DIR/move-ref-patterns-closure-captures-inside.rs:121:35
+ --> $DIR/move-ref-patterns-closure-captures-inside.rs:119:35
|
LL | let arr3: Option<[S; 5]> = None;
| ---- move occurs because `arr3` has type `Option<[S; 5]>`, which does not implement the `Copy` trait
// check-pass
-#![feature(move_ref_pattern)]
-
fn main() {
struct U;
fn accept_fn_once(_: impl FnOnce()) {}
-#![feature(move_ref_pattern)]
-
fn main() {
struct U;
fn accept_fn_once(_: &impl FnOnce()) {}
error[E0525]: expected a closure that implements the `FnMut` trait, but this closure only implements `FnOnce`
- --> $DIR/move-ref-patterns-closure-captures.rs:11:14
+ --> $DIR/move-ref-patterns-closure-captures.rs:9:14
|
LL | let c1 = || {
| ^^ this closure implements `FnOnce`, not `FnMut`
| ------------- the requirement to implement `FnMut` derives from here
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
- --> $DIR/move-ref-patterns-closure-captures.rs:11:14
+ --> $DIR/move-ref-patterns-closure-captures.rs:9:14
|
LL | let c1 = || {
| ^^ this closure implements `FnOnce`, not `Fn`
| --------- the requirement to implement `Fn` derives from here
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut`
- --> $DIR/move-ref-patterns-closure-captures.rs:22:14
+ --> $DIR/move-ref-patterns-closure-captures.rs:20:14
|
LL | let c2 = || {
| ^^ this closure implements `FnMut`, not `Fn`
-#![feature(move_ref_pattern)]
-
fn main() {
struct U;
error[E0507]: cannot move out of a shared reference
- --> $DIR/move-ref-patterns-default-binding-modes.rs:10:22
+ --> $DIR/move-ref-patterns-default-binding-modes.rs:8:22
|
LL | let (a, mut b) = &p;
| ----- ^^
| move occurs because `b` has type `U`, which does not implement the `Copy` trait
error[E0507]: cannot move out of a mutable reference
- --> $DIR/move-ref-patterns-default-binding-modes.rs:14:22
+ --> $DIR/move-ref-patterns-default-binding-modes.rs:12:22
|
LL | let (a, mut b) = &mut p;
| ----- ^^^^^^
// This test checks the dynamic semantics and drop order of pattern matching
// where a product pattern has both a by-move and by-ref binding.
-#![feature(move_ref_pattern)]
-
use std::cell::RefCell;
use std::rc::Rc;
-#![feature(move_ref_pattern)]
-
struct Foo {}
pub fn main() {
error[E0507]: cannot move out of a shared reference
- --> $DIR/for.rs:8:23
+ --> $DIR/for.rs:6:23
|
LL | for (n, mut m) in &tups {
| ----- ^^^^^