summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/argument-suggestions/issue-109425.fixed20
-rw-r--r--tests/ui/argument-suggestions/issue-109425.rs20
-rw-r--r--tests/ui/argument-suggestions/issue-109425.stderr98
-rw-r--r--tests/ui/recursion/issue-95134.rs2
-rw-r--r--tests/ui/suggestions/issue-109291.rs4
-rw-r--r--tests/ui/suggestions/issue-109291.stderr12
-rw-r--r--tests/ui/suggestions/issue-109396.stderr2
-rw-r--r--tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr18
-rw-r--r--tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs26
9 files changed, 200 insertions, 2 deletions
diff --git a/tests/ui/argument-suggestions/issue-109425.fixed b/tests/ui/argument-suggestions/issue-109425.fixed
new file mode 100644
index 00000000000..143ddf99586
--- /dev/null
+++ b/tests/ui/argument-suggestions/issue-109425.fixed
@@ -0,0 +1,20 @@
+// run-rustfix
+
+fn f() {}
+fn i(_: u32) {}
+fn is(_: u32, _: &str) {}
+fn s(_: &str) {}
+
+fn main() {
+ // code expected suggestion
+ f(); // f()
+ //~^ error: this function takes 0 arguments but 2 arguments were supplied
+ i(0,); // i(0,)
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+ i(0); // i(0)
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+ is(0, ""); // is(0, "")
+ //~^ error: this function takes 2 arguments but 4 arguments were supplied
+ s(""); // s("")
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+}
diff --git a/tests/ui/argument-suggestions/issue-109425.rs b/tests/ui/argument-suggestions/issue-109425.rs
new file mode 100644
index 00000000000..a845c419555
--- /dev/null
+++ b/tests/ui/argument-suggestions/issue-109425.rs
@@ -0,0 +1,20 @@
+// run-rustfix
+
+fn f() {}
+fn i(_: u32) {}
+fn is(_: u32, _: &str) {}
+fn s(_: &str) {}
+
+fn main() {
+ // code expected suggestion
+ f(0, 1,); // f()
+ //~^ error: this function takes 0 arguments but 2 arguments were supplied
+ i(0, 1, 2,); // i(0,)
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+ i(0, 1, 2); // i(0)
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+ is(0, 1, 2, ""); // is(0, "")
+ //~^ error: this function takes 2 arguments but 4 arguments were supplied
+ s(0, 1, ""); // s("")
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+}
diff --git a/tests/ui/argument-suggestions/issue-109425.stderr b/tests/ui/argument-suggestions/issue-109425.stderr
new file mode 100644
index 00000000000..1514f1cb487
--- /dev/null
+++ b/tests/ui/argument-suggestions/issue-109425.stderr
@@ -0,0 +1,98 @@
+error[E0061]: this function takes 0 arguments but 2 arguments were supplied
+ --> $DIR/issue-109425.rs:10:5
+ |
+LL | f(0, 1,); // f()
+ | ^ - - unexpected argument of type `{integer}`
+ | |
+ | unexpected argument of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:3:4
+ |
+LL | fn f() {}
+ | ^
+help: remove the extra arguments
+ |
+LL - f(0, 1,); // f()
+LL + f(); // f()
+ |
+
+error[E0061]: this function takes 1 argument but 3 arguments were supplied
+ --> $DIR/issue-109425.rs:12:5
+ |
+LL | i(0, 1, 2,); // i(0,)
+ | ^ - - unexpected argument of type `{integer}`
+ | |
+ | unexpected argument of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:4:4
+ |
+LL | fn i(_: u32) {}
+ | ^ ------
+help: remove the extra arguments
+ |
+LL - i(0, 1, 2,); // i(0,)
+LL + i(0,); // i(0,)
+ |
+
+error[E0061]: this function takes 1 argument but 3 arguments were supplied
+ --> $DIR/issue-109425.rs:14:5
+ |
+LL | i(0, 1, 2); // i(0)
+ | ^ - - unexpected argument of type `{integer}`
+ | |
+ | unexpected argument of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:4:4
+ |
+LL | fn i(_: u32) {}
+ | ^ ------
+help: remove the extra arguments
+ |
+LL - i(0, 1, 2); // i(0)
+LL + i(0); // i(0)
+ |
+
+error[E0061]: this function takes 2 arguments but 4 arguments were supplied
+ --> $DIR/issue-109425.rs:16:5
+ |
+LL | is(0, 1, 2, ""); // is(0, "")
+ | ^^ - - unexpected argument of type `{integer}`
+ | |
+ | unexpected argument of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:5:4
+ |
+LL | fn is(_: u32, _: &str) {}
+ | ^^ ------ -------
+help: remove the extra arguments
+ |
+LL - is(0, 1, 2, ""); // is(0, "")
+LL + is(0, ""); // is(0, "")
+ |
+
+error[E0061]: this function takes 1 argument but 3 arguments were supplied
+ --> $DIR/issue-109425.rs:18:5
+ |
+LL | s(0, 1, ""); // s("")
+ | ^ - - unexpected argument of type `{integer}`
+ | |
+ | unexpected argument of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:6:4
+ |
+LL | fn s(_: &str) {}
+ | ^ -------
+help: remove the extra arguments
+ |
+LL - s(0, 1, ""); // s("")
+LL + s(""); // s("")
+ |
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/tests/ui/recursion/issue-95134.rs b/tests/ui/recursion/issue-95134.rs
index fdc4d536981..2f1cffa2fa9 100644
--- a/tests/ui/recursion/issue-95134.rs
+++ b/tests/ui/recursion/issue-95134.rs
@@ -1,7 +1,7 @@
// build-fail
// known-bug: #95134
// compile-flags: -Copt-level=0
-// failure-status: 101
+// dont-check-failure-status
// dont-check-compiler-stderr
pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> {
diff --git a/tests/ui/suggestions/issue-109291.rs b/tests/ui/suggestions/issue-109291.rs
new file mode 100644
index 00000000000..1947b16a32e
--- /dev/null
+++ b/tests/ui/suggestions/issue-109291.rs
@@ -0,0 +1,4 @@
+fn main() {
+ println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture());
+ //~^ ERROR no function or associated item name
+}
diff --git a/tests/ui/suggestions/issue-109291.stderr b/tests/ui/suggestions/issue-109291.stderr
new file mode 100644
index 00000000000..4ef5948d9bf
--- /dev/null
+++ b/tests/ui/suggestions/issue-109291.stderr
@@ -0,0 +1,12 @@
+error[E0599]: no function or associated item named `forced_capture` found for struct `Backtrace` in the current scope
+ --> $DIR/issue-109291.rs:2:65
+ |
+LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture());
+ | ^^^^^^^^^^^^^^
+ | |
+ | function or associated item not found in `Backtrace`
+ | help: there is an associated function with a similar name: `force_capture`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/suggestions/issue-109396.stderr b/tests/ui/suggestions/issue-109396.stderr
index eca160e2fab..d4956872a39 100644
--- a/tests/ui/suggestions/issue-109396.stderr
+++ b/tests/ui/suggestions/issue-109396.stderr
@@ -25,7 +25,7 @@ note: function defined here
help: remove the extra arguments
|
LL - file.as_raw_fd(),
-LL + ,
+LL + );
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr
new file mode 100644
index 00000000000..6a926534e07
--- /dev/null
+++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr
@@ -0,0 +1,18 @@
+error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
+ --> $DIR/auto-with-drop_tracking_mir.rs:24:13
+ |
+LL | is_send(foo());
+ | ------- ^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Send` is not implemented for `impl Future<Output = ()>`
+note: required by a bound in `is_send`
+ --> $DIR/auto-with-drop_tracking_mir.rs:23:24
+ |
+LL | fn is_send(_: impl Send) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
new file mode 100644
index 00000000000..a5db7c4636b
--- /dev/null
+++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
@@ -0,0 +1,26 @@
+// compile-flags: -Ztrait-solver=next -Zdrop-tracking-mir
+// edition: 2021
+// revisions: pass fail
+//[pass] check-pass
+
+#![feature(negative_impls)]
+
+struct NotSync;
+impl !Sync for NotSync {}
+
+async fn foo() {
+ #[cfg(pass)]
+ let x = &();
+ #[cfg(fail)]
+ let x = &NotSync;
+ bar().await;
+ drop(x);
+}
+
+async fn bar() {}
+
+fn main() {
+ fn is_send(_: impl Send) {}
+ is_send(foo());
+ //[fail]~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely
+}