about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui-fulldeps/run-compiler-twice.rs2
-rw-r--r--tests/ui/async-await/async-closures/foreign.rs5
-rw-r--r--tests/ui/async-await/async-closures/inline-body.rs34
-rw-r--r--tests/ui/compiletest-self-test/compile-flags-last.stderr3
-rw-r--r--tests/ui/impl-trait/opaque-hidden-inferred-rpitit.rs16
-rw-r--r--tests/ui/invalid-compile-flags/print-without-arg.rs1
-rw-r--r--tests/ui/invalid-compile-flags/print-without-arg.stderr5
-rw-r--r--tests/ui/typeck/auxiliary/foreign_struct_trait_unimplemented.rs1
-rw-r--r--tests/ui/typeck/foreign_struct_trait_unimplemented.rs15
-rw-r--r--tests/ui/typeck/foreign_struct_trait_unimplemented.stderr23
10 files changed, 104 insertions, 1 deletions
diff --git a/tests/ui-fulldeps/run-compiler-twice.rs b/tests/ui-fulldeps/run-compiler-twice.rs
index 720fc42cc57..cce4eac0d7c 100644
--- a/tests/ui-fulldeps/run-compiler-twice.rs
+++ b/tests/ui-fulldeps/run-compiler-twice.rs
@@ -65,7 +65,7 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf, linker: Option<&Path
         output_dir: None,
         ice_file: None,
         file_loader: None,
-        locale_resources: &[],
+        locale_resources: Vec::new(),
         lint_caps: Default::default(),
         psess_created: None,
         hash_untracked_state: None,
diff --git a/tests/ui/async-await/async-closures/foreign.rs b/tests/ui/async-await/async-closures/foreign.rs
index 50bef9cf11d..ab6fe06a3f4 100644
--- a/tests/ui/async-await/async-closures/foreign.rs
+++ b/tests/ui/async-await/async-closures/foreign.rs
@@ -12,8 +12,13 @@ extern crate foreign;
 
 struct NoCopy;
 
+async fn call_once(f: impl async FnOnce()) {
+    f().await;
+}
+
 fn main() {
     block_on::block_on(async {
         foreign::closure()().await;
+        call_once(foreign::closure()).await;
     });
 }
diff --git a/tests/ui/async-await/async-closures/inline-body.rs b/tests/ui/async-await/async-closures/inline-body.rs
new file mode 100644
index 00000000000..a842d98d1de
--- /dev/null
+++ b/tests/ui/async-await/async-closures/inline-body.rs
@@ -0,0 +1,34 @@
+//@ edition: 2021
+//@ compile-flags: -Zinline-mir
+//@ build-pass
+
+// Ensure that we don't hit a Steal ICE because we forgot to ensure
+// `mir_inliner_callees` for the synthetic by-move coroutine body since
+// its def-id wasn't previously being considered.
+
+#![feature(async_closure, noop_waker)]
+
+use std::future::Future;
+use std::pin::pin;
+use std::task::*;
+
+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,
+        }
+    }
+}
+
+async fn call_once<T>(f: impl async FnOnce() -> T) -> T {
+    f().await
+}
+
+fn main() {
+    let c = async || {};
+    block_on(call_once(c));
+}
diff --git a/tests/ui/compiletest-self-test/compile-flags-last.stderr b/tests/ui/compiletest-self-test/compile-flags-last.stderr
index d8d40a7d9f1..72d92206e2b 100644
--- a/tests/ui/compiletest-self-test/compile-flags-last.stderr
+++ b/tests/ui/compiletest-self-test/compile-flags-last.stderr
@@ -1,2 +1,5 @@
 error: Argument to option 'cap-lints' missing
+       Usage:
+           --cap-lints LEVEL   Set the most restrictive lint level. More restrictive
+                               lints are capped at this level
 
