-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
References to mutable values #5688
Merged
Merged
Conversation
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
Benchmark for 5a5cc93Click to view benchmark
|
Benchmark for ac57c50Click to view benchmark
|
Benchmark for 634c19bClick to view benchmark
|
sdankel
reviewed
Mar 6, 2024
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.
Awesome work!
...est_programs/should_pass/language/references/dereferencing_operator_dot_on_structs/test.toml
Show resolved
Hide resolved
sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs
Outdated
Show resolved
Hide resolved
Benchmark for 82b6d9bClick to view benchmark
|
IGI-111
reviewed
Mar 7, 2024
Co-authored-by: IGI-111 <[email protected]>
Benchmark for 3fb405cClick to view benchmark
|
IGI-111
approved these changes
Mar 7, 2024
Benchmark for b20d013Click to view benchmark
|
Benchmark for ce5d910Click to view benchmark
|
Benchmark for 8eb28e3Click to view benchmark
|
xunilrj
approved these changes
Mar 11, 2024
Benchmark for f1c358dClick to view benchmark
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
compiler: frontend
Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
compiler
General compiler. Should eventually become more specific as the issue is triaged
language feature
Core language features visible to end users
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.
Description
This PR implements references to mutable values,
&mut T
, as defined in references. The overall effort related to references is tracked in #5063.References to mutable values:
&mut
&mut T
->&T
) and thus can be used wherever "regular" references are expectedThe last point is a step in direction of replacing
ref mut
function parameters with either&
or&mut
.References to mutable values cannot be taken on constants and immutable variables (see errors below). (Note that we slightly departure from the Rust counterparts here. Rust allows
&mut
on constants but issues a warning.)Additionally, the PR implements
Diagnostic
for theConflictingImplsForTraitAndType
and shows the already existing, conflicting implementation of the trait.Demo
For more demos, see the tests in this PR.
Checklist
Breaking*
orNew Feature
labels where relevant.