Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the span used for salsa struct constructors #606

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/salsa-macro-rules/src/setup_tracked_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ macro_rules! setup_tracked_fn {
aux: &dyn $zalsa::JarAux,
first_index: $zalsa::IngredientIndex,
) -> Vec<Box<dyn $zalsa::Ingredient>> {
let mut fn_ingredient = <$zalsa::function::IngredientImpl<$Configuration>>::new(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused (r-a complains about it, whereas rustc does not, probably because r-a does not take into account cross crate diagnostic-ity)

let fn_ingredient = <$zalsa::function::IngredientImpl<$Configuration>>::new(
first_index,
aux,
);
Expand Down
3 changes: 1 addition & 2 deletions components/salsa-macros/src/salsa_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use crate::{
options::{AllowedOptions, Options},
};
use proc_macro2::{Ident, Literal, Span, TokenStream};
use syn::spanned::Spanned;

pub(crate) struct SalsaStruct<'s, A: SalsaStructAllowedOptions> {
struct_item: &'s syn::ItemStruct,
Expand Down Expand Up @@ -115,7 +114,7 @@ where
pub(crate) fn constructor_name(&self) -> syn::Ident {
match self.args.constructor_name.clone() {
Some(name) => name,
None => Ident::new("new", self.struct_item.span()),
None => Ident::new("new", self.struct_item.ident.span()),
}
}

Expand Down
Loading