Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

allcator: change &mut self -> &mut self to mut self -> self #76

Merged
merged 1 commit into from
Mar 7, 2022

Conversation

studychao
Copy link
Member

Previous constraint implemented &mut self -> &mut self for changing max,
min, etc.

But this cause problem for code like

let constraint = Constraint::new(...).max(...).min(...);

This code creates a Constraint and return the mut reference to it, but
there will be no one take the ownership of that Constraint so it'll be
dropped and cannot be used later. Since temporary value is freed at the end
of this statement, it is not a ideal case for us.

Signed-off-by: Chao Wu chaowu@linux.alibaba.com

@studychao studychao force-pushed the chao/fix_allocator_bug branch 2 times, most recently from 83ea5ef to 0347e19 Compare March 7, 2022 03:44
@wllenyj
Copy link
Contributor

wllenyj commented Mar 7, 2022

Fix test case fails in #77.

Previous constraint implemented &mut self -> &mut self for changing max,
min, etc.

But this cause problem for code like
```
let constraint = Constraint::new(...).max(...).min(...);
```

This code creates a Constraint and returns the mut reference to it, but
there will be no one take the ownership of that Constraint so it'll be
dropped and cannot be used later. Since temporary value is freed at the end
of this statement, it is not a ideal case for us.

Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
@codecov
Copy link

codecov bot commented Mar 7, 2022

Codecov Report

Merging #76 (c5611fb) into main (823367f) will decrease coverage by 0.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #76      +/-   ##
==========================================
- Coverage   90.40%   90.21%   -0.19%     
==========================================
  Files          29       36       +7     
  Lines        3771     4895    +1124     
==========================================
+ Hits         3409     4416    +1007     
- Misses        362      479     +117     
Impacted Files Coverage Δ
crates/db-allocator/src/lib.rs 88.05% <100.00%> (-0.52%) ⬇️
crates/db-address-space/src/address_space.rs 62.56% <0.00%> (-3.23%) ⬇️
crates/dbs-legacy-devices/src/serial.rs 90.67% <0.00%> (-0.35%) ⬇️
crates/dbs-interrupt/src/manager.rs 98.44% <0.00%> (ø)
crates/dbs-utils/src/epoll_manager.rs 92.00% <0.00%> (ø)
crates/dbs-interrupt/src/kvm/mod.rs 98.47% <0.00%> (ø)
crates/dbs-interrupt/src/kvm/legacy_irq.rs 72.32% <0.00%> (ø)
crates/dbs-interrupt/src/kvm/msi_generic.rs 92.30% <0.00%> (ø)
crates/dbs-interrupt/src/notifier.rs 88.29% <0.00%> (ø)
crates/dbs-interrupt/src/kvm/msi_irq.rs 72.60% <0.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 823367f...c5611fb. Read the comment docs.

@jiangliu
Copy link
Member

jiangliu commented Mar 7, 2022

Why does the code coverage drop?

@studychao studychao merged commit 2679d9e into openanolis:main Mar 7, 2022
@studychao
Copy link
Member Author

studychao commented Mar 7, 2022

Why does the code coverage drop?

Don't know. There is no new code added or old UT deleted

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants