Skip to content

Commit

Permalink
Failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jun 7, 2024
1 parent e3c3ce6 commit 1653a2d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/ui/specialization/anyid-repro-125197.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//@ aux-build: anyid-repro-125197.rs
//@ check-pass

// Makes sure that we don't check `specializes(impl1, impl2)` for a pair of impls that don't
// actually participate in specialization. Since <https://github.com/rust-lang/rust/pull/122791>,
// we don't treat inductive cycles as errors -- so we may need to winnow more pairs of impls, and
// we try to winnow impls in favor of other impls. However, if we're *inside* the `specializes`
// query, then may have a query cycle if we call `specializes` again!

extern crate anyid_repro_125197;
use anyid_repro_125197::AnyId;

fn main() {
let x = "hello, world";
let y: AnyId = x.into();
let _ = y == x;
}
26 changes: 26 additions & 0 deletions tests/ui/specialization/auxiliary/anyid-repro-125197.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use std::fmt::Display;
use std::sync::Arc;

pub struct AnyId(());

impl PartialEq<Self> for AnyId {
fn eq(&self, _: &Self) -> bool {
todo!()
}
}

impl<T: Identifier> PartialEq<T> for AnyId {
fn eq(&self, _: &T) -> bool {
todo!()
}
}

impl<T: Identifier> From<T> for AnyId {
fn from(_: T) -> Self {
todo!()
}
}

pub trait Identifier: Display + 'static {}

impl<T> Identifier for T where T: PartialEq + Display + 'static {}

0 comments on commit 1653a2d

Please sign in to comment.