Don't populate rust_ir::AdtVariantDatum::fields for now due to perf

This commit is contained in:
Lukas Wirth 2024-02-19 16:46:09 +01:00
parent 9d18e197bc
commit d2b27d09ea
3 changed files with 12 additions and 7 deletions

View file

@ -742,6 +742,8 @@ pub(crate) fn adt_datum_query(
phantom_data,
};
#[cfg(FALSE)]
// this slows down rust-analyzer by quite a bit unfortunately, so enabling this is currently not worth it
let variant_id_to_fields = |id: VariantId| {
let variant_data = &id.variant_data(db.upcast());
let fields = if variant_data.fields().is_empty() {
@ -757,6 +759,7 @@ pub(crate) fn adt_datum_query(
};
rust_ir::AdtVariantDatum { fields }
};
let variant_id_to_fields = |_: VariantId| rust_ir::AdtVariantDatum { fields: vec![] };
let (kind, variants) = match adt_id {
hir_def::AdtId::StructId(id) => {

View file

@ -536,7 +536,7 @@ fn test() {
#[test]
fn coerce_unsize_generic() {
check_no_mismatches(
check(
r#"
//- minicore: coerce_unsized
struct Foo<T> { t: T };
@ -544,7 +544,9 @@ struct Bar<T>(Foo<T>);
fn test() {
let _: &Foo<[usize]> = &Foo { t: [1, 2, 3] };
//^^^^^^^^^^^^^^^^^^^^^ expected &Foo<[usize]>, got &Foo<[i32; 3]>
let _: &Bar<[usize]> = &Bar(Foo { t: [1, 2, 3] });
//^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &Bar<[usize]>, got &Bar<[i32; 3]>
}
"#,
);

View file

@ -4583,21 +4583,21 @@ fn f<T: Send, U>() {
Struct::<T>::IS_SEND;
//^^^^^^^^^^^^^^^^^^^^Yes
Struct::<U>::IS_SEND;
//^^^^^^^^^^^^^^^^^^^^{unknown}
//^^^^^^^^^^^^^^^^^^^^Yes
Struct::<*const T>::IS_SEND;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^{unknown}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^Yes
Enum::<T>::IS_SEND;
//^^^^^^^^^^^^^^^^^^Yes
Enum::<U>::IS_SEND;
//^^^^^^^^^^^^^^^^^^{unknown}
//^^^^^^^^^^^^^^^^^^Yes
Enum::<*const T>::IS_SEND;
//^^^^^^^^^^^^^^^^^^^^^^^^^{unknown}
//^^^^^^^^^^^^^^^^^^^^^^^^^Yes
Union::<T>::IS_SEND;
//^^^^^^^^^^^^^^^^^^^Yes
Union::<U>::IS_SEND;
//^^^^^^^^^^^^^^^^^^^{unknown}
//^^^^^^^^^^^^^^^^^^^Yes
Union::<*const T>::IS_SEND;
//^^^^^^^^^^^^^^^^^^^^^^^^^^{unknown}
//^^^^^^^^^^^^^^^^^^^^^^^^^^Yes
PhantomData::<T>::IS_SEND;
//^^^^^^^^^^^^^^^^^^^^^^^^^Yes
PhantomData::<U>::IS_SEND;