Skip to content

Commit 81a964c

Browse files
committed
Auto merge of #142033 - matthiaskrgr:rollup-99lvg0j, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #141890 (Add link to correct documentation in htmldocck.py) - #141932 (Fix for async drop inside async gen fn) - #141960 (Use non-2015 edition paths in tests that do not test for their resolution) - #141968 (Run wfcheck in one big loop instead of per module) - #141969 (Triagebot: Remove `assign.users_on_vacation`) - #141985 (Ensure query keys are printed with reduced queries) - #141999 (Visit the ident in `PreciseCapturingNonLifetimeArg`.) - #142005 (Change `tag_field` to `FieldIdx` in `Variants::Multiple`) - #142017 (Fix incorrect use of "recommend" over "recommended") - #142024 (Don't refer to 'this tail expression' in expansion.) - #142025 (Don't refer to 'local binding' in extern macro.) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ff223d3 + 4959ee3 commit 81a964c

File tree

97 files changed

+478
-534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+478
-534
lines changed

compiler/rustc_abi/src/layout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
758758
niche_variants,
759759
niche_start,
760760
},
761-
tag_field: 0,
761+
tag_field: FieldIdx::new(0),
762762
variants: IndexVec::new(),
763763
},
764764
fields: FieldsShape::Arbitrary {
@@ -1072,7 +1072,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
10721072
variants: Variants::Multiple {
10731073
tag,
10741074
tag_encoding: TagEncoding::Direct,
1075-
tag_field: 0,
1075+
tag_field: FieldIdx::new(0),
10761076
variants: IndexVec::new(),
10771077
},
10781078
fields: FieldsShape::Arbitrary {

compiler/rustc_abi/src/layout/coroutine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub(super) fn layout<
158158
// Build a prefix layout, including "promoting" all ineligible
159159
// locals as part of the prefix. We compute the layout of all of
160160
// these fields at once to get optimal packing.
161-
let tag_index = prefix_layouts.len();
161+
let tag_index = prefix_layouts.next_index();
162162

163163
// `variant_fields` already accounts for the reserved variants, so no need to add them.
164164
let max_discr = (variant_fields.len() - 1) as u128;
@@ -187,7 +187,7 @@ pub(super) fn layout<
187187

188188
// "a" (`0..b_start`) and "b" (`b_start..`) correspond to
189189
// "outer" and "promoted" fields respectively.
190-
let b_start = FieldIdx::new(tag_index + 1);
190+
let b_start = tag_index.plus(1);
191191
let offsets_b = IndexVec::from_raw(offsets.raw.split_off(b_start.index()));
192192
let offsets_a = offsets;
193193

compiler/rustc_abi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> {
15731573
Multiple {
15741574
tag: Scalar,
15751575
tag_encoding: TagEncoding<VariantIdx>,
1576-
tag_field: usize,
1576+
tag_field: FieldIdx,
15771577
variants: IndexVec<VariantIdx, LayoutData<FieldIdx, VariantIdx>>,
15781578
},
15791579
}

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3314,7 +3314,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
33143314
"function parameter".to_string(),
33153315
"function parameter borrowed here".to_string(),
33163316
),
3317-
LocalKind::Temp if self.body.local_decls[local].is_user_variable() => {
3317+
LocalKind::Temp
3318+
if self.body.local_decls[local].is_user_variable()
3319+
&& !self.body.local_decls[local]
3320+
.source_info
3321+
.span
3322+
.in_external_macro(self.infcx.tcx.sess.source_map()) =>
3323+
{
33183324
("local binding".to_string(), "local binding introduced here".to_string())
33193325
}
33203326
LocalKind::ReturnPointer | LocalKind::Temp => {

compiler/rustc_codegen_cranelift/src/discriminant.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
2828
tag_encoding: TagEncoding::Direct,
2929
variants: _,
3030
} => {
31-
let ptr = place.place_field(fx, FieldIdx::new(tag_field));
31+
let ptr = place.place_field(fx, tag_field);
3232
let to = layout.ty.discriminant_for_variant(fx.tcx, variant_index).unwrap().val;
3333
let to = match ptr.layout().ty.kind() {
3434
ty::Uint(UintTy::U128) | ty::Int(IntTy::I128) => {
@@ -53,7 +53,7 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
5353
variants: _,
5454
} => {
5555
if variant_index != untagged_variant {
56-
let niche = place.place_field(fx, FieldIdx::new(tag_field));
56+
let niche = place.place_field(fx, tag_field);
5757
let niche_type = fx.clif_type(niche.layout().ty).unwrap();
5858
let niche_value = variant_index.as_u32() - niche_variants.start().as_u32();
5959
let niche_value = (niche_value as u128).wrapping_add(niche_start);
@@ -118,7 +118,7 @@ pub(crate) fn codegen_get_discriminant<'tcx>(
118118
let cast_to = fx.clif_type(dest_layout.ty).unwrap();
119119

120120
// Read the tag/niche-encoded discriminant from memory.
121-
let tag = value.value_field(fx, FieldIdx::new(tag_field));
121+
let tag = value.value_field(fx, tag_field);
122122
let tag = tag.load_scalar(fx);
123123

124124
// Decode the discriminant (specifically if it's niche-encoded).

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22

33
use libc::c_uint;
4-
use rustc_abi::{Align, Endian, Size, TagEncoding, VariantIdx, Variants};
4+
use rustc_abi::{Align, Endian, FieldIdx, Size, TagEncoding, VariantIdx, Variants};
55
use rustc_codegen_ssa::debuginfo::type_names::compute_debuginfo_type_name;
66
use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo};
77
use rustc_codegen_ssa::traits::{ConstCodegenMethods, MiscCodegenMethods};
@@ -401,7 +401,7 @@ fn build_union_fields_for_enum<'ll, 'tcx>(
401401
enum_type_and_layout: TyAndLayout<'tcx>,
402402
enum_type_di_node: &'ll DIType,
403403
variant_indices: impl Iterator<Item = VariantIdx> + Clone,
404-
tag_field: usize,
404+
tag_field: FieldIdx,
405405
untagged_variant_index: Option<VariantIdx>,
406406
) -> SmallVec<&'ll DIType> {
407407
let tag_base_type = tag_base_type(cx.tcx, enum_type_and_layout);
@@ -805,7 +805,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
805805
variant_field_infos: &[VariantFieldInfo<'ll>],
806806
discr_type_di_node: &'ll DIType,
807807
tag_base_type: Ty<'tcx>,
808-
tag_field: usize,
808+
tag_field: FieldIdx,
809809
untagged_variant_index: Option<VariantIdx>,
810810
di_flags: DIFlags,
811811
) -> SmallVec<&'ll DIType> {
@@ -858,7 +858,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
858858
}));
859859

860860
assert_eq!(
861-
cx.size_and_align_of(enum_type_and_layout.field(cx, tag_field).ty),
861+
cx.size_and_align_of(enum_type_and_layout.field(cx, tag_field.as_usize()).ty),
862862
cx.size_and_align_of(self::tag_base_type(cx.tcx, enum_type_and_layout))
863863
);
864864

@@ -875,7 +875,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
875875
Endian::Big => (8, 0),
876876
};
877877

878-
let tag_field_offset = enum_type_and_layout.fields.offset(tag_field).bytes();
878+
let tag_field_offset = enum_type_and_layout.fields.offset(tag_field.as_usize()).bytes();
879879
let lo_offset = Size::from_bytes(tag_field_offset + lo_offset);
880880
let hi_offset = Size::from_bytes(tag_field_offset + hi_offset);
881881

@@ -905,8 +905,8 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
905905
cx,
906906
enum_type_di_node,
907907
TAG_FIELD_NAME,
908-
enum_type_and_layout.field(cx, tag_field),
909-
enum_type_and_layout.fields.offset(tag_field),
908+
enum_type_and_layout.field(cx, tag_field.as_usize()),
909+
enum_type_and_layout.fields.offset(tag_field.as_usize()),
910910
di_flags,
911911
tag_base_type_di_node,
912912
None,

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ fn build_discr_member_di_node<'ll, 'tcx>(
373373
file,
374374
UNKNOWN_LINE_NUMBER,
375375
layout,
376-
enum_or_coroutine_type_and_layout.fields.offset(tag_field),
376+
enum_or_coroutine_type_and_layout.fields.offset(tag_field.as_usize()),
377377
DIFlags::FlagArtificial,
378378
ty,
379379
))

