mirror of
https://github.com/openharmony/third_party_rust_rust.git
synced 2026-07-19 19:53:38 -04:00
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 fc04089fa0 (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.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// run-pass
|
||||
// Verify that PartialEq implementations do not break type inference when
|
||||
// accepting types with different allocators
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
fn main() {
|
||||
let boxed: Vec<Box<i32>> = vec![];
|
||||
assert_eq!(boxed, vec![]);
|
||||
|
||||
let rc: Vec<Rc<i32>> = vec![];
|
||||
assert_eq!(rc, vec![]);
|
||||
|
||||
let arc: Vec<Arc<i32>> = vec![];
|
||||
assert_eq!(arc, vec![]);
|
||||
}
|
||||
Reference in New Issue
Block a user