@@ -3,7 +3,7 @@ use span::{Edition, EditionedFileId};
33use syntax:: { TextRange , TextSize } ;
44use test_fixture:: WithFixture ;
55
6- use crate :: { db:: HirDatabase , test_db:: TestDB , Interner , Substitution } ;
6+ use crate :: { db:: HirDatabase , mir :: MirLowerError , test_db:: TestDB , Interner , Substitution } ;
77
88use super :: { interpret_mir, MirEvalError } ;
99
@@ -84,6 +84,16 @@ fn check_panic(#[rust_analyzer::rust_fixture] ra_fixture: &str, expected_panic:
8484 assert_eq ! ( e. is_panic( ) . unwrap_or_else( || panic!( "unexpected error: {e:?}" ) ) , expected_panic) ;
8585}
8686
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+
8797#[ test]
8898fn function_with_extern_c_abi ( ) {
8999 check_pass (
@@ -945,3 +955,27 @@ fn main() {
945955"# ,
946956 ) ;
947957}
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