diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2024-02-19 16:46:09 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2024-02-19 17:38:03 +0100 |
| commit | d2b27d09ea075b36bac166e7ac029742510e8662 (patch) | |
| tree | a3d439ea5b722955a65ad5a23f291c9527baf0a4 | |
| parent | 9d18e197bcbd732a349ff8b51ecf6532d7ea822a (diff) | |
| download | rust-d2b27d09ea075b36bac166e7ac029742510e8662.tar.gz rust-d2b27d09ea075b36bac166e7ac029742510e8662.zip | |
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 49393f05a1a..40a195f7d95 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 bfb8df61a33..d56b15b9b74 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 68cd6071ec7..879c69c758f 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; |
