Skip to content

Bump chalk for built-in supports of async closures #19232

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

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ arrayvec = "0.7.4"
bitflags = "2.4.1"
cargo_metadata = "0.18.1"
camino = "1.1.6"
chalk-solve = { version = "0.99.0", default-features = false }
chalk-ir = "0.99.0"
chalk-recursive = { version = "0.99.0", default-features = false }
chalk-derive = "0.99.0"
chalk-solve = { version = "0.100.0", default-features = false }
chalk-ir = "0.100.0"
chalk-recursive = { version = "0.100.0", default-features = false }
chalk-derive = "0.100.0"
crossbeam-channel = "0.5.8"
dissimilar = "1.0.7"
dot = "0.1.4"
Expand Down
8 changes: 8 additions & 0 deletions crates/hir-ty/src/chalk_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,17 @@ fn well_known_trait_from_lang_item(item: LangItem) -> Option<WellKnownTrait> {
LangItem::Fn => WellKnownTrait::Fn,
LangItem::FnMut => WellKnownTrait::FnMut,
LangItem::FnOnce => WellKnownTrait::FnOnce,
LangItem::AsyncFn => WellKnownTrait::AsyncFn,
LangItem::AsyncFnMut => WellKnownTrait::AsyncFnMut,
LangItem::AsyncFnOnce => WellKnownTrait::AsyncFnOnce,
LangItem::Coroutine => WellKnownTrait::Coroutine,
LangItem::Sized => WellKnownTrait::Sized,
LangItem::Unpin => WellKnownTrait::Unpin,
LangItem::Unsize => WellKnownTrait::Unsize,
LangItem::Tuple => WellKnownTrait::Tuple,
LangItem::PointeeTrait => WellKnownTrait::Pointee,
LangItem::FnPtrTrait => WellKnownTrait::FnPtr,
LangItem::Future => WellKnownTrait::Future,
_ => return None,
})
}
Expand All @@ -730,13 +734,17 @@ fn lang_item_from_well_known_trait(trait_: WellKnownTrait) -> LangItem {
WellKnownTrait::Fn => LangItem::Fn,
WellKnownTrait::FnMut => LangItem::FnMut,
WellKnownTrait::FnOnce => LangItem::FnOnce,
WellKnownTrait::AsyncFn => LangItem::AsyncFn,
WellKnownTrait::AsyncFnMut => LangItem::AsyncFnMut,
WellKnownTrait::AsyncFnOnce => LangItem::AsyncFnOnce,
WellKnownTrait::Coroutine => LangItem::Coroutine,
WellKnownTrait::Sized => LangItem::Sized,
WellKnownTrait::Tuple => LangItem::Tuple,
WellKnownTrait::Unpin => LangItem::Unpin,
WellKnownTrait::Unsize => LangItem::Unsize,
WellKnownTrait::Pointee => LangItem::PointeeTrait,
WellKnownTrait::FnPtr => LangItem::FnPtrTrait,
WellKnownTrait::Future => LangItem::Future,
}
}

Expand Down
39 changes: 39 additions & 0 deletions crates/hir-ty/src/tests/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3861,3 +3861,42 @@ fn main() {
"#]],
);
}

#[test]
fn regression_19196() {
check_infer(
r#"
//- minicore: async_fn
fn async_closure<F: AsyncFnOnce(i32)>(f: F) {}
fn closure<F: FnOnce(i32)>(f: F) {}

fn main() {
async_closure(async |arg| {
arg;
});
closure(|arg| {
arg;
});
}
"#,
expect![[r#"
38..39 'f': F
44..46 '{}': ()
74..75 'f': F
80..82 '{}': ()
94..191 '{ ... }); }': ()
100..113 'async_closure': fn async_closure<impl AsyncFnOnce(i32) -> impl Future<Output = ()>>(impl AsyncFnOnce(i32) -> impl Future<Output = ()>)
100..147 'async_... })': ()
114..146 'async ... }': impl AsyncFnOnce(i32) -> impl Future<Output = ()>
121..124 'arg': i32
126..146 '{ ... }': ()
136..139 'arg': i32
153..160 'closure': fn closure<impl FnOnce(i32)>(impl FnOnce(i32))
153..188 'closur... })': ()
161..187 '|arg| ... }': impl FnOnce(i32)
162..165 'arg': i32
167..187 '{ ... }': ()
177..180 'arg': i32
"#]],
);
}
4 changes: 2 additions & 2 deletions docs/book/src/assists_generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ pub use foo::{Bar, Baz};


### `expand_record_rest_pattern`
**Source:** [expand_rest_pattern.rs](https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/expand_rest_pattern.rs#L24)
**Source:** [expand_rest_pattern.rs](https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/expand_rest_pattern.rs#L26)

Fills fields by replacing rest pattern in record patterns.

Expand All @@ -1094,7 +1094,7 @@ fn foo(bar: Bar) {


### `expand_tuple_struct_rest_pattern`
**Source:** [expand_rest_pattern.rs](https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/expand_rest_pattern.rs#L80)
**Source:** [expand_rest_pattern.rs](https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/expand_rest_pattern.rs#L82)

Fills fields by replacing rest pattern in tuple struct patterns.

Expand Down
Loading