Skip to content

save-analysis doesn't dump ref entry for struct name in static method calls #57462

Closed
@staktrace

Description

@staktrace
Contributor

Here's a small testcase:

struct Foo {
}

impl Foo {
  fn new() {
  }
}

fn main() {
  Foo::new();
}

If you run this through rustc -Z save-analysis and look at the save-analysis JSON file, you'll see that there is no entry for the Foo part of Foo::new(). This seems like a bug.

Activity

changed the title [-]save-analysis doesn't dump [/-] [+]save-analysis doesn't dump ref entry for struct name in static method calls[/+] on Jan 9, 2019
staktrace

staktrace commented on Jan 9, 2019

@staktrace
ContributorAuthor

/cc @nrc

staktrace

staktrace commented on Jan 9, 2019

@staktrace
ContributorAuthor

According to rustc -Z ast-json test.rs the expression is a ExprKind::Call where the Foo::new part would be a Path with two PathSegments. This seems to be processed in process_path here. Not obvious to me why it would fail, since the write_sub_paths_truncated at the end looks like it should deal with the first path segment.

Xanewok

Xanewok commented on Jan 9, 2019

@Xanewok
Member

cc me

emilio

emilio commented on Jan 9, 2019

@emilio
Contributor

I'm taking a look at this, fwiw. process_method_call does nothing with the segment, looks like it should.

emilio

emilio commented on Jan 9, 2019

@emilio
Contributor

Oh, it's a bit more subtle, but I see what's going on now.

emilio

emilio commented on Jan 9, 2019

@emilio
Contributor

I got a fix, testing to see if I can remove hacks to existing code now.

added
A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.
C-bugCategory: This is a bug.
on Jan 9, 2019
emilio

emilio commented on Jan 9, 2019

@emilio
Contributor

Fix is at #57474, but it's unclear to me how to add a test for this. Any doc I could look at?

14 remaining items

Loading
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-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

      Participants

      @staktrace@Centril@emilio@Xanewok

      Issue actions

        save-analysis doesn't dump ref entry for struct name in static method calls · Issue #57462 · rust-lang/rust