Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/builtin/derive_macro.rs')
-rw-r--r--crates/hir-expand/src/builtin/derive_macro.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/hir-expand/src/builtin/derive_macro.rs b/crates/hir-expand/src/builtin/derive_macro.rs
index 8b031e3647..c4da558fda 100644
--- a/crates/hir-expand/src/builtin/derive_macro.rs
+++ b/crates/hir-expand/src/builtin/derive_macro.rs
@@ -22,7 +22,7 @@ use crate::{
use syntax::{
ast::{
self, AstNode, FieldList, HasAttrs, HasGenericArgs, HasGenericParams, HasModuleItem,
- HasName, HasTypeBounds, make,
+ HasName, HasTypeBounds,
},
syntax_editor::{GetOrCreateWhereClause, SyntaxEditor},
};
@@ -1435,6 +1435,7 @@ fn coerce_pointee_expand(
param_name: &str,
replacement: &str,
) -> bool {
+ let make = editor.make();
return match ty {
ast::Type::ArrayType(ty) => ty
.ty()
@@ -1462,8 +1463,8 @@ fn coerce_pointee_expand(
if path.as_single_name_ref().is_some_and(|name| name.text() == param_name) {
editor.replace(
path.syntax(),
- make::path_from_segments(
- [make::path_segment(make::name_ref(replacement))],
+ make.path_from_segments(
+ [make.path_segment(make.name_ref(replacement))],
false,
)
.syntax(),
@@ -1494,6 +1495,9 @@ fn coerce_pointee_expand(
ast::Type::TupleType(ty) => any_long(ty.fields(), |ty| {
substitute_type_in_bound(editor, ty, param_name, replacement)
}),
+ ast::Type::PatternType(ty) => ty
+ .ty()
+ .is_some_and(|ty| substitute_type_in_bound(editor, ty, param_name, replacement)),
ast::Type::InferType(_) | ast::Type::MacroType(_) | ast::Type::NeverType(_) => false,
};