Auto merge of #85305 - MarcusDunn:master, r=pnkfelix

Stabilize bindings_after_at

attempting to stabilze bindings_after_at [#65490](https://github.com/rust-lang/rust/issues/65490), im pretty new to the whole thing so any pointers are greatly appreciated.
This commit is contained in:
bors 2021-07-27 05:53:31 +00:00
commit 998cfe5aad
56 changed files with 228 additions and 335 deletions

View File

@ -4,7 +4,7 @@
//!
//! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`.
#![feature(bindings_after_at)]
#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(iter_is_partitioned)]
#![feature(box_patterns)]
#![recursion_limit = "256"]

View File

@ -287,6 +287,9 @@ declare_features! (
(accepted, const_fn_unsize, "1.54.0", Some(64992), None),
/// Allows `impl Trait` with multiple unrelated lifetimes.
(accepted, member_constraints, "1.54.0", Some(61997), None),
/// Allows bindings in the subpattern of a binding pattern.
/// For example, you can write `x @ Some(y)`.
(accepted, bindings_after_at, "1.54.0", Some(65490), None),
// -------------------------------------------------------------------------
// feature-group-end: accepted features

View File

@ -526,10 +526,6 @@ declare_features! (
/// Allows using `&mut` in constant functions.
(active, const_mut_refs, "1.41.0", Some(57349), None),
/// Allows bindings in the subpattern of a binding pattern.
/// For example, you can write `x @ Some(y)`.
(active, bindings_after_at, "1.41.0", Some(65490), None),
/// Allows `impl const Trait for T` syntax.
(active, const_trait_impl, "1.42.0", Some(67792), None),

View File

@ -8,7 +8,7 @@ Rust MIR: a lowered representation of Rust.
#![feature(in_band_lifetimes)]
#![feature(array_windows)]
#![feature(assert_matches)]
#![feature(bindings_after_at)]
#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]

View File

@ -16,9 +16,8 @@ use rustc_middle::thir::PatKind;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_session::lint::builtin::BINDINGS_WITH_VARIANT_NAME;
use rustc_session::lint::builtin::{IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS};
use rustc_session::parse::feature_err;
use rustc_session::Session;
use rustc_span::{sym, Span};
use rustc_span::Span;
use std::slice;
crate fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
@ -115,9 +114,6 @@ impl PatCtxt<'_, '_> {
impl<'tcx> MatchVisitor<'_, 'tcx> {
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);
}
check_for_bindings_named_same_as_variants(self, pat);
}
@ -732,46 +728,3 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pat<'_
err.emit();
}
}
/// Forbids bindings in `@` patterns. This used to be is necessary for memory safety,
/// because of the way rvalues were handled in the borrow check. (See issue #14587.)
fn check_legality_of_bindings_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pat<'_>) {
AtBindingPatternVisitor { cx, bindings_allowed: true }.visit_pat(pat);
struct AtBindingPatternVisitor<'a, 'b, 'tcx> {
cx: &'a MatchVisitor<'b, 'tcx>,
bindings_allowed: bool,
}
impl<'v> Visitor<'v> for AtBindingPatternVisitor<'_, '_, '_> {
type Map = intravisit::ErasedMap<'v>;
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
NestedVisitorMap::None
}
fn visit_pat(&mut self, pat: &Pat<'_>) {
match pat.kind {
hir::PatKind::Binding(.., ref subpat) => {
if !self.bindings_allowed {
feature_err(
&self.cx.tcx.sess.parse_sess,
sym::bindings_after_at,
pat.span,
"pattern bindings after an `@` are unstable",
)
.emit();
}
if subpat.is_some() {
let bindings_were_allowed = self.bindings_allowed;
self.bindings_allowed = false;
intravisit::walk_pat(self, pat);
self.bindings_allowed = bindings_were_allowed;
}
}
_ => intravisit::walk_pat(self, pat),
}
}
}
}

View File

@ -2,7 +2,7 @@
#![feature(array_windows)]
#![feature(crate_visibility_modifier)]
#![feature(bindings_after_at)]
#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(box_syntax)]
#![feature(box_patterns)]
#![recursion_limit = "256"]

View File

@ -56,7 +56,7 @@ This API is completely unstable and subject to change.
*/
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(bindings_after_at)]
#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]

View File

@ -85,6 +85,7 @@
#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]
#![feature(async_stream)]
#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(cfg_sanitize)]
@ -145,7 +146,6 @@
#![feature(associated_type_bounds)]
#![feature(slice_group_by)]
#![feature(decl_macro)]
#![feature(bindings_after_at)]
// Allow testing this library
#[cfg(test)]

0
src/etc/pre-commit.sh Executable file → Normal file
View File

View File

