mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Auto merge of #16630 - ShoyuVanilla:fix-closure-kind-inference, r=Veykril
fix: Wrong closure kind deduction for closures with predicates Completes #16472, fixes #16421 The changed closure kind deduction is mostly simlar to `rustc_hir_typeck/src/closure.rs`. Porting closure sig deduction from it seems possible too and I'm considering doing it with another PR
This commit is contained in:
commit
a3236be9d7
8 changed files with 269 additions and 36 deletions
|
@ -218,6 +218,15 @@ impl FnTrait {
|
|||
}
|
||||
}
|
||||
|
||||
pub const fn from_lang_item(lang_item: LangItem) -> Option<Self> {
|
||||
match lang_item {
|
||||
LangItem::FnOnce => Some(FnTrait::FnOnce),
|
||||
LangItem::FnMut => Some(FnTrait::FnMut),
|
||||
LangItem::Fn => Some(FnTrait::Fn),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn to_chalk_ir(self) -> rust_ir::ClosureKind {
|
||||
match self {
|
||||
FnTrait::FnOnce => rust_ir::ClosureKind::FnOnce,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue