-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Paper over privacy issues with Deref by changing field names.
Types that implement Deref can cause weird error messages due to their private fields conflicting with a field of the type they deref to, e.g., previously struct Foo { x: int } let a: Arc<Foo> = ...; println!("{}", a.x); would complain the the `x` field of `Arc` was private (since Arc has a private field called `x`) rather than just ignoring it. This patch doesn't fix that issue, but does mean one would have to write `a._ptr` to hit the same error message, which seems far less common. (This patch `_`-prefixes all private fields of `Deref`-implementing types.) cc #12808
- Loading branch information
Showing
5 changed files
with
93 additions
and
74 deletions.
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
Oops, something went wrong.
9698221
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.
saw approval from alexcrichton
at huonw@9698221
9698221
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.
merging huonw/rust/arc-field-rename = 9698221 into auto
9698221
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.
huonw/rust/arc-field-rename = 9698221 merged ok, testing candidate = bbb70cd
9698221
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.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/5933
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/5931
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/5027
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/5035
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/6030
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/5119
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/5127
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/6033
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/5118
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/5124
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/5186
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2919
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/6026
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/5122
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/5137
9698221
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.
fast-forwarding master to auto = bbb70cd