From 3e31ffda973d2fe8e314378a98d0b4633fce9485 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 17 Dec 2020 20:16:10 +0000 Subject: Revert change to evaluation order This change breaks some code and doesn't appear to enable any new code. --- src/test/ui/traits/impl-evaluation-order.rs | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/test/ui/traits/impl-evaluation-order.rs (limited to 'src') diff --git a/src/test/ui/traits/impl-evaluation-order.rs b/src/test/ui/traits/impl-evaluation-order.rs new file mode 100644 index 00000000000..57809d89aa6 --- /dev/null +++ b/src/test/ui/traits/impl-evaluation-order.rs @@ -0,0 +1,39 @@ +// Regression test for #79902 + +// Check that evaluation (which is used to determine whether to copy a type in +// MIR building) evaluates bounds from normalizing an impl after evaluating +// any bounds on the impl. + +// check-pass + +trait A { + type B; +} +trait M {} + +struct G(*const T, *const U); + +impl Clone for G { + fn clone(&self) -> Self { + G { ..*self } + } +} + +impl Copy for G +where + T: A, + U: A, +{ +} + +impl A for () { + type B = (); +} + +fn is_m(_: T) {} + +fn main() { + let x = G(&(), &()); + drop(x); + drop(x); +} -- cgit 1.4.1-3-g733a5