Skip to content

Commit d2b27d0

Browse files
committed
Don't populate rust_ir::AdtVariantDatum::fields for now due to perf
1 parent 9d18e19 commit d2b27d0

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

crates/hir-ty/src/chalk_db.rs

+3
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ pub(crate) fn adt_datum_query(
742742
phantom_data,
743743
};
744744

745+
#[cfg(FALSE)]
746+
// this slows down rust-analyzer by quite a bit unfortunately, so enabling this is currently not worth it
745747
let variant_id_to_fields = |id: VariantId| {
746748
let variant_data = &id.variant_data(db.upcast());
747749
let fields = if variant_data.fields().is_empty() {
@@ -757,6 +759,7 @@ pub(crate) fn adt_datum_query(
757759
};
758760
rust_ir::AdtVariantDatum { fields }
759761
};
762+
let variant_id_to_fields = |_: VariantId| rust_ir::AdtVariantDatum { fields: vec![] };
760763

761764
let (kind, variants) = match adt_id {
762765
hir_def::AdtId::StructId(id) => {

crates/hir-ty/src/tests/coercion.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -536,15 +536,17 @@ fn test() {
536536

537537
#[test]
538538
fn coerce_unsize_generic() {
539-
check_no_mismatches(
539+
check(
540540
r#"
541541
//- minicore: coerce_unsized
542542
struct Foo<T> { t: T };
543543
struct Bar<T>(Foo<T>);
544544
545545
fn test() {
546546
let _: &Foo<[usize]> = &Foo { t: [1, 2, 3] };
547+
//^^^^^^^^^^^^^^^^^^^^^ expected &Foo<[usize]>, got &Foo<[i32; 3]>
547548
let _: &Bar<[usize]> = &Bar(Foo { t: [1, 2, 3] });
549+
//^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &Bar<[usize]>, got &Bar<[i32; 3]>
548550
}
549551
"#,
550552
);

crates/hir-ty/src/tests/traits.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -4583,21 +4583,21 @@ fn f<T: Send, U>() {
45834583
Struct::<T>::IS_SEND;
45844584
//^^^^^^^^^^^^^^^^^^^^Yes
45854585
Struct::<U>::IS_SEND;
4586-
//^^^^^^^^^^^^^^^^^^^^{unknown}
4586+
//^^^^^^^^^^^^^^^^^^^^Yes
45874587
Struct::<*const T>::IS_SEND;
4588-
//^^^^^^^^^^^^^^^^^^^^^^^^^^^{unknown}
4588+
//^^^^^^^^^^^^^^^^^^^^^^^^^^^Yes
45894589
Enum::<T>::IS_SEND;
45904590
//^^^^^^^^^^^^^^^^^^Yes
45914591
Enum::<U>::IS_SEND;
4592-
//^^^^^^^^^^^^^^^^^^{unknown}
4592+
//^^^^^^^^^^^^^^^^^^Yes
45934593
Enum::<*const T>::IS_SEND;
4594-
//^^^^^^^^^^^^^^^^^^^^^^^^^{unknown}
4594+
//^^^^^^^^^^^^^^^^^^^^^^^^^Yes
45954595
Union::<T>::IS_SEND;
45964596
//^^^^^^^^^^^^^^^^^^^Yes
45974597
Union::<U>::IS_SEND;
4598-
//^^^^^^^^^^^^^^^^^^^{unknown}
4598+
//^^^^^^^^^^^^^^^^^^^Yes
45994599
Union::<*const T>::IS_SEND;
4600-
//^^^^^^^^^^^^^^^^^^^^^^^^^^{unknown}
4600+
//^^^^^^^^^^^^^^^^^^^^^^^^^^Yes
46014601
PhantomData::<T>::IS_SEND;
46024602
//^^^^^^^^^^^^^^^^^^^^^^^^^Yes
46034603
PhantomData::<U>::IS_SEND;

0 commit comments

Comments
 (0)