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

fix: Implement mixed site hygiene #18264

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Oct 7, 2024

  1. Implement semitransparent hygiene

    Or macro_rules hygiene, or mixed site hygiene. In other words, hygiene for variables and labels but not items.
    
    The realization that made me implement this was that while "full" hygiene (aka. def site hygiene) is really hard for us to implement, and will likely involve intrusive changes and performance losses, since every `Name` will have to carry hygiene, mixed site hygiene is very local: it applies only to bodies, and we very well can save it in a side map with minor losses.
    
    This fixes one diagnostic in r-a that was about `izip!()` using hygiene (yay!) but it introduces a huge number of others, because of rust-lang#18262. Up until now this issue wasn't a major problem because it only affected few cases, but with hygiene identifiers referred by macros like that are not resolved at all. The next commit will fix that.
    ChayimFriedman2 committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    4cd98c0 View commit details
    Browse the repository at this point in the history

Commits on Oct 8, 2024

  1. Correctly resolve variables and labels from before macro definition i…

    …n macro expansion
    
    E.g.:
    ```rust
    let v;
    macro_rules! m { () => { v }; }
    ```
    
    This was an existing bug, but it was less severe because unless the variable was shadowed it would be correctly resolved. With hygiene however, without this fix the variable is never resolved.
    ChayimFriedman2 committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    1bbce02 View commit details
    Browse the repository at this point in the history