Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/proc_macro.rs')
-rw-r--r--crates/hir-expand/src/proc_macro.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/crates/hir-expand/src/proc_macro.rs b/crates/hir-expand/src/proc_macro.rs
index 8a1a33d7e3..1cd975b980 100644
--- a/crates/hir-expand/src/proc_macro.rs
+++ b/crates/hir-expand/src/proc_macro.rs
@@ -19,18 +19,8 @@ pub enum ProcMacroKind {
Attr,
}
-pub trait AsAny: Any {
- fn as_any(&self) -> &dyn Any;
-}
-
-impl<T: Any> AsAny for T {
- fn as_any(&self) -> &dyn Any {
- self
- }
-}
-
/// A proc-macro expander implementation.
-pub trait ProcMacroExpander: fmt::Debug + Send + Sync + RefUnwindSafe + AsAny {
+pub trait ProcMacroExpander: fmt::Debug + Send + Sync + RefUnwindSafe + Any {
/// Run the expander with the given input subtree, optional attribute input subtree (for
/// [`ProcMacroKind::Attr`]), environment variables, and span information.
fn expand(
@@ -44,7 +34,9 @@ pub trait ProcMacroExpander: fmt::Debug + Send + Sync + RefUnwindSafe + AsAny {
current_dir: String,
) -> Result<tt::TopSubtree, ProcMacroExpansionError>;
- fn eq_dyn(&self, other: &dyn ProcMacroExpander) -> bool;
+ fn eq_dyn(&self, other: &dyn ProcMacroExpander) -> bool {
+ other.type_id() == self.type_id()
+ }
}
impl PartialEq for dyn ProcMacroExpander {