check_consts: fix duplicate errors, make importance consistent#120933
Merged
bors merged 2 commits intorust-lang:masterfrom Feb 12, 2024
Merged
check_consts: fix duplicate errors, make importance consistent#120933bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
RalfJung
commented
Feb 11, 2024
| let decl = &self.body.local_decls[place_ref.local]; | ||
| if let LocalInfo::StaticRef { def_id, .. } = *decl.local_info() { | ||
| let span = decl.source_info.span; | ||
| self.check_static(def_id, span); |
Member
Author
There was a problem hiding this comment.
We already check_static each operand we see, so I don't understand why this was checked again here.
RalfJung
commented
Feb 11, 2024
| //~^^ ERROR thread-local statics cannot be accessed | ||
| //~| ERROR mutable references are not allowed | ||
| //~| ERROR use of mutable static is unsafe | ||
| //~| referencing statics |
Member
Author
There was a problem hiding this comment.
Here this was not a literal duplicate -- the other error is "thread-local statics cannot be accessed". So the old error was even wrong, since STATIC_VAR_2 is a thread-local static, not a regular static, and saying that this is "unstable" and needs the const_refs_to_static feature gate is not correct.
e93abfc to
e13de31
Compare
Contributor
|
@bors r+ rollup |
Collaborator
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Feb 12, 2024
check_consts: fix duplicate errors, make importance consistent This is stuff I noticed while working on rust-lang#120932, but it's orthogonal to that PR. r? `@oli-obk`
This was referenced Feb 12, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 12, 2024
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#120765 (Reorder diagnostics API) - rust-lang#120833 (More internal emit diagnostics cleanups) - rust-lang#120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`) - rust-lang#120917 (Remove a bunch of dead parameters in functions) - rust-lang#120928 (Add test for recently fixed issue) - rust-lang#120933 (check_consts: fix duplicate errors, make importance consistent) - rust-lang#120936 (improve `btree_cursors` functions documentation) - rust-lang#120944 (Check that the ABI of the instance we are inlining is correct) - rust-lang#120956 (Clean inlined type alias with correct param-env) - rust-lang#120962 (Add myself to library/std review) - rust-lang#120972 (fix ICE for deref coercions with type errors) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 12, 2024
Rollup merge of rust-lang#120933 - RalfJung:const-check-misc, r=oli-obk check_consts: fix duplicate errors, make importance consistent This is stuff I noticed while working on rust-lang#120932, but it's orthogonal to that PR. r? ``@oli-obk``
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Feb 26, 2024
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#120765 (Reorder diagnostics API) - rust-lang#120833 (More internal emit diagnostics cleanups) - rust-lang#120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`) - rust-lang#120917 (Remove a bunch of dead parameters in functions) - rust-lang#120928 (Add test for recently fixed issue) - rust-lang#120933 (check_consts: fix duplicate errors, make importance consistent) - rust-lang#120936 (improve `btree_cursors` functions documentation) - rust-lang#120944 (Check that the ABI of the instance we are inlining is correct) - rust-lang#120956 (Clean inlined type alias with correct param-env) - rust-lang#120962 (Add myself to library/std review) - rust-lang#120972 (fix ICE for deref coercions with type errors) r? `@ghost` `@rustbot` modify labels: rollup
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 is stuff I noticed while working on #120932, but it's orthogonal to that PR.
r? @oli-obk