@ -1,5 +1,4 @@
// Tests using a combination of pattern features has the expected borrow checking behavior
#![feature(bindings_after_at)]
#![feature(box_patterns)]
enum Test {

View File

@ -1,5 +1,5 @@
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:37:9
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:36:9
|
LL | ref foo @ [.., ref mut bar] => (),
| -------^^^^^^^^-----------^
@ -8,7 +8,7 @@ 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:121:9
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:120:9
|
LL | ref foo @ Some(box ref mut s) => (),
| -------^^^^^^^^^^^^---------^
@ -17,7 +17,7 @@ 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:19:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:18: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
@ -29,7 +29,7 @@ LL | &x;
| ^^ 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:29:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:28:5
|
LL | ref mut foo @ [.., _] => Some(foo),
| --------------------- mutable borrow occurs here
@ -41,7 +41,7 @@ LL | drop(r);
| - 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:51:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:50:5
|
LL | [ref foo @ .., ref bar] => Some(foo),
| ------------ immutable borrow occurs here
@ -53,7 +53,7 @@ LL | drop(r);
| - 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:63:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:62:5
|
LL | ref foo @ [.., ref bar] => Some(foo),
| ----------------------- immutable borrow occurs here
@ -65,7 +65,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0382]: borrow of moved value: `x`
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:77:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:76: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
@ -80,7 +80,7 @@ LL | &x;
| ^^ 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:87:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:86:5
|
LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo),
| ------------------------------------- immutable borrow occurs here
@ -92,7 +92,7 @@ LL | drop(r);
| - 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:99:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:98:5
|
LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo),
| ----------------------------------------- mutable borrow occurs here
@ -104,7 +104,7 @@ LL | drop(r);
| - 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:113:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:112:5
|
LL | ref foo @ Some(box ref s) => Some(foo),
| ------------------------- immutable borrow occurs here
@ -116,7 +116,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0382]: borrow of moved value: `x`
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:135:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:134: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
@ -131,7 +131,7 @@ LL | &x;
| ^^ 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:145:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:144:5
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a),
| ------------------------------------------------- immutable borrow occurs here
@ -143,7 +143,7 @@ LL | drop(r);
| - 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:157:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:156:5
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b),
| ---------- immutable borrow occurs here
@ -155,7 +155,7 @@ LL | drop(r);
| - 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:171:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:170:5
|
LL | [_, ref a @ Some(box ref b), ..] => Some(a),
| ----------------------- immutable borrow occurs here
@ -167,7 +167,7 @@ LL | drop(r);
| - 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:187:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:186:5
|
LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ------------------------------------------- immutable borrow occurs here
@ -179,7 +179,7 @@ LL | drop(r);
| - 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:201:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:200:5
|
LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ----------------------------------------------- mutable borrow occurs here
@ -191,7 +191,7 @@ LL | drop(r);
| - 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:215:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:214:5
|
LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ------------------------------------------------------------ immutable borrow occurs here

View File

@ -2,7 +2,6 @@
// ignore-wasm32-bare compiled with panic=abort by default
#![feature(generators, generator_trait)]
#![feature(bindings_after_at)]
#![allow(unused_assignments)]
#![allow(unused_variables)]

View File

@ -2,8 +2,6 @@
// Test copy
#![feature(bindings_after_at)]
struct A { a: i32, b: i32 }
struct B { a: i32, b: C }
struct D { a: i32, d: C }

View File

@ -2,8 +2,6 @@
// It checks that you cannot use an AND-pattern (`binding @ pat`)
// where one side is by-ref and the other is by-move.
#![feature(bindings_after_at)]
struct X {
x: (),
}

View File

@ -1,5 +1,5 @@
error: cannot move out of value because it is borrowed
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:14:14
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14
|
LL | Some(ref _y @ _z) => {}
| ------^^^--
@ -8,7 +8,7 @@ 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:19:14
|
LL | Some(_z @ ref _y) => {}
| --^^^------
@ -18,7 +18,7 @@ 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:28:14
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14
|
LL | Some(ref mut _y @ _z) => {}
| ----------^^^--
@ -27,7 +27,7 @@ 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:33:14
|
LL | Some(_z @ ref mut _y) => {}
| --^^^----------
@ -37,7 +37,7 @@ 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:14:14
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14
|
LL | Some(ref _y @ _z) => {}
| ^^^^^^^^^--
@ -52,7 +52,7 @@ LL | Some(ref _y @ ref _z) => {}
| ^^^
error[E0382]: borrow of moved value
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:28:14
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14
|
LL | Some(ref mut _y @ _z) => {}
| ^^^^^^^^^^^^^--

View File

@ -1,7 +1,5 @@
// See issue #12534.
#![feature(bindings_after_at)]
fn main() {}
struct A(Box<u8>);

View File