diff --git a/tests/ui/impl-trait/opaque-hidden-inferred-rpitit.rs b/tests/ui/impl-trait/opaque-hidden-inferred-rpitit.rs
new file mode 100644
index 00000000000..1582cca5cd2
--- /dev/null
+++ b/tests/ui/impl-trait/opaque-hidden-inferred-rpitit.rs
@@ -0,0 +1,16 @@
+//@ check-pass
+
+// Make sure that the `opaque_hidden_inferred_bound` lint doesn't fire on
+// RPITITs with no hidden type.
+
+trait T0 {}
+
+trait T1 {
+    type A: Send;
+}
+
+trait T2 {
+    fn foo() -> impl T1<A = ((), impl T0)>;
+}
+
+fn main() {}
diff --git a/tests/ui/invalid-compile-flags/print-without-arg.rs b/tests/ui/invalid-compile-flags/print-without-arg.rs
new file mode 100644
index 00000000000..a762cb22275
--- /dev/null
+++ b/tests/ui/invalid-compile-flags/print-without-arg.rs
@@ -0,0 +1 @@
+//@ compile-flags: --print
diff --git a/tests/ui/invalid-compile-flags/print-without-arg.stderr b/tests/ui/invalid-compile-flags/print-without-arg.stderr
new file mode 100644
index 00000000000..a18d2779cad
--- /dev/null
+++ b/tests/ui/invalid-compile-flags/print-without-arg.stderr
@@ -0,0 +1,5 @@
+error: Argument to option 'print' missing
+       Usage:
+           --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target]
+                               Compiler information to print on stdout
+
diff --git a/tests/ui/typeck/auxiliary/foreign_struct_trait_unimplemented.rs b/tests/ui/typeck/auxiliary/foreign_struct_trait_unimplemented.rs
new file mode 100644
index 00000000000..097a269e8ee
--- /dev/null
+++ b/tests/ui/typeck/auxiliary/foreign_struct_trait_unimplemented.rs
@@ -0,0 +1 @@
+pub struct B;
diff --git a/tests/ui/typeck/foreign_struct_trait_unimplemented.rs b/tests/ui/typeck/foreign_struct_trait_unimplemented.rs
new file mode 100644
index 00000000000..8ac56bac9b0
--- /dev/null
+++ b/tests/ui/typeck/foreign_struct_trait_unimplemented.rs
@@ -0,0 +1,15 @@
+//@ aux-build:foreign_struct_trait_unimplemented.rs
+
+extern crate foreign_struct_trait_unimplemented;
+
+pub trait Test {}
+
+struct A;
+impl Test for A {}
+
+fn needs_test(_: impl Test) {}
+
+fn main() {
+    needs_test(foreign_struct_trait_unimplemented::B);
+    //~^ ERROR the trait bound `B: Test` is not satisfied
+}
diff --git a/tests/ui/typeck/foreign_struct_trait_unimplemented.stderr b/tests/ui/typeck/foreign_struct_trait_unimplemented.stderr
new file mode 100644
index 00000000000..b9bb97548f6
--- /dev/null
+++ b/tests/ui/typeck/foreign_struct_trait_unimplemented.stderr
@@ -0,0 +1,23 @@
+error[E0277]: the trait bound `B: Test` is not satisfied
+  --> $DIR/foreign_struct_trait_unimplemented.rs:13:16
+   |
+LL |     needs_test(foreign_struct_trait_unimplemented::B);
+   |     ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Test` is not implemented for `B`
+   |     |
+   |     required by a bound introduced by this call
+   |
+help: there are multiple different versions of crate `foreign_struct_trait_unimplemented` in the dependency graph
+  --> $DIR/foreign_struct_trait_unimplemented.rs:3:1
+   |
+LL | extern crate foreign_struct_trait_unimplemented;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one version of crate `foreign_struct_trait_unimplemented` is used here, as a direct dependency of the current crate
+   = help: you can use `cargo tree` to explore your dependency tree
+note: required by a bound in `needs_test`
+  --> $DIR/foreign_struct_trait_unimplemented.rs:10:23
+   |
+LL | fn needs_test(_: impl Test) {}
+   |                       ^^^^ required by this bound in `needs_test`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.