Skip to content

Commit 00bbfb3

Browse files
committed
Bump chalk for built-in supports of async closures
1 parent 62dea27 commit 00bbfb3

File tree

5 files changed

+61
-14
lines changed

5 files changed

+61
-14
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ arrayvec = "0.7.4"
105105
bitflags = "2.4.1"
106106
cargo_metadata = "0.18.1"
107107
camino = "1.1.6"
108-
chalk-solve = { version = "0.99.0", default-features = false }
109-
chalk-ir = "0.99.0"
110-
chalk-recursive = { version = "0.99.0", default-features = false }
111-
chalk-derive = "0.99.0"
108+
chalk-solve = { version = "0.100.0", default-features = false }
109+
chalk-ir = "0.100.0"
110+
chalk-recursive = { version = "0.100.0", default-features = false }
111+
chalk-derive = "0.100.0"
112112
crossbeam-channel = "0.5.8"
113113
dissimilar = "1.0.7"
114114
dot = "0.1.4"

crates/hir-ty/src/chalk_db.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,13 +708,17 @@ fn well_known_trait_from_lang_item(item: LangItem) -> Option<WellKnownTrait> {
708708
LangItem::Fn => WellKnownTrait::Fn,
709709
LangItem::FnMut => WellKnownTrait::FnMut,
710710
LangItem::FnOnce => WellKnownTrait::FnOnce,
711+
LangItem::AsyncFn => WellKnownTrait::AsyncFn,
712+
LangItem::AsyncFnMut => WellKnownTrait::AsyncFnMut,
713+
LangItem::AsyncFnOnce => WellKnownTrait::AsyncFnOnce,
711714
LangItem::Coroutine => WellKnownTrait::Coroutine,
712715
LangItem::Sized => WellKnownTrait::Sized,
713716
LangItem::Unpin => WellKnownTrait::Unpin,
714717
LangItem::Unsize => WellKnownTrait::Unsize,
715718
LangItem::Tuple => WellKnownTrait::Tuple,
716719
LangItem::PointeeTrait => WellKnownTrait::Pointee,
717720
LangItem::FnPtrTrait => WellKnownTrait::FnPtr,
721+
LangItem::Future => WellKnownTrait::Future,
718722
_ => return None,
719723
})
720724
}
@@ -730,13 +734,17 @@ fn lang_item_from_well_known_trait(trait_: WellKnownTrait) -> LangItem {
730734
WellKnownTrait::Fn => LangItem::Fn,
731735
WellKnownTrait::FnMut => LangItem::FnMut,
732736
WellKnownTrait::FnOnce => LangItem::FnOnce,
737+
WellKnownTrait::AsyncFn => LangItem::AsyncFn,
738+
WellKnownTrait::AsyncFnMut => LangItem::AsyncFnMut,
739+
WellKnownTrait::AsyncFnOnce => LangItem::AsyncFnOnce,
733740
WellKnownTrait::Coroutine => LangItem::Coroutine,
734741
WellKnownTrait::Sized => LangItem::Sized,
735742
WellKnownTrait::Tuple => LangItem::Tuple,
736743
WellKnownTrait::Unpin => LangItem::Unpin,
737744
WellKnownTrait::Unsize => LangItem::Unsize,
738745
WellKnownTrait::Pointee => LangItem::PointeeTrait,
739746
WellKnownTrait::FnPtr => LangItem::FnPtrTrait,
747+
WellKnownTrait::Future => LangItem::Future,
740748
}
741749
}
742750

crates/hir-ty/src/tests/simple.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3861,3 +3861,42 @@ fn main() {
38613861
"#]],
38623862
);
38633863
}
3864+
3865+
#[test]
3866+
fn regression_19196() {
3867+
check_infer(
3868+
r#"
3869+
//- minicore: async_fn
3870+
fn async_closure<F: AsyncFnOnce(i32)>(f: F) {}
3871+
fn closure<F: FnOnce(i32)>(f: F) {}
3872+
3873+
fn main() {
3874+
async_closure(async |arg| {
3875+
arg;
3876+
});
3877+
closure(|arg| {
3878+
arg;
3879+
});
3880+
}
3881+
"#,
3882+
expect![[r#"
3883+
38..39 'f': F
3884+
44..46 '{}': ()
3885+
74..75 'f': F
3886+
80..82 '{}': ()
3887+
94..191 '{ ... }); }': ()
3888+
100..113 'async_closure': fn async_closure<impl AsyncFnOnce(i32) -> impl Future<Output = ()>>(impl AsyncFnOnce(i32) -> impl Future<Output = ()>)
3889+
100..147 'async_... })': ()
3890+
114..146 'async ... }': impl AsyncFnOnce(i32) -> impl Future<Output = ()>
3891+
121..124 'arg': i32
3892+
126..146 '{ ... }': ()
3893+
136..139 'arg': i32
3894+
153..160 'closure': fn closure<impl FnOnce(i32)>(impl FnOnce(i32))
3895+
153..188 'closur... })': ()
3896+
161..187 '|arg| ... }': impl FnOnce(i32)
3897+
162..165 'arg': i32
3898+
167..187 '{ ... }': ()
3899+
177..180 'arg': i32
3900+
"#]],
3901+
);
3902+
}

docs/book/src/assists_generated.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ pub use foo::{Bar, Baz};
10701070

10711071

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

10751075
Fills fields by replacing rest pattern in record patterns.
10761076

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

10951095

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

10991099
Fills fields by replacing rest pattern in tuple struct patterns.
11001100

0 commit comments

Comments
 (0)