mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 01:43:22 +00:00
Replace proc_macro APIs with proc_macro2 APIs in ostd_macros
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
74f322caa4
commit
ead5a70444
@ -12,7 +12,7 @@ repository ="https://github.com/asterinas/asterinas"
|
|||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = "1.0.78"
|
proc-macro2 = { version = "1.0.95", features = ["span-locations"] }
|
||||||
quote = "1.0.35"
|
quote = "1.0.35"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
syn = { version = "2.0.48", features = ["full"] }
|
syn = { version = "2.0.48", features = ["full"] }
|
||||||
|
@ -320,11 +320,9 @@ pub fn ktest(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let package_name = std::env::var("CARGO_PKG_NAME").unwrap();
|
let package_name = std::env::var("CARGO_PKG_NAME").unwrap();
|
||||||
let span = proc_macro::Span::call_site();
|
let span = proc_macro2::Span::call_site();
|
||||||
let source = span.source_file().path();
|
let line = span.start().line;
|
||||||
let source = source.to_str().unwrap();
|
let col = span.start().column;
|
||||||
let line = span.line();
|
|
||||||
let col = span.column();
|
|
||||||
|
|
||||||
let register_ktest_item = if package_name.as_str() == "ostd" {
|
let register_ktest_item = if package_name.as_str() == "ostd" {
|
||||||
quote! {
|
quote! {
|
||||||
@ -338,7 +336,7 @@ pub fn ktest(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
module_path: module_path!(),
|
module_path: module_path!(),
|
||||||
fn_name: stringify!(#fn_name),
|
fn_name: stringify!(#fn_name),
|
||||||
package: #package_name,
|
package: #package_name,
|
||||||
source: #source,
|
source: file!(),
|
||||||
line: #line,
|
line: #line,
|
||||||
col: #col,
|
col: #col,
|
||||||
},
|
},
|
||||||
@ -356,7 +354,7 @@ pub fn ktest(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
module_path: module_path!(),
|
module_path: module_path!(),
|
||||||
fn_name: stringify!(#fn_name),
|
fn_name: stringify!(#fn_name),
|
||||||
package: #package_name,
|
package: #package_name,
|
||||||
source: #source,
|
source: file!(),
|
||||||
line: #line,
|
line: #line,
|
||||||
col: #col,
|
col: #col,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user