Update to 1.68.0

This commit is contained in:
wk333 2023-03-22 14:39:22 +08:00
parent 628142f04f
commit 6662f21a90
2 changed files with 8 additions and 63 deletions

View File

@ -1,55 +0,0 @@
From ecf812777a260e35ec9cd0c7d9dbd17a3f5cf5f9 Mon Sep 17 00:00:00 2001
From: Arpad Borsos <swatinem@swatinem.de>
Date: Tue, 29 Nov 2022 23:17:08 +0100
Subject: [PATCH] Fix Async Generator ABI
This change was missed when making async generators implement `Future` directly.
It did not cause any problems in codegen so far, as `GeneratorState<(), Output>`
happens to have the same ABI as `Poll<Output>`.
---
compiler/rustc_ty_utils/src/abi.rs | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs
index 73c7eb6992f0..d644cbccea11 100644
--- a/compiler/rustc_ty_utils/src/abi.rs
+++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -85,7 +85,7 @@ fn fn_sig_for_fn_abi<'tcx>(
bound_vars,
)
}
- ty::Generator(_, substs, _) => {
+ ty::Generator(did, substs, _) => {
let sig = substs.as_generator().poly_sig();
let bound_vars = tcx.mk_bound_variable_kinds(
@@ -104,10 +104,22 @@ fn fn_sig_for_fn_abi<'tcx>(
let env_ty = tcx.mk_adt(pin_adt_ref, pin_substs);
let sig = sig.skip_binder();
- let state_did = tcx.require_lang_item(LangItem::GeneratorState, None);
- let state_adt_ref = tcx.adt_def(state_did);
- let state_substs = tcx.intern_substs(&[sig.yield_ty.into(), sig.return_ty.into()]);
- let ret_ty = tcx.mk_adt(state_adt_ref, state_substs);
+ // The `FnSig` and the `ret_ty` here is for a generators main
+ // `Generator::resume(...) -> GeneratorState` function in case we
+ // have an ordinary generator, or the `Future::poll(...) -> Poll`
+ // function in case this is a special generator backing an async construct.
+ let ret_ty = if tcx.generator_is_async(did) {
+ let state_did = tcx.require_lang_item(LangItem::Poll, None);
+ let state_adt_ref = tcx.adt_def(state_did);
+ let state_substs = tcx.intern_substs(&[sig.return_ty.into()]);
+ tcx.mk_adt(state_adt_ref, state_substs)
+ } else {
+ let state_did = tcx.require_lang_item(LangItem::GeneratorState, None);
+ let state_adt_ref = tcx.adt_def(state_did);
+ let state_substs = tcx.intern_substs(&[sig.yield_ty.into(), sig.return_ty.into()]);
+ tcx.mk_adt(state_adt_ref, state_substs)
+ };
+
ty::Binder::bind_with_vars(
tcx.mk_fn_sig(
[env_ty, sig.resume_ty].iter(),
--
2.39.1

View File

@ -1,7 +1,7 @@
%global bootstrap_rust 1.66.0
%global bootstrap_cargo 1.66.0
%global bootstrap_channel 1.66.0
%global bootstrap_date 2022-12-15
%global bootstrap_rust 1.67.1
%global bootstrap_cargo 1.67.1
%global bootstrap_channel 1.67.1
%global bootstrap_date 2023-02-09
%bcond_with llvm_static
%bcond_with bundled_llvm
%bcond_without bundled_libgit2
@ -9,7 +9,7 @@
%bcond_without curl_http2
%bcond_without lldb
Name: rust
Version: 1.67.1
Version: 1.68.0
Release: 1
Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and MIT)
@ -26,8 +26,6 @@ Patch0005: compile-with-llvm-15.patch
Patch0006: 0001-Use-lld-provided-by-system-for-wasm.patch
# Set a substitute-path in rust-gdb for standard library sources.
Patch0007: rustc-1.61.0-rust-gdb-substitute-path.patch
# https://github.com/rust-lang/rust/pull/105082
Patch0008: 0001-Fix-Async-Generator-ABI.patch
%{lua: function rust_triple(arch)
local abi = "gnu"
@ -249,7 +247,6 @@ sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
rm -rf vendor/curl-sys/curl/
rm -rf vendor/jemalloc-sys/jemalloc/
rm -rf vendor/libssh2-sys/libssh2/
@ -463,6 +460,9 @@ export %{rust_env}
%{_mandir}/man1/cargo*.1*
%changelog
* Wed Mar 22 2023 wangkai <wangkai385@h-partners.com> - 1.68.0-1
- Update to 1.68.0
* Tue Feb 28 2023 wangkai <wangkai385@h-partners.com> - 1.67.1-1
- Update to 1.67.1