Unnamed repository; edit this file 'description' to name the repository.
Merge ref 'e22c616e4e87' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@e22c616e4e87914135c1db261a03e0437255335e Filtered ref: rust-lang/rust-analyzer@37dc6b74ba22080895add3d0e9b22f9eacfb19d0 Upstream diff: https://github.com/rust-lang/rust/compare/e8e4541ff19649d95afab52fdde2c2eaa6829965...e22c616e4e87914135c1db261a03e0437255335e This merge was created using https://github.com/rust-lang/josh-sync.
Laurențiu Nicola 4 weeks ago
parent 0b9ec9a · parent 37dc6b7 · commit 23edabb
-rw-r--r--crates/hir-ty/src/infer/closure.rs18
-rw-r--r--crates/hir-ty/src/next_solver/interner.rs16
2 files changed, 20 insertions, 14 deletions
diff --git a/crates/hir-ty/src/infer/closure.rs b/crates/hir-ty/src/infer/closure.rs
index bebf39b694..40b90bec9c 100644
--- a/crates/hir-ty/src/infer/closure.rs
+++ b/crates/hir-ty/src/infer/closure.rs
@@ -588,13 +588,8 @@ impl<'db> InferenceContext<'_, 'db> {
let ret_param_ty = projection.skip_binder().term.expect_type();
debug!(?ret_param_ty);
- let sig = projection.rebind(self.interner().mk_fn_sig(
- input_tys,
- ret_param_ty,
- false,
- Safety::Safe,
- FnAbi::Rust,
- ));
+ let sig =
+ projection.rebind(self.interner().mk_fn_sig_safe_rust_abi(input_tys, ret_param_ty));
Some(sig)
}
@@ -676,13 +671,8 @@ impl<'db> InferenceContext<'_, 'db> {
// that does not misuse a `FnSig` type, but that can be done separately.
let return_ty = return_ty.unwrap_or_else(|| self.table.next_ty_var());
- let sig = projection.rebind(self.interner().mk_fn_sig(
- input_tys,
- return_ty,
- false,
- Safety::Safe,
- FnAbi::Rust,
- ));
+ let sig =
+ projection.rebind(self.interner().mk_fn_sig_safe_rust_abi(input_tys, return_ty));
Some(sig)
}
diff --git a/crates/hir-ty/src/next_solver/interner.rs b/crates/hir-ty/src/next_solver/interner.rs
index 9ad1b3b712..229e520972 100644
--- a/crates/hir-ty/src/next_solver/interner.rs
+++ b/crates/hir-ty/src/next_solver/interner.rs
@@ -2360,6 +2360,22 @@ impl<'db> DbInterner<'db> {
abi,
}
}
+
+ /// `mk_fn_sig`, but with a safe Rust ABI, and no C-variadic argument.
+ pub fn mk_fn_sig_safe_rust_abi<I>(self, inputs: I, output: Ty<'db>) -> FnSig<'db>
+ where
+ I: IntoIterator<Item = Ty<'db>>,
+ {
+ FnSig {
+ inputs_and_output: Tys::new_from_iter(
+ self,
+ inputs.into_iter().chain(std::iter::once(output)),
+ ),
+ c_variadic: false,
+ safety: Safety::Safe,
+ abi: FnAbi::Rust,
+ }
+ }
}
fn predicates_of(db: &dyn HirDatabase, def_id: SolverDefId) -> &GenericPredicates {