Skip to content

Incomplete save-analysis for macros #31553

Closed as not planned
Closed as not planned

Description

@DanielJCampbell

Currently macros are only recorded if they are called at some point in non-generated source code. The most notable effect of this is that if a macro references some other macro internally (eg. foo! expands to bar!), that macro will not be indexed.

A fix probably requires changes to expansion traces, to store more information about macro bodies after expansion, or manually pulling nested macro calls out of callee spans.

Activity

  1. added
    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
    on Feb 15, 2016
  2. Mark-Simulacrum commented on Apr 29, 2017

    @Mark-Simulacrum
    Member

    Test case for future visits:

    macro_rules! a {
        () => {
            macro_rules! b {
                () => {
                    0
                };
            }
            b!()
        }
    }
    
    fn main() {
        a!();
    }
    rustc -Z save-analysis test.rs
    rg '"name":"b"' save-analysis-temp/test.json # should find "b"
    
  3. steveklabnik commented on Oct 31, 2018

    @steveklabnik
    Contributor

    Triage: no change

  4. added
    A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.
    on Feb 19, 2023
  5. jyn514 commented on Feb 19, 2023

    @jyn514
    Member

    Save-analysis has been removed from the compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions