Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 3bb0171

Browse files
committedNov 26, 2023
Auto merge of rust-lang#118319 - GuillaumeGomez:rollup-vte50yq, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - rust-lang#118296 (rustdoc: replace `elemIsInParent` with `Node.contains`) - rust-lang#118302 (Clean dead codes) - rust-lang#118311 (merge `DefKind::Coroutine` into `Defkind::Closure`) - rust-lang#118318 (Remove myself from users on vacation) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3dbb4da + cb04603 commit 3bb0171

File tree

40 files changed

+99
-376
lines changed

40 files changed

+99
-376
lines changed
 

‎compiler/rustc_ast_lowering/src/index.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
8989
}
9090
}
9191

92-
self.nodes.insert(hir_id.local_id, ParentedNode { parent: self.parent_node, node: node });
92+
self.nodes.insert(hir_id.local_id, ParentedNode { parent: self.parent_node, node });
9393
}
9494

9595
fn with_parent<F: FnOnce(&mut Self)>(&mut self, parent_node_id: HirId, f: F) {

‎compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,8 +2072,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20722072
.map(|name| format!("function `{name}`"))
20732073
.unwrap_or_else(|| {
20742074
match &self.infcx.tcx.def_kind(self.mir_def_id()) {
2075+
DefKind::Closure
2076+
if self
2077+
.infcx
2078+
.tcx
2079+
.is_coroutine(self.mir_def_id().to_def_id()) =>
2080+
{
2081+
"enclosing coroutine"
2082+
}
20752083
DefKind::Closure => "enclosing closure",
2076-
DefKind::Coroutine => "enclosing coroutine",
20772084
kind => bug!("expected closure or coroutine, found {:?}", kind),
20782085
}
20792086
.to_string()

‎compiler/rustc_borrowck/src/type_check/mod.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2678,8 +2678,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
26782678
let typeck_root_args = ty::GenericArgs::identity_for_item(tcx, typeck_root_def_id);
26792679

26802680
let parent_args = match tcx.def_kind(def_id) {
2681+
DefKind::Closure if tcx.is_coroutine(def_id.to_def_id()) => {
2682+
args.as_coroutine().parent_args()
2683+
}
26812684
DefKind::Closure => args.as_closure().parent_args(),
2682-
DefKind::Coroutine => args.as_coroutine().parent_args(),
26832685
DefKind::InlineConst => args.as_inline_const().parent_args(),
26842686
other => bug!("unexpected item {:?}", other),
26852687
};

‎compiler/rustc_borrowck/src/universal_regions.rs‎

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -737,18 +737,6 @@ trait InferCtxtExt<'tcx> {
737737
) -> T
738738
where
739739
T: TypeFoldable<TyCtxt<'tcx>>;
740-
741-
fn instantiate_bound_regions_with_nll_infer_vars_in_recursive_scope(
742-
&self,
743-
mir_def_id: LocalDefId,
744-
indices: &mut UniversalRegionIndices<'tcx>,
745-
);
746-
747-
fn instantiate_bound_regions_with_nll_infer_vars_in_item(
748-
&self,
749-
mir_def_id: LocalDefId,
750-
indices: &mut UniversalRegionIndices<'tcx>,
751-
);
752740
}
753741

754742
impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
@@ -799,54 +787,6 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
799787
});
800788
value
801789
}
802-
803-
/// Finds late-bound regions that do not appear in the parameter listing and adds them to the
804-
/// indices vector. Typically, we identify late-bound regions as we process the inputs and
805-
/// outputs of the closure/function. However, sometimes there are late-bound regions which do
806-
/// not appear in the fn parameters but which are nonetheless in scope. The simplest case of
807-
/// this are unused functions, like fn foo<'a>() { } (see e.g., #51351). Despite not being used,
808-
/// users can still reference these regions (e.g., let x: &'a u32 = &22;), so we need to create
809-
/// entries for them and store them in the indices map. This code iterates over the complete
810-
/// set of late-bound regions and checks for any that we have not yet seen, adding them to the
811-
/// inputs vector.
812-
#[instrument(skip(self, indices))]
813-
fn instantiate_bound_regions_with_nll_infer_vars_in_recursive_scope(
814-
&self,
815-
mir_def_id: LocalDefId,
816-
indices: &mut UniversalRegionIndices<'tcx>,
817-
) {
818-
for_each_late_bound_region_in_recursive_scope(self.tcx, mir_def_id, |r| {
819-
debug!(?r);
820-
if !indices.indices.contains_key(&r) {
821-
let region_vid = {
822-
let name = r.get_name_or_anon();
823-
self.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
824-
};
825-
826-
debug!(?region_vid);
827-
indices.insert_late_bound_region(r, region_vid.as_var());
828-
}
829-
});
830-
}
831-
832-
#[instrument(skip(self, indices))]
833-
fn instantiate_bound_regions_with_nll_infer_vars_in_item(
834-
&self,
835-
mir_def_id: LocalDefId,
836-
indices: &mut UniversalRegionIndices<'tcx>,
837-
) {
838-
for_each_late_bound_region_in_item(self.tcx, mir_def_id, |r| {
839-
debug!(?r);
840-
if !indices.indices.contains_key(&r) {
841-
let region_vid = {
842-
let name = r.get_name_or_anon();
843-
self.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
844-
};
845-
846-
indices.insert_late_bound_region(r, region_vid.as_var());
847-
}
848-
});
849-
}
850790
}
851791

