From a896f01fee1a44e3494cae48eb23a2fbf03a50b1 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Tue, 4 Jul 2023 04:05:44 -0400 Subject: [PATCH] Add a test for `PartialEq` across `Allocator`s 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 fc04089fa09 (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. --- .../issue-113283-alllocator-trait-eq.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs diff --git a/tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs b/tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs new file mode 100644 index 00000000000..5d0e456d9dd --- /dev/null +++ b/tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs @@ -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> = vec![]; + assert_eq!(boxed, vec![]); + + let rc: Vec> = vec![]; + assert_eq!(rc, vec![]); + + let arc: Vec> = vec![]; + assert_eq!(arc, vec![]); +}