Unnamed repository; edit this file 'description' to name the repository.
Don't populate rust_ir::AdtVariantDatum::fields for now due to perf
| -rw-r--r-- | crates/hir-ty/src/chalk_db.rs | 3 | ||||
| -rw-r--r-- | crates/hir-ty/src/tests/coercion.rs | 4 | ||||
| -rw-r--r-- | crates/hir-ty/src/tests/traits.rs | 12 |
3 files changed, 12 insertions, 7 deletions
diff --git a/crates/hir-ty/src/chalk_db.rs b/crates/hir-ty/src/chalk_db.rs index 49393f05a1..40a195f7d9 100644 --- a/crates/hir-ty/src/chalk_db.rs +++ b/crates/hir-ty/src/chalk_db.rs @@ -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) => { diff --git a/crates/hir-ty/src/tests/coercion.rs b/crates/hir-ty/src/tests/coercion.rs index bfb8df61a3..d56b15b9b7 100644 --- a/crates/hir-ty/src/tests/coercion.rs +++ b/crates/hir-ty/src/tests/coercion.rs @@ -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]> } "#, ); diff --git a/crates/hir-ty/src/tests/traits.rs b/crates/hir-ty/src/tests/traits.rs index 68cd6071ec..879c69c758 100644 --- a/crates/hir-ty/src/tests/traits.rs +++ b/crates/hir-ty/src/tests/traits.rs @@ -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; |