slice_patterns: remove gates in tests
This commit is contained in:
parent
3e3cac010b
commit
a1eadca88f
116 changed files with 349 additions and 490 deletions
|
@ -1,5 +1,4 @@
|
|||
#![feature(box_syntax)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn move_out_from_end() {
|
||||
let a = [box 1, box 2];
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// run-pass
|
||||
|
||||
#![feature(slice_patterns, const_fn, const_if_match)]
|
||||
#![feature(const_fn, const_if_match)]
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
struct N(u8);
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
// run-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
struct N(u8);
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
// run-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#![allow(unreachable_patterns)]
|
||||
|
||||
use std::convert::identity;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn a() {
|
||||
let x = [1, 2, 3];
|
||||
match x {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn foldl<T, U, F>(values: &[T],
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// run-pass
|
||||
#![allow(unused_variables)]
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
pub fn main() {
|
||||
let x = &[1, 2, 3, 4, 5];
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn a() {
|
||||
let x = [1];
|
||||
match x {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
struct Foo {
|
||||
string: &'static str
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(never_type, never_type_fallback)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#![allow(unreachable_patterns)]
|
||||
#![allow(unreachable_code)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// run-pass
|
||||
// #47096
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
// Regression test for #47096.
|
||||
|
||||
fn foo(s: &[i32]) -> &[i32] {
|
||||
let &[ref xs @ ..] = s;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
let buf = &[0u8; 4];
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str {
|
||||
match (l1, l2) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
let x = [(), ()];
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Check that closure captures for slice patterns are inferred correctly
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
// run-pass
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// Check that closure captures for slice patterns are inferred correctly
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn arr_by_ref(mut x: [String; 3]) {
|
||||
let f = || {
|
||||
let [ref y, ref z @ ..] = x;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:9:13
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:7:13
|
||||
|
|
||||
LL | let f = || {
|
||||
| -- immutable borrow occurs here
|
||||
|
@ -13,7 +13,7 @@ LL | f();
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:18:13
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:16:13
|
||||
|
|
||||
LL | let mut f = || {
|
||||
| -- mutable borrow occurs here
|
||||
|
@ -27,7 +27,7 @@ LL | f();
|
|||
| - mutable borrow later used here
|
||||
|
||||
error[E0382]: borrow of moved value: `x`
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:27:5
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:25:5
|
||||
|
|
||||
LL | fn arr_by_move(x: [String; 3]) {
|
||||
| - move occurs because `x` has type `[std::string::String; 3]`, which does not implement the `Copy` trait
|
||||
|
@ -40,7 +40,7 @@ LL | &x;
|
|||
| ^^ value borrowed here after move
|
||||
|
||||
error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:35:13
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:33:13
|
||||
|
|
||||
LL | let f = || {
|
||||
| -- immutable borrow occurs here
|
||||
|
@ -54,7 +54,7 @@ LL | f();
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:44:13
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:42:13
|
||||
|
|
||||
LL | let mut f = || {
|
||||
| -- closure construction occurs here
|
||||
|
@ -68,7 +68,7 @@ LL | f();
|
|||
| - first borrow later used here
|
||||
|
||||
error[E0382]: borrow of moved value: `x`
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:53:5
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:51:5
|
||||
|
|
||||
LL | fn arr_box_by_move(x: Box<[String; 3]>) {
|
||||
| - move occurs because `x` has type `std::boxed::Box<[std::string::String; 3]>`, which does not implement the `Copy` trait
|
||||
|
@ -81,7 +81,7 @@ LL | &x;
|
|||
| ^^ value borrowed here after move
|
||||
|
||||
error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:61:13
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:59:13
|
||||
|
|
||||
LL | let f = || {
|
||||
| -- immutable borrow occurs here
|
||||
|
@ -95,7 +95,7 @@ LL | f();
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:70:13
|
||||
--> $DIR/borrowck-closures-slice-patterns.rs:68:13
|
||||
|
|
||||
LL | let mut f = || {
|
||||
| -- closure construction occurs here
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
pub struct Foo {
|
||||
x: u32
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-describe-lvalue.rs:258:13
|
||||
--> $DIR/borrowck-describe-lvalue.rs:256:13
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ first mutable borrow occurs here
|
||||
|
@ -9,7 +9,7 @@ LL | *y = 1;
|
|||
| ------ first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-describe-lvalue.rs:268:20
|
||||
--> $DIR/borrowck-describe-lvalue.rs:266:20
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ first mutable borrow occurs here
|
||||
|
@ -19,7 +19,7 @@ LL | *y = 1;
|
|||
| ------ first borrow later used here
|
||||
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/borrowck-describe-lvalue.rs:266:16
|
||||
--> $DIR/borrowck-describe-lvalue.rs:264:16
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
||||
|
@ -35,7 +35,7 @@ LL | | }
|
|||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
|
||||
error[E0503]: cannot use `f.x` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:41:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:39:9
|
||||
|
|
||||
LL | let x = f.x();
|
||||
| - borrow of `f` occurs here
|
||||
|
@ -45,7 +45,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `g.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:48:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:46:9
|
||||
|
|
||||
LL | let x = g.x();
|
||||
| - borrow of `g` occurs here
|
||||
|
@ -55,7 +55,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `h.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:55:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:53:9
|
||||
|
|
||||
LL | let x = &mut h.0;
|
||||
| -------- borrow of `h.0` occurs here
|
||||
|
@ -65,7 +65,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:63:20
|
||||
--> $DIR/borrowck-describe-lvalue.rs:61:20
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `e` occurs here
|
||||
|
@ -77,7 +77,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `u.a` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:71:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:69:9
|
||||
|
|
||||
LL | let x = &mut u.a;
|
||||
| -------- borrow of `u.a` occurs here
|
||||
|
@ -87,7 +87,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `f.x` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:78:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:76:9
|
||||
|
|
||||
LL | let x = f.x();
|
||||
| - borrow of `*f` occurs here
|
||||
|
@ -97,7 +97,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `g.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:85:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:83:9
|
||||
|
|
||||
LL | let x = g.x();
|
||||
| - borrow of `*g` occurs here
|
||||
|
@ -107,7 +107,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `h.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:92:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:90:9
|
||||
|
|
||||
LL | let x = &mut h.0;
|
||||
| -------- borrow of `h.0` occurs here
|
||||
|
@ -117,7 +117,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:100:20
|
||||
--> $DIR/borrowck-describe-lvalue.rs:98:20
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `*e` occurs here
|
||||
|
@ -129,7 +129,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `u.a` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:109:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:107:9
|
||||
|
|
||||
LL | let x = &mut u.a;
|
||||
| -------- borrow of `u.a` occurs here
|
||||
|
@ -139,7 +139,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:117:15
|
||||
--> $DIR/borrowck-describe-lvalue.rs:115:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -151,7 +151,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:122:18
|
||||
--> $DIR/borrowck-describe-lvalue.rs:120:18
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -163,7 +163,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:127:25
|
||||
--> $DIR/borrowck-describe-lvalue.rs:125:25
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -175,7 +175,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:132:28
|
||||
--> $DIR/borrowck-describe-lvalue.rs:130:28
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -187,7 +187,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:143:15
|
||||
--> $DIR/borrowck-describe-lvalue.rs:141:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -199,7 +199,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:148:18
|
||||
--> $DIR/borrowck-describe-lvalue.rs:146:18
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -211,7 +211,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:153:15
|
||||
--> $DIR/borrowck-describe-lvalue.rs:151:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -223,7 +223,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:158:18
|
||||
--> $DIR/borrowck-describe-lvalue.rs:156:18
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -235,7 +235,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:171:13
|
||||
--> $DIR/borrowck-describe-lvalue.rs:169:13
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ borrow of `e` occurs here
|
||||
|
@ -247,7 +247,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:171:18
|
||||
--> $DIR/borrowck-describe-lvalue.rs:169:18
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ mutable borrow occurs here
|
||||
|
@ -259,7 +259,7 @@ LL | drop(x);
|
|||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:175:23
|
||||
--> $DIR/borrowck-describe-lvalue.rs:173:23
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ mutable borrow occurs here
|
||||
|
@ -271,7 +271,7 @@ LL | drop(x);
|
|||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:188:22
|
||||
--> $DIR/borrowck-describe-lvalue.rs:186:22
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ mutable borrow occurs here
|
||||
|
@ -283,7 +283,7 @@ LL | drop(x);
|
|||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:194:28
|
||||
--> $DIR/borrowck-describe-lvalue.rs:192:28
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ mutable borrow occurs here
|
||||
|
@ -295,7 +295,7 @@ LL | drop(x);
|
|||
| - mutable borrow later used here
|
||||
|
||||
error[E0503]: cannot use `*v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:236:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:234:9
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -306,7 +306,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[_].y` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:236:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:234:9
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
|
@ -317,7 +317,7 @@ LL | drop(x);
|
|||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:247:24
|
||||
--> $DIR/borrowck-describe-lvalue.rs:245:24
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ mutable borrow occurs here
|
||||
|
@ -329,7 +329,7 @@ LL | drop(x);
|
|||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:210:29
|
||||
--> $DIR/borrowck-describe-lvalue.rs:208:29
|
||||
|
|
||||
LL | let x = &mut block;
|
||||
| ---------- mutable borrow occurs here
|
||||
|
@ -340,7 +340,7 @@ LL | drop(x);
|
|||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:225:33
|
||||
--> $DIR/borrowck-describe-lvalue.rs:223:33
|
||||
|
|
||||
LL | let x = &mut block;
|
||||
| ---------- mutable borrow occurs here
|
||||
|
@ -351,7 +351,7 @@ LL | drop(x);
|
|||
| - mutable borrow later used here
|
||||
|
||||
error[E0382]: use of moved value: `x`
|
||||
--> $DIR/borrowck-describe-lvalue.rs:278:22
|
||||
--> $DIR/borrowck-describe-lvalue.rs:276:22
|
||||
|
|
||||
LL | drop(x);
|
||||
| - value moved here
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn array() -> [(String, String); 3] {
|
||||
Default::default()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0382]: use of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:15:14
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:13:14
|
||||
|
|
||||
LL | [_, _, _x] => {}
|
||||
| -- value moved here
|
||||
|
@ -10,7 +10,7 @@ LL | [.., _y] => {}
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:25:14
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:23:14
|
||||
|
|
||||
LL | [_, _, (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -21,7 +21,7 @@ LL | [.., _y] => {}
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a[..].0`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:35:15
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:33:15
|
||||
|
|
||||
LL | [_, _, (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -32,7 +32,7 @@ LL | [.., (_y, _)] => {}
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:46:11
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:44:11
|
||||
|
|
||||
LL | [_x, _, _] => {}
|
||||
| -- value moved here
|
||||
|
@ -43,7 +43,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:57:11
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:55:11
|
||||
|
|
||||
LL | [.., _x] => {}
|
||||
| -- value moved here
|
||||
|
@ -54,7 +54,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:68:11
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:66:11
|
||||
|
|
||||
LL | [(_x, _), _, _] => {}
|
||||
| -- value moved here
|
||||
|
@ -65,7 +65,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:79:11
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:77:11
|
||||
|
|
||||
LL | [.., (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -76,7 +76,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a[..].0`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:91:11
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:89:11
|
||||
|
|
||||
LL | [_y @ .., _, _] => {}
|
||||
| ------- value moved here
|
||||
|
@ -87,7 +87,7 @@ LL | [(_x, _), _, _] => {}
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a[..].0`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:101:15
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:99:15
|
||||
|
|
||||
LL | [_, _, _y @ ..] => {}
|
||||
| ------- value moved here
|
||||
|
@ -98,7 +98,7 @@ LL | [.., (_x, _)] => {}
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:112:11
|
||||
--> $DIR/borrowck-move-out-from-array-match.rs:110:11
|
||||
|
|
||||
LL | [x @ .., _] => {}
|
||||
| ------ value moved here
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// Once the bug is fixed, the test, which is derived from a
|
||||
// passing test for `let` statements, should become check-pass.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn array() -> [(String, String); 3] {
|
||||
Default::default()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:19:11
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:17:11
|
||||
|
|
||||
LL | [_, _, _x] => {}
|
||||
| -- value moved here
|
||||
|
@ -10,7 +10,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:30:11
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:28:11
|
||||
|
|
||||
LL | [_, _, (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -21,7 +21,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:43:11
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:41:11
|
||||
|
|
||||
LL | [_x, _, _] => {}
|
||||
| -- value moved here
|
||||
|
@ -32,7 +32,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:54:11
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:52:11
|
||||
|
|
||||
LL | [.., _x] => {}
|
||||
| -- value moved here
|
||||
|
@ -43,7 +43,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:65:11
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:63:11
|
||||
|
|
||||
LL | [(_x, _), _, _] => {}
|
||||
| -- value moved here
|
||||
|
@ -54,7 +54,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:76:11
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:74:11
|
||||
|
|
||||
LL | [.., (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -65,7 +65,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:87:11
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11
|
||||
|
|
||||
LL | [_, _y @ ..] => {}
|
||||
| ------- value moved here
|
||||
|
@ -76,7 +76,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:98:11
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11
|
||||
|
|
||||
LL | [_y @ .., _] => {}
|
||||
| ------- value moved here
|
||||
|
@ -87,7 +87,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:111:11
|
||||
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11
|
||||
|
|
||||
LL | [x @ .., _, _] => {}
|
||||
| ------ value moved here
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn array() -> [(String, String); 3] {
|
||||
Default::default()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn array() -> [(String, String); 3] {
|
||||
Default::default()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0382]: borrow of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:15:14
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:13:14
|
||||
|
|
||||
LL | [_, _, _x] => {}
|
||||
| -- value moved here
|
||||
|
@ -10,7 +10,7 @@ LL | [.., ref _y] => {}
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:25:14
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:23:14
|
||||
|
|
||||
LL | [_, _, (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -21,7 +21,7 @@ LL | [.., ref _y] => {}
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a[..].0`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:35:15
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:33:15
|
||||
|
|
||||
LL | [_, _, (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -32,7 +32,7 @@ LL | [.., (ref _y, _)] => {}
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:46:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:44:11
|
||||
|
|
||||
LL | [_x, _, _] => {}
|
||||
| -- value moved here
|
||||
|
@ -43,7 +43,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:57:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:55:11
|
||||
|
|
||||
LL | [.., _x] => {}
|
||||
| -- value moved here
|
||||
|
@ -54,7 +54,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:68:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:66:11
|
||||
|
|
||||
LL | [(_x, _), _, _] => {}
|
||||
| -- value moved here
|
||||
|
@ -65,7 +65,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:79:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:77:11
|
||||
|
|
||||
LL | [.., (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -76,7 +76,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:91:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:89:11
|
||||
|
|
||||
LL | [_y @ .., _, _] => {}
|
||||
| ------- value moved here
|
||||
|
@ -87,7 +87,7 @@ LL | [(ref _x, _), _, _] => {}
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:101:15
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:99:15
|
||||
|
|
||||
LL | [_, _, _y @ ..] => {}
|
||||
| ------- value moved here
|
||||
|
@ -98,7 +98,7 @@ LL | [.., (ref _x, _)] => {}
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:112:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:110:11
|
||||
|
|
||||
LL | [x @ .., _] => {}
|
||||
| ------ value moved here
|
||||
|
@ -109,7 +109,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:125:5
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:123:5
|
||||
|
|
||||
LL | [_, _, _x] => {}
|
||||
| -- value moved here
|
||||
|
@ -120,7 +120,7 @@ LL | a[2] = Default::default();
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:133:5
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:131:5
|
||||
|
|
||||
LL | [_, _, (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -131,7 +131,7 @@ LL | a[2].1 = Default::default();
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:141:5
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:139:5
|
||||
|
|
||||
LL | [_, _, _x @ ..] => {}
|
||||
| ------- value moved here
|
||||
|
@ -142,7 +142,7 @@ LL | a[0] = Default::default();
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:149:5
|
||||
--> $DIR/borrowck-move-out-from-array-use-match.rs:147:5
|
||||
|
|
||||
LL | [_, _, _x @ ..] => {}
|
||||
| ------- value moved here
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// Once the bug is fixed, the test, which is derived from a
|
||||
// passing test for `let` statements, should become check-pass.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn array() -> [(String, String); 3] {
|
||||
Default::default()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:19:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:17:11
|
||||
|
|
||||
LL | [_, _, _x] => {}
|
||||
| -- value moved here
|
||||
|
@ -10,7 +10,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:30:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:28:11
|
||||
|
|
||||
LL | [_, _, (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -21,7 +21,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:43:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:41:11
|
||||
|
|
||||
LL | [_x, _, _] => {}
|
||||
| -- value moved here
|
||||
|
@ -32,7 +32,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:54:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:52:11
|
||||
|
|
||||
LL | [.., _x] => {}
|
||||
| -- value moved here
|
||||
|
@ -43,7 +43,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:65:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:63:11
|
||||
|
|
||||
LL | [(_x, _), _, _] => {}
|
||||
| -- value moved here
|
||||
|
@ -54,7 +54,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:76:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:74:11
|
||||
|
|
||||
LL | [.., (_x, _)] => {}
|
||||
| -- value moved here
|
||||
|
@ -65,7 +65,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:87:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11
|
||||
|
|
||||
LL | [_, _y @ ..] => {}
|
||||
| ------- value moved here
|
||||
|
@ -76,7 +76,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:98:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11
|
||||
|
|
||||
LL | [_y @ .., _] => {}
|
||||
| ------- value moved here
|
||||
|
@ -87,7 +87,7 @@ LL | match a {
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:111:11
|
||||
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11
|
||||
|
|
||||
LL | [x @ .., _, _] => {}
|
||||
| ------ value moved here
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn array() -> [(String, String); 3] {
|
||||
Default::default()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn array() -> [(String, String); 3] {
|
||||
Default::default()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0382]: borrow of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:12:14
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:10:14
|
||||
|
|
||||
LL | let [_, _, _x] = a;
|
||||
| -- value moved here
|
||||
|
@ -9,7 +9,7 @@ LL | let [.., ref _y] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:18:14
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:16:14
|
||||
|
|
||||
LL | let [_, _, (_x, _)] = a;
|
||||
| -- value moved here
|
||||
|
@ -19,7 +19,7 @@ LL | let [.., ref _y] = a;
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a[..].0`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:24:15
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:22:15
|
||||
|
|
||||
LL | let [_, _, (_x, _)] = a;
|
||||
| -- value moved here
|
||||
|
@ -29,7 +29,7 @@ LL | let [.., (ref _y, _)] = a;
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:32:10
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:30:10
|
||||
|
|
||||
LL | let [_x, _, _] = a;
|
||||
| -- value moved here
|
||||
|
@ -39,7 +39,7 @@ LL | let [ref _y @ .., _, _] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:38:16
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:36:16
|
||||
|
|
||||
LL | let [.., _x] = a;
|
||||
| -- value moved here
|
||||
|
@ -49,7 +49,7 @@ LL | let [_, _, ref _y @ ..] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:44:10
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:42:10
|
||||
|
|
||||
LL | let [(_x, _), _, _] = a;
|
||||
| -- value moved here
|
||||
|
@ -59,7 +59,7 @@ LL | let [ref _y @ .., _, _] = a;
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:50:16
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:48:16
|
||||
|
|
||||
LL | let [.., (_x, _)] = a;
|
||||
| -- value moved here
|
||||
|
@ -69,7 +69,7 @@ LL | let [_, _, ref _y @ ..] = a;
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:56:11
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:54:11
|
||||
|
|
||||
LL | let [_y @ .., _, _] = a;
|
||||
| ------- value moved here
|
||||
|
@ -79,7 +79,7 @@ LL | let [(ref _x, _), _, _] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:62:15
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:60:15
|
||||
|
|
||||
LL | let [_, _, _y @ ..] = a;
|
||||
| ------- value moved here
|
||||
|
@ -89,7 +89,7 @@ LL | let [.., (ref _x, _)] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: borrow of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:70:13
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:68:13
|
||||
|
|
||||
LL | let [x @ .., _] = a;
|
||||
| ------ value moved here
|
||||
|
@ -99,7 +99,7 @@ LL | let [_, ref _y @ ..] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:78:5
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:76:5
|
||||
|
|
||||
LL | let [_, _, _x] = a;
|
||||
| -- value moved here
|
||||
|
@ -109,7 +109,7 @@ LL | a[2] = Default::default();
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:84:5
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:82:5
|
||||
|
|
||||
LL | let [_, _, (_x, _)] = a;
|
||||
| -- value moved here
|
||||
|
@ -119,7 +119,7 @@ LL | a[2].1 = Default::default();
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:90:5
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:88:5
|
||||
|
|
||||
LL | let [_, _, _x @ ..] = a;
|
||||
| ------- value moved here
|
||||
|
@ -129,7 +129,7 @@ LL | a[0] = Default::default();
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:96:5
|
||||
--> $DIR/borrowck-move-out-from-array-use.rs:94:5
|
||||
|
|
||||
LL | let [_, _, _x @ ..] = a;
|
||||
| ------- value moved here
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn array() -> [(String, String); 3] {
|
||||
Default::default()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0382]: use of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:12:14
|
||||
--> $DIR/borrowck-move-out-from-array.rs:10:14
|
||||
|
|
||||
LL | let [_, _, _x] = a;
|
||||
| -- value moved here
|
||||
|
@ -9,7 +9,7 @@ LL | let [.., _y] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a[..]`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:18:14
|
||||
--> $DIR/borrowck-move-out-from-array.rs:16:14
|
||||
|
|
||||
LL | let [_, _, (_x, _)] = a;
|
||||
| -- value moved here
|
||||
|
@ -19,7 +19,7 @@ LL | let [.., _y] = a;
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a[..].0`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:24:15
|
||||
--> $DIR/borrowck-move-out-from-array.rs:22:15
|
||||
|
|
||||
LL | let [_, _, (_x, _)] = a;
|
||||
| -- value moved here
|
||||
|
@ -29,7 +29,7 @@ LL | let [.., (_y, _)] = a;
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:32:10
|
||||
--> $DIR/borrowck-move-out-from-array.rs:30:10
|
||||
|
|
||||
LL | let [_x, _, _] = a;
|
||||
| -- value moved here
|
||||
|
@ -39,7 +39,7 @@ LL | let [_y @ .., _, _] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:38:16
|
||||
--> $DIR/borrowck-move-out-from-array.rs:36:16
|
||||
|
|
||||
LL | let [.., _x] = a;
|
||||
| -- value moved here
|
||||
|
@ -49,7 +49,7 @@ LL | let [_, _, _y @ ..] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:44:10
|
||||
--> $DIR/borrowck-move-out-from-array.rs:42:10
|
||||
|
|
||||
LL | let [(_x, _), _, _] = a;
|
||||
| -- value moved here
|
||||
|
@ -59,7 +59,7 @@ LL | let [_y @ .., _, _] = a;
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:50:16
|
||||
--> $DIR/borrowck-move-out-from-array.rs:48:16
|
||||
|
|
||||
LL | let [.., (_x, _)] = a;
|
||||
| -- value moved here
|
||||
|
@ -69,7 +69,7 @@ LL | let [_, _, _y @ ..] = a;
|
|||
= note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a[..].0`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:56:11
|
||||
--> $DIR/borrowck-move-out-from-array.rs:54:11
|
||||
|
|
||||
LL | let [_y @ .., _, _] = a;
|
||||
| ------- value moved here
|
||||
|
@ -79,7 +79,7 @@ LL | let [(_x, _), _, _] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a[..].0`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:62:15
|
||||
--> $DIR/borrowck-move-out-from-array.rs:60:15
|
||||
|
|
||||
LL | let [_, _, _y @ ..] = a;
|
||||
| ------- value moved here
|
||||
|
@ -89,7 +89,7 @@ LL | let [.., (_x, _)] = a;
|
|||
= note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `a`
|
||||
--> $DIR/borrowck-move-out-from-array.rs:70:13
|
||||
--> $DIR/borrowck-move-out-from-array.rs:68:13
|
||||
|
|
||||
LL | let [x @ .., _] = a;
|
||||
| ------ value moved here
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// Test that we do not permit moves from &[] matched by a vec pattern.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Foo {
|
||||
string: String
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0508]: cannot move out of type `[Foo]`, a non-copy slice
|
||||
--> $DIR/borrowck-move-out-of-vec-tail.rs:19:19
|
||||
--> $DIR/borrowck-move-out-of-vec-tail.rs:17:19
|
||||
|
|
||||
LL | match tail {
|
||||
| ^^^^ cannot move out of here
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn nop(_s: &[& i32]) {}
|
||||
fn nop_subslice(_s: &[i32]) {}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn nop(_s: &[& i32]) {}
|
||||
fn nop_subslice(_s: &[i32]) {}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:8:13
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:6:13
|
||||
|
|
||||
LL | let [ref first, ref second, ..] = *s;
|
||||
| ---------- immutable borrow occurs here
|
||||
|
@ -9,7 +9,7 @@ LL | nop(&[first, second, second2, third]);
|
|||
| ------ immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:14:14
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:12:14
|
||||
|
|
||||
LL | let [.., ref fourth, ref third, _, ref first] = *s;
|
||||
| --------- immutable borrow occurs here
|
||||
|
@ -19,7 +19,7 @@ LL | nop(&[first, third, third2, fourth]);
|
|||
| ----- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:21:16
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:19:16
|
||||
|
|
||||
LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s;
|
||||
| ------------- immutable borrow occurs here
|
||||
|
@ -30,7 +30,7 @@ LL | nop(&[from_begin2, from_end1, from_end3, from_end4]);
|
|||
| --------- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:23:19
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:21:19
|
||||
|
|
||||
LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s;
|
||||
| ------------- immutable borrow occurs here
|
||||
|
@ -41,7 +41,7 @@ LL | nop(&[from_begin3, from_end1, from_end3, from_end4]);
|
|||
| --------- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:28:14
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:26:14
|
||||
|
|
||||
LL | let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s;
|
||||
| --------------- immutable borrow occurs here
|
||||
|
@ -52,7 +52,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
|
|||
| ----------- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:34:13
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:32:13
|
||||
|
|
||||
LL | let [ref first, ref second, ..] = *s;
|
||||
| ---------- immutable borrow occurs here
|
||||
|
@ -62,7 +62,7 @@ LL | nop(&[first, second]);
|
|||
| ------ immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:41:10
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:39:10
|
||||
|
|
||||
LL | let [.., ref second, ref first] = *s;
|
||||
| ---------- immutable borrow occurs here
|
||||
|
@ -72,7 +72,7 @@ LL | nop(&[first, second]);
|
|||
| ------ immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:48:10
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:46:10
|
||||
|
|
||||
LL | let [_, ref s1 @ ..] = *s;
|
||||
| ----------- immutable borrow occurs here
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// run-pass
|
||||
// compile-flags: -Z borrowck=mir
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn mut_head_tail<'a, A>(v: &'a mut [A]) -> Option<(&'a mut A, &'a mut [A])> {
|
||||
match *v {
|
||||
[ref mut head, ref mut tail @ ..] => {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn nop(_s: &[& i32]) {}
|
||||
fn nop_subslice(_s: &[i32]) {}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn nop(_s: &[& i32]) {}
|
||||
fn nop_subslice(_s: &[i32]) {}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:8:20
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:6:20
|
||||
|
|
||||
LL | if let [ref first, ref second, ..] = *s {
|
||||
| ---------- immutable borrow occurs here
|
||||
|
@ -9,7 +9,7 @@ LL | nop(&[first, second, second2, third]);
|
|||
| ------ immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:16:21
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:14:21
|
||||
|
|
||||
LL | if let [.., ref fourth, ref third, _, ref first] = *s {
|
||||
| --------- immutable borrow occurs here
|
||||
|
@ -19,7 +19,7 @@ LL | nop(&[first, third, third2, fourth]);
|
|||
| ----- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:24:20
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:22:20
|
||||
|
|
||||
LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
|
||||
| ------------- immutable borrow occurs here
|
||||
|
@ -29,7 +29,7 @@ LL | nop(&[from_begin1, from_end1, from_end3, from_end4]);
|
|||
| --------- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:27:23
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:25:23
|
||||
|
|
||||
LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
|
||||
| ------------- immutable borrow occurs here
|
||||
|
@ -40,7 +40,7 @@ LL | nop(&[from_begin2, from_end1, from_end3, from_end4]);
|
|||
| --------- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:30:26
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:28:26
|
||||
|
|
||||
LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s {
|
||||
| ------------- immutable borrow occurs here
|
||||
|
@ -51,7 +51,7 @@ LL | nop(&[from_begin3, from_end1, from_end3, from_end4]);
|
|||
| --------- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:35:21
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:33:21
|
||||
|
|
||||
LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
|
||||
| --------------- immutable borrow occurs here
|
||||
|
@ -61,7 +61,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end2]);
|
|||
| ----------- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:38:21
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:36:21
|
||||
|
|
||||
LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
|
||||
| --------------- immutable borrow occurs here
|
||||
|
@ -72,7 +72,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]);
|
|||
| ----------- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:41:21
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:39:21
|
||||
|
|
||||
LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s {
|
||||
| --------------- immutable borrow occurs here
|
||||
|
@ -83,7 +83,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end4]);
|
|||
| ----------- immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:49:20
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:47:20
|
||||
|
|
||||
LL | if let [ref first, ref second, ..] = *s {
|
||||
| ---------- immutable borrow occurs here
|
||||
|
@ -93,7 +93,7 @@ LL | nop(&[first, second]);
|
|||
| ------ immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:58:17
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:56:17
|
||||
|
|
||||
LL | if let [.., ref second, ref first] = *s {
|
||||
| ---------- immutable borrow occurs here
|
||||
|
@ -103,7 +103,7 @@ LL | nop(&[first, second]);
|
|||
| ------ immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:67:17
|
||||
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:65:17
|
||||
|
|
||||
LL | if let [_, _, _, ref s1 @ ..] = *s {
|
||||
| ----------- immutable borrow occurs here
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn a<'a>() -> &'a [isize] {
|
||||
let vec = vec![1, 2, 3, 4];
|
||||
let vec: &[isize] = &vec;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0515]: cannot return value referencing local variable `vec`
|
||||
--> $DIR/borrowck-vec-pattern-element-loan.rs:10:5
|
||||
--> $DIR/borrowck-vec-pattern-element-loan.rs:8:5
|
||||
|
|
||||
LL | let vec: &[isize] = &vec;
|
||||
| ---- `vec` is borrowed here
|
||||
|
@ -8,7 +8,7 @@ LL | tail
|
|||
| ^^^^ returns a value referencing data owned by the current function
|
||||
|
||||
error[E0515]: cannot return value referencing local variable `vec`
|
||||
--> $DIR/borrowck-vec-pattern-element-loan.rs:20:5
|
||||
--> $DIR/borrowck-vec-pattern-element-loan.rs:18:5
|
||||
|
|
||||
LL | let vec: &[isize] = &vec;
|
||||
| ---- `vec` is borrowed here
|
||||
|
@ -17,7 +17,7 @@ LL | init
|
|||
| ^^^^ returns a value referencing data owned by the current function
|
||||
|
||||
error[E0515]: cannot return value referencing local variable `vec`
|
||||
--> $DIR/borrowck-vec-pattern-element-loan.rs:30:5
|
||||
--> $DIR/borrowck-vec-pattern-element-loan.rs:28:5
|
||||
|
|
||||
LL | let vec: &[isize] = &vec;
|
||||
| ---- `vec` is borrowed here
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn a() {
|
||||
let mut v = vec![1, 2, 3];
|
||||
let vb: &mut [isize] = &mut v;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0499]: cannot borrow `v` as mutable more than once at a time
|
||||
--> $DIR/borrowck-vec-pattern-loan-from-mut.rs:8:13
|
||||
--> $DIR/borrowck-vec-pattern-loan-from-mut.rs:6:13
|
||||
|
|
||||
LL | let vb: &mut [isize] = &mut v;
|
||||
| ------ first mutable borrow occurs here
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
// http://rust-lang.org/COPYRIGHT.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
let mut a = [1, 2, 3, 4];
|
||||
let t = match a {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0506]: cannot assign to `a[_]` because it is borrowed
|
||||
--> $DIR/borrowck-vec-pattern-move-tail.rs:12:5
|
||||
--> $DIR/borrowck-vec-pattern-move-tail.rs:8:5
|
||||
|
|
||||
LL | [1, 2, ref tail @ ..] => tail,
|
||||
| ------------- borrow of `a[_]` occurs here
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn a() {
|
||||
let mut vec = [box 1, box 2, box 3];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0506]: cannot assign to `vec[_]` because it is borrowed
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:10:13
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:9:13
|
||||
|
|
||||
LL | [box ref _a, _, _] => {
|
||||
| ------ borrow of `vec[_]` occurs here
|
||||
|
@ -11,7 +11,7 @@ LL | _a.use_ref();
|
|||
| -- borrow later used here
|
||||
|
||||
error[E0506]: cannot assign to `vec[_]` because it is borrowed
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:24:13
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:23:13
|
||||
|
|
||||
LL | &mut [ref _b @ ..] => {
|
||||
| ----------- borrow of `vec[_]` occurs here
|
||||
|
@ -23,7 +23,7 @@ LL | _b.use_ref();
|
|||
| -- borrow later used here
|
||||
|
||||
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:35:11
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:34:11
|
||||
|
|
||||
LL | match vec {
|
||||
| ^^^ cannot move out of here
|
||||
|
@ -45,7 +45,7 @@ LL | ] => {
|
|||
|
|
||||
|
||||
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:47:13
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:46:13
|
||||
|
|
||||
LL | let a = vec[0];
|
||||
| ^^^^^^
|
||||
|
@ -55,7 +55,7 @@ LL | let a = vec[0];
|
|||
| help: consider borrowing here: `&vec[0]`
|
||||
|
||||
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:56:11
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:55:11
|
||||
|
|
||||
LL | match vec {
|
||||
| ^^^ cannot move out of here
|
||||
|
@ -74,7 +74,7 @@ LL | _b] => {}
|
|||
|
|
||||
|
||||
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:66:13
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:65:13
|
||||
|
|
||||
LL | let a = vec[0];
|
||||
| ^^^^^^
|
||||
|
@ -84,7 +84,7 @@ LL | let a = vec[0];
|
|||
| help: consider borrowing here: `&vec[0]`
|
||||
|
||||
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:75:11
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:74:11
|
||||
|
|
||||
LL | match vec {
|
||||
| ^^^ cannot move out of here
|
||||
|
@ -100,7 +100,7 @@ LL | &mut [_a, _b, _c] => {}
|
|||
= note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
|
||||
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:86:13
|
||||
--> $DIR/borrowck-vec-pattern-nesting.rs:85:13
|
||||
|
|
||||
LL | let a = vec[0];
|
||||
| ^^^^^^
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn a<'a>() -> &'a isize {
|
||||
let vec = vec![1, 2, 3, 4];
|
||||
let vec: &[isize] = &vec;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0515]: cannot return value referencing local variable `vec`
|
||||
--> $DIR/borrowck-vec-pattern-tail-element-loan.rs:10:5
|
||||
--> $DIR/borrowck-vec-pattern-tail-element-loan.rs:8:5
|
||||
|
|
||||
LL | let vec: &[isize] = &vec;
|
||||
| ---- `vec` is borrowed here
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// check-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
match &[0, 1] as &[i32] {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
// edition:2018
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
#![allow(unused)]
|
||||
|
||||
use std::{
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
// run-pass
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
|
||||
#![feature(generators, generator_trait, untagged_unions)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::mem::ManuallyDrop;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
let r = &[1, 2];
|
||||
match r {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0528]: pattern requires at least 3 elements but array has 2
|
||||
--> $DIR/E0528.rs:6:10
|
||||
--> $DIR/E0528.rs:4:10
|
||||
|
|
||||
LL | &[a, b, c, rest @ ..] => {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ pattern cannot match array of 2 elements
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
// run-pass
|
||||
// pretty-expanded FIXME #23616
|
||||
|
||||
#![allow(non_shorthand_field_patterns)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_variables)]
|
||||
// pretty-expanded FIXME #23616
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
struct Foo(isize, isize, isize, isize);
|
||||
struct Bar{a: isize, b: isize, c: isize, d: isize}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error: unreachable pattern
|
||||
--> $DIR/issue-12369.rs:10:9
|
||||
--> $DIR/issue-12369.rs:9:9
|
||||
|
|
||||
LL | &[10,a, ref rest @ ..] => 10
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-12369.rs:2:9
|
||||
--> $DIR/issue-12369.rs:1:9
|
||||
|
|
||||
LL | #![deny(unreachable_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) {
|
||||
match (l1, l2) {
|
||||
//~^ ERROR: cannot move out of type `[T]`, a non-copy slice
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0508]: cannot move out of type `[T]`, a non-copy slice
|
||||
--> $DIR/issue-12567.rs:4:11
|
||||
--> $DIR/issue-12567.rs:2:11
|
||||
|
|
||||
LL | match (l1, l2) {
|
||||
| ^^^^^^^^ cannot move out of here
|
||||
|
@ -13,7 +13,7 @@ LL | (&[hd1, ..], &[hd2, ..])
|
|||
= note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
|
||||
error[E0508]: cannot move out of type `[T]`, a non-copy slice
|
||||
--> $DIR/issue-12567.rs:4:11
|
||||
--> $DIR/issue-12567.rs:2:11
|
||||
|
|
||||
LL | match (l1, l2) {
|
||||
| ^^^^^^^^ cannot move out of here
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
let mut x: &[_] = &[1, 2, 3, 4];
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
assert_eq!(count_members(&[1, 2, 3, 4]), 4);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
assert_eq!(match [0u8; 1024] {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// run-pass
|
||||
// Test that we do not ICE when pattern matching an array against a slice.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
// Test that we do not ICE when pattern matching an array against a slice.
|
||||
|
||||
fn main() {
|
||||
match "foo".as_bytes() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
pub struct History<'a> { pub _s: &'a str }
|
||||
|
||||
impl<'a> History<'a> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0515]: cannot return value referencing function parameter
|
||||
--> $DIR/issue-26619.rs:7:76
|
||||
--> $DIR/issue-26619.rs:5:76
|
||||
|
|
||||
LL | for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) {
|
||||
| -------- ^^^^^^^^^^^^^^^^^^^^^ returns a value referencing data owned by the current function
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// check-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn check(list: &[u8]) {
|
||||
match list {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
use std::ops::Add;
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
match "foo".to_string() {
|
||||
['f', 'o', ..] => {}
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
error[E0425]: cannot find value `does_not_exist` in this scope
|
||||
--> $DIR/match-vec-mismatch.rs:28:11
|
||||
--> $DIR/match-vec-mismatch.rs:26:11
|
||||
|
|
||||
LL | match does_not_exist {
|
||||
| ^^^^^^^^^^^^^^ not found in this scope
|
||||
|
||||
error[E0529]: expected an array or slice, found `std::string::String`
|
||||
--> $DIR/match-vec-mismatch.rs:5:9
|
||||
--> $DIR/match-vec-mismatch.rs:3:9
|
||||
|
|
||||
LL | ['f', 'o', ..] => {}
|
||||
| ^^^^^^^^^^^^^^ pattern cannot match with input type `std::string::String`
|
||||
|
||||
error[E0527]: pattern requires 1 element but array has 3
|
||||
--> $DIR/match-vec-mismatch.rs:20:9
|
||||
--> $DIR/match-vec-mismatch.rs:18:9
|
||||
|
|
||||
LL | [0] => {},
|
||||
| ^^^ expected 3 elements
|
||||
|
||||
error[E0528]: pattern requires at least 4 elements but array has 3
|
||||
--> $DIR/match-vec-mismatch.rs:25:9
|
||||
--> $DIR/match-vec-mismatch.rs:23:9
|
||||
|
|
||||
LL | [0, 1, 2, 3, x @ ..] => {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/match-vec-mismatch.rs:36:9
|
||||
--> $DIR/match-vec-mismatch.rs:34:9
|
||||
|
|
||||
LL | [] => {}
|
||||
| ^^ cannot infer type
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// Ensure that we cannot move out of a reference to a fixed-size array
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
struct D { _x: u8 }
|
||||
|
||||
impl Drop for D { fn drop(&mut self) { } }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0508]: cannot move out of type `[D; 4]`, a non-copy array
|
||||
--> $DIR/move-out-of-array-ref.rs:10:24
|
||||
--> $DIR/move-out-of-array-ref.rs:8:24
|
||||
|
|
||||
LL | let [_, e, _, _] = *a;
|
||||
| - ^^
|
||||
|
@ -10,7 +10,7 @@ LL | let [_, e, _, _] = *a;
|
|||
| move occurs because `e` has type `D`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0508]: cannot move out of type `[D; 4]`, a non-copy array
|
||||
--> $DIR/move-out-of-array-ref.rs:15:27
|
||||
--> $DIR/move-out-of-array-ref.rs:13:27
|
||||
|
|
||||
LL | let [_, s @ .. , _] = *a;
|
||||
| ------ ^^
|
||||
|
@ -21,7 +21,7 @@ LL | let [_, s @ .. , _] = *a;
|
|||
| move occurs because `s` has type `[D; 2]`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0508]: cannot move out of type `[D; 4]`, a non-copy array
|
||||
--> $DIR/move-out-of-array-ref.rs:20:24
|
||||
--> $DIR/move-out-of-array-ref.rs:18:24
|
||||
|
|
||||
LL | let [_, e, _, _] = *a;
|
||||
| - ^^
|
||||
|
@ -32,7 +32,7 @@ LL | let [_, e, _, _] = *a;
|
|||
| move occurs because `e` has type `D`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0508]: cannot move out of type `[D; 4]`, a non-copy array
|
||||
--> $DIR/move-out-of-array-ref.rs:25:27
|
||||
--> $DIR/move-out-of-array-ref.rs:23:27
|
||||
|
|
||||
LL | let [_, s @ .. , _] = *a;
|
||||
| ------ ^^
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#![feature(or_patterns)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#![allow(incomplete_features)]
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#![feature(or_patterns)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#![allow(incomplete_features)]
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#![feature(or_patterns)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#![allow(incomplete_features)]
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ fn main() {
|
|||
match a {
|
||||
[1, tail @ .., tail @ ..] => {},
|
||||
//~^ ERROR identifier `tail` is bound more than once in the same pattern
|
||||
//~| ERROR subslice patterns are unstable
|
||||
//~| ERROR subslice patterns are unstable
|
||||
//~| ERROR `..` can only be used once per slice pattern
|
||||
_ => ()
|
||||
}
|
||||
|
|
|
@ -4,24 +4,6 @@ error[E0416]: identifier `tail` is bound more than once in the same pattern
|
|||
LL | [1, tail @ .., tail @ ..] => {},
|
||||
| ^^^^ used in a pattern more than once
|
||||
|
||||
error[E0658]: subslice patterns are unstable
|
||||
--> $DIR/match-vec-invalid.rs:4:13
|
||||
|
|
||||
LL | [1, tail @ .., tail @ ..] => {},
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/62254
|
||||
= help: add `#![feature(slice_patterns)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: subslice patterns are unstable
|
||||
--> $DIR/match-vec-invalid.rs:4:24
|
||||
|
|
||||
LL | [1, tail @ .., tail @ ..] => {},
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/62254
|
||||
= help: add `#![feature(slice_patterns)]` to the crate attributes to enable
|
||||
|
||||
error: `..` can only be used once per slice pattern
|
||||
--> $DIR/match-vec-invalid.rs:4:31
|
||||
|
|
||||
|
@ -31,12 +13,12 @@ LL | [1, tail @ .., tail @ ..] => {},
|
|||
| previously used here
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/match-vec-invalid.rs:13:30
|
||||
--> $DIR/match-vec-invalid.rs:11:30
|
||||
|
|
||||
LL | const RECOVERY_WITNESS: () = 0;
|
||||
| ^ expected `()`, found integer
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0416, E0658.
|
||||
Some errors have detailed explanations: E0308, E0416.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
|
|
@ -4,7 +4,6 @@ fn main() {
|
|||
|
||||
let Test(&desc[..]) = x;
|
||||
//~^ ERROR: expected one of `)`, `,`, `@`, or `|`, found `[`
|
||||
//~^^ ERROR subslice patterns are unstable
|
||||
}
|
||||
|
||||
const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types
|
||||
|
|
|
@ -7,22 +7,12 @@ LL | let Test(&desc[..]) = x;
|
|||
| expected one of `)`, `,`, `@`, or `|`
|
||||
| help: missing `,`
|
||||
|
||||
error[E0658]: subslice patterns are unstable
|
||||
--> $DIR/pat-lt-bracket-6.rs:5:20
|
||||
|
|
||||
LL | let Test(&desc[..]) = x;
|
||||
| ^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/62254
|
||||
= help: add `#![feature(slice_patterns)]` to the crate attributes to enable
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/pat-lt-bracket-6.rs:10:30
|
||||
--> $DIR/pat-lt-bracket-6.rs:9:30
|
||||
|
|
||||
LL | const RECOVERY_WITNESS: () = 0;
|
||||
| ^ expected `()`, found integer
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0658.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// Test that moving on both sides of an `@` pattern is not allowed.
|
||||
|
||||
#![feature(bindings_after_at)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
struct U; // Not copy!
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-move-and-move.rs:12:9
|
||||
--> $DIR/borrowck-move-and-move.rs:11:9
|
||||
|
|
||||
LL | let a @ b = U;
|
||||
| ^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-move-and-move.rs:16:9
|
||||
--> $DIR/borrowck-move-and-move.rs:15:9
|
||||
|
|
||||
LL | let a @ (b, c) = (U, U);
|
||||
| ^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-move-and-move.rs:20:9
|
||||
--> $DIR/borrowck-move-and-move.rs:19:9
|
||||
|
|
||||
LL | let a @ (b, c) = (u(), u());
|
||||
| ^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-move-and-move.rs:25:9
|
||||
--> $DIR/borrowck-move-and-move.rs:24:9
|
||||
|
|
||||
LL | a @ Ok(b) | a @ Err(b) => {}
|
||||
| ^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-move-and-move.rs:25:21
|
||||
--> $DIR/borrowck-move-and-move.rs:24:21
|
||||
|
|
||||
LL | a @ Ok(b) | a @ Err(b) => {}
|
||||
| ^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-move-and-move.rs:37:9
|
||||
--> $DIR/borrowck-move-and-move.rs:36:9
|
||||
|
|
||||
LL | xs @ [a, .., b] => {}
|
||||
| ^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-move-and-move.rs:43:9
|
||||
--> $DIR/borrowck-move-and-move.rs:42:9
|
||||
|
|
||||
LL | xs @ [_, ys @ .., _] => {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-move-and-move.rs:32:12
|
||||
--> $DIR/borrowck-move-and-move.rs:31:12
|
||||
|
|
||||
LL | fn fun(a @ b: U) {}
|
||||
| ^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-move-and-move.rs:12:13
|
||||
--> $DIR/borrowck-move-and-move.rs:11:13
|
||||
|
|
||||
LL | let a @ b = U;
|
||||
| ----^ - move occurs because value has type `main::U`, which does not implement the `Copy` trait
|
||||
|
@ -56,7 +56,7 @@ LL | let a @ b = U;
|
|||
| 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 `(main::U, main::U)`, which does not implement the `Copy` trait
|
||||
|
@ -65,7 +65,7 @@ LL | let a @ (b, c) = (U, U);
|
|||
| value moved here
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-move-and-move.rs:20:17
|
||||
--> $DIR/borrowck-move-and-move.rs:19:17
|
||||
|
|
||||
LL | let a @ (b, c) = (u(), u());
|
||||
| --------^- ---------- move occurs because value has type `(main::U, main::U)`, which does not implement the `Copy` trait
|
||||
|
@ -74,7 +74,7 @@ LL | let a @ (b, c) = (u(), u());
|
|||
| 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 | match Ok(U) {
|
||||
| ----- move occurs because value has type `std::result::Result<main::U, main::U>`, which does not implement the `Copy` trait
|
||||
|
@ -85,7 +85,7 @@ LL | a @ Ok(b) | a @ Err(b) => {}
|
|||
| value moved here
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-move-and-move.rs:25:29
|
||||
--> $DIR/borrowck-move-and-move.rs:24:29
|
||||
|
|
||||
LL | match Ok(U) {
|
||||
| ----- move occurs because value has type `std::result::Result<main::U, main::U>`, which does not implement the `Copy` trait
|
||||
|
@ -96,7 +96,7 @@ LL | a @ Ok(b) | a @ Err(b) => {}
|
|||
| value moved here
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-move-and-move.rs:37:22
|
||||
--> $DIR/borrowck-move-and-move.rs:36:22
|
||||
|
|
||||
LL | match [u(), u(), u(), u()] {
|
||||
| -------------------- move occurs because value has type `[main::U; 4]`, which does not implement the `Copy` trait
|
||||
|
@ -107,7 +107,7 @@ LL | xs @ [a, .., b] => {}
|
|||
| value moved here
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-move-and-move.rs:43:18
|
||||
--> $DIR/borrowck-move-and-move.rs:42:18
|
||||
|
|
||||
LL | match [u(), u(), u(), u()] {
|
||||
| -------------------- move occurs because value has type `[main::U; 4]`, which does not implement the `Copy` trait
|
||||
|
@ -118,7 +118,7 @@ LL | xs @ [_, ys @ .., _] => {}
|
|||
| value moved here
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-move-and-move.rs:32:16
|
||||
--> $DIR/borrowck-move-and-move.rs:31:16
|
||||
|
|
||||
LL | fn fun(a @ b: U) {}
|
||||
| ----^
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#![feature(bindings_after_at)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
struct C;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#![feature(bindings_after_at)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
struct C;
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:17:9
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:16:9
|
||||
|
|
||||
LL | let a @ box &b = Box::new(&C);
|
||||
| ^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:21:9
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:20:9
|
||||
|
|
||||
LL | let a @ box b = Box::new(C);
|
||||
| ^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:33:25
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:32:25
|
||||
|
|
||||
LL | match Box::new(C) { a @ box b => {} }
|
||||
| ^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0009]: cannot bind by-move and by-ref in the same pattern
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:37:21
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:36:21
|
||||
|
|
||||
LL | let ref a @ box b = Box::new(NC);
|
||||
| ------------^
|
||||
|
@ -26,7 +26,7 @@ LL | let ref a @ box b = Box::new(NC);
|
|||
| by-ref pattern here
|
||||
|
||||
error: cannot borrow `a` 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 occurs here
|
||||
|
||||
error: cannot borrow `a` 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);
|
||||
| -----^^^^^^^---------
|
||||
|
@ -44,7 +44,7 @@ LL | let ref a @ box ref mut b = Box::new(NC);
|
|||
| immutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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);
|
||||
| -----^^^^^^^---------
|
||||
|
@ -53,7 +53,7 @@ LL | let ref a @ box ref mut b = Box::new(NC);
|
|||
| immutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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);
|
||||
| -----^^^^^^^---------
|
||||
|
@ -62,7 +62,7 @@ LL | let ref a @ box ref mut b = Box::new(NC);
|
|||
| immutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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);
|
||||
| ---------^^^^^^^-----
|
||||
|
@ -71,7 +71,7 @@ LL | let ref mut a @ box ref b = Box::new(NC);
|
|||
| mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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 => {
|
||||
| ---------^^^^^^^-----
|
||||
|
@ -80,7 +80,7 @@ LL | ref mut a @ box ref b => {
|
|||
| mutable borrow occurs here
|
||||
|
||||
error[E0009]: cannot bind by-move and by-ref in the same pattern
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:75:38
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:74:38
|
||||
|
|
||||
LL | box [Ok(a), ref xs @ .., Err(b)] => {}
|
||||
| ----------- ^ by-move pattern here
|
||||
|
@ -88,7 +88,7 @@ LL | box [Ok(a), ref xs @ .., Err(b)] => {}
|
|||
| by-ref pattern here
|
||||
|
||||
error[E0009]: cannot bind by-move and by-ref in the same pattern
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:81:46
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:80:46
|
||||
|
|
||||
LL | [Ok(box ref a), ref xs @ .., Err(box b), Err(box ref mut c)] => {}
|
||||
| ----- ----------- ^ --------- by-ref pattern here
|
||||
|
@ -98,19 +98,19 @@ LL | [Ok(box ref a), ref xs @ .., Err(box b), Err(box ref mut c)] => {}
|
|||
| by-ref pattern here
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:25:11
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:24:11
|
||||
|
|
||||
LL | fn f1(a @ box &b: Box<&C>) {}
|
||||
| ^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:29:11
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:28:11
|
||||
|
|
||||
LL | fn f2(a @ box b: Box<C>) {}
|
||||
| ^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error: cannot borrow `a` 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>) {
|
||||
| ---------^^^^^^^-----
|
||||
|
@ -119,7 +119,7 @@ LL | fn f5(ref mut a @ box ref b: Box<NC>) {
|
|||
| mutable borrow occurs here
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:17:18
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:16:18
|
||||
|
|
||||
LL | let a @ box &b = Box::new(&C);
|
||||
| ---------^ ------------ move occurs because value has type `std::boxed::Box<&C>`, which does not implement the `Copy` trait
|
||||
|
@ -128,7 +128,7 @@ LL | let a @ box &b = Box::new(&C);
|
|||
| value moved here
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:21:17
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:20:17
|
||||
|
|
||||
LL | let a @ box b = Box::new(C);
|
||||
| --------^ ----------- move occurs because value has type `std::boxed::Box<C>`, which does not implement the `Copy` trait
|
||||
|
@ -137,7 +137,7 @@ LL | let a @ box b = Box::new(C);
|
|||
| value moved here
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:33:33
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:32:33
|
||||
|
|
||||
LL | match Box::new(C) { a @ box b => {} }
|
||||
| ----------- --------^
|
||||
|
@ -147,7 +147,7 @@ LL | match Box::new(C) { a @ box b => {} }
|
|||
| move occurs because value has type `std::boxed::Box<C>`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0502]: cannot borrow `_` 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);
|
||||
| ------------^^^^^^^^^
|
||||
|
@ -159,7 +159,7 @@ LL | drop(a);
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `_` 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);
|
||||
| ----------------^^^^^
|
||||
|
@ -171,7 +171,7 @@ LL | *a = Box::new(NC);
|
|||
| -- mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `_` 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 => {
|
||||
| ----------------^^^^^
|
||||
|
@ -183,7 +183,7 @@ LL | *a = Box::new(NC);
|
|||
| -- mutable borrow later used here
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:25:20
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:24:20
|
||||
|
|
||||
LL | fn f1(a @ box &b: Box<&C>) {}
|
||||
| ---------^
|
||||
|
@ -193,7 +193,7 @@ LL | fn f1(a @ box &b: Box<&C>) {}
|
|||
| move occurs because value has type `std::boxed::Box<&C>`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:29:19
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:28:19
|
||||
|
|
||||
LL | fn f2(a @ box b: Box<C>) {}
|
||||
| --------^
|
||||
|
@ -203,7 +203,7 @@ LL | fn f2(a @ box b: Box<C>) {}
|
|||
| move occurs because value has type `std::boxed::Box<C>`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0502]: cannot borrow `_` 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>) {
|
||||
| ----------------^^^^^
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
// Test `Copy` bindings in the rhs of `@` patterns.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
#![feature(bindings_after_at)]
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// of an `@` pattern according to NLL borrowck.
|
||||
|
||||
#![feature(bindings_after_at)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
struct U; // Not copy!
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#![feature(bindings_after_at)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
enum Option<T> {
|
||||
None,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: cannot borrow `z` 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) => {
|
||||
| ---------^^^^^^^^^^^^^-----^
|
||||
|
@ -8,7 +8,7 @@ LL | ref mut z @ &mut Some(ref a) => {
|
|||
| mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:32:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:31: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 occurs here
|
||||
|
||||
error: cannot borrow `b` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:32:22
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:31: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:36:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:9
|
||||
|
|
||||
LL | let ref a @ ref mut b = U;
|
||||
| -----^^^---------
|
||||
|
@ -36,7 +36,7 @@ LL | let ref a @ ref mut b = U;
|
|||
| immutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:38:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9
|
||||
|
|
||||
LL | let ref mut a @ ref b = U;
|
||||
| ---------^^^-----
|
||||
|
@ -45,7 +45,7 @@ LL | let ref mut a @ ref b = U;
|
|||
| mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:40:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:39: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:42:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:41: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 occurs here
|
||||
|
||||
error: cannot borrow `a` 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 = u();
|
||||
| ---------^^^-----
|
||||
|
@ -74,7 +74,7 @@ LL | let ref mut a @ ref b = u();
|
|||
| mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:50:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:49:9
|
||||
|
|
||||
LL | let ref a @ ref mut b = u();
|
||||
| -----^^^---------
|
||||
|
@ -83,7 +83,7 @@ LL | let ref a @ ref mut b = u();
|
|||
| immutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:56:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:55:9
|
||||
|
|
||||
LL | let ref mut a @ ref b = U;
|
||||
| ---------^^^-----
|
||||
|
@ -92,7 +92,7 @@ LL | let ref mut a @ ref b = U;
|
|||
| mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:60:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:59:9
|
||||
|
|
||||
LL | let ref a @ ref mut b = U;
|
||||
| -----^^^---------
|
||||
|
@ -101,7 +101,7 @@ LL | let ref a @ ref mut b = U;
|
|||
| immutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:66:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:65: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:66:33
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:65: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:75:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:74: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:75:33
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:74: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:86:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:85: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:86:33
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:85: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:93:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:92: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:93:33
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:92: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:100:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:99: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:100:33
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:99: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:107: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:33
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:107: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:116:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:115: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:121:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:120: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:128:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:127: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:133:9
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:132: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 occurs here
|
||||
|
||||
error: cannot borrow `a` 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) {}
|
||||
| -----^^^---------
|
||||
|
@ -258,7 +258,7 @@ LL | fn f1(ref a @ ref mut b: U) {}
|
|||
| immutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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) {}
|
||||
| ---------^^^-----
|
||||
|
@ -267,7 +267,7 @@ LL | fn f2(ref mut a @ ref b: U) {}
|
|||
| mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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]) {}
|
||||
| -----^^^^^^^^^^^----------------^^^^^^^^
|
||||
|
@ -276,7 +276,7 @@ LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {}
|
|||
| immutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `_` 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) => {
|
||||
| ----------------------^^^^^-
|
||||
|
@ -288,7 +288,7 @@ LL | **z = None;
|
|||
| ---------- mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:45:21
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:44:21
|
||||
|
|
||||
LL | let ref mut a @ ref b = u();
|
||||
| ------------^^^^^
|
||||
|
@ -300,7 +300,7 @@ LL | *a = u();
|
|||
| -------- mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:50:17
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:49:17
|
||||
|
|
||||
LL | let ref a @ ref mut b = u();
|
||||
| --------^^^^^^^^^
|
||||
|
@ -312,7 +312,7 @@ LL | drop(a);
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:75:20
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:20
|
||||
|
|
||||
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
|
||||
| -----------^^^^^^^^^-
|
||||
|
@ -324,7 +324,7 @@ LL | drop(a);
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:75:45
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:45
|
||||
|
|
||||
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
|
||||
| ------------^^^^^^^^^-
|
||||
|
@ -336,7 +336,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:86:61
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:61
|
||||
|
|
||||
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
|
||||
| ^^^^^^ cannot assign
|
||||
|
@ -344,7 +344,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:93:61
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:61
|
||||
|
|
||||
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
|
||||
| ^^^^^^^^^^^ cannot assign
|
||||
|
@ -352,7 +352,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:100:66
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:99: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 main::U`, which does not implement the `Copy` trait
|
||||
|
@ -360,7 +360,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:100:66
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:99: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 main::U`, which does not implement the `Copy` trait
|
||||
|
@ -368,7 +368,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:108:66
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:107: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<main::U, main::U>`, which does not implement the `Copy` trait
|
||||
|
@ -376,7 +376,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:108:66
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:107: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<main::U, main::U>`, which does not implement the `Copy` trait
|
||||
|
@ -384,7 +384,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 `_` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:121:18
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:18
|
||||
|
|
||||
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
||||
| ---------^^^^^^^^^------------
|
||||
|
@ -396,7 +396,7 @@ LL | drop(a);
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:121:29
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:29
|
||||
|
|
||||
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
||||
| --------------------^^^^^^^^^-
|
||||
|
@ -408,7 +408,7 @@ LL | drop(a);
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:128:18
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:18
|
||||
|
|
||||
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
||||
| ---------^^^^^^^^^------------
|
||||
|
@ -420,7 +420,7 @@ LL | drop(a);
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:128:29
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:29
|
||||
|
|
||||
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
||||
| --------------------^^^^^^^^^-
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// Test that `ref mut x @ ref mut y` and varieties of that are not allowed.
|
||||
|
||||
#![feature(bindings_after_at)]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
struct U;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:25:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:24: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:28: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 occurs here
|
||||
|
||||
error: cannot borrow `a` 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;
|
||||
| ---------^^^---------
|
||||
|
@ -26,7 +26,7 @@ LL | let ref mut a @ ref mut b = U;
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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;
|
||||
| ---------^^^---------
|
||||
|
@ -35,7 +35,7 @@ LL | let ref mut a @ ref mut b = U;
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:38: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 occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:43:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:42:9
|
||||
|
|
||||
LL | let ref mut a @ (
|
||||
| ^--------
|
||||
|
@ -66,7 +66,7 @@ LL | | ) = (U, [U, U, U]);
|
|||
| |_____^
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:53:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:52:9
|
||||
|
|
||||
LL | let ref mut a @ (
|
||||
| ^--------
|
||||
|
@ -88,31 +88,31 @@ LL | | ) = (u(), [u(), u(), u()]);
|
|||
| |_________^
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:63:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:62:9
|
||||
|
|
||||
LL | let a @ (ref mut b, ref mut c) = (U, U);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:67:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:66:9
|
||||
|
|
||||
LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
|
||||
| ^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:71:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:70:9
|
||||
|
|
||||
LL | let a @ &mut ref mut b = &mut U;
|
||||
| ^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error[E0007]: cannot bind by-move with sub-bindings
|
||||
--> $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, ref mut c) = &mut (U, U);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:79:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:78:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^---------^
|
||||
|
@ -121,7 +121,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:79:37
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:78:37
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^^---------^
|
||||
|
@ -130,7 +130,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:85:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:84:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^---------^
|
||||
|
@ -139,7 +139,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:85:37
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:84:37
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^^---------^
|
||||
|
@ -148,7 +148,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:92:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:91:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^---------^
|
||||
|
@ -157,7 +157,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:92:37
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:91:37
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^^---------^
|
||||
|
@ -166,7 +166,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:104:9
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:103:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^---------^
|
||||
|
@ -175,7 +175,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:104:37
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:103:37
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^^---------^
|
||||
|
@ -184,7 +184,7 @@ LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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) {}
|
||||
| ---------^^^---------
|
||||
|
@ -193,7 +193,7 @@ LL | fn f1(ref mut a @ ref mut b: U) {}
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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) {}
|
||||
| ---------^^^---------
|
||||
|
@ -202,7 +202,7 @@ LL | fn f2(ref mut a @ ref mut b: U) {}
|
|||
| first mutable borrow occurs here
|
||||
|
||||
error: cannot borrow `a` 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 @ [
|
||||
| ^--------
|
||||
|
@ -220,7 +220,7 @@ LL | | ] : [[U; 4]; 5]
|
|||
| |_________^
|
||||
|
||||
error[E0499]: cannot borrow `_` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:25:21
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:24:21
|
||||
|
|
||||
LL | let ref mut a @ ref mut b = U;
|
||||
| ------------^^^^^^^^^
|
||||
|
@ -232,7 +232,7 @@ LL | drop(a);
|
|||
| - first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `_` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:35:21
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:34:21
|
||||
|
|
||||
LL | let ref mut a @ ref mut b = U;
|
||||
| ------------^^^^^^^^^
|
||||
|
@ -244,7 +244,7 @@ LL | *a = U;
|
|||
| ------ first borrow later used here
|
||||
|
||||
error[E0382]: borrow of moved value
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:63:25
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:62:25
|
||||
|
|
||||
LL | let a @ (ref mut b, ref mut c) = (U, U);
|
||||
| ----------------^^^^^^^^^- ------ move occurs because value has type `(main::U, main::U)`, which does not implement the `Copy` trait
|
||||
|
@ -253,7 +253,7 @@ LL | let a @ (ref mut b, ref mut c) = (U, U);
|
|||
| value moved here
|
||||
|
||||
error[E0382]: borrow of moved value
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:67:21
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:66:21
|
||||
|
|
||||
LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
|
||||
| ------------^-- -------- move occurs because value has type `&mut (main::U, [main::U; 2])`, which does not implement the `Copy` trait
|
||||
|
@ -262,7 +262,7 @@ LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
|
|||
| value moved here
|
||||
|
||||
error[E0382]: borrow of moved value
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:71:18
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:70:18
|
||||
|
|
||||
LL | let a @ &mut ref mut b = &mut U;
|
||||
| ---------^^^^^^^^^ ------ move occurs because value has type `&mut main::U`, which does not implement the `Copy` trait
|
||||
|
@ -271,7 +271,7 @@ LL | let a @ &mut ref mut b = &mut U;
|
|||
| value moved here
|
||||
|
||||
error[E0382]: borrow of moved value
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:74:30
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:73:30
|
||||
|
|
||||
LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
|
||||
| ---------------------^^^^^^^^^- ----------- move occurs because value has type `&mut (main::U, main::U)`, which does not implement the `Copy` trait
|
||||
|
@ -280,7 +280,7 @@ LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
|
|||
| value moved here
|
||||
|
||||
error[E0499]: cannot borrow `_` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:92:24
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:91:24
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------------^^^^^^^^^-
|
||||
|
@ -292,7 +292,7 @@ LL | *a = Err(U);
|
|||
| ----------- first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `_` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:92:53
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:91:53
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ----------------^^^^^^^^^-
|
||||
|
@ -304,7 +304,7 @@ LL | *a = Err(U);
|
|||
| ----------- first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `_` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:104:24
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:103:24
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------------^^^^^^^^^-
|
||||
|
@ -316,7 +316,7 @@ LL | drop(a);
|
|||
| - first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `_` as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:104:53
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:103:53
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ----------------^^^^^^^^^-
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
// This used to cause a stack overflow in the compiler.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
const LARGE_SIZE: usize = 1024 * 1024;
|
||||
let [..] = [0u8; LARGE_SIZE];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// check-pass
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
const C0: &'static [u8] = b"\x00";
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
error: unreachable pattern
|
||||
--> $DIR/match-byte-array-patterns.rs:9:9
|
||||
--> $DIR/match-byte-array-patterns.rs:8:9
|
||||
|
|
||||
LL | &[0x41, 0x41, 0x41, 0x41] => {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/match-byte-array-patterns.rs:2:9
|
||||
--> $DIR/match-byte-array-patterns.rs:1:9
|
||||
|
|
||||
LL | #![deny(unreachable_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/match-byte-array-patterns.rs:15:9
|
||||
--> $DIR/match-byte-array-patterns.rs:14:9
|
||||
|
|
||||
LL | b"AAAA" => {},
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/match-byte-array-patterns.rs:21:9
|
||||
--> $DIR/match-byte-array-patterns.rs:20:9
|
||||
|
|
||||
LL | b"AAAA" => {},
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/match-byte-array-patterns.rs:27:9
|
||||
--> $DIR/match-byte-array-patterns.rs:26:9
|
||||
|
|
||||
LL | b"AAAA" => {},
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/match-byte-array-patterns.rs:35:9
|
||||
--> $DIR/match-byte-array-patterns.rs:34:9
|
||||
|
|
||||
LL | &[0x41, 0x41, 0x41, 0x41] => {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/match-byte-array-patterns.rs:41:9
|
||||
--> $DIR/match-byte-array-patterns.rs:40:9
|
||||
|
|
||||
LL | b"AAAA" => {},
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/match-byte-array-patterns.rs:47:9
|
||||
--> $DIR/match-byte-array-patterns.rs:46:9
|
||||
|
|
||||
LL | b"AAAA" => {},
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/match-byte-array-patterns.rs:53:9
|
||||
--> $DIR/match-byte-array-patterns.rs:52:9
|
||||
|
|
||||
LL | b"AAAA" => {},
|
||||
| ^^^^^^^
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
|
||||
fn check(list: &[Option<()>]) {
|
||||
match list {
|
||||
//~^ ERROR `&[_, Some(_), .., None, _]` not covered
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0004]: non-exhaustive patterns: `&[_, Some(_), .., None, _]` not covered
|
||||
--> $DIR/match-slice-patterns.rs:4:11
|
||||
--> $DIR/match-slice-patterns.rs:2:11
|
||||
|
|
||||
LL | match list {
|
||||
| ^^^^ pattern `&[_, Some(_), .., None, _]` not covered
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(slice_patterns)]
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
error: unreachable pattern
|
||||
--> $DIR/match-vec-unreachable.rs:9:9
|
||||
--> $DIR/match-vec-unreachable.rs:8:9
|
||||
|
|
||||
LL | [(1, 2), (2, 3), b] => (),
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/match-vec-unreachable.rs:2:9
|
||||
--> $DIR/match-vec-unreachable.rs:1:9
|
||||
|
|
||||
LL | #![deny(unreachable_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/match-vec-unreachable.rs:19:9
|
||||
--> $DIR/match-vec-unreachable.rs:18:9
|
||||
|
|
||||
LL | [_, _, _, _, _] => { }
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/match-vec-unreachable.rs:27:9
|
||||
--> $DIR/match-vec-unreachable.rs:26:9
|
||||
|
|
||||
LL | ['a', 'b', 'c'] => {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue