about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make-fulldeps/print-calling-conventions/Makefile4
-rw-r--r--src/test/rustdoc-gui/docblock-code-block-line-number.goml17
-rw-r--r--src/test/rustdoc-gui/source-anchor-scroll.goml2
-rw-r--r--src/test/ui/abi/abi-typo-unstable.rs6
-rw-r--r--src/test/ui/abi/abi-typo-unstable.stderr11
-rw-r--r--src/test/ui/closures/issue-101696.rs36
-rw-r--r--src/test/ui/codemap_tests/unicode.normal.stderr2
-rw-r--r--src/test/ui/parser/issues/issue-8537.stderr2
-rw-r--r--src/test/ui/suggestions/abi-typo.fixed6
-rw-r--r--src/test/ui/suggestions/abi-typo.rs6
-rw-r--r--src/test/ui/suggestions/abi-typo.stderr14
11 files changed, 103 insertions, 3 deletions
diff --git a/src/test/run-make-fulldeps/print-calling-conventions/Makefile b/src/test/run-make-fulldeps/print-calling-conventions/Makefile
new file mode 100644
index 00000000000..d3fd06392b0
--- /dev/null
+++ b/src/test/run-make-fulldeps/print-calling-conventions/Makefile
@@ -0,0 +1,4 @@
+-include ../tools.mk
+
+all:
+	$(RUSTC) --print calling-conventions
diff --git a/src/test/rustdoc-gui/docblock-code-block-line-number.goml b/src/test/rustdoc-gui/docblock-code-block-line-number.goml
index baf9651c40d..ebfffbce715 100644
--- a/src/test/rustdoc-gui/docblock-code-block-line-number.goml
+++ b/src/test/rustdoc-gui/docblock-code-block-line-number.goml
@@ -20,3 +20,20 @@ assert-css: ("pre.line-number", {
 })
 // The first code block has two lines so let's check its `<pre>` elements lists both of them.
 assert-text: ("pre.line-number", "1\n2")
+
+// Now, try changing the setting dynamically. We'll turn it off, using the settings menu,
+// and make sure it goes away.
+
+// First, open the settings menu.
+click: "#settings-menu"
+wait-for: "#settings"
+assert-css: ("#settings", {"display": "block"})
+
+// Then, click the toggle button.
+click: "input#line-numbers + .slider"
+wait-for: 100 // wait-for-false does not exist
+assert-false: "pre.line-number"
+
+// Finally, turn it on again.
+click: "input#line-numbers + .slider"
+wait-for: "pre.line-number"
diff --git a/src/test/rustdoc-gui/source-anchor-scroll.goml b/src/test/rustdoc-gui/source-anchor-scroll.goml
index 4e51c8dcac0..47e40aa8e3b 100644
--- a/src/test/rustdoc-gui/source-anchor-scroll.goml
+++ b/src/test/rustdoc-gui/source-anchor-scroll.goml
@@ -10,7 +10,7 @@ assert-property: ("html", {"scrollTop": "0"})
 click: '//a[text() = "barbar"]'
 assert-property: ("html", {"scrollTop": "125"})
 click: '//a[text() = "bar"]'
-assert-property: ("html", {"scrollTop": "166"})
+assert-property: ("html", {"scrollTop": "156"})
 click: '//a[text() = "sub_fn"]'
 assert-property: ("html", {"scrollTop": "53"})
 
