From eb1f9babecbe51b7580e71ed8e558ff40eeee96c Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 20 Feb 2023 21:02:04 +0000 Subject: [PATCH] Add test for bad cast with deferred projection equality --- .../typeck/lazy-norm/cast-checks-handling-projections.rs | 6 ++++++ .../lazy-norm/cast-checks-handling-projections.stderr | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs create mode 100644 tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr diff --git a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs new file mode 100644 index 00000000000..5ff567cd07c --- /dev/null +++ b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs @@ -0,0 +1,6 @@ +// compile-flags: -Ztrait-solver=next +// known-bug: unknown + +fn main() { + (0u8 + 0u8) as char; +} diff --git a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr new file mode 100644 index 00000000000..6b09ccd5214 --- /dev/null +++ b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr @@ -0,0 +1,9 @@ +error[E0271]: type mismatch resolving `char == ::Output` + --> $DIR/cast-checks-handling-projections.rs:5:5 + | +LL | (0u8 + 0u8) as char; + | ^^^^^^^^^^^ types differ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`.