about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/123456.rs16
-rw-r--r--tests/ui/associated-types/issue-64855-2.rs5
-rw-r--r--tests/ui/associated-types/issue-64855-2.stderr15
-rw-r--r--tests/ui/associated-types/issue-64855.rs5
-rw-r--r--tests/ui/associated-types/issue-64855.stderr21
-rw-r--r--tests/ui/async-await/async-drop/auxiliary/async-drop-dep.rs28
-rw-r--r--tests/ui/async-await/async-drop/dependency-dropped.rs34
-rw-r--r--tests/ui/async-await/async-drop/dependency-dropped.run.stdout1
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-95230.rs9
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-95230.stderr18
-rw-r--r--tests/ui/typeck/suggestions/macro-shorthand-issue-140659.rs56
-rw-r--r--tests/ui/typeck/suggestions/macro-shorthand-issue-140659.stderr16
-rw-r--r--tests/ui/typeck/suggestions/suggest-adding-missing-zero-to-floating-point-number.fixed (renamed from tests/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.fixed)0
-rw-r--r--tests/ui/typeck/suggestions/suggest-adding-missing-zero-to-floating-point-number.rs (renamed from tests/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.rs)0
-rw-r--r--tests/ui/typeck/suggestions/suggest-adding-missing-zero-to-floating-point-number.stderr (renamed from tests/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr)0
-rw-r--r--tests/ui/typeck/suggestions/suggest-arg-comma-delete-ice.rs (renamed from tests/ui/typeck/suggest-arg-comma-delete-ice.rs)0
-rw-r--r--tests/ui/typeck/suggestions/suggest-arg-comma-delete-ice.stderr (renamed from tests/ui/typeck/suggest-arg-comma-delete-ice.stderr)0
-rw-r--r--tests/ui/typeck/suggestions/suggest-box-on-divergent-if-else-arms.fixed (renamed from tests/ui/typeck/suggest-box-on-divergent-if-else-arms.fixed)0
-rw-r--r--tests/ui/typeck/suggestions/suggest-box-on-divergent-if-else-arms.rs (renamed from tests/ui/typeck/suggest-box-on-divergent-if-else-arms.rs)0
-rw-r--r--tests/ui/typeck/suggestions/suggest-box-on-divergent-if-else-arms.stderr (renamed from tests/ui/typeck/suggest-box-on-divergent-if-else-arms.stderr)0
-rw-r--r--tests/ui/typeck/suggestions/suggest-similar-impls-for-root-obligation.rs (renamed from tests/ui/typeck/suggest-similar-impls-for-root-obligation.rs)0
-rw-r--r--tests/ui/typeck/suggestions/suggest-similar-impls-for-root-obligation.stderr (renamed from tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr)0
22 files changed, 198 insertions, 26 deletions
diff --git a/tests/crashes/123456.rs b/tests/crashes/123456.rs
deleted file mode 100644
index ed7cbada3f8..00000000000
--- a/tests/crashes/123456.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-//@ known-bug: #123456
-
-trait Project {
-    const SELF: Self;
-}
-
-fn take1(
-    _: Project<
-        SELF = {
-                   j2.join().unwrap();
-               },
-    >,
-) {
-}
-
-pub fn main() {}
diff --git a/tests/ui/associated-types/issue-64855-2.rs b/tests/ui/associated-types/issue-64855-2.rs
index 30cb37b5198..20b8ff17e9e 100644
--- a/tests/ui/associated-types/issue-64855-2.rs
+++ b/tests/ui/associated-types/issue-64855-2.rs
@@ -1,5 +1,8 @@
-//@ check-pass
+// This was originally a test for a `ReEmpty` ICE, but became an unintentional test of
+// the coinductiveness of WF predicates. That behavior was removed, and thus this is
+// also inadvertently a test for the (non-)co-inductiveness of WF predicates.
 
 pub struct Bar<'a>(&'a Self) where Self: ;
+//~^ ERROR overflow evaluating the requirement `Bar<'a> well-formed`
 
 fn main() {}
