Skip to content

Commit

Permalink
Proper span for fields in derive(Freeze)
Browse files Browse the repository at this point in the history
Summary: Now it shows proper location, but does not show it is coming from `derive(Freeze)` (and it is the same behavior with named fields).

Reviewed By: rajneesh

Differential Revision: D63841672

fbshipit-source-id: 41dc0b512b5c101dd1fd4793e4bd21352f0f040f
  • Loading branch information
stepancheg authored and facebook-github-bot committed Oct 10, 2024
1 parent a4fbaba commit 1b47f8e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions starlark_derive/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ impl<'a> FieldsUtil<'a> {
.iter()
.map(|f| f.ident.clone().unwrap())
.collect(),
Fields::Unnamed(unnamed) => (0..unnamed.unnamed.len())
.map(|i| syn::Ident::new(&format!("f{}", i), Span::call_site()))
Fields::Unnamed(unnamed) => unnamed
.unnamed
.iter()
.enumerate()
.map(|(i, f)| syn::Ident::new(&format!("f{}", i), f.span()))
.collect(),
Fields::Unit => Vec::new(),
}
Expand Down

0 comments on commit 1b47f8e

Please sign in to comment.