Skip to content

Commit 1653a2d

Browse files
Failing test
1 parent e3c3ce6 commit 1653a2d

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

Diff for: tests/ui/specialization/anyid-repro-125197.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ aux-build: anyid-repro-125197.rs
2+
//@ check-pass
3+
4+
// Makes sure that we don't check `specializes(impl1, impl2)` for a pair of impls that don't
5+
// actually participate in specialization. Since <https://github.com/rust-lang/rust/pull/122791>,
6+
// we don't treat inductive cycles as errors -- so we may need to winnow more pairs of impls, and
7+
// we try to winnow impls in favor of other impls. However, if we're *inside* the `specializes`
8+
// query, then may have a query cycle if we call `specializes` again!
9+
10+
extern crate anyid_repro_125197;
11+
use anyid_repro_125197::AnyId;
12+
13+
fn main() {
14+
let x = "hello, world";
15+
let y: AnyId = x.into();
16+
let _ = y == x;
17+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use std::fmt::Display;
2+
use std::sync::Arc;
3+
4+
pub struct AnyId(());
5+
6+
impl PartialEq<Self> for AnyId {
7+
fn eq(&self, _: &Self) -> bool {
8+
todo!()
9+
}
10+
}
11+
12+
impl<T: Identifier> PartialEq<T> for AnyId {
13+
fn eq(&self, _: &T) -> bool {
14+
todo!()
15+
}
16+
}
17+
18+
impl<T: Identifier> From<T> for AnyId {
19+
fn from(_: T) -> Self {
20+
todo!()
21+
}
22+
}
23+
24+
pub trait Identifier: Display + 'static {}
25+
26+
impl<T> Identifier for T where T: PartialEq + Display + 'static {}

0 commit comments

Comments
 (0)