Skip to content

Commit 23edabb

Browse files
committed
Merge ref 'e22c616e4e87' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@e22c616 Filtered ref: 37dc6b7 Upstream diff: rust-lang/rust@e8e4541...e22c616 This merge was created using https://github.com/rust-lang/josh-sync.
2 parents 0b9ec9a + 37dc6b7 commit 23edabb

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

crates/hir-ty/src/infer/closure.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,8 @@ impl<'db> InferenceContext<'_, 'db> {
588588
let ret_param_ty = projection.skip_binder().term.expect_type();
589589
debug!(?ret_param_ty);
590590

591-
let sig = projection.rebind(self.interner().mk_fn_sig(
592-
input_tys,
593-
ret_param_ty,
594-
false,
595-
Safety::Safe,
596-
FnAbi::Rust,
597-
));
591+
let sig =
592+
projection.rebind(self.interner().mk_fn_sig_safe_rust_abi(input_tys, ret_param_ty));
598593

599594
Some(sig)
600595
}
@@ -676,13 +671,8 @@ impl<'db> InferenceContext<'_, 'db> {
676671
// that does not misuse a `FnSig` type, but that can be done separately.
677672
let return_ty = return_ty.unwrap_or_else(|| self.table.next_ty_var());
678673

679-
let sig = projection.rebind(self.interner().mk_fn_sig(
680-
input_tys,
681-
return_ty,
682-
false,
683-
Safety::Safe,
684-
FnAbi::Rust,
685-
));
674+
let sig =
675+
projection.rebind(self.interner().mk_fn_sig_safe_rust_abi(input_tys, return_ty));
686676

687677
Some(sig)
688678
}

crates/hir-ty/src/next_solver/interner.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,6 +2360,22 @@ impl<'db> DbInterner<'db> {
23602360
abi,
23612361
}
23622362
}
2363+
2364+
/// `mk_fn_sig`, but with a safe Rust ABI, and no C-variadic argument.
2365+
pub fn mk_fn_sig_safe_rust_abi<I>(self, inputs: I, output: Ty<'db>) -> FnSig<'db>
2366+
where
2367+
I: IntoIterator<Item = Ty<'db>>,
2368+
{
2369+
FnSig {
2370+
inputs_and_output: Tys::new_from_iter(
2371+
self,
2372+
inputs.into_iter().chain(std::iter::once(output)),
2373+
),
2374+
c_variadic: false,
2375+
safety: Safety::Safe,
2376+
abi: FnAbi::Rust,
2377+
}
2378+
}
23632379
}
23642380

23652381
fn predicates_of(db: &dyn HirDatabase, def_id: SolverDefId) -> &GenericPredicates {

0 commit comments

Comments
 (0)