Skip to content

Commit ffcdf88

Browse files
committed
Tests for WellFormedTraitRef with nonsensical where clauses
These panic
1 parent e1ea346 commit ffcdf88

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

src/test/well_formed_trait_ref.rs

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(non_snake_case)]
2-
31
#[test]
42
fn dependent_where_clause() {
53
crate::assert_ok!(
@@ -126,3 +124,37 @@ fn const_param() {
126124
expect_test::expect!["()"]
127125
)
128126
}
127+
128+
#[test]
129+
#[should_panic(expected = "wrong number of parameters")]
130+
fn type_with_wrong_number_of_parameters() {
131+
crate::test_program_ok(
132+
" [
133+
crate foo {
134+
trait Trait1 {}
135+
136+
struct S1 {}
137+
138+
struct S2<ty T> where S1<T> : Trait1 {
139+
dummy: T,
140+
}
141+
}
142+
] ",
143+
)
144+
.unwrap();
145+
}
146+
147+
#[test]
148+
#[should_panic(expected = "no ADT named `Nonex`")]
149+
fn where_clause_with_nonexistent_type() {
150+
crate::test_program_ok(
151+
" [
152+
crate foo {
153+
trait Trait1 {}
154+
155+
struct S1 where Nonex: Trait1 {}
156+
}
157+
] ",
158+
)
159+
.unwrap();
160+
}

0 commit comments

Comments
 (0)