From e65bdb9c2d07eac38f00eb1233b239d858894800 Mon Sep 17 00:00:00 2001 From: qwer252 Date: Wed, 11 Jun 2025 21:45:00 +0800 Subject: [PATCH] Update lib.rs --- .../listing-20-40/hello_macro/hello_macro_derive/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/listings/ch20-advanced-features/listing-20-40/hello_macro/hello_macro_derive/src/lib.rs b/listings/ch20-advanced-features/listing-20-40/hello_macro/hello_macro_derive/src/lib.rs index 7ae9e55..8f46a38 100644 --- a/listings/ch20-advanced-features/listing-20-40/hello_macro/hello_macro_derive/src/lib.rs +++ b/listings/ch20-advanced-features/listing-20-40/hello_macro/hello_macro_derive/src/lib.rs @@ -3,10 +3,9 @@ use quote::quote; #[proc_macro_derive(HelloMacro)] pub fn hello_macro_derive(input: TokenStream) -> TokenStream { - // Construct a representation of Rust code as a syntax tree - // that we can manipulate. + // 将 Rust 代码构建成我们可以操作的语法树。 let ast = syn::parse(input).unwrap(); - // Build the trait implementation. + // 生成 trait 的实现。 impl_hello_macro(&ast) }