852792
impl<'tcx> UniversalRegionIndices<'tcx> {

‎compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,7 @@ fn add_unused_functions(cx: &CodegenCx<'_, '_>) {
373373
// just "functions", like consts, statics, etc. Filter those out.
374374
// If `ignore_unused_generics` was specified, filter out any
375375
// generic functions from consideration as well.
376-
if !matches!(
377-
kind,
378-
DefKind::Fn | DefKind::AssocFn | DefKind::Closure | DefKind::Coroutine
379-
) {
376+
if !matches!(kind, DefKind::Fn | DefKind::AssocFn | DefKind::Closure) {
380377
return None;
381378
}
382379
if ignore_unused_generics && tcx.generics_of(def_id).requires_monomorphization(tcx) {

‎compiler/rustc_codegen_llvm/src/type_of.rs‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::ty::{self, Ty, TypeVisitableExt};
99
use rustc_target::abi::HasDataLayout;
1010
use rustc_target::abi::{Abi, Align, FieldsShape};
1111
use rustc_target::abi::{Int, Pointer, F32, F64};
12-
use rustc_target::abi::{PointeeInfo, Scalar, Size, TyAbiInterface, Variants};
12+
use rustc_target::abi::{Scalar, Size, Variants};
1313
use smallvec::{smallvec, SmallVec};
1414

1515
use std::fmt::Write;
@@ -184,7 +184,6 @@ pub trait LayoutLlvmExt<'tcx> {
184184
immediate: bool,
185185
) -> &'a Type;
186186
fn llvm_field_index<'a>(&self, cx: &CodegenCx<'a, 'tcx>, index: usize) -> u64;
187-
fn pointee_info_at<'a>(&self, cx: &CodegenCx<'a, 'tcx>, offset: Size) -> Option<PointeeInfo>;
188187
fn scalar_copy_llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> Option<&'a Type>;
189188
}
190189

@@ -356,20 +355,6 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
356355
}
357356
}
358357

359-
// FIXME(eddyb) this having the same name as `TyAndLayout::pointee_info_at`
360-
// (the inherent method, which is lacking this caching logic) can result in
361-
// the uncached version being called - not wrong, but potentially inefficient.
362-
fn pointee_info_at<'a>(&self, cx: &CodegenCx<'a, 'tcx>, offset: Size) -> Option<PointeeInfo> {
363-
if let Some(&pointee) = cx.pointee_infos.borrow().get(&(self.ty, offset)) {
364-
return pointee;
365-
}
366-
367-
let result = Ty::ty_and_layout_pointee_info_at(*self, cx, offset);
368-
369-
cx.pointee_infos.borrow_mut().insert((self.ty, offset), result);
370-
result
371-
}
372-
373358
fn scalar_copy_llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> Option<&'a Type> {
374359
debug_assert!(self.is_sized());
375360

‎compiler/rustc_hir/src/def.rs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ pub enum DefKind {
114114
of_trait: bool,
115115
},
116116
Closure,
117-
Coroutine,
118117
}
119118

