Skip to content
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

Remove RefCell::get and RefCell::set #13301

Merged
merged 3 commits into from
Apr 4, 2014
Merged

Conversation

erickt
Copy link
Contributor

@erickt erickt commented Apr 4, 2014

RefCell::get can be a bit surprising, because it actually clones the wrapped value. This removes RefCell::get and replaces all the users with RefCell::borrow() when it can, and RefCell::borrow().clone() when it can't. It removes RefCell::set for consistency. This closes #13182.

It also fixes an infinite loop in a test when debugging is on.

It's surprising that `RefCell::get()` is implicitly doing a clone
on a value. This patch removes it and replaces all users with
either `.borrow()` when we can autoderef, or `.borrow().clone()`
when we cannot.
This fixes rust-lang#13238. It avoids an infinite loop when compiling
the tests with `-g`. Without this change, the debuginfo on
`black_box` prevents the method from being inlined, which
allows llvm to convert `silent_recurse` into a tail-call. This
then loops forever instead of consuming all the stack like it
is supposed to. This patch forces inlining `black_box`, which
triggers the right error.
bors added a commit that referenced this pull request Apr 4, 2014
`RefCell::get` can be a bit surprising, because it actually clones the wrapped value. This removes `RefCell::get` and replaces all the users with `RefCell::borrow()` when it can, and `RefCell::borrow().clone()` when it can't. It removes `RefCell::set` for consistency. This closes #13182.

It also fixes an infinite loop in a test when debugging is on.
@bors bors closed this Apr 4, 2014
@bors bors merged commit 1b6997d into rust-lang:master Apr 4, 2014
bors-servo pushed a commit to servo/servo that referenced this pull request Apr 16, 2014
It's going away in the next Rust upgrade (rust-lang/rust#13301). r? @larsbergstrom

We'll need to do the same in rust-layers.
mbrubeck added a commit to mbrubeck/rust-layers that referenced this pull request Apr 17, 2014
It's going away in the next Rust upgrade (rust-lang/rust#13301).
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Sep 30, 2019
…beck:refcell-get); r=larsbergstrom

It's going away in the next Rust upgrade (rust-lang/rust#13301). r? larsbergstrom

We'll need to do the same in rust-layers.

Source-Repo: https://github.com/servo/servo
Source-Revision: aafadb65f2f5e318805a03f3bc9814eb1a8a50cc

UltraBlame original commit: b14ab74b1b9813efa98ef1cb51659a7979f3aa0d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Sep 30, 2019
…beck:refcell-get); r=larsbergstrom

It's going away in the next Rust upgrade (rust-lang/rust#13301). r? larsbergstrom

We'll need to do the same in rust-layers.

Source-Repo: https://github.com/servo/servo
Source-Revision: aafadb65f2f5e318805a03f3bc9814eb1a8a50cc

UltraBlame original commit: b14ab74b1b9813efa98ef1cb51659a7979f3aa0d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…beck:refcell-get); r=larsbergstrom

It's going away in the next Rust upgrade (rust-lang/rust#13301). r? larsbergstrom

We'll need to do the same in rust-layers.

Source-Repo: https://github.com/servo/servo
Source-Revision: aafadb65f2f5e318805a03f3bc9814eb1a8a50cc

UltraBlame original commit: b14ab74b1b9813efa98ef1cb51659a7979f3aa0d
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Oct 11, 2022
…r=Veykril

Make assist tests panic again on empty source changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove RefCell::get
4 participants