Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup infra for handling auto trait bounds disabled due to perf problems #13112

Merged
merged 7 commits into from
Feb 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/hir-ty/src/chalk_db.rs
Original file line number Diff line number Diff line change
@@ -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) => {
4 changes: 3 additions & 1 deletion crates/hir-ty/src/tests/coercion.rs
Original file line number Diff line number Diff line change
@@ -536,15 +536,17 @@ fn test() {

#[test]
fn coerce_unsize_generic() {
check_no_mismatches(
check(
r#"
//- minicore: coerce_unsized
struct Foo<T> { t: T };
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]>
}
"#,
);
12 changes: 6 additions & 6 deletions crates/hir-ty/src/tests/traits.rs
Original file line number Diff line number Diff line change
@@ -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;

Unchanged files with check annotations Beta

///
/// fn assert_send() {
/// is_send(DatabaseImpl::default());
/// }

Check failure on line 37 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

`Rc<bool>` cannot be sent between threads safely

Check failure on line 37 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

`Rc<bool>` cannot be shared between threads safely
/// ```
fn test_key_not_send_db_not_send() {}
/// trait NoSendSyncDatabase: salsa::Database {
/// fn no_send_sync_value(&self, key: bool) -> Cell<bool>;
/// fn no_send_sync_key(&self, key: Cell<bool>) -> bool;
/// }

Check failure on line 52 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

the trait bound `Cell<bool>: Hash` is not satisfied
///
/// fn no_send_sync_value(_db: &dyn NoSendSyncDatabase, key: bool) -> Cell<bool> {
/// Cell::new(key)
///
/// fn no_send_sync_key(_db: &dyn NoSendSyncDatabase, key: Cell<bool>) -> bool {
/// *key
/// }

Check failure on line 60 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

type `Cell<bool>` cannot be dereferenced
///
/// #[salsa::database(NoSendSyncStorage)]
/// #[derive(Default)]

Check failure on line 63 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

no field `storage` on type `&DatabaseImpl`

Check failure on line 63 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

no field `storage` on type `&mut DatabaseImpl`
/// struct DatabaseImpl {
/// runtime: salsa::Storage<Self>,
/// }
///
/// fn assert_send() {
/// is_send(DatabaseImpl::default());
/// }

Check failure on line 75 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

`Cell<bool>` cannot be shared between threads safely
/// ```
fn test_key_not_sync_db_not_send() {}
/// trait NoSendSyncDatabase: salsa::Database {
/// fn no_send_sync_value(&self, key: bool) -> Cell<bool>;
/// fn no_send_sync_key(&self, key: Cell<bool>) -> bool;
/// }

Check failure on line 90 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

the trait bound `Cell<bool>: Hash` is not satisfied
///
/// fn no_send_sync_value(_db: &dyn NoSendSyncDatabase, key: bool) -> Cell<bool> {
/// Cell::new(key)
///
/// fn no_send_sync_key(_db: &dyn NoSendSyncDatabase, key: Cell<bool>) -> bool {
/// *key
/// }

Check failure on line 98 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

type `Cell<bool>` cannot be dereferenced
///
/// #[salsa::database(NoSendSyncStorage)]
/// #[derive(Default)]

Check failure on line 101 in crates/salsa/src/doctest.rs

GitHub Actions / Rust (ubuntu-latest)

no field `storage` on type `&DatabaseImpl`
/// struct DatabaseImpl {
/// runtime: salsa::Storage<Self>,
/// }