Skip to content

Commit

Permalink
Add a regression test for rust-lang#134162
Browse files Browse the repository at this point in the history
  • Loading branch information
jieyouxu committed Dec 13, 2024
1 parent 4847d6a commit fcb27e9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/ui/typeck/rhs-ty-hint-134162.e2018.stderr
Original file line number Diff line number Diff line change
@@ -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`.
11 changes: 11 additions & 0 deletions tests/ui/typeck/rhs-ty-hint-134162.e2021.stderr
Original file line number Diff line number Diff line change
@@ -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`.
11 changes: 11 additions & 0 deletions tests/ui/typeck/rhs-ty-hint-134162.e2024.stderr
Original file line number Diff line number Diff line change
@@ -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`.
18 changes: 18 additions & 0 deletions tests/ui/typeck/rhs-ty-hint-134162.rs
Original file line number Diff line number Diff line change
@@ -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]`
}

0 comments on commit fcb27e9

Please sign in to comment.