about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-22 21:24:29 +0000
committerbors <bors@rust-lang.org>2023-02-22 21:24:29 +0000
commitda439d98749e7c94f3ecf355fdd616253ee08359 (patch)
tree447f24e380c71df5422e366c51c2c871f8c320ea /tests
parentfdbc4329cb781c7768ffa6d76c8fa2d032d3fe20 (diff)
parent9f5c401f670190737f93b6e440fea4d733ab7560 (diff)
Auto merge of #108357 - matthiaskrgr:rollup-ceo3q2s, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #107736 ( Rename atomic 'as_mut_ptr' to 'as_ptr' to match Cell (ref #66893) )
 - #108176 (Don't delay `ReError` bug during lexical region resolve)
 - #108315 (Lint dead code in closures and generators)
 - #108342 (apply query response: actually define opaque types)
 - #108344 (Fix test filename for #105700)
 - #108353 (resolve: Remove `ImportResolver`)

Failed merges:

 - #107911 (Add check for invalid #[macro_export] arguments)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lint/dead-code/in-closure.rs16
-rw-r--r--tests/ui/lint/dead-code/in-closure.stderr20
-rw-r--r--tests/ui/recursion_limit/issue-105700.rs (renamed from tests/ui/recursion_limit/issue_21102.rs)0
-rw-r--r--tests/ui/recursion_limit/issue-105700.stderr (renamed from tests/ui/recursion_limit/issue_21102.stderr)4
-rw-r--r--tests/ui/regions/resolve-re-error-ice.rs22
-rw-r--r--tests/ui/regions/resolve-re-error-ice.stderr15
6 files changed, 75 insertions, 2 deletions
diff --git a/tests/ui/lint/dead-code/in-closure.rs b/tests/ui/lint/dead-code/in-closure.rs
new file mode 100644
index 00000000000..c55634405ed
--- /dev/null
+++ b/tests/ui/lint/dead-code/in-closure.rs
@@ -0,0 +1,16 @@
+// edition: 2021
+
+#![deny(dead_code)]
+
+pub fn foo() {
+    let closure = || {
+        fn a() {}   //~ ERROR function `a` is never used
+    };
+    closure()
+}
+
+pub async fn async_foo() {
+    const A: usize = 1; //~ ERROR constant `A` is never used
+}
+
+fn main() {}
diff --git a/tests/ui/lint/dead-code/in-closure.stderr b/tests/ui/lint/dead-code/in-closure.stderr
new file mode 100644
index 00000000000..deb276be702
--- /dev/null
+++ b/tests/ui/lint/dead-code/in-closure.stderr
@@ -0,0 +1,20 @@
+error: function `a` is never used
+  --> $DIR/in-closure.rs:7:12
+   |
+LL |         fn a() {}
+   |            ^
+   |
+note: the lint level is defined here
+  --> $DIR/in-closure.rs:3:9
+   |
+LL | #![deny(dead_code)]
+   |         ^^^^^^^^^
+
+error: constant `A` is never used
+  --> $DIR/in-closure.rs:13:11
+   |
+LL |     const A: usize = 1;
+   |           ^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/recursion_limit/issue_21102.rs b/tests/ui/recursion_limit/issue-105700.rs
index e1fee46313d..e1fee46313d 100644
--- a/tests/ui/recursion_limit/issue_21102.rs
+++ b/tests/ui/recursion_limit/issue-105700.rs
diff --git a/tests/ui/recursion_limit/issue_21102.stderr b/tests/ui/recursion_limit/issue-105700.stderr
index 1bd722c492b..9b1114e9ce6 100644
--- a/tests/ui/recursion_limit/issue_21102.stderr
+++ b/tests/ui/recursion_limit/issue-105700.stderr
@@ -1,10 +1,10 @@
 error: recursion limit reached while expanding `#[invalid_attribute]`
-  --> $DIR/issue_21102.rs:6:1
+  --> $DIR/issue-105700.rs:6:1
    |
 LL | #![invalid_attribute]
    | ^^^^^^^^^^^^^^^^^^^^^
    |
-   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "8"]` attribute to your crate (`issue_21102`)
+   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "8"]` attribute to your crate (`issue_105700`)
 
 error: aborting due to previous error
 
diff --git a/tests/ui/regions/resolve-re-error-ice.rs b/tests/ui/regions/resolve-re-error-ice.rs
new file mode 100644
index 00000000000..f37b27a82b3
--- /dev/null
+++ b/tests/ui/regions/resolve-re-error-ice.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+// Allow this for now, can remove this UI test when this becomes a hard error.
+#![allow(implied_bounds_entailment)]
+
+use std::collections::hash_map::{Keys, HashMap};
+use std::marker::PhantomData;
+
+trait MapAssertion<'a, K, V, R> {
+    fn key_set(&self) -> Subject<Keys<K, V>, (), R>;
+}
+
+struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>);
+
+impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap<K, V>, (), R>
+{
+    fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> {
+        todo!()
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/regions/resolve-re-error-ice.stderr b/tests/ui/regions/resolve-re-error-ice.stderr
new file mode 100644
index 00000000000..e7003e1c32f
--- /dev/null
+++ b/tests/ui/regions/resolve-re-error-ice.stderr
@@ -0,0 +1,15 @@
+Future incompatibility report: Future breakage diagnostic:
+warning: impl method assumes more implied bounds than the corresponding trait method
+  --> $DIR/resolve-re-error-ice.rs:17:16
+   |
+LL |     fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> {
+   |                ^^^^^     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this type to make the impl signature compatible: `Subject<'_, std::collections::hash_map::Keys<'_, K, V>, (), R>`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572>
+note: the lint level is defined here
+  --> $DIR/resolve-re-error-ice.rs:4:10
+   |
+LL | #![allow(implied_bounds_entailment)]
+   |          ^^^^^^^^^^^^^^^^^^^^^^^^^
+