compiler/rustc_codegen_ssa/src/mir/operand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,10 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
462462
let tag_op = match self.val {
463463
OperandValue::ZeroSized => bug!(),
464464
OperandValue::Immediate(_) | OperandValue::Pair(_, _) => {
465-
self.extract_field(fx, bx, tag_field)
465+
self.extract_field(fx, bx, tag_field.as_usize())
466466
}
467467
OperandValue::Ref(place) => {
468-
let tag = place.with_type(self.layout).project_field(bx, tag_field);
468+
let tag = place.with_type(self.layout).project_field(bx, tag_field.as_usize());
469469
bx.load_operand(tag)
470470
}
471471
};

compiler/rustc_codegen_ssa/src/mir/place.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
250250
Variants::Single { index } => assert_eq!(index, variant_index),
251251

252252
Variants::Multiple { tag_encoding: TagEncoding::Direct, tag_field, .. } => {
253-
let ptr = self.project_field(bx, tag_field);
253+
let ptr = self.project_field(bx, tag_field.as_usize());
254254
let to =
255255
self.layout.ty.discriminant_for_variant(bx.tcx(), variant_index).unwrap().val;
256256
bx.store_to_place(
@@ -265,7 +265,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
265265
..
266266
} => {
267267
if variant_index != untagged_variant {
268-
let niche = self.project_field(bx, tag_field);
268+
let niche = self.project_field(bx, tag_field.as_usize());
269269
let niche_llty = bx.cx().immediate_backend_type(niche.layout);
270270
let BackendRepr::Scalar(scalar) = niche.layout.backend_repr else {
271271
bug!("expected a scalar placeref for the niche");

compiler/rustc_const_eval/src/interpret/discriminant.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Functions for reading and writing discriminants of multi-variant layouts (enums and coroutines).
22
3-
use rustc_abi::{self as abi, TagEncoding, VariantIdx, Variants};
3+
use rustc_abi::{self as abi, FieldIdx, TagEncoding, VariantIdx, Variants};
44
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt, TyAndLayout};
55
use rustc_middle::ty::{self, CoroutineArgsExt, ScalarInt, Ty};
66
use rustc_middle::{mir, span_bug};
@@ -26,7 +26,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
2626
// No need to validate that the discriminant here because the
2727
// `TyAndLayout::for_variant()` call earlier already checks the
2828
// variant is valid.
29-
let tag_dest = self.project_field(dest, tag_field)?;
29+
let tag_dest = self.project_field(dest, tag_field.as_usize())?;
3030
self.write_scalar(tag, &tag_dest)
3131
}
3232
None => {
@@ -96,7 +96,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
9696
let tag_layout = self.layout_of(tag_scalar_layout.primitive().to_int_ty(*self.tcx))?;
9797

9898
// Read tag and sanity-check `tag_layout`.
99-
let tag_val = self.read_immediate(&self.project_field(op, tag_field)?)?;
99+
let tag_val = self.read_immediate(&self.project_field(op, tag_field.as_usize())?)?;
100100
assert_eq!(tag_layout.size, tag_val.layout.size);
101101
assert_eq!(tag_layout.backend_repr.is_signed(), tag_val.layout.backend_repr.is_signed());
102102
trace!("tag value: {}", tag_val);
@@ -231,7 +231,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
231231
&self,
232232
layout: TyAndLayout<'tcx>,
233233
variant_index: VariantIdx,
234-
) -> InterpResult<'tcx, Option<(ScalarInt, usize)>> {
234+
) -> InterpResult<'tcx, Option<(ScalarInt, FieldIdx)>> {
235235
// Layout computation excludes uninhabited variants from consideration.
236236
// Therefore, there's no way to represent those variants in the given layout.
237237
// Essentially, uninhabited variants do not have a tag that corresponds to their

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
294294
// First, check if we are projecting to a variant.
295295
match layout.variants {
296296
Variants::Multiple { tag_field, .. } => {
297-
if tag_field == field {
297+
if tag_field.as_usize() == field {
298298
return match layout.ty.kind() {
299299
ty::Adt(def, ..) if def.is_enum() => PathElem::EnumTag,
300300
ty::Coroutine(..) => PathElem::CoroutineTag,

compiler/rustc_hir/src/intravisit.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,8 +1332,9 @@ pub fn walk_precise_capturing_arg<'v, V: Visitor<'v>>(
13321332
match *arg {
13331333
PreciseCapturingArg::Lifetime(lt) => visitor.visit_lifetime(lt),
13341334
PreciseCapturingArg::Param(param) => {
1335-
let PreciseCapturingNonLifetimeArg { hir_id, ident: _, res: _ } = param;
1336-
visitor.visit_id(hir_id)
1335+
let PreciseCapturingNonLifetimeArg { hir_id, ident, res: _ } = param;
1336+
try_visit!(visitor.visit_id(hir_id));
1337+
visitor.visit_ident(ident)
13371338
}
13381339
}
13391340
}

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
77
use rustc_errors::codes::*;
88
use rustc_errors::{Applicability, ErrorGuaranteed, pluralize, struct_span_code_err};
99
use rustc_hir::def::{DefKind, Res};
10-
use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
10+
use rustc_hir::def_id::{DefId, LocalDefId};
1111
use rustc_hir::lang_items::LangItem;
1212
use rustc_hir::{AmbigArg, ItemKind};
1313
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
@@ -2402,8 +2402,8 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
24022402
}
24032403
}
24042404

2405-
fn check_mod_type_wf(tcx: TyCtxt<'_>, module: LocalModDefId) -> Result<(), ErrorGuaranteed> {
2406-
let items = tcx.hir_module_items(module);
2405+
fn check_type_wf(tcx: TyCtxt<'_>, (): ()) -> Result<(), ErrorGuaranteed> {
2406+
let items = tcx.hir_crate_items(());
24072407
let res = items
24082408
.par_items(|item| tcx.ensure_ok().check_well_formed(item.owner_id.def_id))
24092409
.and(items.par_impl_items(|item| tcx.ensure_ok().check_well_formed(item.owner_id.def_id)))
@@ -2412,9 +2412,8 @@ fn check_mod_type_wf(tcx: TyCtxt<'_>, module: LocalModDefId) -> Result<(), Error
24122412
items.par_foreign_items(|item| tcx.ensure_ok().check_well_formed(item.owner_id.def_id)),
24132413
)
24142414
.and(items.par_opaques(|item| tcx.ensure_ok().check_well_formed(item)));
2415-
if module == LocalModDefId::CRATE_DEF_ID {
2416-
super::entry::check_for_entry_fn(tcx);
2417-
}
2415+
super::entry::check_for_entry_fn(tcx);
2416+
24182417
res
24192418
}
24202419

@@ -2552,5 +2551,5 @@ struct RedundantLifetimeArgsLint<'tcx> {
25522551
}
25532552

25542553
pub fn provide(providers: &mut Providers) {
2555-
*providers = Providers { check_mod_type_wf, check_well_formed, ..*providers };
2554+
*providers = Providers { check_type_wf, check_well_formed, ..*providers };
25562555
}

compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
182182
// what we are intending to discard, to help future type-based refactoring.
183183
type R = Result<(), ErrorGuaranteed>;
184184

185-
tcx.par_hir_for_each_module(|module| {
186-
let _: R = tcx.ensure_ok().check_mod_type_wf(module);
187-
});
185+
let _: R = tcx.ensure_ok().check_type_wf(());
188186

189187
for &trait_def_id in tcx.all_local_trait_impls(()).keys() {
190188
let _: R = tcx.ensure_ok().coherent_trait(trait_def_id);

compiler/rustc_middle/src/dep_graph/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use rustc_data_structures::profiling::SelfProfilerRef;
22
use rustc_query_system::ich::StableHashingContext;
33
use rustc_session::Session;
44

5+
use crate::ty::print::with_reduced_queries;
56
use crate::ty::{self, TyCtxt};
67

78
#[macro_use]
@@ -84,4 +85,8 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
8485
fn dep_kind_info(&self, dk: DepKind) -> &DepKindStruct<'tcx> {
8586
&self.query_kinds[dk.as_usize()]
8687
}
88+
89+
fn with_reduced_queries<T>(self, f: impl FnOnce() -> T) -> T {
90+
with_reduced_queries!(f())
91+
}
8792
}

compiler/rustc_middle/src/query/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,8 +1148,8 @@ rustc_queries! {
11481148
desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) }
11491149
}
11501150

1151-
query check_mod_type_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> {
1152-
desc { |tcx| "checking that types are well-formed in {}", describe_as_module(key, tcx) }
1151+
query check_type_wf(key: ()) -> Result<(), ErrorGuaranteed> {
1152+
desc { "checking that types are well-formed" }
11531153
return_result_from_ensure_ok
11541154
}
11551155

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ where
934934
.unwrap(),
935935
),
936936
Variants::Multiple { tag, tag_field, .. } => {
937-
if i == tag_field {
937+
if FieldIdx::from_usize(i) == tag_field {
938938
return TyMaybeWithLayout::TyAndLayout(tag_layout(tag));
939939
}
940940
TyMaybeWithLayout::Ty(args.as_coroutine().prefix_tys()[i])
@@ -1060,8 +1060,10 @@ where
10601060
tag_field,
10611061
variants,
10621062
..
1063-
} if variants.len() == 2 && this.fields.offset(*tag_field) == offset => {
1064-
let tagged_variant = if untagged_variant.as_u32() == 0 {
1063+
} if variants.len() == 2
1064+
&& this.fields.offset(tag_field.as_usize()) == offset =>
1065+
{
1066+
let tagged_variant = if *untagged_variant == VariantIdx::ZERO {
10651067
VariantIdx::from_u32(1)
10661068
} else {
10671069
VariantIdx::from_u32(0)

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
18861886
) -> Result<(), PrintError> {
18871887
define_scoped_cx!(self);
18881888

1889-
if self.should_print_verbose() {
1889+
if with_reduced_queries() || self.should_print_verbose() {
18901890
p!(write("ValTree({:?}: ", cv.valtree), print(cv.ty), ")");
18911891
return Ok(());
18921892
}

compiler/rustc_mir_transform/src/coroutine/drop.rs

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,34 @@ pub(super) fn expand_async_drops<'tcx>(
382382
dropline_call_bb = Some(drop_call_bb);
383383
}
384384

385-
// value needed only for return-yields or gen-coroutines, so just const here
386-
let value = Operand::Constant(Box::new(ConstOperand {
387-
span: body.span,
388-
user_ty: None,
389-
const_: Const::from_bool(tcx, false),
390-
}));
385+
let value =
386+
if matches!(coroutine_kind, CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, _))
387+
{
388+
// For AsyncGen we need `yield Poll<OptRet>::Pending`
389+
let full_yield_ty = body.yield_ty().unwrap();
390+
let ty::Adt(_poll_adt, args) = *full_yield_ty.kind() else { bug!() };
391+
let ty::Adt(_option_adt, args) = *args.type_at(0).kind() else { bug!() };
392+
let yield_ty = args.type_at(0);
393+
Operand::Constant(Box::new(ConstOperand {
394+
span: source_info.span,
395+
const_: Const::Unevaluated(
396+
UnevaluatedConst::new(
397+
tcx.require_lang_item(LangItem::AsyncGenPending, None),
398+
tcx.mk_args(&[yield_ty.into()]),
399+
),
400+
full_yield_ty,
401+
),
402+
user_ty: None,
403+
}))
404+
} else {
405+
// value needed only for return-yields or gen-coroutines, so just const here
406+
Operand::Constant(Box::new(ConstOperand {
407+
span: body.span,
408+
user_ty: None,
409+
const_: Const::from_bool(tcx, false),
410+
}))
411+
};
412+
391413
use rustc_middle::mir::AssertKind::ResumedAfterDrop;
392414
let panic_bb = insert_panic_block(tcx, body, ResumedAfterDrop(coroutine_kind));
393415

0 commit comments

Comments
 (0)