Skip to content

Commit e2ad919

Browse files
committed
Tests for WellFormedTraitRef with various parameter kinds
static_lifetime_param fails.
1 parent 056cda2 commit e2ad919

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

src/test/well_formed_trait_ref.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,61 @@ fn missing_dependent_where_clause() {
6868
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]
6969
)
7070
}
71+
72+
#[test]
73+
fn lifetime_param() {
74+
crate::assert_ok!(
75+
//@check-pass
76+
[
77+
crate foo {
78+
trait Trait1<lt a> {}
79+
80+
struct S1 {}
81+
82+
struct S2<lt a> where S1: Trait1<a> {}
83+
}
84+
]
85+
86+
expect_test::expect!["()"]
87+
)
88+
}
89+
90+
#[test]
91+
fn static_lifetime_param() {
92+
crate::assert_ok!(
93+
//@check-pass
94+
[
95+
crate foo {
96+
trait Trait1<lt a> {}
97+
98+
struct S1 {}
99+
100+
impl Trait1<static> for S1 {}
101+
102+
struct S2 where S1: Trait1<static> {}
103+
}
104+
]
105+
106+
expect_test::expect!["()"]
107+
)
108+
}
109+
110+
#[test]
111+
fn const_param() {
112+
crate::assert_ok!(
113+
//@check-pass
114+
[
115+
crate foo {
116+
trait Trait1<const C> where type_of_const C is u32 {}
117+
118+
struct S1 {}
119+
120+
impl Trait1<const 3_u32> for S1 {}
121+
122+
struct S2 where S1: Trait1<const 3_u32> {}
123+
}
124+
]
125+
126+
expect_test::expect!["()"]
127+
)
128+
}

0 commit comments

Comments
 (0)