diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-12-14 02:51:15 +0800 |
|---|---|---|
| committer | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-12-14 17:07:20 +0800 |
| commit | 0b0744ae8093eeeb9cf9627320ca0d4649c9ffaf (patch) | |
| tree | a05c28e4b9de98d07b9d8f95d1d02d4be0dd9b28 | |
| parent | a1740a9c3568e856f6aa12d83e008d38c9749d4b (diff) | |
| download | rust-0b0744ae8093eeeb9cf9627320ca0d4649c9ffaf.tar.gz rust-0b0744ae8093eeeb9cf9627320ca0d4649c9ffaf.zip | |
Add a regression test for #134162
| -rw-r--r-- | tests/crashes/134162.rs | 8 | ||||
| -rw-r--r-- | tests/ui/typeck/rhs-ty-hint-134162.e2018.stderr | 11 | ||||
| -rw-r--r-- | tests/ui/typeck/rhs-ty-hint-134162.e2021.stderr | 11 | ||||
| -rw-r--r-- | tests/ui/typeck/rhs-ty-hint-134162.e2024.stderr | 11 | ||||
| -rw-r--r-- | tests/ui/typeck/rhs-ty-hint-134162.rs | 18 |
5 files changed, 51 insertions, 8 deletions
diff --git a/tests/crashes/134162.rs b/tests/crashes/134162.rs deleted file mode 100644 index 9e5a4a1cb0b..00000000000 --- a/tests/crashes/134162.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ known-bug: #134162 - -fn main() { - struct X; - - let xs = [X, X, X]; - let eq = xs == [panic!("panic evaluated"); 2]; -} diff --git a/tests/ui/typeck/rhs-ty-hint-134162.e2018.stderr b/tests/ui/typeck/rhs-ty-hint-134162.e2018.stderr new file mode 100644 index 00000000000..ff189e36ba0 --- /dev/null +++ b/tests/ui/typeck/rhs-ty-hint-134162.e2018.stderr @@ -0,0 +1,11 @@ +error[E0369]: binary operation `==` cannot be applied to type `[X; 1]` + --> $DIR/rhs-ty-hint-134162.rs:16:17 + | +LL | let _ = [X] == [panic!(); 2]; + | --- ^^ ------------- [_; 2] + | | + | [X; 1] + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/typeck/rhs-ty-hint-134162.e2021.stderr b/tests/ui/typeck/rhs-ty-hint-134162.e2021.stderr new file mode 100644 index 00000000000..ff189e36ba0 --- /dev/null +++ b/tests/ui/typeck/rhs-ty-hint-134162.e2021.stderr @@ -0,0 +1,11 @@ +error[E0369]: binary operation `==` cannot be applied to type `[X; 1]` + --> $DIR/rhs-ty-hint-134162.rs:16:17 + | +LL | let _ = [X] == [panic!(); 2]; + | --- ^^ ------------- [_; 2] + | | + | [X; 1] + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/typeck/rhs-ty-hint-134162.e2024.stderr b/tests/ui/typeck/rhs-ty-hint-134162.e2024.stderr new file mode 100644 index 00000000000..ff189e36ba0 --- /dev/null +++ b/tests/ui/typeck/rhs-ty-hint-134162.e2024.stderr @@ -0,0 +1,11 @@ +error[E0369]: binary operation `==` cannot be applied to type `[X; 1]` + --> $DIR/rhs-ty-hint-134162.rs:16:17 + | +LL | let _ = [X] == [panic!(); 2]; + | --- ^^ ------------- [_; 2] + | | + | [X; 1] + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/typeck/rhs-ty-hint-134162.rs b/tests/ui/typeck/rhs-ty-hint-134162.rs new file mode 100644 index 00000000000..a14b4bcfd26 --- /dev/null +++ b/tests/ui/typeck/rhs-ty-hint-134162.rs @@ -0,0 +1,18 @@ +//! Regression test for <https://github.com/rust-lang/rust/issues/134162>. +//! +//! <https://github.com/rust-lang/rust/pull/110877> introduced RHS type hints for when a ty doesn't +//! support a bin op. In the suggestion path, there was a `delay_bug`. +//! <https://github.com/rust-lang/rust/pull/121208> converted this `delay_bug` to `bug`, which did +//! not trigger any test failures as we did not have test coverage for this particular case. This +//! manifested in an ICE as reported in <https://github.com/rust-lang/rust/issues/134162>. + +//@ revisions: e2018 e2021 e2024 +//@[e2018] edition: 2018 +//@[e2021] edition: 2021 +//@[e2024] edition: 2024 + +fn main() { + struct X; + let _ = [X] == [panic!(); 2]; + //[e2018,e2021,e2024]~^ ERROR binary operation `==` cannot be applied to type `[X; 1]` +} |
