-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Don't use LateContext
in the constant evaluator
#13200
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
Conversation
1d5b9b9
to
3474d6a
Compare
3474d6a
to
59a1ff9
Compare
☔ The latest upstream changes (presumably #11441) made this pull request unmergeable. Please resolve the merge conflicts. |
clippy_utils/src/consts.rs
Outdated
&& let ["core", "num", int_impl, "max_value"] = *def_path | ||
&& let ExprKind::Path(qpath @ QPath::TypeRelative(_, name)) = &callee.kind | ||
&& let Res::Def(DefKind::AssocFn, did) = self.typeck.qpath_res(qpath, callee.hir_id) | ||
&& name.ident.as_str() == "max_value" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one nit I can see: since we're checking the diagnostic name we don't need the by str one
59a1ff9
to
5114d37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with rebase
5114d37
to
e4ad36d
Compare
Thanks! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This also changes the interface to require explicitly creating the context.
constant
could be added back in, but the others are probably not worth it.A couple of bugs have been fixed. The wrong
TypeckResults
was used once when evaluating a constant, and the wrongParamEnv
was used by some callers (there wasn't a way to use the correct one).changelog: none