about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-29 04:23:06 +0000
committerbors <bors@rust-lang.org>2023-03-29 04:23:06 +0000
commit40cd0310db7f67867b305c28fb87b5b660e77df1 (patch)
tree9f0086ae2c2407c7c348c254fef54c0b19ca0c88 /tests
parentacd27bb5572553a4dc9a2d6f21d9a3a68ff8a233 (diff)
parent439c68ceeb4b7337db47bf08955d438f5b8e5804 (diff)
downloadrust-40cd0310db7f67867b305c28fb87b5b660e77df1.tar.gz
rust-40cd0310db7f67867b305c28fb87b5b660e77df1.zip
Auto merge of #109714 - matthiaskrgr:rollup-wipns5h, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #109149 (Improve error message when writer is forgotten in write and writeln macro)
 - #109367 (Streamline fast rejection)
 - #109548 (AnnotationColumn struct to fix hard tab column numbers in errors)
 - #109694 (do not panic on failure to acquire jobserver token)
 - #109705 (new solver: check for intercrate mode when accessing the cache)
 - #109708 (Specialization involving RPITITs is broken so ignore the diagnostic differences)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/jobserver-error/Makefile8
-rw-r--r--tests/run-make/jobserver-error/jobserver.stderr4
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr (renamed from tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr)4
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr34
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs2
-rw-r--r--tests/ui/diagnostic-width/auxiliary/tab_column_numbers.rs6
-rw-r--r--tests/ui/diagnostic-width/tab-column-numbers.rs12
-rw-r--r--tests/ui/diagnostic-width/tab-column-numbers.stderr14
-rw-r--r--tests/ui/macros/missing-writer.rs17
-rw-r--r--tests/ui/macros/missing-writer.stderr59
-rw-r--r--tests/ui/suggestions/mut-borrow-needed-by-trait.stderr10
11 files changed, 165 insertions, 5 deletions
diff --git a/tests/run-make/jobserver-error/Makefile b/tests/run-make/jobserver-error/Makefile
new file mode 100644
index 00000000000..3b9104fc354
--- /dev/null
+++ b/tests/run-make/jobserver-error/Makefile
@@ -0,0 +1,8 @@
+include ../../run-make-fulldeps/tools.mk
+
+# only-linux
+
+# Test compiler behavior in case: `jobserver-auth` points to correct pipe which is not jobserver.
+
+all:
+	bash -c 'echo "fn main() {}" | MAKEFLAGS="--jobserver-auth=3,3" $(RUSTC) - 3</dev/null' 2>&1 | diff jobserver.stderr -
diff --git a/tests/run-make/jobserver-error/jobserver.stderr b/tests/run-make/jobserver-error/jobserver.stderr
new file mode 100644
index 00000000000..d18e15a2628
--- /dev/null
+++ b/tests/run-make/jobserver-error/jobserver.stderr
@@ -0,0 +1,4 @@
+error: failed to acquire jobserver token: early EOF on jobserver pipe
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr
index f71fd9980a2..1e67cdca248 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr
@@ -1,5 +1,5 @@
 warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
-  --> $DIR/dont-project-to-specializable-projection.rs:4:12
+  --> $DIR/dont-project-to-specializable-projection.rs:6:12
    |
 LL | #![feature(async_fn_in_trait)]
    |            ^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(async_fn_in_trait)]
    = note: `#[warn(incomplete_features)]` on by default
 
 error: async associated function in trait cannot be specialized
-  --> $DIR/dont-project-to-specializable-projection.rs:14:5
+  --> $DIR/dont-project-to-specializable-projection.rs:16:5
    |
 LL |     default async fn foo(_: T) -> &'static str {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr
new file mode 100644
index 00000000000..fa89c6b77e0
--- /dev/null
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr
@@ -0,0 +1,34 @@
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/dont-project-to-specializable-projection.rs:6:12
+   |
+LL | #![feature(async_fn_in_trait)]
+   |            ^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+error[E0053]: method `foo` has an incompatible type for trait
+  --> $DIR/dont-project-to-specializable-projection.rs:16:35
+   |
+LL |     default async fn foo(_: T) -> &'static str {
+   |                                   ^^^^^^^^^^^^ expected associated type, found future
+   |
+note: type in trait
+  --> $DIR/dont-project-to-specializable-projection.rs:12:27
+   |
+LL |     async fn foo(_: T) -> &'static str;
+   |                           ^^^^^^^^^^^^
+   = note: expected signature `fn(_) -> impl Future<Output = &'static str>`
+              found signature `fn(_) -> impl Future<Output = &'static str>`
+
+error: async associated function in trait cannot be specialized
+  --> $DIR/dont-project-to-specializable-projection.rs:16:5
+   |
+LL |     default async fn foo(_: T) -> &'static str {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
index afd3db5e052..7183eaccc93 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
@@ -1,5 +1,7 @@
 // edition: 2021
 // known-bug: #108309
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
 
 #![feature(async_fn_in_trait)]
 #![feature(min_specialization)]
