diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/rustdoc-gui/search-keyboard.goml | 28 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-102154.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/suggestions/dont-suggest-ufcs-for-const.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/suggestions/dont-suggest-ufcs-for-const.stderr | 15 | ||||
| -rw-r--r-- | src/test/ui/suggestions/suggest-assoc-fn-call-deref.fixed | 15 | ||||
| -rw-r--r-- | src/test/ui/suggestions/suggest-assoc-fn-call-deref.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/suggestions/suggest-assoc-fn-call-deref.stderr | 19 |
7 files changed, 109 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/search-keyboard.goml b/src/test/rustdoc-gui/search-keyboard.goml new file mode 100644 index 00000000000..be642fc4997 --- /dev/null +++ b/src/test/rustdoc-gui/search-keyboard.goml @@ -0,0 +1,28 @@ +// Checks that the search tab results work correctly with function signature syntax +// First, try a search-by-name +goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +write: (".search-input", "Foo") +// To be SURE that the search will be run. +press-key: 'Enter' +// Waiting for the search results to appear... +wait-for: "#titles" + +// Now use the keyboard commands to switch to the third result. +press-key: "ArrowDown" +press-key: "ArrowDown" +press-key: "ArrowDown" +assert: ".search-results.active > a:focus:nth-of-type(3)" + +// Now switch to the second tab, then back to the first one, then arrow back up. +press-key: "ArrowRight" +assert: ".search-results.active:nth-of-type(2) > a:focus:nth-of-type(1)" +press-key: "ArrowLeft" +assert: ".search-results.active:nth-of-type(1) > a:focus:nth-of-type(3)" +press-key: "ArrowUp" +assert: ".search-results.active > a:focus:nth-of-type(2)" +press-key: "ArrowUp" +assert: ".search-results.active > a:focus:nth-of-type(1)" +press-key: "ArrowUp" +assert: ".search-input:focus" +press-key: "ArrowDown" +assert: ".search-results.active > a:focus:nth-of-type(1)" diff --git a/src/test/rustdoc/issue-102154.rs b/src/test/rustdoc/issue-102154.rs new file mode 100644 index 00000000000..b36f270806f --- /dev/null +++ b/src/test/rustdoc/issue-102154.rs @@ -0,0 +1,13 @@ +trait A<Y, N> { + type B; +} +type MaybeBox<T> = <T as A<T, Box<T>>>::B; +struct P { + t: MaybeBox<P> +} +impl<Y, N> A<Y, N> for P { + type B = N; +} +fn main() { + let t: MaybeBox<P>; +} diff --git a/src/test/ui/suggestions/dont-suggest-ufcs-for-const.rs b/src/test/ui/suggestions/dont-suggest-ufcs-for-const.rs new file mode 100644 index 00000000000..06cf243f1b4 --- /dev/null +++ b/src/test/ui/suggestions/dont-suggest-ufcs-for-const.rs @@ -0,0 +1,4 @@ +fn main() { + 1_u32.MAX(); + //~^ ERROR no method named `MAX` found for type `u32` in the current scope +} diff --git a/src/test/ui/suggestions/dont-suggest-ufcs-for-const.stderr b/src/test/ui/suggestions/dont-suggest-ufcs-for-const.stderr new file mode 100644 index 00000000000..04e0511d788 --- /dev/null +++ b/src/test/ui/suggestions/dont-suggest-ufcs-for-const.stderr @@ -0,0 +1,15 @@ +error[E0599]: no method named `MAX` found for type `u32` in the current scope + --> $DIR/dont-suggest-ufcs-for-const.rs:2:11 + | +LL | 1_u32.MAX(); + | ------^^^-- + | | | + | | this is an associated function, not a method + | help: use associated function syntax instead: `u32::MAX()` + | + = note: found the following associated functions; to be used as methods, functions must have a `self` parameter + = note: the candidate is defined in an impl for the type `u32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/suggestions/suggest-assoc-fn-call-deref.fixed b/src/test/ui/suggestions/suggest-assoc-fn-call-deref.fixed new file mode 100644 index 00000000000..8d96cf590c3 --- /dev/null +++ b/src/test/ui/suggestions/suggest-assoc-fn-call-deref.fixed @@ -0,0 +1,15 @@ +// run-rustfix + +#![allow(unused)] + +struct Foo<T>(T); + +impl<T> Foo<T> { + fn test() -> i32 { 1 } +} + +fn main() { + let x = Box::new(Foo(1i32)); + Foo::<i32>::test(); + //~^ ERROR no method named `test` found for struct `Box<Foo<i32>>` in the current scope +} diff --git a/src/test/ui/suggestions/suggest-assoc-fn-call-deref.rs b/src/test/ui/suggestions/suggest-assoc-fn-call-deref.rs new file mode 100644 index 00000000000..186901f75a8 --- /dev/null +++ b/src/test/ui/suggestions/suggest-assoc-fn-call-deref.rs @@ -0,0 +1,15 @@ +// run-rustfix + +#![allow(unused)] + +struct Foo<T>(T); + +impl<T> Foo<T> { + fn test() -> i32 { 1 } +} + +fn main() { + let x = Box::new(Foo(1i32)); + x.test(); + //~^ ERROR no method named `test` found for struct `Box<Foo<i32>>` in the current scope +} diff --git a/src/test/ui/suggestions/suggest-assoc-fn-call-deref.stderr b/src/test/ui/suggestions/suggest-assoc-fn-call-deref.stderr new file mode 100644 index 00000000000..00fb96f0326 --- /dev/null +++ b/src/test/ui/suggestions/suggest-assoc-fn-call-deref.stderr @@ -0,0 +1,19 @@ +error[E0599]: no method named `test` found for struct `Box<Foo<i32>>` in the current scope + --> $DIR/suggest-assoc-fn-call-deref.rs:13:7 + | +LL | x.test(); + | --^^^^-- + | | | + | | this is an associated function, not a method + | help: use associated function syntax instead: `Foo::<i32>::test()` + | + = note: found the following associated functions; to be used as methods, functions must have a `self` parameter +note: the candidate is defined in an impl for the type `Foo<T>` + --> $DIR/suggest-assoc-fn-call-deref.rs:8:5 + | +LL | fn test() -> i32 { 1 } + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. |