@ -1,5 +1,5 @@
error[E0382]: use of partially moved value
--> $DIR/bind-by-move-no-subbindings-fun-param.rs:9:6
--> $DIR/bind-by-move-no-subbindings-fun-param.rs:7:6
|
LL | fn f(a @ A(u): A) -> Box<u8> {
| ^^^^^^-^

View File

@ -1,7 +1,5 @@
// Test that moving on both sides of an `@` pattern is not allowed.
#![feature(bindings_after_at)]
fn main() {
struct U; // Not copy!

View File

@ -1,5 +1,5 @@
error[E0382]: use of moved value
--> $DIR/borrowck-move-and-move.rs:13:9
--> $DIR/borrowck-move-and-move.rs:11:9
|
LL | let a @ b = U;
| ^^^^- - move occurs because value has type `U`, which does not implement the `Copy` trait
@ -8,7 +8,7 @@ LL | let a @ b = U;
| value used here after move
error[E0382]: use of partially moved value
--> $DIR/borrowck-move-and-move.rs:15:9
--> $DIR/borrowck-move-and-move.rs:13:9
|
LL | let a @ (b, c) = (U, U);
| ^^^^^^^^-^
@ -19,7 +19,7 @@ LL | let a @ (b, c) = (U, U);
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: use of partially moved value
--> $DIR/borrowck-move-and-move.rs:17:9
--> $DIR/borrowck-move-and-move.rs:15:9
|
LL | let a @ (b, c) = (u(), u());
| ^^^^^^^^-^
@ -30,7 +30,7 @@ LL | let a @ (b, c) = (u(), u());
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: use of moved value
--> $DIR/borrowck-move-and-move.rs:20:16
--> $DIR/borrowck-move-and-move.rs:18:16
|
LL | match Ok(U) {
| ----- move occurs because value has type `Result<U, U>`, which does not implement the `Copy` trait
@ -41,7 +41,7 @@ LL | a @ Ok(b) | a @ Err(b) => {}
| value moved here
error[E0382]: use of moved value
--> $DIR/borrowck-move-and-move.rs:20:29
--> $DIR/borrowck-move-and-move.rs:18:29
|
LL | match Ok(U) {
| ----- move occurs because value has type `Result<U, U>`, which does not implement the `Copy` trait
@ -52,7 +52,7 @@ LL | a @ Ok(b) | a @ Err(b) => {}
| value moved here
error[E0382]: use of partially moved value
--> $DIR/borrowck-move-and-move.rs:27:9
--> $DIR/borrowck-move-and-move.rs:25:9
|
LL | xs @ [a, .., b] => {}
| ^^^^^^^^^^^^^-^
@ -63,7 +63,7 @@ LL | xs @ [a, .., b] => {}
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: use of partially moved value
--> $DIR/borrowck-move-and-move.rs:31:9
--> $DIR/borrowck-move-and-move.rs:29:9
|
LL | xs @ [_, ys @ .., _] => {}
| ^^^^^^^^^-------^^^^
@ -74,7 +74,7 @@ LL | xs @ [_, ys @ .., _] => {}
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: use of moved value
--> $DIR/borrowck-move-and-move.rs:24:12
--> $DIR/borrowck-move-and-move.rs:22:12
|
LL | fn fun(a @ b: U) {}
| ^^^^-

View File

@ -2,7 +2,6 @@
// Test `@` patterns combined with `box` patterns.
#![feature(bindings_after_at)]
#![feature(box_patterns)]
#[derive(Copy, Clone)]

View File

@ -1,6 +1,5 @@
// Test `@` patterns combined with `box` patterns.
#![feature(bindings_after_at)]
#![feature(box_patterns)]
#[derive(Copy, Clone)]

View File

@ -1,5 +1,5 @@
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-at-and-box.rs:32:9
--> $DIR/borrowck-pat-at-and-box.rs:31:9
|
LL | let ref a @ box b = Box::new(NC);
| -----^^^^^^^-
@ -8,7 +8,7 @@ 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:35:9
--> $DIR/borrowck-pat-at-and-box.rs:34:9
|
LL | let ref a @ box ref mut b = Box::new(nc());
| -----^^^^^^^---------
@ -17,7 +17,7 @@ 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:37:9
--> $DIR/borrowck-pat-at-and-box.rs:36:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
@ -26,7 +26,7 @@ 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:39:9
--> $DIR/borrowck-pat-at-and-box.rs:38:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
@ -35,7 +35,7 @@ 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);
| -----^^^^^^^---------
@ -44,7 +44,7 @@ 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:49:9
--> $DIR/borrowck-pat-at-and-box.rs:48:9
|
LL | let ref mut a @ box ref b = Box::new(NC);
| ---------^^^^^^^-----
@ -53,7 +53,7 @@ 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:63:9
--> $DIR/borrowck-pat-at-and-box.rs:62:9
|
LL | ref mut a @ box ref b => {
| ---------^^^^^^^-----
@ -62,7 +62,7 @@ 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:55:11
--> $DIR/borrowck-pat-at-and-box.rs:54:11
|
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
| ---------^^^^^^^-----
@ -71,7 +71,7 @@ LL | fn f5(ref mut a @ box ref b: Box<NC>) {
| mutable borrow, by `a`, occurs here
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-at-and-box.rs:32:9
--> $DIR/borrowck-pat-at-and-box.rs:31:9
|
LL | let ref a @ box b = Box::new(NC);
| ^^^^^^^^^^^^-
@ -82,7 +82,7 @@ LL | let ref a @ box b = Box::new(NC);
= note: move occurs because value has type `NC`, 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:39:9
--> $DIR/borrowck-pat-at-and-box.rs:38:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| ^^^^^^^^^^^^---------
@ -94,7 +94,7 @@ LL | *b = 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:43:9
--> $DIR/borrowck-pat-at-and-box.rs:42:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| ^^^^^^^^^^^^---------
@ -106,7 +106,7 @@ LL | *b = NC;
| ------- mutable borrow later used here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:49:9
--> $DIR/borrowck-pat-at-and-box.rs:48:9
|
LL | let ref mut a @ box ref b = Box::new(NC);
| ^^^^^^^^^^^^^^^^-----
@ -118,7 +118,7 @@ LL | drop(b);
| - immutable borrow later used here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:63:9
--> $DIR/borrowck-pat-at-and-box.rs:62:9
|
LL | ref mut a @ box ref b => {
| ^^^^^^^^^^^^^^^^-----
@ -130,7 +130,7 @@ LL | drop(b);
| - immutable borrow later used here
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:55:11
--> $DIR/borrowck-pat-at-and-box.rs:54:11
|
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
| ^^^^^^^^^^^^^^^^-----

View File

@ -2,8 +2,6 @@
// Test `Copy` bindings in the rhs of `@` patterns.
#![feature(bindings_after_at)]
#[derive(Copy, Clone)]
struct C;

View File

@ -1,8 +1,6 @@
// Test that `by_move_binding @ pat_with_by_ref_bindings` is prevented even with promotion.
// Currently this logic exists in THIR match checking as opposed to borrowck.
#![feature(bindings_after_at)]
fn main() {
struct U;
let a @ ref b = U; //~ ERROR borrow of moved value

View File

@ -1,5 +1,5 @@
error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse-promotion.rs:8:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse-promotion.rs:6:9
|
LL | let a @ ref b = U;
| -^^^-----

View File

@ -1,7 +1,5 @@
// Test that `by_move_binding @ pat_with_by_ref_bindings` is prevented.
#![feature(bindings_after_at)]
fn main() {
struct U;

View File

@ -1,5 +1,5 @@
error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:22:9
|
LL | let a @ ref b = U;
| -^^^-----
@ -9,7 +9,7 @@ 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:26:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| -^^^^^^^^^^^^---------^^^^^^-----^
@ -20,7 +20,7 @@ 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:26:14
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:14
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| -----^^^---------
@ -30,7 +30,7 @@ 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:26:33
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:33
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| -^^^-----
@ -40,7 +40,7 @@ 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:31:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:29:9
|
LL | let a @ [ref mut b, ref c] = [U, U];
| -^^^^---------^^-----^
@ -51,7 +51,7 @@ 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:33:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:9
|
LL | let a @ ref b = u();
| -^^^-----
@ -61,7 +61,7 @@ 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:35:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| -^^^^^^^^^^^^---------^^^^^^-----^
@ -72,7 +72,7 @@ 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:35:14
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:14
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| -----^^^---------
@ -82,7 +82,7 @@ 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:35:33
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:33
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| -^^^-----
@ -92,7 +92,7 @@ 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:40:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:38:9
|
LL | let a @ [ref mut b, ref c] = [u(), u()];
| -^^^^---------^^-----^
@ -103,7 +103,7 @@ 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:44:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:42:9
|
LL | a @ Some(ref b) => {}
| -^^^^^^^^-----^
@ -113,7 +113,7 @@ 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:49:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:9
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^
@ -124,7 +124,7 @@ 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:49:19
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:19
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -----^^^---------
@ -134,7 +134,7 @@ 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:49:38
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:38
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^-----
@ -144,7 +144,7 @@ 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:57:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:9
|
LL | mut a @ Some([ref b, ref mut c]) => {}
| -----^^^^^^^^^-----^^---------^^
@ -155,7 +155,7 @@ 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:63:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:9
|
LL | a @ Some(ref b) => {}
| -^^^^^^^^-----^
@ -165,7 +165,7 @@ 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:69:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:9
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^
@ -176,7 +176,7 @@ 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:69:19
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:19
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -----^^^---------
@ -186,7 +186,7 @@ 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:69:38
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:38
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^-----
@ -196,7 +196,7 @@ 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:77:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:9
|
LL | mut a @ Some([ref b, ref mut c]) => {}
| -----^^^^^^^^^-----^^---------^^
@ -207,7 +207,7 @@ 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:13:11
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:11:11
|
LL | fn f1(a @ ref b: U) {}
| -^^^-----
@ -217,7 +217,7 @@ 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:16:11
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| -----^^^^^^^^-----^^^^^^^^^^-----^
@ -228,7 +228,7 @@ 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:16:20
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:20
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| -^^^-----
@ -238,7 +238,7 @@ 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:16:31
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:31
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| -----^^^-----
@ -248,7 +248,7 @@ 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:21:11
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:19:11
|
LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {}
| -^^^^---------^^-----^
@ -259,7 +259,7 @@ 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]: use of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:26:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| ^^^^^^^^^^^^^^^^^^^^^^^^---------^
@ -270,7 +270,7 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: use of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:35:9
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| ^^^^^^^^^^^^^^^^^^^^^^^^---------^
@ -281,7 +281,7 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
= note: partial 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:49:38
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:38
|
LL | match Some((U, U)) {
| ------------ move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait
@ -292,7 +292,7 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| value moved here
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:57:30
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:30
|
LL | match Some([U, U]) {
| ------------ move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait
@ -303,7 +303,7 @@ LL | mut a @ Some([ref b, ref mut c]) => {}
| value moved here
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:63:18
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:18
|
LL | match Some(u()) {
| --------- move occurs because value has type `Option<U>`, which does not implement the `Copy` trait
@ -314,7 +314,7 @@ LL | a @ Some(ref b) => {}
| value moved here
error[E0382]: use of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:69:38
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:38
|
LL | match Some((u(), u())) {
| ---------------- move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait
@ -325,7 +325,7 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| value moved here
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:77:30
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:30
|
LL | match Some([u(), u()]) {
| ---------------- move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait
@ -336,7 +336,7 @@ LL | mut a @ Some([ref b, ref mut c]) => {}
| value moved here
error[E0382]: use of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:16:11
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| ^^^^^^^^^^^^^^^^^^^^-------------^

View File

@ -1,7 +1,5 @@
// Test that `ref mut? @ pat_with_by_move_bindings` is prevented.
#![feature(bindings_after_at)]
fn main() {
struct U;

View File

@ -1,5 +1,5 @@
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:24:9
|
LL | let ref a @ b = U;
| -----^^^-
@ -8,7 +8,7 @@ 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:28:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:9
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
@ -18,7 +18,7 @@ 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:28:18
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:18
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
| -----^^^-----
@ -27,7 +27,7 @@ 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:28:33
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:33
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
| -----^^^-
@ -36,7 +36,7 @@ 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:32:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:30:9
|
LL | let ref mut a @ [b, mut c] = [U, U];
| ---------^^^^-^^-----^
@ -46,7 +46,7 @@ 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:35:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:33:9
|
LL | let ref a @ b = u();
| -----^^^-
@ -55,7 +55,7 @@ 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:38:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:9
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
@ -65,7 +65,7 @@ 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:38:18
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:18
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| -----^^^-----
@ -74,7 +74,7 @@ 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:38:33
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:33
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| -----^^^-
@ -83,7 +83,7 @@ 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:44:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:42:9
|
LL | let ref mut a @ [b, mut c] = [u(), u()];
| ---------^^^^-^^-----^
@ -93,7 +93,7 @@ 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:49:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:47:9
|
LL | ref a @ Some(b) => {}
| -----^^^^^^^^-^
@ -102,7 +102,7 @@ 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:54:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:52:9
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^
@ -112,7 +112,7 @@ 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:54:23
--> $DIR/borrowck-pat-by-move-and-ref.rs:52:23
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-----
@ -121,7 +121,7 @@ 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:54:38
--> $DIR/borrowck-pat-by-move-and-ref.rs:52:38
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-
@ -130,7 +130,7 @@ 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:61:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:59:9
|
LL | ref mut a @ Some([b, mut c]) => {}
| ---------^^^^^^^^^-^^-----^^
@ -140,7 +140,7 @@ 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:66:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:64:9
|
LL | ref a @ Some(b) => {}
| -----^^^^^^^^-^
@ -149,7 +149,7 @@ 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:71:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:9
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^
@ -159,7 +159,7 @@ 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:71:23
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:23
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-----
@ -168,7 +168,7 @@ 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:71:38
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:38
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-
@ -177,7 +177,7 @@ 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:80:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:78:9
|
LL | ref mut a @ Some([b, mut c]) => {}
| ---------^^^^^^^^^-^^-----^^
@ -187,7 +187,7 @@ 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:13:11
--> $DIR/borrowck-pat-by-move-and-ref.rs:11:11
|
LL | fn f1(ref a @ b: U) {}
| -----^^^-
@ -196,7 +196,7 @@ 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:14:11
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
@ -206,7 +206,7 @@ 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:14:20
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| -----^^^-----
@ -215,7 +215,7 @@ 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:14:35
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| -----^^^-
@ -224,7 +224,7 @@ 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:22:11
--> $DIR/borrowck-pat-by-move-and-ref.rs:20:11
|
LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {}
| ---------^^^^-^^-----^
@ -234,7 +234,7 @@ LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {}
| value borrowed, by `a`, here
error[E0382]: borrow of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:32:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:30:9
|
LL | let ref mut a @ [b, mut c] = [U, U];
| ^^^^^^^^^^^^^^^^-----^
@ -245,7 +245,7 @@ LL | let ref mut a @ [b, mut c] = [U, U];
= note: partial 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.rs:35:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:33:9
|
LL | let ref a @ b = u();
| ^^^^^^^^- --- move occurs because value has type `U`, which does not implement the `Copy` trait
@ -254,7 +254,7 @@ LL | let ref a @ b = u();
| value borrowed here after move
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:38:18
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:18
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| ^^^^^^^^-----
@ -265,7 +265,7 @@ LL | let ref a @ (ref b @ mut c, ref d @ 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.rs:38:33
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:33
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| ^^^^^^^^-
@ -276,7 +276,7 @@ LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
= note: move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: borrow of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:44:9
--> $DIR/borrowck-pat-by-move-and-ref.rs:42:9
|
LL | let ref mut a @ [b, mut c] = [u(), u()];
| ^^^^^^^^^^^^^^^^-----^
@ -287,7 +287,7 @@ LL | let ref mut a @ [b, mut c] = [u(), u()];
= note: partial 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.rs:71:23
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:23
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| ^^^^^^^^-----
@ -302,7 +302,7 @@ LL | ref a @ Some((ref b @ ref mut c, ref d @ e)) => {}
| ^^^
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:71:38
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:38
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| ^^^^^^^^-
@ -317,7 +317,7 @@ LL | ref a @ Some((ref b @ mut c, ref d @ ref e)) => {}
| ^^^
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:13:11
--> $DIR/borrowck-pat-by-move-and-ref.rs:11:11
|
LL | fn f1(ref a @ b: U) {}
| ^^^^^^^^-
@ -327,7 +327,7 @@ LL | fn f1(ref a @ 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.rs:16:20
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:20
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| ^^^^^^^^-----
@ -338,7 +338,7 @@ LL | fn f2(ref a @ (ref b @ mut c, ref d @ 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.rs:16:35
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:35
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| ^^^^^^^^-
@ -349,7 +349,7 @@ LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
= note: move occurs because value has type `U`, which does not implement the `Copy` trait
error[E0382]: borrow of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:22:11
--> $DIR/borrowck-pat-by-move-and-ref.rs:20:11
|
LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {}
| ^^^^^^^^^^^^^^^^-----^

View File

@ -3,8 +3,6 @@
// Test that `ref` patterns may be used on both sides
// of an `@` pattern according to NLL borrowck.
#![feature(bindings_after_at)]
fn main() {
struct U; // Not copy!

View File

@ -1,5 +1,3 @@
#![feature(bindings_after_at)]
enum Option<T> {
None,
Some(T),

View File

@ -1,5 +1,5 @@
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:10:9
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:9
|
LL | ref mut z @ &mut Some(ref a) => {
| ---------^^^^^^^^^^^^^-----^
@ -8,7 +8,7 @@ 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:33:9
|
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
| ---------^^^^-----------------^
@ -18,7 +18,7 @@ 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:33:22
|
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
| -----^^^---------
@ -27,7 +27,7 @@ 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:37:9
|
LL | let ref a @ ref mut b = U;
| -----^^^---------
@ -36,7 +36,7 @@ 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:39:9
|
LL | let ref mut a @ ref b = U;
| ---------^^^-----
@ -45,7 +45,7 @@ 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:41:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
@ -55,7 +55,7 @@ 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:43:9
|
LL | let ref mut a @ (ref b, ref c) = (U, U);
| ---------^^^^-----^^-----^
@ -65,7 +65,7 @@ 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:46:9
|
LL | let ref mut a @ ref b = u();
| ---------^^^-----
@ -74,7 +74,7 @@ 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:51:9
|
LL | let ref a @ ref mut b = u();
| -----^^^---------
@ -83,7 +83,7 @@ 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:57:9
|
LL | let ref mut a @ ref b = U;
| ---------^^^-----
@ -92,7 +92,7 @@ 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:61:9
|
LL | let ref a @ ref mut b = U;
| -----^^^---------
@ -101,7 +101,7 @@ 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:67:9
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
| ---------^^^^^^-----^
@ -110,7 +110,7 @@ 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:67:33
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
| ---------^^^^^^^-----^
@ -119,7 +119,7 @@ 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:76:9
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| -----^^^^^^---------^
@ -128,7 +128,7 @@ 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:76:33
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| -----^^^^^^^---------^
@ -137,7 +137,7 @@ 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:87:9
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
| -----^^^^^^---------^
@ -146,7 +146,7 @@ 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:87:33
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
| -----^^^^^^^---------^
@ -155,7 +155,7 @@ 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:94:9
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
| ---------^^^^^^-----^
@ -164,7 +164,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); fa
| 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:94:33
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
| ---------^^^^^^^-----^
@ -173,7 +173,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); fa
| 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:101:9
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
| -----^^^^^^---------^
@ -182,7 +182,7 @@ 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:101:33
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
| -----^^^^^^^---------^
@ -191,7 +191,7 @@ 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:109:9
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
| ---------^^^^^^-----^
@ -200,7 +200,7 @@ 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:109:33
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
| ---------^^^^^^^-----^
@ -209,7 +209,7 @@ 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:117:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
@ -219,7 +219,7 @@ 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:125:9
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
@ -229,7 +229,7 @@ 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:129:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
@ -239,7 +239,7 @@ 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:134:9
|
LL | let ref mut a @ (ref b, ref c) = (U, U);
| ---------^^^^-----^^-----^
@ -249,7 +249,7 @@ 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:24:11
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:22:11
|
LL | fn f1(ref a @ ref mut b: U) {}
| -----^^^---------
@ -258,7 +258,7 @@ 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:26:11
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11
|
LL | fn f2(ref mut a @ ref b: U) {}
| ---------^^^-----
@ -267,7 +267,7 @@ 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:28:11
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11
|
LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {}
| -----^^^^^^^^^^^----------------^^^^^^^^
@ -276,7 +276,7 @@ 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:30:22
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:22
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
| -----^^^-------------
@ -286,7 +286,7 @@ 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:30:30
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
| ---------^^^-
@ -295,7 +295,7 @@ 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:10:31
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:31
|
LL | ref mut z @ &mut Some(ref a) => {
| ----------------------^^^^^-
@ -307,7 +307,7 @@ LL | **z = None;
| ---------- 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:48:9
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9
|
LL | let ref mut a @ ref b = u();
| ^^^^^^^^^^^^-----
@ -319,7 +319,7 @@ LL | drop(b);
| - immutable 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:53:9
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9
|
LL | let ref a @ ref mut b = u();
| ^^^^^^^^---------
@ -331,7 +331,7 @@ LL | *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:78:20
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:20
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| -----------^^^^^^^^^-
@ -343,7 +343,7 @@ LL | drop(a);
| - 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:76:45
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| ------------^^^^^^^^^-
@ -355,7 +355,7 @@ LL | drop(a);
| - 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:87:61
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
| ^^^^^^ cannot assign
@ -363,7 +363,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false }
= 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:94:61
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
| ^^^^^^^^^^^ cannot assign
@ -371,7 +371,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); fa
= 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:101: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
@ -379,7 +379,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false
= 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:101: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
@ -387,7 +387,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false
= 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:109: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 Result<U, U>`, which does not implement the `Copy` trait
@ -395,7 +395,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false
= 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:109: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 Result<U, U>`, which does not implement the `Copy` trait
@ -403,7 +403,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:119:9
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| ^^^^^^^^^---------^^^^^^^^^^^^
@ -415,7 +415,7 @@ LL | *b = U;
| ------ 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:125:9
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| ^^^^^^^^^---------^^^^^^^^^^^^
@ -427,7 +427,7 @@ LL | *b = U;
| ------ 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:131:9
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| ^^^^^^^^^---------^^^^^^^^^^^^
@ -439,7 +439,7 @@ LL | *b = U;
| ------ mutable borrow later used here
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:30:30
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
| --------^^^^^^^^^^^^-

View File

@ -1,7 +1,5 @@
// Test that `ref mut x @ ref mut y` and varieties of that are not allowed.
#![feature(bindings_after_at)]
fn main() {
struct U;

View File

@ -1,5 +1,5 @@
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:26:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
@ -8,7 +8,7 @@ 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:31:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
@ -17,7 +17,7 @@ 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:33:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
@ -26,7 +26,7 @@ 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:36:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
@ -35,7 +35,7 @@ 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:41:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
@ -44,7 +44,7 @@ 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:44:9
|
LL | let ref mut a @ (
| ^--------
@ -66,7 +66,7 @@ LL | | ) = (U, [U, U, U]);
| |_____^
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:54:9
|
LL | let ref mut a @ (
| ^--------
@ -88,7 +88,7 @@ LL | | ) = (u(), [u(), u(), u()]);
| |_________^
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:66:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:64:9
|
LL | let a @ (ref mut b, ref mut c) = (U, U);
| -^^^^---------^^---------^
@ -99,7 +99,7 @@ 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:69:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:67:9
|
LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
| -^^^^-^^^-^^-^^
@ -111,7 +111,7 @@ 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:72:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:70:9
|
LL | let a @ &mut ref mut b = &mut U;
| -^^^^^^^^---------
@ -121,7 +121,7 @@ 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:74:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:72:9
|
LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
| -^^^^^^^^^---------^^---------^
@ -132,7 +132,7 @@ 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:78:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
@ -141,7 +141,7 @@ 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:78:37
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
@ -150,7 +150,7 @@ 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:84:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
@ -159,7 +159,7 @@ 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:84:37
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
@ -168,7 +168,7 @@ 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:91:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
@ -177,7 +177,7 @@ 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:91:37
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
@ -186,7 +186,7 @@ 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:103:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
@ -195,7 +195,7 @@ 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:103:37
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
@ -204,7 +204,7 @@ 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:10:11
--> $DIR/borrowck-pat-ref-mut-twice.rs:8:11
|
LL | fn f1(ref mut a @ ref mut b: U) {}
| ---------^^^---------
@ -213,7 +213,7 @@ 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:12:11
--> $DIR/borrowck-pat-ref-mut-twice.rs:10:11
|
LL | fn f2(ref mut a @ ref mut b: U) {}
| ---------^^^---------
@ -222,7 +222,7 @@ 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:15:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:13:9
|
LL | ref mut a @ [
| ^--------
@ -240,7 +240,7 @@ LL | | ] : [[U; 4]; 5]
| |_________^
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:23:22
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:22
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ---------^^^-------------
@ -250,7 +250,7 @@ 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:23:34
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ---------^^^-
@ -259,7 +259,7 @@ 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:31:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^^^^---------
@ -271,7 +271,7 @@ LL | drop(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:41:9
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^^^^---------
@ -283,7 +283,7 @@ LL | *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:91:24
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:24
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------------^^^^^^^^^-
@ -295,7 +295,7 @@ LL | *a = Err(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:91:53
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:53
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ----------------^^^^^^^^^-
@ -307,7 +307,7 @@ LL | *a = Err(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:103:24
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:24
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------------^^^^^^^^^-
@ -319,7 +319,7 @@ LL | drop(a);
| - 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:103:53
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:53
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ----------------^^^^^^^^^-
@ -331,7 +331,7 @@ LL | drop(a);
| - first borrow later used here
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:23:34
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ------------^^^^^^^^^^^^-

View File

@ -2,7 +2,6 @@
// run-pass
#![feature(bindings_after_at)]
#![feature(box_patterns)]
#[derive(Debug, PartialEq)]

View File

@ -1,7 +1,5 @@
// Test that mixing `Copy` and non-`Copy` types in `@` patterns is forbidden.
#![feature(bindings_after_at)]
#[derive(Copy, Clone)]
struct C;

View File

@ -1,5 +1,5 @@
error[E0382]: use of partially moved value
--> $DIR/copy-and-move-mixed.rs:14:9
--> $DIR/copy-and-move-mixed.rs:12:9
|
LL | let a @ NC(b, c @ NC(d, e)) = NC(C, NC(C, C));
| ^^^^^^^^^^------------^

View File

@ -7,7 +7,6 @@
// If `binding` is allowed to influence `subpat`,
// this would create problems for the generalization aforementioned.
#![feature(bindings_after_at)]
fn main() {
struct NotCopy;

View File

@ -1,5 +1,5 @@
error: cannot move out of value because it is borrowed
--> $DIR/default-binding-modes-both-sides-independent.rs:27:9
--> $DIR/default-binding-modes-both-sides-independent.rs:26:9
|
LL | let ref a @ b = NotCopy;
| -----^^^-
@ -8,7 +8,7 @@ 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:30:9
--> $DIR/default-binding-modes-both-sides-independent.rs:29:9
|
LL | let ref mut a @ b = NotCopy;
| ---------^^^-
@ -17,7 +17,7 @@ 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:35:12
--> $DIR/default-binding-modes-both-sides-independent.rs:34:12
|
LL | Ok(ref a @ b) | Err(b @ ref a) => {
| -----^^^-
@ -26,7 +26,7 @@ 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:35:29
--> $DIR/default-binding-modes-both-sides-independent.rs:34:29
|
LL | Ok(ref a @ b) | Err(b @ ref a) => {
| -^^^-----
@ -36,7 +36,7 @@ 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:43:9
--> $DIR/default-binding-modes-both-sides-independent.rs:42:9
|
LL | ref a @ b => {
| -----^^^-
@ -45,7 +45,7 @@ LL | ref a @ b => {
| value borrowed, by `a`, here
error[E0382]: borrow of moved value
--> $DIR/default-binding-modes-both-sides-independent.rs:30:9
--> $DIR/default-binding-modes-both-sides-independent.rs:29:9
|
LL | let ref mut a @ b = NotCopy;
| ^^^^^^^^^^^^- ------- move occurs because value has type `NotCopy`, which does not implement the `Copy` trait

View File

@ -1,3 +0,0 @@
fn main() {
let x @ y = 0; //~ ERROR pattern bindings after an `@` are unstable
}

View File

@ -1,12 +0,0 @@
error[E0658]: pattern bindings after an `@` are unstable
--> $DIR/feature-gate-bindings_after_at.rs:2:13
|
LL | let x @ y = 0;
| ^
|
= note: see issue #65490 <https://github.com/rust-lang/rust/issues/65490> for more information
= help: add `#![feature(bindings_after_at)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(bindings_after_at)]
#![deny(unused_mut)]
fn main() {

View File

@ -1,5 +1,3 @@
#![feature(bindings_after_at)]
fn main() {
let mut is_mut @ not_mut = 42;
&mut is_mut;

View File

@ -1,5 +1,5 @@
error[E0596]: cannot borrow `not_mut` as mutable, as it is not declared as mutable
--> $DIR/nested-binding-modes-mut.rs:6:5
--> $DIR/nested-binding-modes-mut.rs:4:5
|
LL | let mut is_mut @ not_mut = 42;
| ------- help: consider changing this to be mutable: `mut not_mut`
@ -8,7 +8,7 @@ LL | &mut not_mut;
| ^^^^^^^^^^^^ cannot borrow as mutable
error[E0596]: cannot borrow `not_mut` as mutable, as it is not declared as mutable
--> $DIR/nested-binding-modes-mut.rs:11:5
--> $DIR/nested-binding-modes-mut.rs:9:5
|
LL | let not_mut @ mut is_mut = 42;
| -------------------- help: consider changing this to be mutable: `mut not_mut`

View File

@ -1,5 +1,3 @@
#![feature(bindings_after_at)]
fn main() {
let ref is_ref @ is_val = 42;
*is_ref;

View File

@ -1,11 +1,11 @@
error[E0614]: type `{integer}` cannot be dereferenced
--> $DIR/nested-binding-modes-ref.rs:6:5
--> $DIR/nested-binding-modes-ref.rs:4:5
|
LL | *is_val;
| ^^^^^^^
error[E0614]: type `{integer}` cannot be dereferenced
--> $DIR/nested-binding-modes-ref.rs:11:5
--> $DIR/nested-binding-modes-ref.rs:9:5
|
LL | *is_val;
| ^^^^^^^

View File

@ -1,6 +1,5 @@
// run-pass
#![feature(bindings_after_at)]
struct A { a: u8, b: u8 }

View File

@ -1,7 +1,6 @@
// Here we check that type ascription is syntactically invalid when
// not in the top position of a ascribing a let binding or function parameter.
#![feature(bindings_after_at)]
// This has no effect.
// We include it to demonstrate that this is the case:

View File

@ -1,23 +1,23 @@
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `@`
--> $DIR/nested-type-ascription-syntactically-invalid.rs:19:15
--> $DIR/nested-type-ascription-syntactically-invalid.rs:18:15
|
LL | let a: u8 @ b = 0;
| ^ expected one of 7 possible tokens
error: expected one of `)`, `,`, `@`, or `|`, found `:`
--> $DIR/nested-type-ascription-syntactically-invalid.rs:25:15
--> $DIR/nested-type-ascription-syntactically-invalid.rs:24:15
|
LL | let a @ (b: u8);
| ^ expected one of `)`, `,`, `@`, or `|`
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `)`
--> $DIR/nested-type-ascription-syntactically-invalid.rs:25:19
--> $DIR/nested-type-ascription-syntactically-invalid.rs:24:19
|
LL | let a @ (b: u8);
| ^ expected one of 7 possible tokens
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `@`
--> $DIR/nested-type-ascription-syntactically-invalid.rs:32:15
--> $DIR/nested-type-ascription-syntactically-invalid.rs:31:15
|
LL | let a: T1 @ Outer(b: T2);
| ^ expected one of 7 possible tokens

View File

@ -2,7 +2,6 @@
// run-pass
#![feature(bindings_after_at)]
#![feature(box_patterns)]
#[derive(Debug, PartialEq)]

View File

@ -2,7 +2,6 @@
// run-pass
#![feature(bindings_after_at)]
#[derive(Debug, PartialEq)]
enum MatchArm {

View File

@ -2,7 +2,6 @@
// run-pass
#![feature(bindings_after_at)]
#[derive(Debug, PartialEq)]
enum MatchArm {

View File

@ -1,7 +1,6 @@
// Test that `binding @ subpat` acts as a product context with respect to duplicate binding names.
// The code that is tested here lives in resolve (see `resolve_pattern_inner`).
#![feature(bindings_after_at)]
fn main() {
fn f(a @ a @ a: ()) {}

View File

@ -1,59 +1,59 @@
error[E0415]: identifier `a` is bound more than once in this parameter list
--> $DIR/pat-at-same-name-both.rs:7:14
--> $DIR/pat-at-same-name-both.rs:6:14
|
LL | fn f(a @ a @ a: ()) {}
| ^ used as parameter more than once
error[E0415]: identifier `a` is bound more than once in this parameter list
--> $DIR/pat-at-same-name-both.rs:7:18
--> $DIR/pat-at-same-name-both.rs:6:18
|
LL | fn f(a @ a @ a: ()) {}
| ^ used as parameter more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:12:20
--> $DIR/pat-at-same-name-both.rs:11:20
|
LL | Ok(a @ b @ a)
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:14:23
--> $DIR/pat-at-same-name-both.rs:13:23
|
LL | | Err(a @ b @ a)
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:19:13
--> $DIR/pat-at-same-name-both.rs:18:13
|
LL | let a @ a @ a = ();
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:19:17
--> $DIR/pat-at-same-name-both.rs:18:17
|
LL | let a @ a @ a = ();
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:22:21
--> $DIR/pat-at-same-name-both.rs:21:21
|
LL | let ref a @ ref a = ();
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:24:29
--> $DIR/pat-at-same-name-both.rs:23:29
|
LL | let ref mut a @ ref mut a = ();
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:27:17
--> $DIR/pat-at-same-name-both.rs:26:17
|
LL | let a @ (Ok(a) | Err(a)) = Ok(());
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:27:26
--> $DIR/pat-at-same-name-both.rs:26:26
|
LL | let a @ (Ok(a) | Err(a)) = Ok(());
| ^ used in a pattern more than once

View File

@ -2,7 +2,6 @@
// run-pass
#![feature(bindings_after_at)]
#[derive(Debug, PartialEq)]
enum MatchArm {

View File

@ -4,8 +4,6 @@
// check-pass
#![feature(bindings_after_at)]
fn main() {
return;