diff --git a/tests/ui/diagnostic-width/auxiliary/tab_column_numbers.rs b/tests/ui/diagnostic-width/auxiliary/tab_column_numbers.rs
new file mode 100644
index 00000000000..93418b7651c
--- /dev/null
+++ b/tests/ui/diagnostic-width/auxiliary/tab_column_numbers.rs
@@ -0,0 +1,6 @@
+// ignore-tidy-tab
+
+pub struct S;
+impl S {
+		fn method(&self) {}
+}
diff --git a/tests/ui/diagnostic-width/tab-column-numbers.rs b/tests/ui/diagnostic-width/tab-column-numbers.rs
new file mode 100644
index 00000000000..2abb0bcde95
--- /dev/null
+++ b/tests/ui/diagnostic-width/tab-column-numbers.rs
@@ -0,0 +1,12 @@
+// Test for #109537: ensure that column numbers are correctly generated when using hard tabs.
+// aux-build:tab_column_numbers.rs
+
+// ignore-tidy-tab
+
+extern crate tab_column_numbers;
+
+fn main() {
+	let s = tab_column_numbers::S;
+	s.method();
+	//~^ ERROR method `method` is private
+}
diff --git a/tests/ui/diagnostic-width/tab-column-numbers.stderr b/tests/ui/diagnostic-width/tab-column-numbers.stderr
new file mode 100644
index 00000000000..ea4e1ff52a9
--- /dev/null
+++ b/tests/ui/diagnostic-width/tab-column-numbers.stderr
@@ -0,0 +1,14 @@
+error[E0624]: method `method` is private
+  --> $DIR/tab-column-numbers.rs:10:4
+   |
+LL |     s.method();
+   |       ^^^^^^ private method
+   |
+  ::: $DIR/auxiliary/tab_column_numbers.rs:5:3
+   |
+LL |         fn method(&self) {}
+   |         ---------------- private method defined here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/tests/ui/macros/missing-writer.rs b/tests/ui/macros/missing-writer.rs
new file mode 100644
index 00000000000..7df965c3684
--- /dev/null
+++ b/tests/ui/macros/missing-writer.rs
@@ -0,0 +1,17 @@
+// Check error for missing writer in writeln! and write! macro
+fn main() {
+    let x = 1;
+    let y = 2;
+    write!("{}_{}", x, y);
+    //~^ ERROR format argument must be a string literal
+    //~| HELP you might be missing a string literal to format with
+    //~| ERROR cannot write into `&'static str`
+    //~| NOTE must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method
+    //~| HELP a writer is needed before this format string
+    writeln!("{}_{}", x, y);
+    //~^ ERROR format argument must be a string literal
+    //~| HELP you might be missing a string literal to format with
+    //~| ERROR cannot write into `&'static str`
+    //~| NOTE must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method
+    //~| HELP a writer is needed before this format string
+}
diff --git a/tests/ui/macros/missing-writer.stderr b/tests/ui/macros/missing-writer.stderr
new file mode 100644
index 00000000000..86dfe7d65ea
--- /dev/null
+++ b/tests/ui/macros/missing-writer.stderr
@@ -0,0 +1,59 @@
+error: format argument must be a string literal
+  --> $DIR/missing-writer.rs:5:21
+   |
+LL |     write!("{}_{}", x, y);
+   |                     ^
+   |
+help: you might be missing a string literal to format with
+   |
+LL |     write!("{}_{}", "{} {}", x, y);
+   |                     ++++++++
+
+error: format argument must be a string literal
+  --> $DIR/missing-writer.rs:11:23
+   |
+LL |     writeln!("{}_{}", x, y);
+   |                       ^
+   |
+help: you might be missing a string literal to format with
+   |
+LL |     writeln!("{}_{}", "{} {}", x, y);
+   |                       ++++++++
+
+error[E0599]: cannot write into `&'static str`
+  --> $DIR/missing-writer.rs:5:12
+   |
+LL |     write!("{}_{}", x, y);
+   |     -------^^^^^^^------- method not found in `&str`
+   |
+note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method
+  --> $DIR/missing-writer.rs:5:12
+   |
+LL |     write!("{}_{}", x, y);
+   |            ^^^^^^^
+help: a writer is needed before this format string
+  --> $DIR/missing-writer.rs:5:12
+   |
+LL |     write!("{}_{}", x, y);
+   |            ^
+
+error[E0599]: cannot write into `&'static str`
+  --> $DIR/missing-writer.rs:11:14
+   |
+LL |     writeln!("{}_{}", x, y);
+   |     ---------^^^^^^^------- method not found in `&str`
+   |
+note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method
+  --> $DIR/missing-writer.rs:11:14
+   |
+LL |     writeln!("{}_{}", x, y);
+   |              ^^^^^^^
+help: a writer is needed before this format string
+  --> $DIR/missing-writer.rs:11:14
+   |
+LL |     writeln!("{}_{}", x, y);
+   |              ^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr b/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr
index 6910b77d9bc..94710f4503f 100644
--- a/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr
+++ b/tests/ui/suggestions/mut-borrow-needed-by-trait.stderr
@@ -21,18 +21,22 @@ note: required by a bound in `BufWriter`
   --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
 
 error[E0599]: the method `write_fmt` exists for struct `BufWriter<&dyn Write>`, but its trait bounds were not satisfied
-  --> $DIR/mut-borrow-needed-by-trait.rs:21:5
+  --> $DIR/mut-borrow-needed-by-trait.rs:21:14
    |
 LL |     writeln!(fp, "hello world").unwrap();
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds
+   |     ---------^^---------------- method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds
   --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
    |
    = note: doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write`
    |
+note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method
+  --> $DIR/mut-borrow-needed-by-trait.rs:21:14
+   |
+LL |     writeln!(fp, "hello world").unwrap();
+   |              ^^
    = note: the following trait bounds were not satisfied:
            `&dyn std::io::Write: std::io::Write`
            which is required by `BufWriter<&dyn std::io::Write>: std::io::Write`
-   = note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors