-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix various aspects around let
bindings inside const functions
#56160
Merged
Merged
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
4d2bed9
Stabilize `const_let` inside const functions
oli-obk dba5ba0
Update a test's diagnostics
oli-obk df2123c
Update compile-fail test
oli-obk 52b67b1
Remove a bunch of now-unnecessary `const_let` feature gates
oli-obk ef38afc
Add a test for various const let features
oli-obk 59c6c49
Also test the `const_let` feature gate in statics
oli-obk 7ec3c10
Add tests for mutable borrows
oli-obk d62bcad
Allow `let` bindings everywhere
oli-obk 507ea97
Properly name the flag for `&&` -> `&` conversion
oli-obk 75ce28a
Show auto-applicable correction warning for short circuiting in const…
oli-obk d8ece18
Improve the error around short circuiting and let bindings
oli-obk 866664c
Add a test for single variant matches
oli-obk 8937faa
Reenable `const_let` feature gate
oli-obk 16d2a92
Improve the diagnostic message
oli-obk ac47bd7
Fix a compile-fail test
oli-obk 25d1c07
Remove unused feature gate from `libcore`
oli-obk 172b428
Re-add accidentally deleted test
oli-obk 42e5317
Add trailing newline
oli-obk 9d2f97b
Test float assign ops
oli-obk e6e08c6
Fix rebase fallout
oli-obk 07345f0
Undo a change that got lost in the larger refactorings
oli-obk 2cb5e3d
Manually inline trivial function
oli-obk 6ca2ad5
Correct documentation about `FakeRead`
oli-obk b678238
Properly worded diagnostic message
oli-obk d815e2b
Explain that lack of short circuiting support in constants is temporary
oli-obk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
8 changes: 4 additions & 4 deletions
8
src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
error[E0080]: could not evaluate static initializer | ||
error[E0019]: static contains unimplemented expression type | ||
--> $DIR/assign-to-static-within-other-static-2.rs:27:5 | ||
| | ||
LL | *FOO.0.get() = 5; //~ ERROR could not evaluate static initializer | ||
| ^^^^^^^^^^^^^^^^ tried to modify a static's initial value from another static's initializer | ||
LL | *FOO.0.get() = 5; //~ ERROR contains unimplemented expression type | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0080`. | ||
For more information about this error, try `rustc --explain E0019`. |
This file contains 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
13 changes: 10 additions & 3 deletions
13
src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
error[E0019]: static contains unimplemented expression type | ||
--> $DIR/mod-static-with-const-fn.rs:29:5 | ||
| | ||
LL | *FOO.0.get() = 5; | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants | ||
--> $DIR/mod-static-with-const-fn.rs:34:5 | ||
--> $DIR/mod-static-with-const-fn.rs:32:5 | ||
| | ||
LL | foo(); | ||
| ^^^^^ | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0015`. | ||
Some errors occurred: E0015, E0019. | ||
For more information about an error, try `rustc --explain E0015`. |
This file contains 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
Oops, something went wrong.
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.
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.
Woah. I don't think I realized we do this sort of conversion.