about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-01 11:09:35 +0000
committerbors <bors@rust-lang.org>2022-07-01 11:09:35 +0000
commitca1e68b3229e710c3948a361ee770d846a88e6da (patch)
treecbd0e8977b42bd32f8ab140f36f825a9d8d74ed6 /src/test
parent7e2733bb1dd9afe5fd20370ca4d539d42ac50419 (diff)
parent6e918b4a97c8a2cb0923a639d76f840ac63b76c7 (diff)
Auto merge of #98730 - matthiaskrgr:rollup-2c4d4x5, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #97629 ([core] add `Exclusive` to sync)
 - #98503 (fix data race in thread::scope)
 - #98670 (llvm-wrapper: adapt for LLVMConstExtractValue removal)
 - #98671 (Fix source sidebar bugs)
 - #98677 (For diagnostic information of Boolean, remind it as use the type: 'bool')
 - #98684 (add test for 72793)
 - #98688 (interpret: add From<&MplaceTy> for PlaceTy)
 - #98695 (use "or pattern")
 - #98709 (Remove unneeded methods declaration for old web browsers)
 - #98717 (get rid of tidy 'unnecessarily ignored' warnings)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-gui/sidebar-source-code-display.goml36
-rw-r--r--src/test/rustdoc-gui/sidebar-source-code.goml4
-rw-r--r--src/test/ui/lint/recommend-literal.rs7
-rw-r--r--src/test/ui/lint/recommend-literal.stderr36
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-72793.rs25
5 files changed, 100 insertions, 8 deletions
diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml
index 8f53e8627ee..c441f84a821 100644
--- a/src/test/rustdoc-gui/sidebar-source-code-display.goml
+++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml
@@ -116,3 +116,39 @@ assert-css: (
     "#source-sidebar .expand + .children .folders .name",
     {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
 )
+
+// Now checking on mobile devices.
+size: (500, 700)
+reload:
+// Waiting for the sidebar to be displayed...
+wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
+
+// We now check it takes the full size of the display.
+assert-property: ("body", {"clientWidth": "500", "clientHeight": "700"})
+assert-property: (".sidebar", {"clientWidth": "500", "clientHeight": "700"})
+
+// We now check the display of the toggle once the sidebar is expanded.
+assert-property: ("#sidebar-toggle", {"clientWidth": "500", "clientHeight": "39"})
+assert-css: (
+    "#sidebar-toggle",
+    {
+        "border-top-width": "0px",
+        "border-right-width": "0px",
+        "border-left-width": "0px",
+        "border-bottom-width": "1px",
+    },
+)
+
+// We now check that the scroll position is kept when opening the sidebar.
+click: "#sidebar-toggle"
+wait-for-css: (".sidebar", {"width": "0px"})
+// We scroll to line 117 to change the scroll position.
+scroll-to: '//*[@id="117"]'
+assert-window-property: {"pageYOffset": "2519"}
+// Expanding the sidebar...
+click: "#sidebar-toggle"
+wait-for-css: (".sidebar", {"width": "500px"})
+click: "#sidebar-toggle"
+wait-for-css: (".sidebar", {"width": "0px"})
+// The "scrollTop" property should be the same.
+assert-window-property: {"pageYOffset": "2519"}
diff --git a/src/test/rustdoc-gui/sidebar-source-code.goml b/src/test/rustdoc-gui/sidebar-source-code.goml
index 724520bc399..86df478fa1d 100644
--- a/src/test/rustdoc-gui/sidebar-source-code.goml
+++ b/src/test/rustdoc-gui/sidebar-source-code.goml
@@ -18,8 +18,8 @@ assert: "nav.sidebar"
 
 // We now switch to mobile mode.
 size: (600, 600)
-// We check that the sidebar has the expected width (0 and 1px for the border).
-assert-css: ("nav.sidebar", {"width": "1px"})
+// We check that the sidebar has the expected width (0).
+assert-css: ("nav.sidebar", {"width": "0px"})
 // We expand the sidebar.
 click: "#sidebar-toggle"
 assert-css: (".source-sidebar-expanded nav.sidebar", {"width": "600px"})
diff --git a/src/test/ui/lint/recommend-literal.rs b/src/test/ui/lint/recommend-literal.rs
index f60d3d10dce..453cbf28569 100644
--- a/src/test/ui/lint/recommend-literal.rs
+++ b/src/test/ui/lint/recommend-literal.rs
@@ -7,6 +7,13 @@ fn main() {
     let y: long = 74802374902374923;
     //~^ ERROR cannot find type `long` in this scope
     //~| HELP perhaps you intended to use this type
+    let v1: Boolean = true;
+    //~^ ERROR: cannot find type `Boolean` in this scope [E0412]
+    //~| HELP perhaps you intended to use this type
+    let v2: Bool = true;
+    //~^ ERROR: cannot find type `Bool` in this scope [E0412]
+    //~| HELP a builtin type with a similar name exists
+    //~| HELP perhaps you intended to use this type
 }
 
 fn z(a: boolean) {
diff --git a/src/test/ui/lint/recommend-literal.stderr b/src/test/ui/lint/recommend-literal.stderr
index 0ebcfb40dc3..424ecadd4b8 100644
--- a/src/test/ui/lint/recommend-literal.stderr
+++ b/src/test/ui/lint/recommend-literal.stderr
@@ -16,8 +16,32 @@ LL |     let y: long = 74802374902374923;
    |            not found in this scope
    |            help: perhaps you intended to use this type: `i64`
 
+error[E0412]: cannot find type `Boolean` in this scope
+  --> $DIR/recommend-literal.rs:10:13
+   |
+LL |     let v1: Boolean = true;
+   |             ^^^^^^^
+   |             |
+   |             not found in this scope
+   |             help: perhaps you intended to use this type: `bool`
+
+error[E0412]: cannot find type `Bool` in this scope
+  --> $DIR/recommend-literal.rs:13:13
+   |
+LL |     let v2: Bool = true;
+   |             ^^^^
+   |
+help: a builtin type with a similar name exists
+   |
+LL |     let v2: bool = true;
+   |             ~~~~
+help: perhaps you intended to use this type
+   |
+LL |     let v2: bool = true;
+   |             ~~~~
+
 error[E0412]: cannot find type `boolean` in this scope
-  --> $DIR/recommend-literal.rs:12:9
+  --> $DIR/recommend-literal.rs:19:9
    |
 LL | fn z(a: boolean) {
    |         ^^^^^^^
@@ -26,7 +50,7 @@ LL | fn z(a: boolean) {
    |         help: perhaps you intended to use this type: `bool`
 
 error[E0412]: cannot find type `byte` in this scope
-  --> $DIR/recommend-literal.rs:17:11
+  --> $DIR/recommend-literal.rs:24:11
    |
 LL | fn a() -> byte {
    |           ^^^^
@@ -35,7 +59,7 @@ LL | fn a() -> byte {
    |           help: perhaps you intended to use this type: `u8`
 
 error[E0412]: cannot find type `float` in this scope
-  --> $DIR/recommend-literal.rs:24:12
+  --> $DIR/recommend-literal.rs:31:12
    |
 LL |     width: float,
    |            ^^^^^
@@ -44,7 +68,7 @@ LL |     width: float,
    |            help: perhaps you intended to use this type: `f32`
 
 error[E0412]: cannot find type `int` in this scope
-  --> $DIR/recommend-literal.rs:27:19
+  --> $DIR/recommend-literal.rs:34:19
    |
 LL |     depth: Option<int>,
    |                   ^^^ not found in this scope
@@ -59,7 +83,7 @@ LL | struct Data<int> {
    |            +++++
 
 error[E0412]: cannot find type `short` in this scope
-  --> $DIR/recommend-literal.rs:33:16
+  --> $DIR/recommend-literal.rs:40:16
    |
 LL | impl Stuff for short {}
    |                ^^^^^
@@ -67,6 +91,6 @@ LL | impl Stuff for short {}
    |                not found in this scope
    |                help: perhaps you intended to use this type: `i16`
 
-error: aborting due to 7 previous errors
+error: aborting due to 9 previous errors
 
 For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/type-alias-impl-trait/issue-72793.rs b/src/test/ui/type-alias-impl-trait/issue-72793.rs
new file mode 100644
index 00000000000..828c871143a
--- /dev/null
+++ b/src/test/ui/type-alias-impl-trait/issue-72793.rs
@@ -0,0 +1,25 @@
+// check-pass
+// compile-flags: -Zmir-opt-level=3
+
+#![feature(type_alias_impl_trait)]
+
+trait T { type Item; }
+
+type Alias<'a> = impl T<Item = &'a ()>;
+
+struct S;
+impl<'a> T for &'a S {
+    type Item = &'a ();
+}
+
+fn filter_positive<'a>() -> Alias<'a> {
+    &S
+}
+
+fn with_positive(fun: impl Fn(Alias<'_>)) {
+    fun(filter_positive());
+}
+
+fn main() {
+    with_positive(|_| ());
+}