diff --git a/src/test/ui/abi/abi-typo-unstable.rs b/src/test/ui/abi/abi-typo-unstable.rs
new file mode 100644
index 00000000000..94991a5eb17
--- /dev/null
+++ b/src/test/ui/abi/abi-typo-unstable.rs
@@ -0,0 +1,6 @@
+// rust-intrinsic is unstable and not enabled, so it should not be suggested as a fix
+extern "rust-intrinsec" fn rust_intrinsic() {} //~ ERROR invalid ABI
+
+fn main() {
+    rust_intrinsic();
+}
diff --git a/src/test/ui/abi/abi-typo-unstable.stderr b/src/test/ui/abi/abi-typo-unstable.stderr
new file mode 100644
index 00000000000..3b346e00227
--- /dev/null
+++ b/src/test/ui/abi/abi-typo-unstable.stderr
@@ -0,0 +1,11 @@
+error[E0703]: invalid ABI: found `rust-intrinsec`
+  --> $DIR/abi-typo-unstable.rs:2:8
+   |
+LL | extern "rust-intrinsec" fn rust_intrinsic() {}
+   |        ^^^^^^^^^^^^^^^^ invalid ABI
+   |
+   = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0703`.
diff --git a/src/test/ui/closures/issue-101696.rs b/src/test/ui/closures/issue-101696.rs
new file mode 100644
index 00000000000..0a358bd1643
--- /dev/null
+++ b/src/test/ui/closures/issue-101696.rs
@@ -0,0 +1,36 @@
+// check-pass
+
+use std::marker::PhantomData;
+
+#[derive(Default)]
+struct MyType<'a> {
+    field: usize,
+    _phantom: PhantomData<&'a ()>,
+}
+
+#[derive(Default)]
+struct MyTypeVariant<'a> {
+    field: usize,
+    _phantom: PhantomData<&'a ()>,
+}
+
+trait AsVariantTrait {
+    type Type;
+}
+
+impl<'a> AsVariantTrait for MyType<'a> {
+    type Type = MyTypeVariant<'a>;
+}
+
+type Variant<G> = <G as AsVariantTrait>::Type;
+
+fn foo<T: Default, F: FnOnce(T)>(f: F) {
+    let input = T::default();
+    f(input);
+}
+
+fn main() {
+    foo(|a: <MyType as AsVariantTrait>::Type| {
+        a.field;
+    });
+}
diff --git a/src/test/ui/codemap_tests/unicode.normal.stderr b/src/test/ui/codemap_tests/unicode.normal.stderr
index 60f8cff84b3..05ceb6910da 100644
--- a/src/test/ui/codemap_tests/unicode.normal.stderr
+++ b/src/test/ui/codemap_tests/unicode.normal.stderr
@@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `路濫狼á́́`
 LL | extern "路濫狼á́́" fn foo() {}
    |        ^^^^^^^^^ invalid ABI
    |
-   = help: valid ABIs: Rust, C, C-unwind, cdecl, cdecl-unwind, stdcall, stdcall-unwind, fastcall, fastcall-unwind, vectorcall, vectorcall-unwind, thiscall, thiscall-unwind, aapcs, aapcs-unwind, win64, win64-unwind, sysv64, sysv64-unwind, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, efiapi, avr-interrupt, avr-non-blocking-interrupt, C-cmse-nonsecure-call, wasm, system, system-unwind, rust-intrinsic, rust-call, platform-intrinsic, unadjusted, rust-cold
+   = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/issues/issue-8537.stderr b/src/test/ui/parser/issues/issue-8537.stderr
index 505d830ef3e..523cc9dc588 100644
--- a/src/test/ui/parser/issues/issue-8537.stderr
+++ b/src/test/ui/parser/issues/issue-8537.stderr
@@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `invalid-ab_isize`
 LL |   "invalid-ab_isize"
    |   ^^^^^^^^^^^^^^^^^^ invalid ABI
    |
-   = help: valid ABIs: Rust, C, C-unwind, cdecl, cdecl-unwind, stdcall, stdcall-unwind, fastcall, fastcall-unwind, vectorcall, vectorcall-unwind, thiscall, thiscall-unwind, aapcs, aapcs-unwind, win64, win64-unwind, sysv64, sysv64-unwind, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, efiapi, avr-interrupt, avr-non-blocking-interrupt, C-cmse-nonsecure-call, wasm, system, system-unwind, rust-intrinsic, rust-call, platform-intrinsic, unadjusted, rust-cold
+   = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/suggestions/abi-typo.fixed b/src/test/ui/suggestions/abi-typo.fixed
new file mode 100644
index 00000000000..04d265865f0
--- /dev/null
+++ b/src/test/ui/suggestions/abi-typo.fixed
@@ -0,0 +1,6 @@
+// run-rustfix
+extern "cdecl" fn cdedl() {} //~ ERROR invalid ABI
+
+fn main() {
+    cdedl();
+}
diff --git a/src/test/ui/suggestions/abi-typo.rs b/src/test/ui/suggestions/abi-typo.rs
new file mode 100644
index 00000000000..6d80db522eb
--- /dev/null
+++ b/src/test/ui/suggestions/abi-typo.rs
@@ -0,0 +1,6 @@
+// run-rustfix
+extern "cdedl" fn cdedl() {} //~ ERROR invalid ABI
+
+fn main() {
+    cdedl();
+}
diff --git a/src/test/ui/suggestions/abi-typo.stderr b/src/test/ui/suggestions/abi-typo.stderr
new file mode 100644
index 00000000000..67a84f119f6
--- /dev/null
+++ b/src/test/ui/suggestions/abi-typo.stderr
@@ -0,0 +1,14 @@
+error[E0703]: invalid ABI: found `cdedl`
+  --> $DIR/abi-typo.rs:2:8
+   |
+LL | extern "cdedl" fn cdedl() {}
+   |        ^^^^^^^
+   |        |
+   |        invalid ABI
+   |        help: did you mean: `"cdecl"`
+   |
+   = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0703`.