From 631cd5845e8de329d0e227aaa707d7ea228b8f8f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:29 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/traits/new-solver/projection-discr-kind.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/ui/traits/new-solver/projection-discr-kind.rs (limited to 'tests/ui/traits/new-solver/projection-discr-kind.rs') diff --git a/tests/ui/traits/new-solver/projection-discr-kind.rs b/tests/ui/traits/new-solver/projection-discr-kind.rs new file mode 100644 index 000000000..20296b287 --- /dev/null +++ b/tests/ui/traits/new-solver/projection-discr-kind.rs @@ -0,0 +1,18 @@ +// compile-flags: -Ztrait-solver=next + +// Check that `::Discriminant` doesn't normalize +// to itself and cause overflow/ambiguity. + +trait Foo { + type Assoc; +} + +trait Bar {} +fn needs_bar(_: impl Bar) {} + +fn foo(x: T::Assoc) { + needs_bar(std::mem::discriminant(&x)); + //~^ ERROR the trait bound `Discriminant<::Assoc>: Bar` is not satisfied +} + +fn main() {} -- cgit v1.2.3