Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e0b7577
linux x64: default to `-znostart-stop-gc`
lqd Feb 26, 2025
0dfe2ae
Windows: Use MoveFileEx by default in `fs:rename`
ChrisDenton Feb 24, 2025
3cb53df
Return OutOfMemoryError and update docs
ChrisDenton Mar 6, 2025
d975bd3
Remove highlighting of spans on `-Zteach`
estebank Feb 27, 2025
72326bf
On long spans, trim the middle of them to make them fit in the termin…
estebank Feb 27, 2025
f1c751b
Refactor `emitter` to better account for unicode chars when trimming
estebank Feb 27, 2025
cb82b79
Fix rustdoc test
estebank Feb 27, 2025
c75da0e
Fix multiline span start special case
estebank Feb 27, 2025
a04c47a
Make trimming logic work on more than one span at a time
estebank Feb 28, 2025
db2fb71
fix rebase
estebank Mar 7, 2025
fb04372
Move all alloc integration tests to a new alloctests crate
bjorn3 Feb 6, 2025
be1e0b7
Move most Rc tests to alloctests
bjorn3 Feb 6, 2025
701bedc
Move last remaining Rc test to alloctests
bjorn3 Feb 6, 2025
ae5687e
Fully test the alloc crate through alloctests
bjorn3 Feb 6, 2025
22d0440
Add comments
bjorn3 Feb 13, 2025
17dd2b1
Mention `env` and `option_env` macros in `std::env::var` docs
GuillaumeGomez Mar 7, 2025
720eacf
Rollup merge of #136642 - bjorn3:separate_alloctest_crate, r=cuviper
jhpratt Mar 8, 2025
0c67061
Rollup merge of #137528 - ChrisDenton:rename-win, r=joboet
jhpratt Mar 8, 2025
dfae8e8
Rollup merge of #137685 - lqd:nostart-stop-gc, r=petrochenkov
jhpratt Mar 8, 2025
2c374e3
Rollup merge of #137757 - estebank:trim-spans, r=davidtwco
jhpratt Mar 8, 2025
6576d35
Rollup merge of #138189 - GuillaumeGomez:env-var, r=joshtriplett
jhpratt Mar 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move last remaining Rc test to alloctests
  • Loading branch information
bjorn3 committed Mar 7, 2025
commit 701bedc323b0314ef6f084ba98ed18327faa36bc
3 changes: 0 additions & 3 deletions library/alloc/src/rc/mod.rs → library/alloc/src/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,6 @@ use crate::string::String;
#[cfg(not(no_global_oom_handling))]
use crate::vec::Vec;

#[cfg(test)]
mod tests;

// This is repr(C) to future-proof against possible field-reordering, which
// would interfere with otherwise safe [into|from]_raw() of transmutable
// inner types.
Expand Down
15 changes: 0 additions & 15 deletions library/alloc/src/rc/tests.rs

This file was deleted.

18 changes: 18 additions & 0 deletions library/alloctests/tests/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,24 @@ fn weak_self_cyclic() {
// hopefully we don't double-free (or leak)...
}

#[test]
fn is_unique() {
fn is_unique<T>(this: &Rc<T>) -> bool {
Rc::weak_count(this) == 0 && Rc::strong_count(this) == 1
}

let x = Rc::new(3);
assert!(is_unique(&x));
let y = x.clone();
assert!(!is_unique(&x));
drop(y);
assert!(is_unique(&x));
let w = Rc::downgrade(&x);
assert!(!is_unique(&x));
drop(w);
assert!(is_unique(&x));
}

#[test]
fn test_strong_count() {
let a = Rc::new(0);
Expand Down