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

Ignore deprecation for items deprecated by the same attribute #35317

Merged
merged 5 commits into from
Aug 5, 2016

Conversation

TimNN
Copy link
Contributor

@TimNN TimNN commented Aug 4, 2016

Whenever a node would be reported as deprecated:

  • check if the parent item is also deprecated
  • if it is and both were deprecated by the same attribute
  • skip the deprecation warning

fixes #35128
closes #16490

r? @eddyb


bug!("unexpected lint traversal order: expected `_post` for {:?} but called for {:?}",
top, item_id);
}
Copy link
Member

Choose a reason for hiding this comment

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

Not entirely sure, is this a good use of the lint hooks and DefIndex?
The need for a Vec is a bit sad - manually written visitors can get away with just regular stack recursion.
cc @Manishearth @llogiq @nikomatsakis

Copy link
Member

Choose a reason for hiding this comment

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

Remember that all the lints have the cost of a single visitor; they are threaded together. This cannot be done with arbitrary visitors. The lint hooks exist basically for this use case.

That said, can't we pull instead of push here? We can use parent nodes and walk up the node tree. The case of a lint being triggered is relatively rare, so paying the cost of a tree walk there isn't too bad.

Copy link
Member

Choose a reason for hiding this comment

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

You mean we could use get_parent instead of a stack, and store a single NodeId?
I think that would work - the problem solved by the stack here is that not all NodeIds are in the map.

Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to store anything?

Also, I thought that was fixed? Which nodes are missing from the map?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Manishearth: The cases I encountered where Paths: for example Foo and Bar in impl Foo for Bar or fn f<T: Foo>() {}, if I remember correctly.

Copy link
Member

@Manishearth Manishearth Aug 4, 2016

Choose a reason for hiding this comment

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

Oh, I see. Hmm.

In that case,do what eddy suggested -- store a single node id, and dynamically walk up the tree from there on error.

Copy link
Member

Choose a reason for hiding this comment

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

on error.

Not always in post_item?

@eddyb
Copy link
Member

eddyb commented Aug 4, 2016

LGTM, modulo the two comments I've left.

@llogiq
Copy link
Contributor

llogiq commented Aug 4, 2016

Yeah, walking up the tree isn't so bad if we can get away without allocation in the non-error case.

@eddyb
Copy link
Member

eddyb commented Aug 4, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Aug 4, 2016

📌 Commit 65dafe0 has been approved by eddyb

Whenever a node whould be reported as deprecated:

- check if the parent item is also deprecated

- if it is and both were deprecated by the same attribute

- skip the deprecation warning

fixes rust-lang#35128
closes rust-lang#16490
@TimNN
Copy link
Contributor Author

TimNN commented Aug 4, 2016

@eddyb could you r+ again, I had to fix a tidy failure.

@eddyb
Copy link
Member

eddyb commented Aug 4, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Aug 4, 2016

📌 Commit 627b1e8 has been approved by eddyb

@bors
Copy link
Contributor

bors commented Aug 5, 2016

⌛ Testing commit 627b1e8 with merge 4c02363...

bors added a commit that referenced this pull request Aug 5, 2016
Ignore deprecation for items deprecated by the same attribute

Whenever a node would be reported as deprecated:

- check if the parent item is also deprecated
- if it is and both were deprecated by the same attribute
- skip the deprecation warning

fixes #35128
closes #16490

r? @eddyb
@bors bors mentioned this pull request Aug 5, 2016
@bors bors merged commit 627b1e8 into rust-lang:master Aug 5, 2016
@TimNN TimNN deleted the internal-deprecated branch August 5, 2016 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants