blob: 381b3caacb6b5333e89fd94830a529c7a8f628e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
//@ check-pass
//@ edition:2021
trait Global {}
fn main() {
trait Local {};
impl<T: Local> Global for Vec<T> { }
//~^ WARN non-local `impl` definition
}
trait Uto7 {}
trait Uto8 {}
struct Test;
fn bad() {
struct Local;
impl Uto7 for Test where Local: std::any::Any {}
//~^ WARN non-local `impl` definition
impl<T> Uto8 for T {}
//~^ WARN non-local `impl` definition
}
struct UwU<T>(T);
fn fun() {
#[derive(Debug)]
struct OwO;
impl Default for UwU<OwO> {
fn default() -> Self {
UwU(OwO)
}
}
}
fn meow() {
#[derive(Debug)]
struct Cat;
impl AsRef<Cat> for () {
fn as_ref(&self) -> &Cat { &Cat }
}
}
struct G;
fn fun2() {
#[derive(Debug, Default)]
struct B;
impl PartialEq<B> for G {
fn eq(&self, _: &B) -> bool {
true
}
}
}
struct Wrap<T>(T);
impl Wrap<Wrap<Wrap<()>>> {}
fn rawr() {
struct Lion;
impl From<Wrap<Wrap<Lion>>> for () {
fn from(_: Wrap<Wrap<Lion>>) -> Self {
todo!()
}
}
impl From<()> for Wrap<Lion> {
fn from(_: ()) -> Self {
todo!()
}
}
}
fn side_effects() {
dbg!(().as_ref()); // prints `Cat`
dbg!(UwU::default().0);
let _ = G::eq(&G, dbg!(&<_>::default()));
}
|