120119
impl DefKind {
@@ -157,7 +156,6 @@ impl DefKind {
157156
DefKind::Field => "field",
158157
DefKind::Impl { .. } => "implementation",
159158
DefKind::Closure => "closure",
160-
DefKind::Coroutine => "coroutine",
161159
DefKind::ExternCrate => "extern crate",
162160
DefKind::GlobalAsm => "global assembly block",
163161
}
@@ -216,7 +214,6 @@ impl DefKind {
216214
| DefKind::LifetimeParam
217215
| DefKind::ExternCrate
218216
| DefKind::Closure
219-
| DefKind::Coroutine
220217
| DefKind::Use
221218
| DefKind::ForeignMod
222219
| DefKind::GlobalAsm
@@ -226,7 +223,7 @@ impl DefKind {
226223

227224
#[inline]
228225
pub fn is_fn_like(self) -> bool {
229-
matches!(self, DefKind::Fn | DefKind::AssocFn | DefKind::Closure | DefKind::Coroutine)
226+
matches!(self, DefKind::Fn | DefKind::AssocFn | DefKind::Closure)
230227
}
231228

232229
/// Whether `query get_codegen_attrs` should be used with this definition.
@@ -236,7 +233,6 @@ impl DefKind {
236233
| DefKind::AssocFn
237234
| DefKind::Ctor(..)
238235
| DefKind::Closure
239-
| DefKind::Coroutine
240236
| DefKind::Static(_) => true,
241237
DefKind::Mod
242238
| DefKind::Struct

‎compiler/rustc_hir_analysis/src/check/check.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ fn opaque_type_cycle_error(
14491449
label_match(capture.place.ty(), capture.get_path_span(tcx));
14501450
}
14511451
// Label any coroutine locals that capture the opaque
1452-
if let DefKind::Coroutine = tcx.def_kind(closure_def_id)
1452+
if tcx.is_coroutine(closure_def_id)
14531453
&& let Some(coroutine_layout) = tcx.mir_coroutine_witnesses(closure_def_id)
14541454
{
14551455
for interior_ty in &coroutine_layout.field_tys {
@@ -1470,7 +1470,7 @@ pub(super) fn check_coroutine_obligations(
14701470
tcx: TyCtxt<'_>,
14711471
def_id: LocalDefId,
14721472
) -> Result<(), ErrorGuaranteed> {
1473-
debug_assert!(matches!(tcx.def_kind(def_id), DefKind::Coroutine));
1473+
debug_assert!(tcx.is_coroutine(def_id.to_def_id()));
14741474

14751475
let typeck = tcx.typeck(def_id);
14761476
let param_env = tcx.param_env(def_id);

‎compiler/rustc_hir_typeck/src/mem_categorization.rs‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,18 @@ use rustc_trait_selection::infer::InferCtxtExt;
6666

6767
pub(crate) trait HirNode {
6868
fn hir_id(&self) -> hir::HirId;
69-
fn span(&self) -> Span;
7069
}
7170

7271
impl HirNode for hir::Expr<'_> {
7372
fn hir_id(&self) -> hir::HirId {
7473
self.hir_id
7574
}
76-
fn span(&self) -> Span {
77-
self.span
78-
}
7975
}
8076

8177
impl HirNode for hir::Pat<'_> {
8278
fn hir_id(&self) -> hir::HirId {
8379
self.hir_id
8480
}
85-
fn span(&self) -> Span {
86-
self.span
87-
}
8881
}
8982

9083
#[derive(Clone)]

‎compiler/rustc_infer/src/infer/nll_relate/mod.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ pub trait TypeRelatingDelegate<'tcx> {
113113
fn forbid_inference_vars() -> bool;
114114
}
115115

116-
#[derive(Copy, Clone)]
117-
struct UniversallyQuantified(bool);
118-
119116
impl<'me, 'tcx, D> TypeRelating<'me, 'tcx, D>
120117
where
121118
D: TypeRelatingDelegate<'tcx>,

‎compiler/rustc_interface/src/passes.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
756756
});
757757

758758
tcx.hir().par_body_owners(|def_id| {
759-
if let rustc_hir::def::DefKind::Coroutine = tcx.def_kind(def_id) {
759+
if tcx.is_coroutine(def_id.to_def_id()) {
760760
tcx.ensure().mir_coroutine_witnesses(def_id);
761761
tcx.ensure().check_coroutine_obligations(def_id);
762762
}

‎compiler/rustc_metadata/src/rmeta/encoder.rs‎

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,7 @@ fn should_encode_span(def_kind: DefKind) -> bool {
857857
| DefKind::OpaqueTy
858858
| DefKind::Field
859859
| DefKind::Impl { .. }
860-
| DefKind::Closure
861-
| DefKind::Coroutine => true,
860+
| DefKind::Closure => true,
862861
DefKind::ForeignMod | DefKind::GlobalAsm => false,
863862
}
864863
}
@@ -898,8 +897,7 @@ fn should_encode_attrs(def_kind: DefKind) -> bool {
898897
| DefKind::InlineConst
899898
| DefKind::OpaqueTy
900899
| DefKind::LifetimeParam
901-
| DefKind::GlobalAsm
902-
| DefKind::Coroutine => false,
900+
| DefKind::GlobalAsm => false,
903901
}
904902
}
905903

@@ -934,8 +932,7 @@ fn should_encode_expn_that_defined(def_kind: DefKind) -> bool {
934932
| DefKind::Field
935933
| DefKind::LifetimeParam
936934
| DefKind::GlobalAsm
937-
| DefKind::Closure
938-
| DefKind::Coroutine => false,
935+
| DefKind::Closure => false,
939936
}
940937
}
941938

@@ -970,7 +967,6 @@ fn should_encode_visibility(def_kind: DefKind) -> bool {
970967
| DefKind::GlobalAsm
971968
| DefKind::Impl { .. }
972969
| DefKind::Closure
973-
| DefKind::Coroutine
974970
| DefKind::ExternCrate => false,
975971
}
976972
}
@@ -1006,7 +1002,6 @@ fn should_encode_stability(def_kind: DefKind) -> bool {
10061002
| DefKind::InlineConst
10071003
| DefKind::GlobalAsm
10081004
| DefKind::Closure
1009-
| DefKind::Coroutine
10101005
| DefKind::ExternCrate => false,
10111006
}
10121007
}
@@ -1049,6 +1044,8 @@ fn should_encode_mir(
10491044
| DefKind::AssocConst
10501045
| DefKind::Static(..)
10511046
| DefKind::Const => (true, false),
1047+
// Coroutines require optimized MIR to compute layout.
1048+
DefKind::Closure if tcx.is_coroutine(def_id.to_def_id()) => (false, true),
10521049
// Full-fledged functions + closures
10531050
DefKind::AssocFn | DefKind::Fn | DefKind::Closure => {
10541051
let generics = tcx.generics_of(def_id);
@@ -1062,8 +1059,6 @@ fn should_encode_mir(
10621059
|| tcx.is_const_default_method(def_id.to_def_id());
10631060
(is_const_fn, opt)
10641061
}
1065-
// Coroutines require optimized MIR to compute layout.
1066-
DefKind::Coroutine => (false, true),
10671062
// The others don't have MIR.
10681063
_ => (false, false),
10691064
}
@@ -1099,7 +1094,6 @@ fn should_encode_variances<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, def_kind: Def
10991094
| DefKind::InlineConst
11001095
| DefKind::GlobalAsm
11011096
| DefKind::Closure
1102-
| DefKind::Coroutine
11031097
| DefKind::ExternCrate => false,
11041098
DefKind::TyAlias => tcx.type_alias_is_lazy(def_id),
11051099
}
@@ -1128,8 +1122,7 @@ fn should_encode_generics(def_kind: DefKind) -> bool {
11281122
| DefKind::Impl { .. }
11291123
| DefKind::Field
11301124
| DefKind::TyParam
1131-
| DefKind::Closure
1132-
| DefKind::Coroutine => true,
1125+
| DefKind::Closure => true,
11331126
DefKind::Mod
11341127
| DefKind::ForeignMod
11351128
| DefKind::ConstParam
@@ -1158,7 +1151,6 @@ fn should_encode_type(tcx: TyCtxt<'_>, def_id: LocalDefId, def_kind: DefKind) ->
11581151
| DefKind::AssocFn
11591152
| DefKind::AssocConst
11601153
| DefKind::Closure
1161-
| DefKind::Coroutine
11621154
| DefKind::ConstParam
11631155
| DefKind::AnonConst
11641156
| DefKind::InlineConst => true,
@@ -1219,7 +1211,6 @@ fn should_encode_fn_sig(def_kind: DefKind) -> bool {
12191211
| DefKind::Impl { .. }
12201212
| DefKind::AssocConst
12211213
| DefKind::Closure
1222-
| DefKind::Coroutine
12231214
| DefKind::ConstParam
12241215
| DefKind::AnonConst
12251216
| DefKind::InlineConst
@@ -1258,7 +1249,6 @@ fn should_encode_constness(def_kind: DefKind) -> bool {
12581249
| DefKind::OpaqueTy
12591250
| DefKind::Impl { of_trait: false }
12601251
| DefKind::ForeignTy
1261-
| DefKind::Coroutine
12621252
| DefKind::ConstParam
12631253
| DefKind::InlineConst
12641254
| DefKind::AssocTy
@@ -1293,7 +1283,6 @@ fn should_encode_const(def_kind: DefKind) -> bool {
12931283
| DefKind::Impl { .. }
12941284
| DefKind::AssocFn
12951285
| DefKind::Closure
1296-
| DefKind::Coroutine
12971286
| DefKind::ConstParam
12981287
| DefKind::AssocTy
12991288
| DefKind::TyParam
@@ -1453,8 +1442,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
14531442
self.encode_info_for_assoc_item(def_id);
14541443
}
14551444
}
1456-
if let DefKind::Coroutine = def_kind {
1457-
let data = self.tcx.coroutine_kind(def_id).unwrap();
1445+
if def_kind == DefKind::Closure
1446+
&& let Some(data) = self.tcx.coroutine_kind(def_id)
1447+
{
14581448
record!(self.tables.coroutine_kind[def_id] <- data);
14591449
}
14601450
if let DefKind::Enum | DefKind::Struct | DefKind::Union = def_kind {
@@ -1636,7 +1626,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
16361626
record!(self.tables.closure_saved_names_of_captured_variables[def_id.to_def_id()]
16371627
<- tcx.closure_saved_names_of_captured_variables(def_id));
16381628

1639-
if let DefKind::Coroutine = self.tcx.def_kind(def_id)
1629+
if self.tcx.is_coroutine(def_id.to_def_id())
16401630
&& let Some(witnesses) = tcx.mir_coroutine_witnesses(def_id)
16411631
{
16421632
record!(self.tables.mir_coroutine_witnesses[def_id.to_def_id()] <- witnesses);
@@ -1663,7 +1653,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
16631653
}
16641654
record!(self.tables.promoted_mir[def_id.to_def_id()] <- tcx.promoted_mir(def_id));
16651655

1666-
if let DefKind::Coroutine = self.tcx.def_kind(def_id)
1656+
if self.tcx.is_coroutine(def_id.to_def_id())
16671657
&& let Some(witnesses) = tcx.mir_coroutine_witnesses(def_id)
16681658
{
16691659
record!(self.tables.mir_coroutine_witnesses[def_id.to_def_id()] <- witnesses);

‎compiler/rustc_metadata/src/rmeta/table.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ fixed_size_enum! {
167167
( Impl { of_trait: false } )
168168
( Impl { of_trait: true } )
169169
( Closure )
170-
( Coroutine )
171170
( Static(ast::Mutability::Not) )
172171
( Static(ast::Mutability::Mut) )
173172
( Ctor(CtorOf::Struct, CtorKind::Fn) )

‎compiler/rustc_middle/src/hir/map/mod.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ impl<'hir> Map<'hir> {
231231
Node::ConstBlock(_) => DefKind::InlineConst,
232232
Node::Field(_) => DefKind::Field,
233233
Node::Expr(expr) => match expr.kind {
234-
ExprKind::Closure(Closure { movability: None, .. }) => DefKind::Closure,
235-
ExprKind::Closure(Closure { movability: Some(_), .. }) => DefKind::Coroutine,
234+
ExprKind::Closure(_) => DefKind::Closure,
236235
_ => bug!("def_kind: unsupported node: {}", self.node_to_string(hir_id)),
237236
},
238237
Node::GenericParam(param) => match param.kind {
@@ -436,7 +435,7 @@ impl<'hir> Map<'hir> {
436435
}
437436
DefKind::InlineConst => BodyOwnerKind::Const { inline: true },
438437
DefKind::Ctor(..) | DefKind::Fn | DefKind::AssocFn => BodyOwnerKind::Fn,
439-
DefKind::Closure | DefKind::Coroutine => BodyOwnerKind::Closure,
438+
DefKind::Closure => BodyOwnerKind::Closure,
440439
DefKind::Static(mt) => BodyOwnerKind::Static(mt),
441440
dk => bug!("{:?} is not a body node: {:?}", def_id, dk),
442441
}

‎compiler/rustc_middle/src/ty/context.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,10 @@ impl<'tcx> TyCtxt<'tcx> {
804804
self.diagnostic_items(did.krate).name_to_id.get(&name) == Some(&did)
805805
}
806806

807+
pub fn is_coroutine(self, def_id: DefId) -> bool {
808+
self.coroutine_kind(def_id).is_some()
809+
}
810+
807811
/// Returns `true` if the node pointed to by `def_id` is a coroutine for an async construct.
808812
pub fn coroutine_is_async(self, def_id: DefId) -> bool {
809813
matches!(self.coroutine_kind(def_id), Some(hir::CoroutineKind::Async(_)))

‎compiler/rustc_middle/src/ty/util.rs‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -550,16 +550,13 @@ impl<'tcx> TyCtxt<'tcx> {
550550
/// those are not yet phased out). The parent of the closure's
551551
/// `DefId` will also be the context where it appears.
552552
pub fn is_closure(self, def_id: DefId) -> bool {
553-
matches!(self.def_kind(def_id), DefKind::Closure | DefKind::Coroutine)
553+
matches!(self.def_kind(def_id), DefKind::Closure)
554554
}
555555

556556
/// Returns `true` if `def_id` refers to a definition that does not have its own
557557
/// type-checking context, i.e. closure, coroutine or inline const.
558558
pub fn is_typeck_child(self, def_id: DefId) -> bool {
559-
matches!(
560-
self.def_kind(def_id),
561-
DefKind::Closure | DefKind::Coroutine | DefKind::InlineConst
562-
)
559+
matches!(self.def_kind(def_id), DefKind::Closure | DefKind::InlineConst)
563560
}
564561

565562
/// Returns `true` if `def_id` refers to a trait (i.e., `trait Foo { ... }`).
@@ -732,11 +729,13 @@ impl<'tcx> TyCtxt<'tcx> {
732729
pub fn def_kind_descr(self, def_kind: DefKind, def_id: DefId) -> &'static str {
733730
match def_kind {
734731
DefKind::AssocFn if self.associated_item(def_id).fn_has_self_parameter => "method",
735-
DefKind::Coroutine => match self.coroutine_kind(def_id).unwrap() {
736-
rustc_hir::CoroutineKind::Async(..) => "async closure",
737-
rustc_hir::CoroutineKind::Coroutine => "coroutine",
738-
rustc_hir::CoroutineKind::Gen(..) => "gen closure",
739-
},
732+
DefKind::Closure if let Some(coroutine_kind) = self.coroutine_kind(def_id) => {
733+
match coroutine_kind {
734+
rustc_hir::CoroutineKind::Async(..) => "async closure",
735+
rustc_hir::CoroutineKind::Coroutine => "coroutine",
736+
rustc_hir::CoroutineKind::Gen(..) => "gen closure",
737+
}
738+
}
740739
_ => def_kind.descr(def_id),
741740
}
742741
}
@@ -750,11 +749,13 @@ impl<'tcx> TyCtxt<'tcx> {
750749
pub fn def_kind_descr_article(self, def_kind: DefKind, def_id: DefId) -> &'static str {
751750
match def_kind {
752751
DefKind::AssocFn if self.associated_item(def_id).fn_has_self_parameter => "a",
753-
DefKind::Coroutine => match self.coroutine_kind(def_id).unwrap() {
754-
rustc_hir::CoroutineKind::Async(..) => "an",
755-
rustc_hir::CoroutineKind::Coroutine => "a",
756-
rustc_hir::CoroutineKind::Gen(..) => "a",
757-
},
752+
DefKind::Closure if let Some(coroutine_kind) = self.coroutine_kind(def_id) => {
753+
match coroutine_kind {
754+
rustc_hir::CoroutineKind::Async(..) => "an",
755+
rustc_hir::CoroutineKind::Coroutine => "a",
756+
rustc_hir::CoroutineKind::Gen(..) => "a",
757+
}
758+
}
758759
_ => def_kind.article(),
759760
}
760761
}

‎compiler/rustc_mir_build/src/build/mod.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,14 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) -
638638
);
639639
(sig.inputs().to_vec(), sig.output(), None)
640640
}
641+
DefKind::Closure if coroutine_kind.is_some() => {
642+
let coroutine_ty = tcx.type_of(def_id).instantiate_identity();
643+
let ty::Coroutine(_, args, _) = coroutine_ty.kind() else { bug!() };
644+
let args = args.as_coroutine();
645+
let yield_ty = args.yield_ty();
646+
let return_ty = args.return_ty();
647+
(vec![coroutine_ty, args.resume_ty()], return_ty, Some(yield_ty))
648+
}
641649
DefKind::Closure => {
642650
let closure_ty = tcx.type_of(def_id).instantiate_identity();
643651
let ty::Closure(_, args) = closure_ty.kind() else { bug!() };
@@ -650,14 +658,6 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) -
650658
};
651659
([self_ty].into_iter().chain(sig.inputs().to_vec()).collect(), sig.output(), None)
652660
}
653-
DefKind::Coroutine => {
654-
let coroutine_ty = tcx.type_of(def_id).instantiate_identity();
655-
let ty::Coroutine(_, args, _) = coroutine_ty.kind() else { bug!() };
656-
let args = args.as_coroutine();
657-
let yield_ty = args.yield_ty();
658-
let return_ty = args.return_ty();
659-
(vec![coroutine_ty, args.resume_ty()], return_ty, Some(yield_ty))
660-
}
661661
dk => bug!("{:?} is not a body: {:?}", def_id, dk),
662662
};
663663

‎compiler/rustc_mir_build/src/thir/cx/mod.rs‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub(crate) fn thir_body(
3737

3838
// The resume argument may be missing, in that case we need to provide it here.
3939
// It will always be `()` in this case.
40-
if tcx.def_kind(owner_def) == DefKind::Coroutine && body.params.is_empty() {
40+
if tcx.is_coroutine(owner_def.to_def_id()) && body.params.is_empty() {
4141
cx.thir.params.push(Param {
4242
ty: Ty::new_unit(tcx),
4343
pat: None,
@@ -119,6 +119,17 @@ impl<'tcx> Cx<'tcx> {
119119

120120
fn closure_env_param(&self, owner_def: LocalDefId, owner_id: HirId) -> Option<Param<'tcx>> {
121121
match self.tcx.def_kind(owner_def) {
122+
DefKind::Closure if self.tcx.is_coroutine(owner_def.to_def_id()) => {
123+
let coroutine_ty = self.typeck_results.node_type(owner_id);
124+
let coroutine_param = Param {
125+
ty: coroutine_ty,
126+
pat: None,
127+
ty_span: None,
128+
self_kind: None,
129+
hir_id: None,
130+
};
131+
Some(coroutine_param)
132+
}
122133
DefKind::Closure => {
123134
let closure_ty = self.typeck_results.node_type(owner_id);
124135

@@ -148,17 +159,6 @@ impl<'tcx> Cx<'tcx> {
148159

149160
Some(env_param)
150161
}
151-
DefKind::Coroutine => {
152-
let coroutine_ty = self.typeck_results.node_type(owner_id);
153-
let coroutine_param = Param {
154-
ty: coroutine_ty,
155-
pat: None,
156-
ty_span: None,
157-
self_kind: None,
158-
hir_id: None,
159-
};
160-
Some(coroutine_param)
161-
}
162162
_ => None,
163163
}
164164
}

‎compiler/rustc_mir_build/src/thir/pattern/mod.rs‎

Lines changed: 3 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ use rustc_hir::pat_util::EnumerateAndAdjustIterator;
1818
use rustc_hir::RangeEnd;
1919
use rustc_index::Idx;
2020
use rustc_middle::mir::interpret::{ErrorHandled, GlobalId, LitToConstError, LitToConstInput};
21-
use rustc_middle::mir::{self, BorrowKind, Const, Mutability, UserTypeProjection};
21+
use rustc_middle::mir::{self, BorrowKind, Const, Mutability};
2222
use rustc_middle::thir::{
2323
Ascription, BindingMode, FieldPat, LocalVarId, Pat, PatKind, PatRange, PatRangeBoundary,
2424
};
2525
use rustc_middle::ty::layout::IntegerExt;
26-
use rustc_middle::ty::{
27-
self, AdtDef, CanonicalUserTypeAnnotation, GenericArg, GenericArgsRef, Region, Ty, TyCtxt,
28-
TypeVisitableExt, UserType,
29-
};
26+
use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty, TyCtxt, TypeVisitableExt};
3027
use rustc_span::def_id::LocalDefId;
31-
use rustc_span::{ErrorGuaranteed, Span, Symbol};
28+
use rustc_span::{ErrorGuaranteed, Span};
3229
use rustc_target::abi::{FieldIdx, Integer};
3330

3431
use std::cmp::Ordering;
@@ -701,146 +698,3 @@ impl<'tcx> UserAnnotatedTyHelpers<'tcx> for PatCtxt<'_, 'tcx> {
701698
self.typeck_results
702699
}
703700
}
704-
705-
trait PatternFoldable<'tcx>: Sized {
706-
fn fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
707-
self.super_fold_with(folder)
708-
}
709-
710-
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self;
711-
}
712-
713-
trait PatternFolder<'tcx>: Sized {
714-
fn fold_pattern(&mut self, pattern: &Pat<'tcx>) -> Pat<'tcx> {
715-
pattern.super_fold_with(self)
716-
}
717-
718-
fn fold_pattern_kind(&mut self, kind: &PatKind<'tcx>) -> PatKind<'tcx> {
719-
kind.super_fold_with(self)
720-
}
721-
}
722-
723-
impl<'tcx, T: PatternFoldable<'tcx>> PatternFoldable<'tcx> for Box<T> {
724-
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
725-
let content: T = (**self).fold_with(folder);
726-
Box::new(content)
727-
}
728-
}
729-
730-
impl<'tcx, T: PatternFoldable<'tcx>> PatternFoldable<'tcx> for Vec<T> {
731-
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
732-
self.iter().map(|t| t.fold_with(folder)).collect()
733-
}
734-
}
735-
736-
impl<'tcx, T: PatternFoldable<'tcx>> PatternFoldable<'tcx> for Box<[T]> {
737-
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
738-
self.iter().map(|t| t.fold_with(folder)).collect()
739-
}
740-
}
741-
742-
impl<'tcx, T: PatternFoldable<'tcx>> PatternFoldable<'tcx> for Option<T> {
743-
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
744-
self.as_ref().map(|t| t.fold_with(folder))
745-
}
746-
}
747-
748-
macro_rules! ClonePatternFoldableImpls {
749-
(<$lt_tcx:tt> $($ty:ty),+) => {
750-
$(
751-
impl<$lt_tcx> PatternFoldable<$lt_tcx> for $ty {
752-
fn super_fold_with<F: PatternFolder<$lt_tcx>>(&self, _: &mut F) -> Self {
753-
Clone::clone(self)
754-
}
755-
}
756-
)+
757-
}
758-
}
759-
760-
ClonePatternFoldableImpls! { <'tcx>
761-
Span, FieldIdx, Mutability, Symbol, LocalVarId, usize,
762-
Region<'tcx>, Ty<'tcx>, BindingMode, AdtDef<'tcx>,
763-
GenericArgsRef<'tcx>, &'tcx GenericArg<'tcx>, UserType<'tcx>,
764-
UserTypeProjection, CanonicalUserTypeAnnotation<'tcx>
765-
}
766-
767-
impl<'tcx> PatternFoldable<'tcx> for FieldPat<'tcx> {
768-
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
769-
FieldPat { field: self.field.fold_with(folder), pattern: self.pattern.fold_with(folder) }
770-
}
771-
}
772-
773-
impl<'tcx> PatternFoldable<'tcx> for Pat<'tcx> {
774-
fn fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
775-
folder.fold_pattern(self)
776-
}
777-
778-
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
779-
Pat {
780-
ty: self.ty.fold_with(folder),
781-
span: self.span.fold_with(folder),
782-
kind: self.kind.fold_with(folder),
783-
}
784-
}
785-
}
786-
787-
impl<'tcx> PatternFoldable<'tcx> for PatKind<'tcx> {
788-
fn fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
789-
folder.fold_pattern_kind(self)
790-
}
791-
792-
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
793-
match *self {
794-
PatKind::Wild => PatKind::Wild,
795-
PatKind::Error(e) => PatKind::Error(e),
796-
PatKind::AscribeUserType {
797-
ref subpattern,
798-
ascription: Ascription { ref annotation, variance },
799-
} => PatKind::AscribeUserType {
800-
subpattern: subpattern.fold_with(folder),
801-
ascription: Ascription { annotation: annotation.fold_with(folder), variance },
802-
},
803-
PatKind::Binding { mutability, name, mode, var, ty, ref subpattern, is_primary } => {
804-
PatKind::Binding {
805-
mutability: mutability.fold_with(folder),
806-
name: name.fold_with(folder),
807-
mode: mode.fold_with(folder),
808-
var: var.fold_with(folder),
809-
ty: ty.fold_with(folder),
810-
subpattern: subpattern.fold_with(folder),
811-
is_primary,
812-
}
813-
}
814-
PatKind::Variant { adt_def, args, variant_index, ref subpatterns } => {
815-
PatKind::Variant {
816-
adt_def: adt_def.fold_with(folder),
817-
args: args.fold_with(folder),
818-
variant_index,
819-
subpatterns: subpatterns.fold_with(folder),
820-
}
821-
}
822-
PatKind::Leaf { ref subpatterns } => {
823-
PatKind::Leaf { subpatterns: subpatterns.fold_with(folder) }
824-
}
825-
PatKind::Deref { ref subpattern } => {
826-
PatKind::Deref { subpattern: subpattern.fold_with(folder) }
827-
}
828-
PatKind::Constant { value } => PatKind::Constant { value },
829-
PatKind::InlineConstant { def, subpattern: ref pattern } => {
830-
PatKind::InlineConstant { def, subpattern: pattern.fold_with(folder) }
831-
}
832-
PatKind::Range(ref range) => PatKind::Range(range.clone()),
833-
PatKind::Slice { ref prefix, ref slice, ref suffix } => PatKind::Slice {
834-
prefix: prefix.fold_with(folder),
835-
slice: slice.fold_with(folder),
836-
suffix: suffix.fold_with(folder),
837-
},
838-
PatKind::Array { ref prefix, ref slice, ref suffix } => PatKind::Array {
839-
prefix: prefix.fold_with(folder),
840-
slice: slice.fold_with(folder),
841-
suffix: suffix.fold_with(folder),
842-
},
843-
PatKind::Or { ref pats } => PatKind::Or { pats: pats.fold_with(folder) },
844-
}
845-
}
846-
}