diff --git a/tests/ui/associated-types/issue-64855-2.stderr b/tests/ui/associated-types/issue-64855-2.stderr
new file mode 100644
index 00000000000..22292a8721a
--- /dev/null
+++ b/tests/ui/associated-types/issue-64855-2.stderr
@@ -0,0 +1,15 @@
+error[E0275]: overflow evaluating the requirement `Bar<'a> well-formed`
+  --> $DIR/issue-64855-2.rs:5:36
+   |
+LL | pub struct Bar<'a>(&'a Self) where Self: ;
+   |                                    ^^^^
+   |
+note: required by a bound in `Bar`
+  --> $DIR/issue-64855-2.rs:5:36
+   |
+LL | pub struct Bar<'a>(&'a Self) where Self: ;
+   |                                    ^^^^ required by this bound in `Bar`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/associated-types/issue-64855.rs b/tests/ui/associated-types/issue-64855.rs
index 81cf3ae6e83..5d325b981a2 100644
--- a/tests/ui/associated-types/issue-64855.rs
+++ b/tests/ui/associated-types/issue-64855.rs
@@ -1,8 +1,13 @@
+// This was originally a test for a `ReEmpty` ICE, but became an unintentional test of
+// the coinductiveness of WF predicates. That behavior was removed, and thus this is
+// also inadvertently a test for the (non-)co-inductiveness of WF predicates.
+
 pub trait Foo {
     type Type;
 }
 
 pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
 //~^ ERROR the trait bound `Bar<T>: Foo` is not satisfied
+//~| ERROR overflow evaluating the requirement `Bar<T> well-formed`
 
 fn main() {}
diff --git a/tests/ui/associated-types/issue-64855.stderr b/tests/ui/associated-types/issue-64855.stderr
index 7c09abdb3b6..d8ba1a9d07e 100644
--- a/tests/ui/associated-types/issue-64855.stderr
+++ b/tests/ui/associated-types/issue-64855.stderr
@@ -1,15 +1,28 @@
 error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
