diff options
Diffstat (limited to 'tests/ui/typeck/lazy-norm')
4 files changed, 53 insertions, 0 deletions
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 000000000..5ff567cd0 --- /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 000000000..6b09ccd52 --- /dev/null +++ b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr @@ -0,0 +1,9 @@ +error[E0271]: type mismatch resolving `char == <u8 as Add>::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`. diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs new file mode 100644 index 000000000..019c6e81c --- /dev/null +++ b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs @@ -0,0 +1,24 @@ +// compile-flags: -Ztrait-solver=next +// known-bug: unknown + +trait Test { + type Assoc; +} + +fn transform<T: Test>(x: T) -> T::Assoc { + todo!() +} + +impl Test for i32 { + type Assoc = i32; +} + +impl Test for String { + type Assoc = String; +} + +fn main() { + let mut x = Default::default(); + x = transform(x); + x = 1i32; +} diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr new file mode 100644 index 000000000..57cbc65a1 --- /dev/null +++ b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/equating-projection-cyclically.rs:22:19 + | +LL | x = transform(x); + | ^ expected inferred type, found associated type + | + = note: expected type `_` + found associated type `<_ as Test>::Assoc` + = help: consider constraining the associated type `<_ as Test>::Assoc` to `_` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. |