|
1 | 1 | use base_db::SourceDatabase; |
2 | 2 | use expect_test::Expect; |
3 | | -use hir_def::{DefWithBodyId, ModuleDefId}; |
| 3 | +use hir_def::ModuleDefId; |
4 | 4 | use salsa::EventKind; |
5 | 5 | use test_fixture::WithFixture; |
6 | 6 |
|
@@ -519,198 +519,6 @@ impl SomeStruct { |
519 | 519 | ); |
520 | 520 | } |
521 | 521 |
|
522 | | -// FIXME(next-solver): does this test make sense with fast path? |
523 | | -#[test] |
524 | | -fn add_struct_invalidates_trait_solve() { |
525 | | - let (mut db, file_id) = TestDB::with_single_file( |
526 | | - " |
527 | | -//- /main.rs crate:main |
528 | | -struct SomeStruct; |
529 | | -
|
530 | | -trait Trait<T> { |
531 | | - fn method(&self) -> T; |
532 | | -} |
533 | | -impl Trait<u32> for SomeStruct {} |
534 | | -
|
535 | | -fn main() { |
536 | | - let s = SomeStruct; |
537 | | - s.method(); |
538 | | - s.$0 |
539 | | -}", |
540 | | - ); |
541 | | - |
542 | | - execute_assert_events( |
543 | | - &db, |
544 | | - || { |
545 | | - let module = db.module_for_file(file_id.file_id(&db)); |
546 | | - let crate_def_map = module.def_map(&db); |
547 | | - let mut defs: Vec<DefWithBodyId> = vec![]; |
548 | | - visit_module(&db, crate_def_map, module.local_id, &mut |it| { |
549 | | - let def = match it { |
550 | | - ModuleDefId::FunctionId(it) => it.into(), |
551 | | - ModuleDefId::EnumVariantId(it) => it.into(), |
552 | | - ModuleDefId::ConstId(it) => it.into(), |
553 | | - ModuleDefId::StaticId(it) => it.into(), |
554 | | - _ => return, |
555 | | - }; |
556 | | - defs.push(def); |
557 | | - }); |
558 | | - |
559 | | - for def in defs { |
560 | | - let _inference_result = db.infer(def); |
561 | | - } |
562 | | - }, |
563 | | - &[("trait_solve_shim", 0)], |
564 | | - expect_test::expect![[r#" |
565 | | - [ |
566 | | - "source_root_crates_shim", |
567 | | - "crate_local_def_map", |
568 | | - "file_item_tree_query", |
569 | | - "ast_id_map_shim", |
570 | | - "parse_shim", |
571 | | - "real_span_map_shim", |
572 | | - "TraitItems::query_with_diagnostics_", |
573 | | - "body_shim", |
574 | | - "body_with_source_map_shim", |
575 | | - "attrs_shim", |
576 | | - "ImplItems::of_", |
577 | | - "infer_shim", |
578 | | - "trait_signature_shim", |
579 | | - "trait_signature_with_source_map_shim", |
580 | | - "attrs_shim", |
581 | | - "function_signature_shim", |
582 | | - "function_signature_with_source_map_shim", |
583 | | - "attrs_shim", |
584 | | - "body_shim", |
585 | | - "body_with_source_map_shim", |
586 | | - "trait_environment_shim", |
587 | | - "lang_item", |
588 | | - "crate_lang_items", |
589 | | - "attrs_shim", |
590 | | - "attrs_shim", |
591 | | - "return_type_impl_traits_shim", |
592 | | - "generic_predicates_ns_shim", |
593 | | - "infer_shim", |
594 | | - "function_signature_shim", |
595 | | - "function_signature_with_source_map_shim", |
596 | | - "trait_environment_shim", |
597 | | - "expr_scopes_shim", |
598 | | - "struct_signature_shim", |
599 | | - "struct_signature_with_source_map_shim", |
600 | | - "generic_predicates_shim", |
601 | | - "value_ty_shim", |
602 | | - "VariantFields::firewall_", |
603 | | - "VariantFields::query_", |
604 | | - "lang_item", |
605 | | - "inherent_impls_in_crate_shim", |
606 | | - "impl_signature_shim", |
607 | | - "impl_signature_with_source_map_shim", |
608 | | - "callable_item_signature_shim", |
609 | | - "trait_impls_in_deps_shim", |
610 | | - "trait_impls_in_crate_shim", |
611 | | - "impl_trait_with_diagnostics_shim", |
612 | | - "impl_self_ty_with_diagnostics_shim", |
613 | | - "type_for_adt_tracked", |
614 | | - "impl_trait_with_diagnostics_ns_shim", |
615 | | - "impl_self_ty_with_diagnostics_ns_shim", |
616 | | - "generic_predicates_ns_shim", |
617 | | - "value_ty_shim", |
618 | | - "generic_predicates_shim", |
619 | | - "lang_item", |
620 | | - ] |
621 | | - "#]], |
622 | | - ); |
623 | | - |
624 | | - let new_text = " |
625 | | -//- /main.rs crate:main |
626 | | -struct AnotherStruct; |
627 | | -
|
628 | | -struct SomeStruct; |
629 | | -
|
630 | | -trait Trait<T> { |
631 | | - fn method(&self) -> T; |
632 | | -} |
633 | | -impl Trait<u32> for SomeStruct {} |
634 | | -
|
635 | | -fn main() { |
636 | | - let s = SomeStruct; |
637 | | - s.method(); |
638 | | - s.$0 |
639 | | -}"; |
640 | | - |
641 | | - db.set_file_text(file_id.file_id(&db), new_text); |
642 | | - |
643 | | - execute_assert_events( |
644 | | - &db, |
645 | | - || { |
646 | | - let module = db.module_for_file(file_id.file_id(&db)); |
647 | | - let crate_def_map = module.def_map(&db); |
648 | | - let mut defs: Vec<DefWithBodyId> = vec![]; |
649 | | - |
650 | | - visit_module(&db, crate_def_map, module.local_id, &mut |it| { |
651 | | - let def = match it { |
652 | | - ModuleDefId::FunctionId(it) => it.into(), |
653 | | - ModuleDefId::EnumVariantId(it) => it.into(), |
654 | | - ModuleDefId::ConstId(it) => it.into(), |
655 | | - ModuleDefId::StaticId(it) => it.into(), |
656 | | - _ => return, |
657 | | - }; |
658 | | - defs.push(def); |
659 | | - }); |
660 | | - |
661 | | - for def in defs { |
662 | | - let _inference_result = db.infer(def); |
663 | | - } |
664 | | - }, |
665 | | - &[("trait_solve_shim", 0)], |
666 | | - expect_test::expect![[r#" |
667 | | - [ |
668 | | - "parse_shim", |
669 | | - "ast_id_map_shim", |
670 | | - "file_item_tree_query", |
671 | | - "real_span_map_shim", |
672 | | - "crate_local_def_map", |
673 | | - "TraitItems::query_with_diagnostics_", |
674 | | - "body_with_source_map_shim", |
675 | | - "attrs_shim", |
676 | | - "body_shim", |
677 | | - "ImplItems::of_", |
678 | | - "infer_shim", |
679 | | - "attrs_shim", |
680 | | - "trait_signature_with_source_map_shim", |
681 | | - "attrs_shim", |
682 | | - "function_signature_with_source_map_shim", |
683 | | - "function_signature_shim", |
684 | | - "body_with_source_map_shim", |
685 | | - "body_shim", |
686 | | - "trait_environment_shim", |
687 | | - "crate_lang_items", |
688 | | - "attrs_shim", |
689 | | - "attrs_shim", |
690 | | - "attrs_shim", |
691 | | - "return_type_impl_traits_shim", |
692 | | - "generic_predicates_ns_shim", |
693 | | - "infer_shim", |
694 | | - "function_signature_with_source_map_shim", |
695 | | - "expr_scopes_shim", |
696 | | - "struct_signature_with_source_map_shim", |
697 | | - "VariantFields::query_", |
698 | | - "inherent_impls_in_crate_shim", |
699 | | - "impl_signature_with_source_map_shim", |
700 | | - "impl_signature_shim", |
701 | | - "callable_item_signature_shim", |
702 | | - "trait_impls_in_crate_shim", |
703 | | - "impl_trait_with_diagnostics_shim", |
704 | | - "impl_self_ty_with_diagnostics_shim", |
705 | | - "impl_trait_with_diagnostics_ns_shim", |
706 | | - "impl_self_ty_with_diagnostics_ns_shim", |
707 | | - "generic_predicates_ns_shim", |
708 | | - "generic_predicates_shim", |
709 | | - ] |
710 | | - "#]], |
711 | | - ); |
712 | | -} |
713 | | - |
714 | 522 | fn execute_assert_events( |
715 | 523 | db: &TestDB, |
716 | 524 | f: impl FnOnce(), |
|
0 commit comments