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

Use const_eval instead of constant for more lints? #461

Open
3 of 8 tasks
llogiq opened this issue Nov 18, 2015 · 3 comments
Open
3 of 8 tasks

Use const_eval instead of constant for more lints? #461

llogiq opened this issue Nov 18, 2015 · 3 comments
Labels
C-question Category: Questions

Comments

@llogiq
Copy link
Contributor

llogiq commented Nov 18, 2015

  • eq_op won't join here because we expressly only want syntactically equal expressions
  • bit_mask uses it
  • float_cmp uses it
  • approx_const doesn't even need constant because we only want to match literals
  • zero_div_zero might probably be able to use it
  • min_max might use it (but we currently bail on refs, so it's debatable whether it should)
  • loops could benefit from it
  • identity_op shouldn't use it because it bails on refs and it's so low-payoff that a full const_eval isn't worth it

What do you folks think?

@llogiq llogiq added the C-question Category: Questions label Nov 18, 2015
@Manishearth
Copy link
Member

We don't have a way of bypassing const resolution in const_eval though (do we?). We want to resolve constant expressions without doing const lookup because of cfgs and tweaking.

@llogiq
Copy link
Contributor Author

llogiq commented Nov 18, 2015

Agreed. We could easily simplify consts.rs to work without a Context, though. const_eval should work in the other cases.

@Manishearth
Copy link
Member

Sounds good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-question Category: Questions
Projects
None yet
Development

No branches or pull requests

2 participants