about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-14 20:20:40 +0000
committerbors <bors@rust-lang.org>2023-06-14 20:20:40 +0000
commit8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220 (patch)
tree757e21f059fc4174cf233a2fcaea26576700e065 /tests
parent0b475c705f36fb3b0a63994b92f2bbd2f5865b07 (diff)
parent36163881396b218a98c38598c239a0b32515533f (diff)
downloadrust-8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220.tar.gz
rust-8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220.zip
Auto merge of #112625 - matthiaskrgr:rollup-jcobj3g, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #112584 (loongarch64-none*: Remove environment component from llvm target)
 - #112600 (Introduce a `Stable` trait to translate MIR to SMIR)
 - #112605 (Improve docs/clean up negative overlap functions)
 - #112611 (Error on unconstrained lifetime in RPITIT)
 - #112612 (Fix explicit-outlives-requirements lint span)
 - #112613 (Fix rustdoc-gui tests on Windows)
 - #112620 (Fix small typo)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-gui/shortcuts.goml6
-rw-r--r--tests/rustdoc-gui/source-code-page.goml24
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr21
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr20
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr20
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.rs21
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.stderr74
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr12
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr12
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.current.stderr9
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.next.stderr9
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.rs16
-rw-r--r--tests/ui/rust-2018/edition-lint-infer-outlives.fixed6
-rw-r--r--tests/ui/rust-2018/edition-lint-infer-outlives.rs8
-rw-r--r--tests/ui/rust-2018/edition-lint-infer-outlives.stderr11
15 files changed, 174 insertions, 95 deletions
diff --git a/tests/rustdoc-gui/shortcuts.goml b/tests/rustdoc-gui/shortcuts.goml
index 667df89ec9b..2c61ee5428b 100644
--- a/tests/rustdoc-gui/shortcuts.goml
+++ b/tests/rustdoc-gui/shortcuts.goml
@@ -13,7 +13,7 @@ press-key: "Escape"
 assert-css: ("#help-button .popover", {"display": "none"})
 // Checking doc collapse and expand.
 // It should be displaying a "-":
-assert-text: ("#toggle-all-docs", "[\u2212]")
+assert-text: ("#toggle-all-docs", "[−]")
 press-key: "-"
 wait-for-text: ("#toggle-all-docs", "[+]")
 assert-attribute: ("#toggle-all-docs", {"class": "will-expand"})
@@ -23,9 +23,9 @@ assert-text: ("#toggle-all-docs", "[+]")
 assert-attribute: ("#toggle-all-docs", {"class": "will-expand"})
 // Expanding now.
 press-key: "+"
-wait-for-text: ("#toggle-all-docs", "[\u2212]")
+wait-for-text: ("#toggle-all-docs", "[−]")
 assert-attribute: ("#toggle-all-docs", {"class": ""})
 // Pressing it again shouldn't do anything.
 press-key: "+"
-assert-text: ("#toggle-all-docs", "[\u2212]")
+assert-text: ("#toggle-all-docs", "[−]")
 assert-attribute: ("#toggle-all-docs", {"class": ""})
diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml
index d5dd511b1d3..f8f73398d9b 100644
--- a/tests/rustdoc-gui/source-code-page.goml
+++ b/tests/rustdoc-gui/source-code-page.goml
@@ -64,23 +64,23 @@ call-function: ("check-colors", {
 compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y"))
 // Check the `href` property so that users can treat anchors as links.
 assert-property: (".src-line-numbers > a:nth-child(1)", {
-    "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#1"
-})
+    "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#1"
+}, ENDS_WITH)
 assert-property: (".src-line-numbers > a:nth-child(2)", {
-    "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#2"
-})
+    "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#2"
+}, ENDS_WITH)
 assert-property: (".src-line-numbers > a:nth-child(3)", {
-    "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#3"
-})
+    "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#3"
+}, ENDS_WITH)
 assert-property: (".src-line-numbers > a:nth-child(4)", {
-    "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#4"
-})
+    "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#4"
+}, ENDS_WITH)
 assert-property: (".src-line-numbers > a:nth-child(5)", {
-    "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#5"
-})
+    "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#5"
+}, ENDS_WITH)
 assert-property: (".src-line-numbers > a:nth-child(6)", {
-    "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#6"
-})
+    "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#6"
+}, ENDS_WITH)
 
 // Assert that the line numbers text is aligned to the right.
 assert-css: (".src-line-numbers", {"text-align": "right"})
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
new file mode 100644
index 00000000000..f604ada6ac7
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
@@ -0,0 +1,21 @@
+error[E0053]: method `early` has an incompatible type for trait
+  --> $DIR/method-signature-matches.rs:58:27
+   |
+LL |     fn early<'late, T>(_: &'late ()) {}
+   |                     -     ^^^^^^^^^
+   |                     |     |
+   |                     |     expected type parameter `T`, found `()`
+   |                     |     help: change the parameter type to match the trait: `&'early T`
+   |                     this type parameter
+   |
+note: type in trait
+  --> $DIR/method-signature-matches.rs:53:28
+   |
+LL |     fn early<'early, T>(x: &'early T) -> impl Sized;
+   |                            ^^^^^^^^^
+   = note: expected signature `fn(&'early T)`
+              found signature `fn(&())`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
new file mode 100644
index 00000000000..d3183b92e84
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
@@ -0,0 +1,20 @@
+error[E0053]: method `owo` has an incompatible type for trait
+  --> $DIR/method-signature-matches.rs:14:15
+   |
+LL |     fn owo(_: u8) {}
+   |               ^^
+   |               |
+   |               expected `()`, found `u8`
+   |               help: change the parameter type to match the trait: `()`
+   |
+note: type in trait
+  --> $DIR/method-signature-matches.rs:9:15
+   |
+LL |     fn owo(x: ()) -> impl Sized;
+   |               ^^
+   = note: expected signature `fn(())`
+              found signature `fn(u8)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
new file mode 100644
index 00000000000..80fda1c9fe1
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
@@ -0,0 +1,20 @@
+error[E0053]: method `owo` has an incompatible type for trait
+  --> $DIR/method-signature-matches.rs:25:21
+   |
+LL |     async fn owo(_: u8) {}
+   |                     ^^
+   |                     |
+   |                     expected `()`, found `u8`
+   |                     help: change the parameter type to match the trait: `()`
+   |
+note: type in trait
+  --> $DIR/method-signature-matches.rs:20:21
+   |
+LL |     async fn owo(x: ()) {}
+   |                     ^^
+   = note: expected signature `fn(()) -> _`
+              found signature `fn(u8) -> _`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.rs b/tests/ui/impl-trait/in-trait/method-signature-matches.rs
index c848ee3f643..294f93b30d0 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.rs
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.rs
@@ -1,51 +1,62 @@
 // edition: 2021
+// revisions: mismatch mismatch_async too_many too_few lt
 
 #![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
 #![allow(incomplete_features)]
 
+#[cfg(mismatch)]
 trait Uwu {
     fn owo(x: ()) -> impl Sized;
 }
 
+#[cfg(mismatch)]
 impl Uwu for () {
     fn owo(_: u8) {}
-    //~^ ERROR method `owo` has an incompatible type for trait
+    //[mismatch]~^ ERROR method `owo` has an incompatible type for trait
 }
 
+#[cfg(mismatch_async)]
 trait AsyncUwu {
     async fn owo(x: ()) {}
 }
 
+#[cfg(mismatch_async)]
 impl AsyncUwu for () {
     async fn owo(_: u8) {}
-    //~^ ERROR method `owo` has an incompatible type for trait
+    //[mismatch_async]~^ ERROR method `owo` has an incompatible type for trait
 }
 
+#[cfg(too_many)]
 trait TooMuch {
     fn calm_down_please() -> impl Sized;
 }
 
+#[cfg(too_many)]
 impl TooMuch for () {
     fn calm_down_please(_: (), _: (), _: ()) {}
-    //~^ ERROR method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0
+    //[too_many]~^ ERROR method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0
 }
 
+#[cfg(too_few)]
 trait TooLittle {
     fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized;
 }
 
+#[cfg(too_few)]
 impl TooLittle for () {
     fn come_on_a_little_more_effort() {}
-    //~^ ERROR method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3
+    //[too_few]~^ ERROR method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3
 }
 
+#[cfg(lt)]
 trait Lifetimes {
     fn early<'early, T>(x: &'early T) -> impl Sized;
 }
 
+#[cfg(lt)]
 impl Lifetimes for () {
     fn early<'late, T>(_: &'late ()) {}
-    //~^ ERROR method `early` has an incompatible type for trait
+    //[lt]~^ ERROR method `early` has an incompatible type for trait
 }
 
 fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.stderr
deleted file mode 100644
index 3ec62020e6c..00000000000
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.stderr
+++ /dev/null
@@ -1,74 +0,0 @@
-error[E0053]: method `owo` has an incompatible type for trait
-  --> $DIR/method-signature-matches.rs:11:15
-   |
-LL |     fn owo(_: u8) {}
-   |               ^^
-   |               |
-   |               expected `()`, found `u8`
-   |               help: change the parameter type to match the trait: `()`
-   |
-note: type in trait
-  --> $DIR/method-signature-matches.rs:7:15
-   |
-LL |     fn owo(x: ()) -> impl Sized;
-   |               ^^
-   = note: expected signature `fn(())`
-              found signature `fn(u8)`
-
-error[E0053]: method `owo` has an incompatible type for trait
-  --> $DIR/method-signature-matches.rs:20:21
-   |
-LL |     async fn owo(_: u8) {}
-   |                     ^^
-   |                     |
-   |                     expected `()`, found `u8`
-   |                     help: change the parameter type to match the trait: `()`
-   |
-note: type in trait
-  --> $DIR/method-signature-matches.rs:16:21
-   |
-LL |     async fn owo(x: ()) {}
-   |                     ^^
-   = note: expected signature `fn(()) -> _`
-              found signature `fn(u8) -> _`
-
-error[E0050]: method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0
-  --> $DIR/method-signature-matches.rs:29:28
-   |
-LL |     fn calm_down_please() -> impl Sized;
-   |     ------------------------------------ trait requires 0 parameters
-...
-LL |     fn calm_down_please(_: (), _: (), _: ()) {}
-   |                            ^^^^^^^^^^^^^^^^ expected 0 parameters, found 3
-
-error[E0050]: method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3
-  --> $DIR/method-signature-matches.rs:38:5
-   |
-LL |     fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized;
-   |                                        ---------------- trait requires 3 parameters
-...
-LL |     fn come_on_a_little_more_effort() {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 3 parameters, found 0
-
-error[E0053]: method `early` has an incompatible type for trait
-  --> $DIR/method-signature-matches.rs:47:27
-   |
-LL |     fn early<'late, T>(_: &'late ()) {}
-   |                     -     ^^^^^^^^^
-   |                     |     |
-   |                     |     expected type parameter `T`, found `()`
-   |                     |     help: change the parameter type to match the trait: `&'early T`
-   |                     this type parameter
-   |
-note: type in trait
-  --> $DIR/method-signature-matches.rs:43:28
-   |
-LL |     fn early<'early, T>(x: &'early T) -> impl Sized;
-   |                            ^^^^^^^^^
-   = note: expected signature `fn(&'early T)`
-              found signature `fn(&())`
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0050, E0053.
-For more information about an error, try `rustc --explain E0050`.
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
new file mode 100644
index 00000000000..24bcfeb748f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
@@ -0,0 +1,12 @@
+error[E0050]: method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3
+  --> $DIR/method-signature-matches.rs:47:5
+   |
+LL |     fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized;
+   |                                        ---------------- trait requires 3 parameters
+...
+LL |     fn come_on_a_little_more_effort() {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 3 parameters, found 0
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0050`.
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
new file mode 100644
index 00000000000..616cbd2905c
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
@@ -0,0 +1,12 @@
+error[E0050]: method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0
+  --> $DIR/method-signature-matches.rs:36:28
+   |
+LL |     fn calm_down_please() -> impl Sized;
+   |     ------------------------------------ trait requires 0 parameters
+...
+LL |     fn calm_down_please(_: (), _: (), _: ()) {}
+   |                            ^^^^^^^^^^^^^^^^ expected 0 parameters, found 3
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0050`.
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.current.stderr b/tests/ui/impl-trait/in-trait/unconstrained-lt.current.stderr
new file mode 100644
index 00000000000..bf088ae8b25
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.current.stderr
@@ -0,0 +1,9 @@
+error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+  --> $DIR/unconstrained-lt.rs:10:6
+   |
+LL | impl<'a, T> Foo for T {
+   |      ^^ unconstrained lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0207`.
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.next.stderr b/tests/ui/impl-trait/in-trait/unconstrained-lt.next.stderr
new file mode 100644
index 00000000000..bf088ae8b25
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.next.stderr
@@ -0,0 +1,9 @@
+error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+  --> $DIR/unconstrained-lt.rs:10:6
+   |
+LL | impl<'a, T> Foo for T {
+   |      ^^ unconstrained lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0207`.
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
new file mode 100644
index 00000000000..f966be43a6e
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
@@ -0,0 +1,16 @@
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
+
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Foo {
+    fn test() -> impl Sized;
+}
+
+impl<'a, T> Foo for T {
+    //~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+
+    fn test() -> &'a () { &() }
+}
+
+fn main() {}
diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.fixed b/tests/ui/rust-2018/edition-lint-infer-outlives.fixed
index 868bdf2e068..5058d61b588 100644
--- a/tests/ui/rust-2018/edition-lint-infer-outlives.fixed
+++ b/tests/ui/rust-2018/edition-lint-infer-outlives.fixed
@@ -801,4 +801,10 @@ where
     yoo: &'a U
 }
 
+// https://github.com/rust-lang/rust/issues/105150
+struct InferredWhereBoundWithInlineBound<'a, T: ?Sized>
+{
+    data: &'a T,
+}
+
 fn main() {}
diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.rs b/tests/ui/rust-2018/edition-lint-infer-outlives.rs
index 75783764ad6..3f63cb8e900 100644
--- a/tests/ui/rust-2018/edition-lint-infer-outlives.rs
+++ b/tests/ui/rust-2018/edition-lint-infer-outlives.rs
@@ -801,4 +801,12 @@ where
     yoo: &'a U
 }
 
+// https://github.com/rust-lang/rust/issues/105150
+struct InferredWhereBoundWithInlineBound<'a, T: ?Sized>
+//~^ ERROR outlives requirements can be inferred
+    where T: 'a,
+{
+    data: &'a T,
+}
+
 fn main() {}
diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr
index e655fb4842c..dbf301fd8a1 100644
--- a/tests/ui/rust-2018/edition-lint-infer-outlives.stderr
+++ b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr
@@ -11,6 +11,15 @@ LL | #![deny(explicit_outlives_requirements)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: outlives requirements can be inferred
+  --> $DIR/edition-lint-infer-outlives.rs:805:56
+   |
+LL |   struct InferredWhereBoundWithInlineBound<'a, T: ?Sized>
+   |  ________________________________________________________^
+LL | |
+LL | |     where T: 'a,
+   | |________________^ help: remove this bound
+
+error: outlives requirements can be inferred
   --> $DIR/edition-lint-infer-outlives.rs:26:31
    |
 LL |     struct TeeOutlivesAy<'a, T: 'a> {
@@ -922,5 +931,5 @@ error: outlives requirements can be inferred
 LL |     union BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug {
    |                                                            ^^^^^^^^ help: remove this bound
 
-error: aborting due to 153 previous errors
+error: aborting due to 154 previous errors