@@ -3,7 +3,7 @@ use span::{Edition, EditionedFileId};
3
3
use syntax:: { TextRange , TextSize } ;
4
4
use test_fixture:: WithFixture ;
5
5
6
- use crate :: { db:: HirDatabase , test_db:: TestDB , Interner , Substitution } ;
6
+ use crate :: { db:: HirDatabase , mir :: MirLowerError , test_db:: TestDB , Interner , Substitution } ;
7
7
8
8
use super :: { interpret_mir, MirEvalError } ;
9
9
@@ -84,6 +84,16 @@ fn check_panic(#[rust_analyzer::rust_fixture] ra_fixture: &str, expected_panic:
84
84
assert_eq ! ( e. is_panic( ) . unwrap_or_else( || panic!( "unexpected error: {e:?}" ) ) , expected_panic) ;
85
85
}
86
86
87
+ fn check_error_with (
88
+ #[ rust_analyzer:: rust_fixture] ra_fixture : & str ,
89
+ expect_err : impl FnOnce ( MirEvalError ) -> bool ,
90
+ ) {
91
+ let ( db, file_ids) = TestDB :: with_many_files ( ra_fixture) ;
92
+ let file_id = * file_ids. last ( ) . unwrap ( ) ;
93
+ let e = eval_main ( & db, file_id) . unwrap_err ( ) ;
94
+ assert ! ( expect_err( e) ) ;
95
+ }
96
+
87
97
#[ test]
88
98
fn function_with_extern_c_abi ( ) {
89
99
check_pass (
@@ -945,3 +955,27 @@ fn main() {
945
955
"# ,
946
956
) ;
947
957
}
958
+
959
+ #[ test]
960
+ fn regression_19177 ( ) {
961
+ check_error_with (
962
+ r#"
963
+ //- minicore: copy
964
+ trait Foo {}
965
+ trait Bar {}
966
+ trait Baz {}
967
+ trait Qux {
968
+ type Assoc;
969
+ }
970
+
971
+ fn main<'a, T: Foo + Bar + Baz>(
972
+ x: &T,
973
+ y: (),
974
+ z: &'a dyn Qux<Assoc = T>,
975
+ w: impl Foo + Bar,
976
+ ) {
977
+ }
978
+ "# ,
979
+ |e| matches ! ( e, MirEvalError :: MirLowerError ( _, MirLowerError :: GenericArgNotProvided ( ..) ) ) ,
980
+ ) ;
981
+ }
0 commit comments