diff --git a/crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs b/crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs
index fafcde25ae..37cf348c92 100644
--- a/crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs
+++ b/crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs
@@ -16,7 +16,7 @@ struct Foo;
#[derive(Copy)]
struct Foo;
-impl < > core::marker::Copy for Foo< > {}"#]],
+impl < > core::marker::Copy for Foo< > where {}"#]],
);
}
@@ -41,7 +41,7 @@ macro Copy {}
#[derive(Copy)]
struct Foo;
-impl < > crate ::marker::Copy for Foo< > {}"#]],
+impl < > crate ::marker::Copy for Foo< > where {}"#]],
);
}
@@ -57,7 +57,7 @@ struct Foo;
#[derive(Copy)]
struct Foo;
-impl core::marker::Copy for Foo {}"#]],
+impl core::marker::Copy for Foo where {}"#]],
);
}
@@ -74,7 +74,7 @@ struct Foo;
#[derive(Copy)]
struct Foo;
-impl core::marker::Copy for Foo {}"#]],
+impl core::marker::Copy for Foo where {}"#]],
);
}
@@ -90,7 +90,7 @@ struct Foo;
#[derive(Clone)]
struct Foo;
-impl core::clone::Clone for Foo {}"#]],
+impl core::clone::Clone for Foo where {}"#]],
);
}
@@ -106,6 +106,6 @@ struct Foo(u32);
#[derive(Clone)]
struct Foo(u32);
-impl core::clone::Clone for Foo {}"#]],
+impl core::clone::Clone for Foo where {}"#]],
);
}
diff --git a/crates/hir-expand/src/builtin_derive_macro.rs b/crates/hir-expand/src/builtin_derive_macro.rs
index 5c1a75132e..7e753663c0 100644
--- a/crates/hir-expand/src/builtin_derive_macro.rs
+++ b/crates/hir-expand/src/builtin_derive_macro.rs
@@ -1,11 +1,12 @@
//! Builtin derives.
use base_db::{CrateOrigin, LangCrateOrigin};
+use std::collections::HashSet;
use tracing::debug;
use crate::tt::{self, TokenId};
use syntax::{
- ast::{self, AstNode, HasGenericParams, HasModuleItem, HasName},
+ ast::{self, AstNode, HasGenericParams, HasModuleItem, HasName, HasTypeBounds, PathType},
match_ast,
};
@@ -60,8 +61,11 @@ pub fn find_builtin_derive(ident: &name::Name) -> Option
struct BasicAdtInfo {
name: tt::Ident,
- /// `Some(ty)` if it's a const param of type `ty`, `None` if it's a type param.
- param_types: Vec