Skip to content

Commit 8dd9cf5

Browse files
authored
Merge pull request #179 from andersk/dead-code
Fix dead code warnings in tests
2 parents 9738caa + 7195c3b commit 8dd9cf5

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
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+
use gc::Gc;
2+
#[cfg(feature = "nightly")]
3+
use gc::{Finalize, Trace};
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/gc_semantics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ fn as_ptr() {
303303
let a_ptr = Gc::as_ptr(&a);
304304
assert_eq!(a_ptr, Gc::as_ptr(&aa));
305305

306-
let b = Gc::new(B(a.clone()));
306+
let b = Gc::new(B(a.clone()));
307307
assert_eq!(a_ptr, Gc::as_ptr(&b.0));
308308
let bb = Gc::new(B(a.clone()));
309309
assert_eq!(a_ptr, Gc::as_ptr(&bb.0));

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

+15-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,21 @@ struct Baz {
5247

5348
#[test]
5449
fn test() {
50+
unsafe {
51+
InnerBoxSlice {
52+
inner: Box::new([1, 2, 3]),
53+
}
54+
.trace();
55+
InnerBoxStr {
56+
inner: "abc".into(),
57+
}
58+
.trace();
59+
InnerRcStr {
60+
inner: "abc".into(),
61+
}
62+
.trace();
63+
}
64+
5565
let bar = Bar { inner: Foo };
5666
unsafe {
5767
bar.trace();

0 commit comments

Comments
 (0)