Skip to content

Commit

Permalink
Add a test for PartialEq across Allocators breaking inference (ru…
Browse files Browse the repository at this point in the history
…st-lang#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.
  • Loading branch information
tgross35 committed Jul 4, 2023
1 parent 0130c3a commit 3c9a749
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs
Original file line number Diff line number Diff line change
@@ -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![]);
}

0 comments on commit 3c9a749

Please sign in to comment.