Skip to content

Conversation

@puguo
Copy link
Contributor

@puguo puguo commented May 29, 2025

This PR updates resolver to allow all effect types to be included in the expanded macro call

File changed

I modified resolver to accept HIRFileId instead of regular FileId, which allows macro call ids to be passed in, this allows us to retrieve the cached expansion in RA database.
I also modified macro_expansion logic and added an offset mapping file to ensure syn and Rust Analyzer can share the cached expansion.

Copy link
Collaborator

@cdstanford cdstanford left a comment

Choose a reason for hiding this comment

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

Thanks for the macro improvements! Looks good to me. I made a couple minor comments and requested changes below.

Requested changes:

  • fix the minor comments
  • fix the build tests (build, checks, fmt are failing so far)
  • update make test (did the test data on the macro_test package change at all with these changes)?
  • If not, can you add additional macro examples to macro_test which utilize the features you added? I see that macro_test hasn't changed since the last PR.

Thanks! Caleb

r? @lzoghbi ?

src/effect.rs Outdated
is_unsafe: bool,
ffi: Option<CanonicalPath>,
sinks: &HashSet<IdentPath>,
macro_loc: Option<SrcLoc>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

add a small doc to this like: overwrites the source location if provided

Copy link
Collaborator

Choose a reason for hiding this comment

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

(I guess filepath and callsite are not used in the macro case?)

Copy link
Collaborator

Choose a reason for hiding this comment

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

honestly it would possibly be better to have different constructors for different cases, the effect model design for pub fn new_call(...) is a bit of a mess right now. But this isn't something we have to fix right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just tried to split this into normal and macro cases for now

Copy link
Collaborator

Choose a reason for hiding this comment

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

@puguo can you add a doc to what this parameter does?

like: overwrites the source location if provided

@cdstanford
Copy link
Collaborator

Hi @puguo - hope you are doing well! What is the status of this PR? Thanks!

@puguo
Copy link
Contributor Author

puguo commented Aug 18, 2025

Hi @puguo - hope you are doing well! What is the status of this PR? Thanks!

Hey Caleb, thanks for checking! I tried some fix in June but wasn't able to finish it, and then I got busy with my internship, will resume working on this after my internship ends

@cdstanford
Copy link
Collaborator

@puguo Sounds good, thanks! :)

@cdstanford cdstanford merged commit 6b6f25d into PLSysSec:main Sep 24, 2025
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants