summaryrefslogtreecommitdiffstats
path: root/src/test/ui/btreemap
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /src/test/ui/btreemap
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/btreemap')
-rw-r--r--src/test/ui/btreemap/btreemap-index-mut.rs6
-rw-r--r--src/test/ui/btreemap/btreemap-index-mut.stderr19
-rw-r--r--src/test/ui/btreemap/btreemap_dropck.rs16
-rw-r--r--src/test/ui/btreemap/btreemap_dropck.stderr13
-rw-r--r--src/test/ui/btreemap/btreemap_into_iterator_lifetime.rs23
5 files changed, 0 insertions, 77 deletions
diff --git a/src/test/ui/btreemap/btreemap-index-mut.rs b/src/test/ui/btreemap/btreemap-index-mut.rs
deleted file mode 100644
index 62972acab..000000000
--- a/src/test/ui/btreemap/btreemap-index-mut.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-use std::collections::BTreeMap;
-
-fn main() {
- let mut map = BTreeMap::<u32, u32>::new();
- map[&0] = 1; //~ ERROR cannot assign
-}
diff --git a/src/test/ui/btreemap/btreemap-index-mut.stderr b/src/test/ui/btreemap/btreemap-index-mut.stderr
deleted file mode 100644
index 26f2a4c4b..000000000
--- a/src/test/ui/btreemap/btreemap-index-mut.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0594]: cannot assign to data in an index of `BTreeMap<u32, u32>`
- --> $DIR/btreemap-index-mut.rs:5:5
- |
-LL | map[&0] = 1;
- | ^^^^^^^^^^^ cannot assign
- |
- = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap<u32, u32>`
-help: to modify a `BTreeMap<u32, u32>`, use `.get_mut()`, `.insert()` or the entry API
- |
-LL | map.insert(&0, 1);
- | ~~~~~~~~ ~ +
-LL | map.get_mut(&0).map(|val| { *val = 1; });
- | ~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ++++
-LL | let val = map.entry(&0).or_insert(1);
- | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ +
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/btreemap/btreemap_dropck.rs b/src/test/ui/btreemap/btreemap_dropck.rs
deleted file mode 100644
index c58727df3..000000000
--- a/src/test/ui/btreemap/btreemap_dropck.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-struct PrintOnDrop<'a>(&'a str);
-
-impl Drop for PrintOnDrop<'_> {
- fn drop(&mut self) {
- println!("printint: {}", self.0);
- }
-}
-
-use std::collections::BTreeMap;
-use std::iter::FromIterator;
-
-fn main() {
- let s = String::from("Hello World!");
- let _map = BTreeMap::from_iter([((), PrintOnDrop(&s))]);
- drop(s); //~ ERROR cannot move out of `s` because it is borrowed
-}
diff --git a/src/test/ui/btreemap/btreemap_dropck.stderr b/src/test/ui/btreemap/btreemap_dropck.stderr
deleted file mode 100644
index e953e7ae8..000000000
--- a/src/test/ui/btreemap/btreemap_dropck.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0505]: cannot move out of `s` because it is borrowed
- --> $DIR/btreemap_dropck.rs:15:10
- |
-LL | let _map = BTreeMap::from_iter([((), PrintOnDrop(&s))]);
- | -- borrow of `s` occurs here
-LL | drop(s);
- | ^ move out of `s` occurs here
-LL | }
- | - borrow might be used here, when `_map` is dropped and runs the `Drop` code for type `BTreeMap`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/btreemap/btreemap_into_iterator_lifetime.rs b/src/test/ui/btreemap/btreemap_into_iterator_lifetime.rs
deleted file mode 100644
index fda825bc6..000000000
--- a/src/test/ui/btreemap/btreemap_into_iterator_lifetime.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// check-pass
-
-use std::collections::{BTreeMap, HashMap};
-
-trait Map
-where
- for<'a> &'a Self: IntoIterator<Item = (&'a Self::Key, &'a Self::Value)>,
-{
- type Key;
- type Value;
-}
-
-impl<K, V> Map for HashMap<K, V> {
- type Key = K;
- type Value = V;
-}
-
-impl<K, V> Map for BTreeMap<K, V> {
- type Key = K;
- type Value = V;
-}
-
-fn main() {}