Skip to content

Commit 3c9a749

Browse files
committed
Add a test for PartialEq across Allocators breaking inference (#113283)
Verify that `PartialEq` implementations do not break type inference when comparing types across different allocators. This catches a regression in current nightly introduced in 001b081 (alloc: Allow comparing `Box`s over different allocators") `Box` is the only type that currently impelements this, but tests are included for `Rc` and `Arc` to prevent future regresssions.
1 parent 0130c3a commit 3c9a749

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// run-pass
2+
// Verify that PartialEq implementations do not break type inference when
3+
// accepting types with different allocators
4+
5+
use std::rc::Rc;
6+
use std::sync::Arc;
7+
8+
9+
fn main() {
10+
let boxed: Vec<Box<i32>> = vec![];
11+
assert_eq!(boxed, vec![]);
12+
13+
let rc: Vec<Rc<i32>> = vec![];
14+
assert_eq!(rc, vec![]);
15+
16+
let arc: Vec<Arc<i32>> = vec![];
17+
assert_eq!(arc, vec![]);
18+
}

0 commit comments

Comments
 (0)