Prevent expr_cast hides prior error.#5889
Closed
youknowone wants to merge 1 commit intorust-lang:masterfrom
Closed
Prevent expr_cast hides prior error.#5889youknowone wants to merge 1 commit intorust-lang:masterfrom
youknowone wants to merge 1 commit intorust-lang:masterfrom
Conversation
This will help not to meet confusing errors. In issue rust-lang#5873, the error was "expected constant expr for vector length: Can't cast str to int". It was originally "expected constant expr for vector length: Non-constant path in constant expr" (though still invalid error). This patch make the original error to be printed.
Contributor
Author
|
Oh.. I made pull request to master. sorry. |
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Aug 11, 2020
…r=Manishearth Avoid or_fun_call for const_fn with no args Based on rust-lang#5682 by @lzutao This avoids a subset of false positives, specifically those related to `const fn`s that take no arguments. For the rest, a much more involved fix would be needed, see rust-lang/rust-clippy#5682 (comment). So this does *not* solve rust-lang#5658 changelog: Avoid triggering [`or_fun_call`] with `const fn`s that take no arguments. Fixes rust-lang#5886
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Sep 10, 2020
or_fn_call: ignore nullary associated const fns The fix in rust-lang#5889 was missing associated functions. changelog: Ignore also `const fn` methods in [`or_fun_call`] Fixes rust-lang#5693
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Oct 9, 2020
…thiaskrgr Revert: or_fun_call should lint calls to `const fn`s with no args The changes in rust-lang#5889 and rust-lang#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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will help not to meet confusing errors.
In issue #5873, the error was "expected constant expr for vector length: Can't cast str to int".
It was orignally "expected constant expr for vector length: Non-constant path in constant expr" (though still invalid error).
This patch make the original error to be printed.