Skip to content

Commit 29db81d

Browse files
committed
Fix dead code warnings in tests
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent d84eb95 commit 29db81d

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

gc/tests/finalize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct X(Box<dyn Trace>);
4141
fn drop_triggers_finalize() {
4242
FLAGS.with(|f| assert_eq!(f.get(), Flags(0, 0)));
4343
{
44-
let _x = A { b: B };
44+
let _x = X(Box::new(A { b: B }));
4545
FLAGS.with(|f| assert_eq!(f.get(), Flags(0, 0)));
4646
}
4747
FLAGS.with(|f| assert_eq!(f.get(), Flags(1, 1)));

gc/tests/from_box.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
use gc::{Finalize, Gc, Trace};
1+
#[cfg(feature = "nightly")]
2+
use gc::{Finalize, Trace};
3+
use gc::Gc;
24

5+
#[cfg(feature = "nightly")]
36
trait Foo: Trace {}
47

8+
#[cfg(feature = "nightly")]
59
#[derive(Trace, Finalize)]
610
struct Bar;
11+
#[cfg(feature = "nightly")]
712
impl Foo for Bar {}
813

914
#[test]

gc/tests/ignore_trace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ struct S(#[unsafe_ignore_trace] Gc<()>);
77
/// cycles through that `Gc`, but it should not result in panics.
88
#[test]
99
fn ignore_trace_gc() {
10-
Gc::new(S(Gc::new(())));
10+
*Gc::new(S(Gc::new(()))).0;
1111
force_collect();
1212
}

gc/tests/trace_impl.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ struct InnerBoxStr {
3434
inner: Box<str>,
3535
}
3636

37-
#[derive(Trace, Clone, Finalize)]
38-
struct InnerRcSlice {
39-
inner: Box<[u32]>,
40-
}
41-
4237
#[derive(Trace, Clone, Finalize)]
4338
struct InnerRcStr {
4439
inner: Rc<str>,
@@ -52,6 +47,12 @@ struct Baz {
5247

5348
#[test]
5449
fn test() {
50+
unsafe {
51+
InnerBoxSlice { inner: Box::new([1, 2, 3]) }.trace();
52+
InnerBoxStr { inner: "abc".into() }.trace();
53+
InnerRcStr { inner: "abc".into() }.trace();
54+
}
55+
5556
let bar = Bar { inner: Foo };
5657
unsafe {
5758
bar.trace();

0 commit comments

Comments
 (0)