summaryrefslogtreecommitdiffstats
path: root/src/test/ui/rfc-2005-default-binding-mode
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/rfc-2005-default-binding-mode
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/rfc-2005-default-binding-mode')
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs24
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr14
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/const.rs17
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/const.stderr18
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/enum.rs22
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/enum.stderr21
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs28
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr21
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/for.rs9
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/for.stderr12
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs10
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr9
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/lit.rs24
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/lit.stderr25
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs11
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr9
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/slice.rs7
-rw-r--r--src/test/ui/rfc-2005-default-binding-mode/slice.stderr16
18 files changed, 0 insertions, 297 deletions
diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs
deleted file mode 100644
index 54ab9f0ad..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
deleted file mode 100644
index b7c0b0bb6..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/const.rs b/src/test/ui/rfc-2005-default-binding-mode/const.rs
deleted file mode 100644
index 93df88040..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/const.stderr b/src/test/ui/rfc-2005-default-binding-mode/const.stderr
deleted file mode 100644
index 0f5671254..000000000
--- a/src/test/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 struct `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/src/test/ui/rfc-2005-default-binding-mode/enum.rs b/src/test/ui/rfc-2005-default-binding-mode/enum.rs
deleted file mode 100644
index 4e57769d6..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/enum.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr
deleted file mode 100644
index 21e3d3d27..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs
deleted file mode 100644
index b8fde2208..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr
deleted file mode 100644
index c3f64f65a..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/for.rs b/src/test/ui/rfc-2005-default-binding-mode/for.rs
deleted file mode 100644
index d6c5a13b1..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/for.stderr b/src/test/ui/rfc-2005-default-binding-mode/for.stderr
deleted file mode 100644
index 9cc20a7bf..000000000
--- a/src/test/ui/rfc-2005-default-binding-mode/for.stderr
+++ /dev/null
@@ -1,12 +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
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs
deleted file mode 100644
index b4a0d8145..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr
deleted file mode 100644
index e1e1bf7f6..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/lit.rs b/src/test/ui/rfc-2005-default-binding-mode/lit.rs
deleted file mode 100644
index ce79cfbdc..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/lit.stderr b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr
deleted file mode 100644
index 11bc170cd..000000000
--- a/src/test/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 array `[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/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs
deleted file mode 100644
index 46fdfd678..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr
deleted file mode 100644
index c672acee0..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/slice.rs b/src/test/ui/rfc-2005-default-binding-mode/slice.rs
deleted file mode 100644
index 363a0e3e6..000000000
--- a/src/test/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/src/test/ui/rfc-2005-default-binding-mode/slice.stderr b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr
deleted file mode 100644
index 60c1f5420..000000000
--- a/src/test/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`.