From 7b6998798548a4b87a0c65655522802d81387fba Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Tue, 2 Feb 2021 13:34:08 -0300 Subject: [PATCH] Add regression test for ICE that happened on incr comp An ICE happened when certain code is compiled in incremental compilation mode and there are two `Ident`s that have the same `StableHash` value but are considered different by `Eq` and `Hash`. The `Ident` issue is now fixed. --- .../traits-assoc-type-macros.rs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/test/ui/associated-type-bounds/traits-assoc-type-macros.rs diff --git a/src/test/ui/associated-type-bounds/traits-assoc-type-macros.rs b/src/test/ui/associated-type-bounds/traits-assoc-type-macros.rs new file mode 100644 index 000000000000..ad5c6aed97c2 --- /dev/null +++ b/src/test/ui/associated-type-bounds/traits-assoc-type-macros.rs @@ -0,0 +1,43 @@ +// check-pass +// compile-flags:-Cincremental=tmp/traits-assoc-type-macros + +// This test case makes sure that we can compile with incremental compilation +// enabled when there are macros, traits, inheritance and associated types involved. + +trait Deserializer { + type Error; +} + +trait Deserialize { + fn deserialize(_: D) -> D::Error + where + D: Deserializer; +} + +macro_rules! impl_deserialize { + ($name:ident) => { + impl Deserialize for $name { + fn deserialize(_: D) -> D::Error + where + D: Deserializer, + { + loop {} + } + } + }; +} + +macro_rules! formats { + { + $($name:ident,)* + } => { + $( + pub struct $name; + + impl_deserialize!($name); + )* + } +} +formats! { Foo, Bar, } + +fn main() {}