Skip to content

Commit

Permalink
Add simple quote_spanned for cat macro
Browse files Browse the repository at this point in the history
  • Loading branch information
birktj committed Feb 2, 2023
1 parent fee8302 commit ad87d00
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nalgebra-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
)]

use proc_macro::TokenStream;
use quote::{format_ident, quote, ToTokens, TokenStreamExt};
use quote::{format_ident, quote, quote_spanned, ToTokens, TokenStreamExt};
use syn::parse::{Error, Parse, ParseStream, Result};
use syn::punctuated::Punctuated;
use syn::{parse_macro_input, Token};
use syn::spanned::Spanned;
use syn::{Expr, Lit};

use proc_macro2::{Delimiter, Spacing, TokenStream as TokenStream2, TokenTree};
Expand Down Expand Up @@ -480,7 +481,7 @@ fn cat_impl(prefix: &str, matrix: Matrix) -> TokenStream2 {
if let ConcatElem::Expr(expr) = cell {
let ident = format_ident!("{}_cat_{}_{}", prefix, i, j);
let ident_shape = format_ident!("{}_cat_{}_{}_shape", prefix, i, j);
output.extend(std::iter::once(quote! {
output.extend(std::iter::once(quote_spanned! {expr.span()=>
let #ident = #expr;
let #ident_shape = #ident.shape_generic();
}));
Expand Down

0 comments on commit ad87d00

Please sign in to comment.