]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #6077 - ebroto:revert_or_fun_call_const, r=matthiaskrgr
authorbors <bors@rust-lang.org>
Thu, 24 Sep 2020 14:14:53 +0000 (14:14 +0000)
committerbors <bors@rust-lang.org>
Thu, 24 Sep 2020 14:14:53 +0000 (14:14 +0000)
Revert: or_fun_call should lint calls to `const fn`s with no args

The changes in #5889 and #5984 were done under the incorrect assumption that a `const fn` with no args was guaranteed to be evaluated at compile time.  A `const fn` is only guaranteed to be evaluated at compile time if it's inside a const context (the initializer of a `const` or a `static`).

See this [zulip conversation](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Common.20misconception.3A.20.60const.20fn.60.20and.20its.20effect.20on.20codegen/near/208059113) for more details on this common misconception.

Given that none of the linted methods by `or_fun_call` can be called in const contexts, the lint should make no exceptions.

changelog: [`or_fun_call`] lints again calls to `const fn` with no args


Trivial merge