about summary refs log tree commit diff
path: root/tests/ui/rfc-2005-default-binding-mode
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfc-2005-default-binding-mode')
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs24
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr14
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/const.rs17
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/const.stderr18
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/enum.rs22
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/enum.stderr21
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/explicit-mut.rs28
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/explicit-mut.stderr21
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/for.rs9
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/for.stderr17
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/issue-44912-or.rs10
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr9
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/lit.rs24
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/lit.stderr25
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/no-double-error.rs11
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/no-double-error.stderr9
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/slice.rs7
-rw-r--r--tests/ui/rfc-2005-default-binding-mode/slice.stderr16
18 files changed, 0 insertions, 302 deletions
diff --git a/tests/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs b/tests/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs
deleted file mode 100644
index 54ab9f0ad33..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#[derive(Copy, Clone, Debug, Eq, PartialEq)]
-pub struct Foo {
-}
-
-impl Foo {
-    fn get(&self) -> Option<&Result<String, String>> {
-        None
-    }
-
-    fn mutate(&mut self) { }
-}
-
-fn main() {
-    let mut foo = Foo { };
-
-    // foo.get() returns type Option<&Result<String, String>>, so
-    // using `string` keeps borrow of `foo` alive. Hence calling
-    // `foo.mutate()` should be an error.
-    while let Some(Ok(string)) = foo.get() {
-        foo.mutate();
-        //~^ ERROR cannot borrow `foo` as mutable
-        println!("foo={:?}", *string);
-    }
-}
diff --git a/tests/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr b/tests/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
deleted file mode 100644
index b7c0b0bb6b9..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
-  --> $DIR/borrowck-issue-49631.rs:20:9
-   |
-LL |     while let Some(Ok(string)) = foo.get() {
-   |                                  --------- immutable borrow occurs here
-LL |         foo.mutate();
-   |         ^^^^^^^^^^^^ mutable borrow occurs here
-LL |
-LL |         println!("foo={:?}", *string);
-   |                              ------- immutable borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0502`.
diff --git a/tests/ui/rfc-2005-default-binding-mode/const.rs b/tests/ui/rfc-2005-default-binding-mode/const.rs
deleted file mode 100644
index 93df880408d..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/const.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// FIXME(tschottdorf): this test should pass.
-
-#[derive(PartialEq, Eq)]
-struct Foo {
-    bar: i32,
-}
-
-const FOO: Foo = Foo{bar: 5};
-
-fn main() {
-    let f = Foo{bar:6};
-
-    match &f {
-        FOO => {}, //~ ERROR mismatched types
-        _ => panic!(),
-    }
-}
diff --git a/tests/ui/rfc-2005-default-binding-mode/const.stderr b/tests/ui/rfc-2005-default-binding-mode/const.stderr
deleted file mode 100644
index fc06de90a00..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/const.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/const.rs:14:9
-   |
-LL | const FOO: Foo = Foo{bar: 5};
-   | -------------- constant defined here
-...
-LL |     match &f {
-   |           -- this expression has type `&Foo`
-LL |         FOO => {},
-   |         ^^^
-   |         |
-   |         expected `&Foo`, found `Foo`
-   |         `FOO` is interpreted as a constant, not a new binding
-   |         help: introduce a new binding instead: `other_foo`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfc-2005-default-binding-mode/enum.rs b/tests/ui/rfc-2005-default-binding-mode/enum.rs
deleted file mode 100644
index 4e57769d6e2..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/enum.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-enum Wrapper {
-    Wrap(i32),
-}
-
-use Wrapper::Wrap;
-
-pub fn main() {
-    let Wrap(x) = &Wrap(3);
-    *x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
-
-
-    if let Some(x) = &Some(3) {
-        *x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
-    } else {
-        panic!();
-    }
-
-    while let Some(x) = &Some(3) {
-        *x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
-        break;
-    }
-}
diff --git a/tests/ui/rfc-2005-default-binding-mode/enum.stderr b/tests/ui/rfc-2005-default-binding-mode/enum.stderr
deleted file mode 100644
index 21e3d3d273d..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/enum.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0594]: cannot assign to `*x`, which is behind a `&` reference
-  --> $DIR/enum.rs:9:5
-   |
-LL |     *x += 1;
-   |     ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `*x`, which is behind a `&` reference
-  --> $DIR/enum.rs:13:9
-   |
-LL |         *x += 1;
-   |         ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `*x`, which is behind a `&` reference
-  --> $DIR/enum.rs:19:9
-   |
-LL |         *x += 1;
-   |         ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0594`.
diff --git a/tests/ui/rfc-2005-default-binding-mode/explicit-mut.rs b/tests/ui/rfc-2005-default-binding-mode/explicit-mut.rs
deleted file mode 100644
index b8fde2208ac..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/explicit-mut.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Verify the binding mode shifts - only when no `&` are auto-dereferenced is the
-// final default binding mode mutable.
-
-fn main() {
-    match &&Some(5i32) {
-        Some(n) => {
-            *n += 1; //~ ERROR cannot assign to `*n`, which is behind a `&` reference
-            let _ = n;
-        }
-        None => {},
-    };
-
-    match &mut &Some(5i32) {
-        Some(n) => {
-            *n += 1; //~ ERROR cannot assign to `*n`, which is behind a `&` reference
-            let _ = n;
-        }
-        None => {},
-    };
-
-    match &&mut Some(5i32) {
-        Some(n) => {
-            *n += 1; //~ ERROR cannot assign to `*n`, which is behind a `&` reference
-            let _ = n;
-        }
-        None => {},
-    };
-}
diff --git a/tests/ui/rfc-2005-default-binding-mode/explicit-mut.stderr b/tests/ui/rfc-2005-default-binding-mode/explicit-mut.stderr
deleted file mode 100644
index c3f64f65a41..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/explicit-mut.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0594]: cannot assign to `*n`, which is behind a `&` reference
-  --> $DIR/explicit-mut.rs:7:13
-   |
-LL |             *n += 1;
-   |             ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `*n`, which is behind a `&` reference
-  --> $DIR/explicit-mut.rs:15:13
-   |
-LL |             *n += 1;
-   |             ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written
-
-error[E0594]: cannot assign to `*n`, which is behind a `&` reference
-  --> $DIR/explicit-mut.rs:23:13
-   |
-LL |             *n += 1;
-   |             ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0594`.
diff --git a/tests/ui/rfc-2005-default-binding-mode/for.rs b/tests/ui/rfc-2005-default-binding-mode/for.rs
deleted file mode 100644
index d6c5a13b1bd..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/for.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-struct Foo {}
-
-pub fn main() {
-    let mut tups = vec![(Foo {}, Foo {})];
-    // The below desugars to &(ref n, mut m).
-    for (n, mut m) in &tups {
-        //~^ ERROR cannot move out of a shared reference
-    }
-}
diff --git a/tests/ui/rfc-2005-default-binding-mode/for.stderr b/tests/ui/rfc-2005-default-binding-mode/for.stderr
deleted file mode 100644
index 07991af6ef9..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/for.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0507]: cannot move out of a shared reference
-  --> $DIR/for.rs:6:23
-   |
-LL |     for (n, mut m) in &tups {
-   |             -----     ^^^^^
-   |             |
-   |             data moved here
-   |             move occurs because `m` has type `Foo`, which does not implement the `Copy` trait
-   |
-help: consider borrowing the pattern binding
-   |
-LL |     for (n, ref mut m) in &tups {
-   |             +++
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/rfc-2005-default-binding-mode/issue-44912-or.rs b/tests/ui/rfc-2005-default-binding-mode/issue-44912-or.rs
deleted file mode 100644
index b4a0d8145c1..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/issue-44912-or.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// FIXME(tschottdorf): This should compile. See #44912.
-
-pub fn main() {
-    let x = &Some((3, 3));
-    let _: &i32 = match x {
-        Some((x, 3)) | &Some((ref x, 5)) => x,
-        //~^ ERROR is bound inconsistently
-        _ => &5i32,
-    };
-}
diff --git a/tests/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr b/tests/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr
deleted file mode 100644
index e1e1bf7f6d9..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0409]: variable `x` is bound inconsistently across alternatives separated by `|`
-  --> $DIR/issue-44912-or.rs:6:35
-   |
-LL |         Some((x, 3)) | &Some((ref x, 5)) => x,
-   |               - first binding     ^ bound in different ways
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0409`.
diff --git a/tests/ui/rfc-2005-default-binding-mode/lit.rs b/tests/ui/rfc-2005-default-binding-mode/lit.rs
deleted file mode 100644
index ce79cfbdc1a..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/lit.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// FIXME(tschottdorf): we want these to compile, but they don't.
-
-fn with_str() {
-    let s: &'static str = "abc";
-
-    match &s {
-            "abc" => true, //~ ERROR mismatched types
-            _ => panic!(),
-    };
-}
-
-fn with_bytes() {
-    let s: &'static [u8] = b"abc";
-
-    match &s {
-        b"abc" => true, //~ ERROR mismatched types
-        _ => panic!(),
-    };
-}
-
-pub fn main() {
-    with_str();
-    with_bytes();
-}
diff --git a/tests/ui/rfc-2005-default-binding-mode/lit.stderr b/tests/ui/rfc-2005-default-binding-mode/lit.stderr
deleted file mode 100644
index 181f57899a9..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/lit.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/lit.rs:7:13
-   |
-LL |     match &s {
-   |           -- this expression has type `&&str`
-LL |             "abc" => true,
-   |             ^^^^^ expected `&&str`, found `&str`
-   |
-   = note: expected reference `&&str`
-              found reference `&'static str`
-
-error[E0308]: mismatched types
-  --> $DIR/lit.rs:16:9
-   |
-LL |     match &s {
-   |           -- this expression has type `&&[u8]`
-LL |         b"abc" => true,
-   |         ^^^^^^ expected `&&[u8]`, found `&[u8; 3]`
-   |
-   = note: expected reference `&&[u8]`
-              found reference `&'static [u8; 3]`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfc-2005-default-binding-mode/no-double-error.rs b/tests/ui/rfc-2005-default-binding-mode/no-double-error.rs
deleted file mode 100644
index 46fdfd678cc..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/no-double-error.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Without caching type lookups in FnCtxt.resolve_ty_and_def_ufcs
-// the error below would be reported twice (once when checking
-// for a non-ref pattern, once when processing the pattern).
-
-fn main() {
-    let foo = 22;
-    match foo {
-        u32::XXX => { } //~ ERROR no associated item named
-        _ => { }
-    }
-}
diff --git a/tests/ui/rfc-2005-default-binding-mode/no-double-error.stderr b/tests/ui/rfc-2005-default-binding-mode/no-double-error.stderr
deleted file mode 100644
index c672acee040..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/no-double-error.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0599]: no associated item named `XXX` found for type `u32` in the current scope
-  --> $DIR/no-double-error.rs:8:14
-   |
-LL |         u32::XXX => { }
-   |              ^^^ associated item not found in `u32`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/rfc-2005-default-binding-mode/slice.rs b/tests/ui/rfc-2005-default-binding-mode/slice.rs
deleted file mode 100644
index 363a0e3e649..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/slice.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-pub fn main() {
-    let sl: &[u8] = b"foo";
-
-    match sl { //~ ERROR non-exhaustive patterns
-        [first, remainder @ ..] => {},
-    };
-}
diff --git a/tests/ui/rfc-2005-default-binding-mode/slice.stderr b/tests/ui/rfc-2005-default-binding-mode/slice.stderr
deleted file mode 100644
index 5b51dc5acc4..00000000000
--- a/tests/ui/rfc-2005-default-binding-mode/slice.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0004]: non-exhaustive patterns: `&[]` not covered
-  --> $DIR/slice.rs:4:11
-   |
-LL |     match sl {
-   |           ^^ pattern `&[]` not covered
-   |
-   = note: the matched value is of type `&[u8]`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
-   |
-LL ~         [first, remainder @ ..] => {},
-LL ~         &[] => todo!(),
-   |
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0004`.