Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs')
-rw-r--r--crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs70
1 files changed, 65 insertions, 5 deletions
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 80474bc154..f41f971904 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
@@ -115,6 +115,66 @@ impl <A: core::clone::Clone, B: core::clone::Clone, > core::clone::Clone for Com
}
#[test]
+fn test_clone_expand_with_associated_types() {
+ check(
+ r#"
+//- minicore: derive, clone
+trait Trait {
+ type InWc;
+ type InFieldQualified;
+ type InFieldShorthand;
+ type InGenericArg;
+}
+trait Marker {}
+struct Vec<T>(T);
+
+#[derive(Clone)]
+struct Foo<T: Trait>
+where
+ <T as Trait>::InWc: Marker,
+{
+ qualified: <T as Trait>::InFieldQualified,
+ shorthand: T::InFieldShorthand,
+ generic: Vec<T::InGenericArg>,
+}
+"#,
+ expect![[r#"
+trait Trait {
+ type InWc;
+ type InFieldQualified;
+ type InFieldShorthand;
+ type InGenericArg;
+}
+trait Marker {}
+struct Vec<T>(T);
+
+#[derive(Clone)]
+struct Foo<T: Trait>
+where
+ <T as Trait>::InWc: Marker,
+{
+ qualified: <T as Trait>::InFieldQualified,
+ shorthand: T::InFieldShorthand,
+ generic: Vec<T::InGenericArg>,
+}
+
+impl <T: core::clone::Clone, > core::clone::Clone for Foo<T, > where T: Trait, T::InFieldShorthand: core::clone::Clone, T::InGenericArg: core::clone::Clone, {
+ fn clone(&self ) -> Self {
+ match self {
+ Foo {
+ qualified: qualified, shorthand: shorthand, generic: generic,
+ }
+ =>Foo {
+ qualified: qualified.clone(), shorthand: shorthand.clone(), generic: generic.clone(),
+ }
+ ,
+ }
+ }
+}"#]],
+ );
+}
+
+#[test]
fn test_clone_expand_with_const_generics() {
check(
r#"
@@ -336,18 +396,18 @@ enum Command {
}
impl < > core::hash::Hash for Command< > where {
- fn hash<H: core::hash::Hasher>(&self , state: &mut H) {
- core::mem::discriminant(self ).hash(state);
+ fn hash<H: core::hash::Hasher>(&self , ra_expand_state: &mut H) {
+ core::mem::discriminant(self ).hash(ra_expand_state);
match self {
Command::Move {
x: x, y: y,
}
=> {
- x.hash(state);
- y.hash(state);
+ x.hash(ra_expand_state);
+ y.hash(ra_expand_state);
}
, Command::Do(f0, )=> {
- f0.hash(state);
+ f0.hash(ra_expand_state);
}
, Command::Jump=> {}
,