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

Add _post methods for blocks and crates #31562

Merged
merged 3 commits into from
Feb 13, 2016
Merged

Conversation

llogiq
Copy link
Contributor

@llogiq llogiq commented Feb 11, 2016

This fixes #31512 for me.

A bit of explanation: I want to have check_block_post(&mut self, &Context, &Block) and check_crate_post(&mut self, &Context, &Crate) methods in both early and late lint passes. Ideally we'd have _post methods for all operations that walk, but this'll do for now.

@Manishearth r?

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@llogiq
Copy link
Contributor Author

llogiq commented Feb 11, 2016

r? @Manishearth – I always forget which way 'round...

@Manishearth
Copy link
Member

Could we have one for items too? That sounds like another logical thing to have a post-check for.

@llogiq
Copy link
Contributor Author

llogiq commented Feb 11, 2016

Sure. I've got the commit here, but my notebook network is flaky. Will commit soon.

@llogiq
Copy link
Contributor Author

llogiq commented Feb 11, 2016

@Manishearth done.

@Manishearth
Copy link
Member

r=me, but also asking @eddyb for a second opinion

@eddyb
Copy link
Member

eddyb commented Feb 11, 2016

I think we should try to experiment with a way to avoid combinatoric explosion, perhaps trait Check<T> with e.g. impl Check<Expr> for MyLint, but I don't see how this could be done cleanly without specialization (same goes for our visitors and folders btw).

@Manishearth
Copy link
Member

That's an interesting idea, but I don't think combinatoric explosion can happen here, or that such changes need to be made here often.

An eventual new design for lint passes would be nice though. Not sure if we need it right now.

@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 11, 2016

📌 Commit d483a6e has been approved by Manishearth

@llogiq
Copy link
Contributor Author

llogiq commented Feb 11, 2016

FWIW, I don't think we get combinatoric explosion here. Worst (or best, depending on how you look at it) case we have an entry/exit (or check/post in our current nomenclature) for each node that contains other nodes.

@llogiq
Copy link
Contributor Author

llogiq commented Feb 12, 2016

There is some duplicate error messages in the compiletest output. I doubt it has something to do with the new methods, as there is nothing that uses them yet.

@bors retry

@@ -918,6 +920,7 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
run_lints!(cx, check_item, early_passes, it);
cx.visit_ids(|v| v.visit_item(it));
ast_visit::walk_item(cx, it);
run_lints!(cx, check_item, early_passes, it);
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be check_item_post

@llogiq
Copy link
Contributor Author

llogiq commented Feb 12, 2016

Thanks, @oli-obk ! Good catch.

@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 12, 2016

📌 Commit a270b7b has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Feb 13, 2016

⌛ Testing commit a270b7b with merge 5801991...

bors added a commit that referenced this pull request Feb 13, 2016
This fixes #31512 for me.

A bit of explanation: I want to have `check_block_post(&mut self, &Context, &Block)` and `check_crate_post(&mut self, &Context, &Crate)` methods in both early and late lint passes. Ideally we'd have _post methods for all operations that walk, but this'll do for now.

@Manishearth r?
@bors bors merged commit a270b7b into rust-lang:master Feb 13, 2016
@llogiq llogiq deleted the lint_post branch February 13, 2016 10:56
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.

extend lint interface with more _post methods
7 participants