-
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
rustc_borrowck
memory management tweaks
#131225
Conversation
The `regioncx` and `borrow_set` fields can be references instead of `Rc`. They use the existing `'a` lifetime. This avoids some heap allocations and is a bit simpler.
Refcounting isn't needed.
It can own these two fields.
Either `&T` or `Rc<T>` is preferable.
By making it own two of its fields.
@bors r+ rollup |
@@ -150,14 +150,14 @@ pub(crate) fn type_check<'a, 'tcx>( | |||
infcx, | |||
param_env, | |||
implicit_region_bound, | |||
universal_regions, |
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.
Rc clone()'s better be Rc::clone
, so whenever field refactored out of Rc, compiler will warn, instead of wasting clone()'s.
Actually, i want lint for it :-) : https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_ref_ptr
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.
I’m aware and prefer Rc::clone, but it’s fine until the lint is used.
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.
Submitted #131375, but is some discussion required before enabling it in CI?
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.
Seems likely
…kingjubilee Rollup of 7 pull requests Successful merges: - rust-lang#128721 (Don't allow the `#[pointee]` attribute where it doesn't belong) - rust-lang#130479 (skip in-tree compiler build for llvm-bitcode-linker if ci-rustc is on) - rust-lang#130899 (Couple of changes to make it easier to compile rustc for wasm) - rust-lang#131225 (`rustc_borrowck` memory management tweaks) - rust-lang#131351 (Remove valgrind test suite and support from compiletest, bootstrap and opt-dist) - rust-lang#131359 (Fix used_underscore_binding in rustc_serialize) - rust-lang#131367 (Mark Boxy as on vacation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131225 - nnethercote:rustc_borrowck-mm, r=lqd `rustc_borrowck` memory management tweaks Minor cleanups in `rustc_borrowck` relating to memory management. r? `@lqd`
compiler: apply clippy::clone_on_ref_ptr for CI Apply lint https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_ref_ptr for compiler, also see rust-lang#131225 (comment). Some Arc's can be misplaced with Lrc's, sorry. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/enable.20more.20clippy.20lints.20for.20compiler.20.28and.5Cor.20std.29
compiler: apply clippy::clone_on_ref_ptr for CI Apply lint https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_ref_ptr for compiler, also see rust-lang#131225 (comment). Some Arc's can be misplaced with Lrc's, sorry. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/enable.20more.20clippy.20lints.20for.20compiler.20.28and.5Cor.20std.29
compiler: apply clippy::clone_on_ref_ptr for CI Apply lint https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_ref_ptr for compiler, also see rust-lang#131225 (comment). Some Arc's can be misplaced with Lrc's, sorry. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/enable.20more.20clippy.20lints.20for.20compiler.20.28and.5Cor.20std.29
compiler: apply clippy::clone_on_ref_ptr for CI Apply lint https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_ref_ptr for compiler, also see rust-lang#131225 (comment). Some Arc's can be misplaced with Lrc's, sorry. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/enable.20more.20clippy.20lints.20for.20compiler.20.28and.5Cor.20std.29
Rollup merge of rust-lang#131375 - klensy:clone_on_ref_ptr, r=cjgillot compiler: apply clippy::clone_on_ref_ptr for CI Apply lint https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_ref_ptr for compiler, also see rust-lang#131225 (comment). Some Arc's can be misplaced with Lrc's, sorry. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/enable.20more.20clippy.20lints.20for.20compiler.20.28and.5Cor.20std.29
compiler: apply clippy::clone_on_ref_ptr for CI Apply lint https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_ref_ptr for compiler, also see rust-lang/rust#131225 (comment). Some Arc's can be misplaced with Lrc's, sorry. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/enable.20more.20clippy.20lints.20for.20compiler.20.28and.5Cor.20std.29
compiler: apply clippy::clone_on_ref_ptr for CI Apply lint https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_ref_ptr for compiler, also see rust-lang/rust#131225 (comment). Some Arc's can be misplaced with Lrc's, sorry. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/enable.20more.20clippy.20lints.20for.20compiler.20.28and.5Cor.20std.29
Minor cleanups in
rustc_borrowck
relating to memory management.r? @lqd