-  --> $DIR/issue-64855.rs:5:19
+  --> $DIR/issue-64855.rs:9:19
    |
 LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
    |                   ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<T>`
    |
 help: this trait has no implementations, consider adding one
-  --> $DIR/issue-64855.rs:1:1
+  --> $DIR/issue-64855.rs:5:1
    |
 LL | pub trait Foo {
    | ^^^^^^^^^^^^^
 
-error: aborting due to 1 previous error
+error[E0275]: overflow evaluating the requirement `Bar<T> well-formed`
+  --> $DIR/issue-64855.rs:9:46
+   |
+LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
+   |                                              ^^^^
+   |
+note: required by a bound in `Bar`
+  --> $DIR/issue-64855.rs:9:46
+   |
+LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
+   |                                              ^^^^ required by this bound in `Bar`
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0275, E0277.
+For more information about an error, try `rustc --explain E0275`.
diff --git a/tests/ui/async-await/async-drop/auxiliary/async-drop-dep.rs b/tests/ui/async-await/async-drop/auxiliary/async-drop-dep.rs
new file mode 100644
index 00000000000..1729599f7b3
--- /dev/null
+++ b/tests/ui/async-await/async-drop/auxiliary/async-drop-dep.rs
@@ -0,0 +1,28 @@
+//@ edition:2021
+
+#![feature(async_drop)]
+#![allow(incomplete_features)]
+
+pub struct HasDrop;
+impl Drop for HasDrop{
+    fn drop(&mut self) {
+        println!("Sync drop");
+    }
+}
+
+pub struct MongoDrop;
+impl MongoDrop {
+    pub async fn new() -> Result<Self, HasDrop> {
+        Ok(Self)
+    }
+}
+impl Drop for MongoDrop{
+    fn drop(&mut self) {
+        println!("Sync drop");
+    }
+}
+impl std::future::AsyncDrop for MongoDrop {
+    async fn drop(self: std::pin::Pin<&mut Self>) {
+        println!("Async drop");
+    }
+}
diff --git a/tests/ui/async-await/async-drop/dependency-dropped.rs b/tests/ui/async-await/async-drop/dependency-dropped.rs
new file mode 100644
index 00000000000..f763bb32b17
--- /dev/null
+++ b/tests/ui/async-await/async-drop/dependency-dropped.rs
@@ -0,0 +1,34 @@
+//@ run-pass
+//@ check-run-results
+//@ aux-build:async-drop-dep.rs
+//@ edition:2021
+
+#![feature(async_drop)]
+#![allow(incomplete_features)]
+
+extern crate async_drop_dep;
+
+use async_drop_dep::MongoDrop;
+use std::pin::pin;
+use std::task::{Context, Poll, Waker};
+use std::future::Future;
+
+async fn asyncdrop() {
+    let _ = MongoDrop::new().await;
+}
+
+pub fn block_on<T>(fut: impl Future<Output = T>) -> T {
+    let mut fut = pin!(fut);
+    let ctx = &mut Context::from_waker(Waker::noop());
+
+    loop {
+        match fut.as_mut().poll(ctx) {
+            Poll::Pending => {}
+            Poll::Ready(t) => break t,
+        }
+    }
+}
+
+fn main() {
+    let _ = block_on(asyncdrop());
+}
diff --git a/tests/ui/async-await/async-drop/dependency-dropped.run.stdout b/tests/ui/async-await/async-drop/dependency-dropped.run.stdout
new file mode 100644
index 00000000000..7aaf70c12d6
--- /dev/null
+++ b/tests/ui/async-await/async-drop/dependency-dropped.run.stdout
@@ -0,0 +1 @@
+Async drop
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-95230.rs b/tests/ui/higher-ranked/trait-bounds/issue-95230.rs
index d1ca6834551..821a04ff065 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-95230.rs
+++ b/tests/ui/higher-ranked/trait-bounds/issue-95230.rs
@@ -1,11 +1,10 @@
-//@ revisions: old next
-//@[next] compile-flags: -Znext-solver
-//@[old] check-pass
-//@[next] known-bug: #109764
-
+// This used to be a test for overflow handling + higher-ranked outlives
+// in the new solver, but this test isn't expected to pass since WF preds
+// are not coinductive anymore.
 
 pub struct Bar
 where
     for<'a> &'a mut Self:;
+//~^ ERROR overflow evaluating the requirement `for<'a> &'a mut Bar well-formed`
 
 fn main() {}
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-95230.stderr b/tests/ui/higher-ranked/trait-bounds/issue-95230.stderr
new file mode 100644
index 00000000000..7070af75d29
--- /dev/null
+++ b/tests/ui/higher-ranked/trait-bounds/issue-95230.stderr
@@ -0,0 +1,18 @@
+error[E0275]: overflow evaluating the requirement `for<'a> &'a mut Bar well-formed`
+  --> $DIR/issue-95230.rs:7:13
+   |
+LL |     for<'a> &'a mut Self:;
+   |             ^^^^^^^^^^^^
+   |
+note: required by a bound in `Bar`
+  --> $DIR/issue-95230.rs:7:13
+   |
+LL | pub struct Bar
+   |            --- required by a bound in this struct
+LL | where
+LL |     for<'a> &'a mut Self:;
+   |             ^^^^^^^^^^^^ required by this bound in `Bar`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.rs b/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.rs
new file mode 100644
index 00000000000..d71a7ff1d3d
--- /dev/null
+++ b/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.rs
@@ -0,0 +1,56 @@
+trait Reencode {
+    type Error;
+    fn tag_index(&mut self, tag: u32) -> Result<u32, Self::Error>;
+}
+
+struct Reencoder;
+impl Reencode for Reencoder {
+    type Error = &'static str;
+    fn tag_index(&mut self, tag: u32) -> Result<u32, Self::Error> {
+        Ok(tag)
+    }
+}
+
+
+enum Operator {
+    Suspend { tag_index: u32 },
+}
+
+enum Instruction {
+    Suspend { tag_index: u32 },
+}
+
+
+macro_rules! for_each_operator {
+    ($m:ident) => {
+        $m! {
+            Suspend { tag_index: u32 } => visit_suspend
+        }
+    };
+}
+
+
+fn process<T: Reencode>(op: &Operator, reencoder: &mut T) -> Instruction {
+    macro_rules! translate {
+        (Suspend { tag_index: $ty:ty } => $visit:ident) => {
+            match op {
+                Operator::Suspend { tag_index } => {
+                    let tag_index = reencoder.tag_index(*tag_index);
+
+                    // KEY POINT: Using field shorthand syntax where the compiler gets confused
+                    // Here tag_index is a Result<u32, E> but we're using it where u32 is expected
+                    Instruction::Suspend { tag_index } //~ ERROR mismatched types [E0308]
+                }
+            }
+        };
+    }
+
+    for_each_operator!(translate)
+}
+
+fn main() {
+    let mut reencoder = Reencoder;
+    let op = Operator::Suspend { tag_index: 1 };
+
+    let _ = process(&op, &mut reencoder);
+}
diff --git a/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.stderr b/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.stderr
new file mode 100644
index 00000000000..12537754d80
--- /dev/null
+++ b/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+  --> $DIR/macro-shorthand-issue-140659.rs:42:44
+   |
+LL |                     Instruction::Suspend { tag_index }
+   |                                            ^^^^^^^^^ expected `u32`, found `Result<u32, <T as Reencode>::Error>`
+...
+LL |     for_each_operator!(translate)
+   |     ----------------------------- in this macro invocation
+   |
+   = note: expected type `u32`
+              found enum `Result<u32, <T as Reencode>::Error>`
+   = note: this error originates in the macro `translate` which comes from the expansion of the macro `for_each_operator` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.fixed b/tests/ui/typeck/suggestions/suggest-adding-missing-zero-to-floating-point-number.fixed
index cb4a3967741..cb4a3967741 100644
--- a/tests/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.fixed
+++ b/tests/ui/typeck/suggestions/suggest-adding-missing-zero-to-floating-point-number.fixed
diff --git a/tests/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.rs b/tests/ui/typeck/suggestions/suggest-adding-missing-zero-to-floating-point-number.rs
index e4cafc466c6..e4cafc466c6 100644
--- a/tests/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.rs
+++ b/tests/ui/typeck/suggestions/suggest-adding-missing-zero-to-floating-point-number.rs
diff --git a/tests/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr b/tests/ui/typeck/suggestions/suggest-adding-missing-zero-to-floating-point-number.stderr
index 503015f3bec..503015f3bec 100644
--- a/tests/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr
+++ b/tests/ui/typeck/suggestions/suggest-adding-missing-zero-to-floating-point-number.stderr
diff --git a/tests/ui/typeck/suggest-arg-comma-delete-ice.rs b/tests/ui/typeck/suggestions/suggest-arg-comma-delete-ice.rs
index 48d02e13eca..48d02e13eca 100644
--- a/tests/ui/typeck/suggest-arg-comma-delete-ice.rs
+++ b/tests/ui/typeck/suggestions/suggest-arg-comma-delete-ice.rs
diff --git a/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr b/tests/ui/typeck/suggestions/suggest-arg-comma-delete-ice.stderr
index 0b899ad2712..0b899ad2712 100644
--- a/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr
+++ b/tests/ui/typeck/suggestions/suggest-arg-comma-delete-ice.stderr
diff --git a/tests/ui/typeck/suggest-box-on-divergent-if-else-arms.fixed b/tests/ui/typeck/suggestions/suggest-box-on-divergent-if-else-arms.fixed
index f562b24cc4c..f562b24cc4c 100644
--- a/tests/ui/typeck/suggest-box-on-divergent-if-else-arms.fixed
+++ b/tests/ui/typeck/suggestions/suggest-box-on-divergent-if-else-arms.fixed
diff --git a/tests/ui/typeck/suggest-box-on-divergent-if-else-arms.rs b/tests/ui/typeck/suggestions/suggest-box-on-divergent-if-else-arms.rs
index e364e6daa6a..e364e6daa6a 100644
--- a/tests/ui/typeck/suggest-box-on-divergent-if-else-arms.rs
+++ b/tests/ui/typeck/suggestions/suggest-box-on-divergent-if-else-arms.rs
diff --git a/tests/ui/typeck/suggest-box-on-divergent-if-else-arms.stderr b/tests/ui/typeck/suggestions/suggest-box-on-divergent-if-else-arms.stderr
index c58bf60e7d6..c58bf60e7d6 100644
--- a/tests/ui/typeck/suggest-box-on-divergent-if-else-arms.stderr
+++ b/tests/ui/typeck/suggestions/suggest-box-on-divergent-if-else-arms.stderr
diff --git a/tests/ui/typeck/suggest-similar-impls-for-root-obligation.rs b/tests/ui/typeck/suggestions/suggest-similar-impls-for-root-obligation.rs
index d00b4f33132..d00b4f33132 100644
--- a/tests/ui/typeck/suggest-similar-impls-for-root-obligation.rs
+++ b/tests/ui/typeck/suggestions/suggest-similar-impls-for-root-obligation.rs
diff --git a/tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr b/tests/ui/typeck/suggestions/suggest-similar-impls-for-root-obligation.stderr
index 5c0d98735f7..5c0d98735f7 100644
--- a/tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr
+++ b/tests/ui/typeck/suggestions/suggest-similar-impls-for-root-obligation.stderr