‎compiler/rustc_mir_transform/src/const_prop.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
8484

8585
// FIXME(welseywiser) const prop doesn't work on coroutines because of query cycles
8686
// computing their layout.
87-
let is_coroutine = def_kind == DefKind::Coroutine;
88-
if is_coroutine {
87+
if tcx.is_coroutine(def_id.to_def_id()) {
8988
trace!("ConstProp skipped for coroutine {:?}", def_id);
9089
return;
9190
}

‎compiler/rustc_mir_transform/src/const_prop_lint.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<'tcx> MirLint<'tcx> for ConstPropLint {
6161

6262
// FIXME(welseywiser) const prop doesn't work on coroutines because of query cycles
6363
// computing their layout.
64-
if let DefKind::Coroutine = def_kind {
64+
if tcx.is_coroutine(def_id.to_def_id()) {
6565
trace!("ConstPropLint skipped for coroutine {:?}", def_id);
6666
return;
6767
}

‎compiler/rustc_mir_transform/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ fn inner_mir_for_ctfe(tcx: TyCtxt<'_>, def: LocalDefId) -> Body<'_> {
395395
/// mir borrowck *before* doing so in order to ensure that borrowck can be run and doesn't
396396
/// end up missing the source MIR due to stealing happening.
397397
fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal<Body<'_>> {
398-
if let DefKind::Coroutine = tcx.def_kind(def) {
398+
if tcx.is_coroutine(def.to_def_id()) {
399399
tcx.ensure_with_value().mir_coroutine_witnesses(def);
400400
}
401401
let mir_borrowck = tcx.mir_borrowck(def);

‎compiler/rustc_monomorphize/src/polymorphize.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn mark_used_by_default_parameters<'tcx>(
131131
unused_parameters: &mut UnusedGenericParams,
132132
) {
133133
match tcx.def_kind(def_id) {
134-
DefKind::Closure | DefKind::Coroutine => {
134+
DefKind::Closure => {
135135
for param in &generics.params {
136136
debug!(?param, "(closure/gen)");
137137
unused_parameters.mark_used(param.index);
@@ -248,7 +248,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkUsedGenericParams<'a, 'tcx> {
248248
fn visit_local_decl(&mut self, local: Local, local_decl: &LocalDecl<'tcx>) {
249249
if local == Local::from_usize(1) {
250250
let def_kind = self.tcx.def_kind(self.def_id);
251-
if matches!(def_kind, DefKind::Closure | DefKind::Coroutine) {
251+
if matches!(def_kind, DefKind::Closure) {
252252
// Skip visiting the closure/coroutine that is currently being processed. This only
253253
// happens because the first argument to the closure is a reference to itself and
254254
// that will call `visit_args`, resulting in each generic parameter captured being

‎compiler/rustc_privacy/src/lib.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,7 @@ impl<'tcx> EmbargoVisitor<'tcx> {
653653
| DefKind::Field
654654
| DefKind::GlobalAsm
655655
| DefKind::Impl { .. }
656-
| DefKind::Closure
657-
| DefKind::Coroutine => (),
656+
| DefKind::Closure => (),
658657
}
659658
}
660659
}

‎compiler/rustc_resolve/src/build_reduced_graph.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,8 +973,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
973973
| DefKind::LifetimeParam
974974
| DefKind::GlobalAsm
975975
| DefKind::Closure
976-
| DefKind::Impl { .. }
977-
| DefKind::Coroutine,
976+
| DefKind::Impl { .. },
978977
_,
979978
)
980979
| Res::Local(..)

‎compiler/rustc_smir/src/rustc_smir/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub(crate) fn new_item_kind(kind: DefKind) -> ItemKind {
8989
| DefKind::GlobalAsm => {
9090
unreachable!("Not a valid item kind: {kind:?}");
9191
}
92-
DefKind::Closure | DefKind::Coroutine | DefKind::AssocFn | DefKind::Fn => ItemKind::Fn,
92+
DefKind::Closure | DefKind::AssocFn | DefKind::Fn => ItemKind::Fn,
9393
DefKind::Const | DefKind::InlineConst | DefKind::AssocConst | DefKind::AnonConst => {
9494
ItemKind::Const
9595
}

‎compiler/rustc_symbol_mangling/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ fn compute_symbol_name<'tcx>(
234234
// and we want to be sure to avoid any symbol conflicts here.
235235
let is_globally_shared_function = matches!(
236236
tcx.def_kind(instance.def_id()),
237-
DefKind::Fn | DefKind::AssocFn | DefKind::Closure | DefKind::Coroutine | DefKind::Ctor(..)
237+
DefKind::Fn | DefKind::AssocFn | DefKind::Closure | DefKind::Ctor(..)
238238
) && matches!(
239239
MonoItem::Fn(instance).instantiation_mode(tcx),
240240
InstantiationMode::GloballyShared { may_conflict: true }

‎compiler/rustc_trait_selection/src/solve/assembly/mod.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ pub(super) trait GoalKind<'tcx>:
3737

3838
fn trait_ref(self, tcx: TyCtxt<'tcx>) -> ty::TraitRef<'tcx>;
3939

40-
fn polarity(self) -> ty::ImplPolarity;
41-
4240
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self;
4341

4442
fn trait_def_id(self, tcx: TyCtxt<'tcx>) -> DefId;

‎compiler/rustc_trait_selection/src/solve/mod.rs‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ enum GoalEvaluationKind {
6464

6565
trait CanonicalResponseExt {
6666
fn has_no_inference_or_external_constraints(&self) -> bool;
67-
68-
fn has_only_region_constraints(&self) -> bool;
6967
}
7068

7169
impl<'tcx> CanonicalResponseExt for Canonical<'tcx, Response<'tcx>> {
@@ -74,11 +72,6 @@ impl<'tcx> CanonicalResponseExt for Canonical<'tcx, Response<'tcx>> {
7472
&& self.value.var_values.is_identity()
7573
&& self.value.external_constraints.opaque_types.is_empty()
7674
}
77-
78-
fn has_only_region_constraints(&self) -> bool {
79-
self.value.var_values.is_identity_modulo_regions()
80-
&& self.value.external_constraints.opaque_types.is_empty()
81-
}
8275
}
8376

8477
impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {

‎compiler/rustc_trait_selection/src/solve/project_goals/mod.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
101101
self.projection_ty.trait_ref(tcx)
102102
}
103103

104-
fn polarity(self) -> ty::ImplPolarity {
105-
ty::ImplPolarity::Positive
106-
}
107-
108104
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
109105
self.with_self_ty(tcx, self_ty)
110106
}

‎compiler/rustc_trait_selection/src/solve/trait_goals.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
2424
self.trait_ref
2525
}
2626

27-
fn polarity(self) -> ty::ImplPolarity {
28-
self.polarity
29-
}
30-
3127
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
3228
self.with_self_ty(tcx, self_ty)
3329
}

‎compiler/rustc_ty_utils/src/implied_bounds.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'
156156
| DefKind::Field
157157
| DefKind::LifetimeParam
158158
| DefKind::GlobalAsm
159-
| DefKind::Closure
160-
| DefKind::Coroutine => ty::List::empty(),
159+
| DefKind::Closure => ty::List::empty(),
161160
}
162161
}
163162

‎compiler/rustc_ty_utils/src/opaque_types.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn opaque_types_defined_by<'tcx>(
313313
| DefKind::Impl { .. } => {}
314314
// Closures and coroutines are type checked with their parent, so we need to allow all
315315
// opaques from the closure signature *and* from the parent body.
316-
DefKind::Closure | DefKind::Coroutine | DefKind::InlineConst => {
316+
DefKind::Closure | DefKind::InlineConst => {
317317
collector.opaques.extend(tcx.opaque_types_defined_by(tcx.local_parent(item)));
318318
}
319319
}

‎compiler/rustc_ty_utils/src/sig_types.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub(crate) fn walk_types<'tcx, V: SpannedTypeVisitor<'tcx>>(
6767
// These are not part of a public API, they can only appear as hidden types, and there
6868
// the interesting parts are solely in the signature of the containing item's opaque type
6969
// or dyn type.
70-
DefKind::InlineConst | DefKind::Closure | DefKind::Coroutine => {}
70+
DefKind::InlineConst | DefKind::Closure => {}
7171
DefKind::Impl { of_trait } => {
7272
if of_trait {
7373
let span = tcx.hir().get_by_def_id(item).expect_item().expect_impl().of_trait.unwrap().path.span;

‎library/std/src/error.rs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ pub use core::error::Error;
1212
#[unstable(feature = "error_generic_member_access", issue = "99301")]
1313
pub use core::error::{request_ref, request_value, Request};
1414

15-
mod private {
16-
// This is a hack to prevent `type_id` from being overridden by `Error`
17-
// implementations, since that can enable unsound downcasting.
18-
#[unstable(feature = "error_type_id", issue = "60784")]
19-
#[derive(Debug)]
20-
pub struct Internal;
21-
}
22-
2315
/// An error reporter that prints an error and its sources.
2416
///
2517
/// Report also exposes configuration options for formatting the error sources, either entirely on a

‎src/librustdoc/formats/item_type.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ impl From<DefKind> for ItemType {
149149
| DefKind::LifetimeParam
150150
| DefKind::GlobalAsm
151151
| DefKind::Impl { .. }
152-
| DefKind::Closure
153-
| DefKind::Coroutine => Self::ForeignType,
152+
| DefKind::Closure => Self::ForeignType,
154153
}
155154
}
156155
}

‎src/librustdoc/html/static/js/main.js‎

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,9 @@ function showMain() {
2525
removeClass(document.getElementById(MAIN_ID), "hidden");
2626
}
2727

28-
function elemIsInParent(elem, parent) {
29-
while (elem && elem !== document.body) {
30-
if (elem === parent) {
31-
return true;
32-
}
33-
elem = elem.parentElement;
34-
}
35-
return false;
36-
}
37-
3828
function blurHandler(event, parentElem, hideCallback) {
39-
if (!elemIsInParent(document.activeElement, parentElem) &&
40-
!elemIsInParent(event.relatedTarget, parentElem)
29+
if (!parentElem.contains(document.activeElement) &&
30+
!parentElem.contains(event.relatedTarget)
4131
) {
4232
hideCallback();
4333
}
@@ -1118,7 +1108,7 @@ function preLoadCss(cssUrl) {
11181108
if (ev.pointerType !== "mouse") {
11191109
return;
11201110
}
1121-
if (!e.TOOLTIP_FORCE_VISIBLE && !elemIsInParent(ev.relatedTarget, e)) {
1111+
if (!e.TOOLTIP_FORCE_VISIBLE && !e.contains(ev.relatedTarget)) {
11221112
// See "Tooltip pointer leave gesture" below.
11231113
setTooltipHoverTimeout(e, false);
11241114
addClass(wrapper, "fade-out");
@@ -1178,10 +1168,10 @@ function preLoadCss(cssUrl) {
11781168

11791169
function tooltipBlurHandler(event) {
11801170
if (window.CURRENT_TOOLTIP_ELEMENT &&
1181-
!elemIsInParent(document.activeElement, window.CURRENT_TOOLTIP_ELEMENT) &&
1182-
!elemIsInParent(event.relatedTarget, window.CURRENT_TOOLTIP_ELEMENT) &&
1183-
!elemIsInParent(document.activeElement, window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE) &&
1184-
!elemIsInParent(event.relatedTarget, window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE)
1171+
!window.CURRENT_TOOLTIP_ELEMENT.contains(document.activeElement) &&
1172+
!window.CURRENT_TOOLTIP_ELEMENT.contains(event.relatedTarget) &&
1173+
!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(document.activeElement) &&
1174+
!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(event.relatedTarget)
11851175
) {
11861176
// Work around a difference in the focus behaviour between Firefox, Chrome, and Safari.
11871177
// When I click the button on an already-opened tooltip popover, Safari
@@ -1248,8 +1238,8 @@ function preLoadCss(cssUrl) {
12481238
if (ev.pointerType !== "mouse") {
12491239
return;
12501240
}
1251-
if (!e.TOOLTIP_FORCE_VISIBLE &&
1252-
!elemIsInParent(ev.relatedTarget, window.CURRENT_TOOLTIP_ELEMENT)) {
1241+
if (!e.TOOLTIP_FORCE_VISIBLE && window.CURRENT_TOOLTIP_ELEMENT &&
1242+
!window.CURRENT_TOOLTIP_ELEMENT.contains(ev.relatedTarget)) {
12531243
// Tooltip pointer leave gesture:
12541244
//
12551245
// Designing a good hover microinteraction is a matter of guessing user

‎src/librustdoc/html/static/js/settings.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Local js definitions:
22
/* global getSettingValue, updateLocalStorage, updateTheme */
3-
/* global addClass, removeClass, onEach, onEachLazy, blurHandler, elemIsInParent */
3+
/* global addClass, removeClass, onEach, onEachLazy, blurHandler */
44
/* global MAIN_ID, getVar, getSettingsButton */
55

66
"use strict";
@@ -232,7 +232,7 @@
232232
const settingsButton = getSettingsButton();
233233
const settingsMenu = document.getElementById("settings");
234234
settingsButton.onclick = event => {
235-
if (elemIsInParent(event.target, settingsMenu)) {
235+
if (settingsMenu.contains(event.target)) {
236236
return;
237237
}
238238
event.preventDefault();

‎src/librustdoc/passes/collect_intra_doc_links.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,6 @@ fn resolution_failure(
19241924
Variant
19251925
| Field
19261926
| Closure
1927-
| Coroutine
19281927
| AssocTy
19291928
| AssocConst
19301929
| AssocFn

‎triagebot.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ cc = ["@nnethercote"]
626626
[assign]
627627
warn_non_default_branch = true
628628
contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html"
629-
users_on_vacation = ["jyn514", "WaffleLapkin", "oli-obk"]
629+
users_on_vacation = ["jyn514", "oli-obk"]
630630

631631
[assign.adhoc_groups]
632632
compiler-team = [

0 commit comments

Comments
 (0)
This repository has been archived.