Skip to content

Commit e2c6041

Browse files
committed
Use new proc_macro::Span::file() api.
1 parent f7b1820 commit e2c6041

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

macros/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn compile_error_msg(py: Python, error: PyErr, tokens: TokenStream) -> Token
2525

2626
if let Some(tb) = &error.traceback(py) {
2727
if let Ok((file, line)) = get_traceback_info(tb) {
28-
if file == Span::call_site().source_file().path().to_string_lossy() {
28+
if file == Span::call_site().file() {
2929
if let Ok(msg) = value.str() {
3030
if let Some(span) = span_for_line(tokens, line) {
3131
let error = format!("python: {}", msg);

macros/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn python_impl(input: TokenStream) -> Result<TokenStream, TokenStream> {
2020

2121
check_no_attribute(input.clone())?;
2222

23-
let filename = Span::call_site().source_file().path().to_string_lossy().into_owned();
23+
let filename = Span::call_site().file();
2424

2525
let mut x = EmbedPython::new();
2626

@@ -67,7 +67,7 @@ fn python_impl(input: TokenStream) -> Result<TokenStream, TokenStream> {
6767
fn ct_python_impl(input: TokenStream) -> Result<TokenStream, TokenStream> {
6868
let tokens = input.clone();
6969

70-
let filename = Span::call_site().source_file().path().to_string_lossy().into_owned();
70+
let filename = Span::call_site().file();
7171

7272
let mut x = EmbedPython::new();
7373

0 commit comments

Comments
 (0)