Skip to content

Commit 3e041ce

Browse files
committed
Auto merge of #75666 - davidtwco:tidy-lang-items, r=varkor
hir: consistent use and naming of lang items This PR adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module. This is certainly subjective and while I think this is an improvement, if many in the team don't then we can just close this.
2 parents 3cf8f69 + 6cc268e commit 3e041ce

File tree

43 files changed

+277
-299
lines changed

Some content is hidden

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

43 files changed

+277
-299
lines changed

src/librustc_ast_lowering/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20582058

20592059
hir::GenericBound::LangItemTrait(
20602060
// ::std::future::Future<future_params>
2061-
hir::LangItem::FutureTraitLangItem,
2061+
hir::LangItem::Future,
20622062
span,
20632063
self.next_id(),
20642064
future_args,

src/librustc_codegen_ssa/base.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc_data_structures::profiling::print_time_passes_entry;
3131
use rustc_data_structures::sync::{par_iter, Lock, ParallelIterator};
3232
use rustc_hir as hir;
3333
use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE};
34-
use rustc_hir::lang_items::StartFnLangItem;
34+
use rustc_hir::lang_items::LangItem;
3535
use rustc_index::vec::Idx;
3636
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
3737
use rustc_middle::middle::cstore::EncodedMetadata;
@@ -458,7 +458,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
458458
let (arg_argc, arg_argv) = get_argc_argv(cx, &mut bx);
459459

460460
let (start_fn, args) = if use_start_lang_item {
461-
let start_def_id = cx.tcx().require_lang_item(StartFnLangItem, None);
461+
let start_def_id = cx.tcx().require_lang_item(LangItem::Start, None);
462462
let start_fn = cx.get_fn_addr(
463463
ty::Instance::resolve(
464464
cx.tcx(),

src/librustc_codegen_ssa/mir/block.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::traits::*;
1010
use crate::MemFlags;
1111

1212
use rustc_ast as ast;
13-
use rustc_hir::lang_items;
13+
use rustc_hir::lang_items::LangItem;
1414
use rustc_index::vec::Idx;
1515
use rustc_middle::mir;
1616
use rustc_middle::mir::interpret::{AllocId, ConstValue, Pointer, Scalar};
@@ -420,14 +420,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
420420
let index = self.codegen_operand(&mut bx, index).immediate();
421421
// It's `fn panic_bounds_check(index: usize, len: usize)`,
422422
// and `#[track_caller]` adds an implicit third argument.
423-
(lang_items::PanicBoundsCheckFnLangItem, vec![index, len, location])
423+
(LangItem::PanicBoundsCheck, vec![index, len, location])
424424
}
425425
_ => {
426426
let msg_str = Symbol::intern(msg.description());
427427
let msg = bx.const_str(msg_str);
428428
// It's `pub fn panic(expr: &str)`, with the wide reference being passed
429429
// as two arguments, and `#[track_caller]` adds an implicit third argument.
430-
(lang_items::PanicFnLangItem, vec![msg.0, msg.1, location])
430+
(LangItem::Panic, vec![msg.0, msg.1, location])
431431
}
432432
};
433433

@@ -492,8 +492,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
492492

493493
// Obtain the panic entry point.
494494
// FIXME: dedup this with `codegen_assert_terminator` above.
495-
let def_id =
496-
common::langcall(bx.tcx(), Some(span), "", lang_items::PanicFnLangItem);
495+
let def_id = common::langcall(bx.tcx(), Some(span), "", LangItem::Panic);
497496
let instance = ty::Instance::mono(bx.tcx(), def_id);
498497
let fn_abi = FnAbi::of_instance(bx, instance, &[]);
499498
let llfn = bx.get_fn_addr(instance);

src/librustc_codegen_ssa/mir/rvalue.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::traits::*;
88
use crate::MemFlags;
99

1010
use rustc_apfloat::{ieee, Float, Round, Status};
11-
use rustc_hir::lang_items::ExchangeMallocFnLangItem;
11+
use rustc_hir::lang_items::LangItem;
1212
use rustc_middle::mir;
1313
use rustc_middle::ty::cast::{CastTy, IntTy};
1414
use rustc_middle::ty::layout::{HasTyCtxt, TyAndLayout};
@@ -507,7 +507,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
507507
let llty_ptr = bx.cx().backend_type(box_layout);
508508

509509
// Allocate space:
510-
let def_id = match bx.tcx().lang_items().require(ExchangeMallocFnLangItem) {
510+
let def_id = match bx.tcx().lang_items().require(LangItem::ExchangeMalloc) {
511511
Ok(id) => id,
512512
Err(s) => {
513513
bx.cx().sess().fatal(&format!("allocation of `{}` {}", box_layout.ty, s));

src/librustc_hir/lang_items.rs

+153-158
Large diffs are not rendered by default.

src/librustc_hir/weak_lang_items.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ macro_rules! weak_lang_items {
1515
lazy_static! {
1616
pub static ref WEAK_ITEMS_REFS: FxHashMap<Symbol, LangItem> = {
1717
let mut map = FxHashMap::default();
18-
$(map.insert(sym::$name, lang_items::$item);)*
18+
$(map.insert(sym::$name, LangItem::$item);)*
1919
map
2020
};
2121
}
@@ -46,7 +46,7 @@ impl LanguageItems {
4646
) }
4747

4848
weak_lang_items! {
49-
panic_impl, PanicImplLangItem, rust_begin_unwind;
50-
eh_personality, EhPersonalityLangItem, rust_eh_personality;
51-
oom, OomLangItem, rust_oom;
49+
panic_impl, PanicImpl, rust_begin_unwind;
50+
eh_personality, EhPersonality, rust_eh_personality;
51+
oom, Oom, rust_oom;
5252
}

src/librustc_middle/middle/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn required(tcx: TyCtxt<'_>, lang_item: LangItem) -> bool {
5353
// symbols. Other panic runtimes ensure that the relevant symbols are
5454
// available to link things together, but they're never exercised.
5555
match tcx.sess.panic_strategy() {
56-
PanicStrategy::Abort => lang_item != LangItem::EhPersonalityLangItem,
56+
PanicStrategy::Abort => lang_item != LangItem::EhPersonality,
5757
PanicStrategy::Unwind => true,
5858
}
5959
}

src/librustc_middle/ty/adjustment.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::ty::subst::SubstsRef;
22
use crate::ty::{self, Ty, TyCtxt};
33
use rustc_hir as hir;
44
use rustc_hir::def_id::DefId;
5-
use rustc_hir::lang_items::{DerefMutTraitLangItem, DerefTraitLangItem};
5+
use rustc_hir::lang_items::LangItem;
66
use rustc_macros::HashStable;
77

88
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, HashStable)]
@@ -118,8 +118,8 @@ pub struct OverloadedDeref<'tcx> {
118118
impl<'tcx> OverloadedDeref<'tcx> {
119119
pub fn method_call(&self, tcx: TyCtxt<'tcx>, source: Ty<'tcx>) -> (DefId, SubstsRef<'tcx>) {
120120
let trait_def_id = match self.mutbl {
121-
hir::Mutability::Not => tcx.require_lang_item(DerefTraitLangItem, None),
122-
hir::Mutability::Mut => tcx.require_lang_item(DerefMutTraitLangItem, None),
121+
hir::Mutability::Not => tcx.require_lang_item(LangItem::Deref, None),
122+
hir::Mutability::Mut => tcx.require_lang_item(LangItem::DerefMut, None),
123123
};
124124
let method_def_id = tcx
125125
.associated_items(trait_def_id)

src/librustc_middle/ty/context.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use rustc_hir::def::{DefKind, Res};
4040
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LOCAL_CRATE};
4141
use rustc_hir::definitions::{DefPathHash, Definitions};
4242
use rustc_hir::intravisit::Visitor;
43-
use rustc_hir::lang_items::{self, PanicLocationLangItem};
43+
use rustc_hir::lang_items::LangItem;
4444
use rustc_hir::{HirId, ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet, Node, TraitCandidate};
4545
use rustc_index::vec::{Idx, IndexVec};
4646
use rustc_macros::HashStable;
@@ -1538,7 +1538,7 @@ impl<'tcx> TyCtxt<'tcx> {
15381538
pub fn caller_location_ty(&self) -> Ty<'tcx> {
15391539
self.mk_imm_ref(
15401540
self.lifetimes.re_static,
1541-
self.type_of(self.require_lang_item(PanicLocationLangItem, None))
1541+
self.type_of(self.require_lang_item(LangItem::PanicLocation, None))
15421542
.subst(*self, self.mk_substs([self.lifetimes.re_static.into()].iter())),
15431543
)
15441544
}
@@ -2185,12 +2185,12 @@ impl<'tcx> TyCtxt<'tcx> {
21852185

21862186
#[inline]
21872187
pub fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx> {
2188-
let def_id = self.require_lang_item(lang_items::OwnedBoxLangItem, None);
2188+
let def_id = self.require_lang_item(LangItem::OwnedBox, None);
21892189
self.mk_generic_adt(def_id, ty)
21902190
}
21912191

21922192
#[inline]
2193-
pub fn mk_lang_item(self, ty: Ty<'tcx>, item: lang_items::LangItem) -> Option<Ty<'tcx>> {
2193+
pub fn mk_lang_item(self, ty: Ty<'tcx>, item: LangItem) -> Option<Ty<'tcx>> {
21942194
let def_id = self.lang_items().require(item).ok()?;
21952195
Some(self.mk_generic_adt(def_id, ty))
21962196
}
@@ -2203,7 +2203,7 @@ impl<'tcx> TyCtxt<'tcx> {
22032203

22042204
#[inline]
22052205
pub fn mk_maybe_uninit(self, ty: Ty<'tcx>) -> Ty<'tcx> {
2206-
let def_id = self.require_lang_item(lang_items::MaybeUninitLangItem, None);
2206+
let def_id = self.require_lang_item(LangItem::MaybeUninit, None);
22072207
self.mk_generic_adt(def_id, ty)
22082208
}
22092209

src/librustc_middle/ty/instance.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::ty::{self, SubstsRef, Ty, TyCtxt, TypeFoldable};
55
use rustc_errors::ErrorReported;
66
use rustc_hir::def::Namespace;
77
use rustc_hir::def_id::{CrateNum, DefId};
8-
use rustc_hir::lang_items::{DropInPlaceFnLangItem, FnOnceTraitLangItem};
8+
use rustc_hir::lang_items::LangItem;
99
use rustc_macros::HashStable;
1010

1111
use std::fmt;
@@ -408,7 +408,7 @@ impl<'tcx> Instance<'tcx> {
408408
}
409409

410410
pub fn resolve_drop_in_place(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> {
411-
let def_id = tcx.require_lang_item(DropInPlaceFnLangItem, None);
411+
let def_id = tcx.require_lang_item(LangItem::DropInPlace, None);
412412
let substs = tcx.intern_substs(&[ty.into()]);
413413
Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, substs).unwrap().unwrap()
414414
}
@@ -419,7 +419,7 @@ impl<'tcx> Instance<'tcx> {
419419
substs: ty::SubstsRef<'tcx>,
420420
) -> Instance<'tcx> {
421421
debug!("fn_once_adapter_shim({:?}, {:?})", closure_did, substs);
422-
let fn_once = tcx.require_lang_item(FnOnceTraitLangItem, None);
422+
let fn_once = tcx.require_lang_item(LangItem::FnOnce, None);
423423
let call_once = tcx
424424
.associated_items(fn_once)
425425
.in_definition_order()

src/librustc_middle/ty/layout.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_ast::{self as ast, IntTy, UintTy};
88
use rustc_attr as attr;
99
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1010
use rustc_hir as hir;
11-
use rustc_hir::lang_items::{GeneratorStateLangItem, PinTypeLangItem};
11+
use rustc_hir::lang_items::LangItem;
1212
use rustc_index::bit_set::BitSet;
1313
use rustc_index::vec::{Idx, IndexVec};
1414
use rustc_session::{DataTypeKind, FieldInfo, SizeKind, VariantInfo};
@@ -2371,13 +2371,13 @@ impl<'tcx> ty::Instance<'tcx> {
23712371
let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv);
23722372
let env_ty = tcx.mk_mut_ref(tcx.mk_region(env_region), ty);
23732373

2374-
let pin_did = tcx.require_lang_item(PinTypeLangItem, None);
2374+
let pin_did = tcx.require_lang_item(LangItem::Pin, None);
23752375
let pin_adt_ref = tcx.adt_def(pin_did);
23762376
let pin_substs = tcx.intern_substs(&[env_ty.into()]);
23772377
let env_ty = tcx.mk_adt(pin_adt_ref, pin_substs);
23782378

23792379
sig.map_bound(|sig| {
2380-
let state_did = tcx.require_lang_item(GeneratorStateLangItem, None);
2380+
let state_did = tcx.require_lang_item(LangItem::GeneratorState, None);
23812381
let state_adt_ref = tcx.adt_def(state_did);
23822382
let state_substs =
23832383
tcx.intern_substs(&[sig.yield_ty.into(), sig.return_ty.into()]);

src/librustc_middle/ty/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc_errors::ErrorReported;
3232
use rustc_hir as hir;
3333
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Namespace, Res};
3434
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX};
35-
use rustc_hir::lang_items::{FnMutTraitLangItem, FnOnceTraitLangItem, FnTraitLangItem};
35+
use rustc_hir::lang_items::LangItem;
3636
use rustc_hir::{Constness, Node};
3737
use rustc_index::vec::{Idx, IndexVec};
3838
use rustc_macros::HashStable;
@@ -2670,9 +2670,9 @@ impl<'tcx> ClosureKind {
26702670

26712671
pub fn trait_did(&self, tcx: TyCtxt<'tcx>) -> DefId {
26722672
match *self {
2673-
ClosureKind::Fn => tcx.require_lang_item(FnTraitLangItem, None),
2674-
ClosureKind::FnMut => tcx.require_lang_item(FnMutTraitLangItem, None),
2675-
ClosureKind::FnOnce => tcx.require_lang_item(FnOnceTraitLangItem, None),
2673+
ClosureKind::Fn => tcx.require_lang_item(LangItem::Fn, None),
2674+
ClosureKind::FnMut => tcx.require_lang_item(LangItem::FnMut, None),
2675+
ClosureKind::FnOnce => tcx.require_lang_item(LangItem::FnOnce, None),
26762676
}
26772677
}
26782678

src/librustc_mir/borrow_check/type_check/mod.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1010
use rustc_errors::struct_span_err;
1111
use rustc_hir as hir;
1212
use rustc_hir::def_id::{DefId, LocalDefId};
13-
use rustc_hir::lang_items::{CoerceUnsizedTraitLangItem, CopyTraitLangItem, SizedTraitLangItem};
13+
use rustc_hir::lang_items::LangItem;
1414
use rustc_index::vec::{Idx, IndexVec};
1515
use rustc_infer::infer::canonical::QueryRegionConstraints;
1616
use rustc_infer::infer::outlives::env::RegionBoundPairs;
@@ -507,7 +507,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
507507
if let PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) = context {
508508
let tcx = self.tcx();
509509
let trait_ref = ty::TraitRef {
510-
def_id: tcx.require_lang_item(CopyTraitLangItem, Some(self.last_span)),
510+
def_id: tcx.require_lang_item(LangItem::Copy, Some(self.last_span)),
511511
substs: tcx.mk_substs_trait(place_ty.ty, &[]),
512512
};
513513

@@ -1474,7 +1474,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14741474
self.check_rvalue(body, rv, location);
14751475
if !self.tcx().features().unsized_locals {
14761476
let trait_ref = ty::TraitRef {
1477-
def_id: tcx.require_lang_item(SizedTraitLangItem, Some(self.last_span)),
1477+
def_id: tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
14781478
substs: tcx.mk_substs_trait(place_ty, &[]),
14791479
};
14801480
self.prove_trait_ref(
@@ -2025,7 +2025,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20252025
self.param_env,
20262026
ty::Binder::bind(ty::TraitRef::new(
20272027
self.tcx().require_lang_item(
2028-
CopyTraitLangItem,
2028+
LangItem::Copy,
20292029
Some(self.last_span),
20302030
),
20312031
tcx.mk_substs_trait(ty, &[]),
@@ -2050,7 +2050,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20502050
}
20512051

20522052
let trait_ref = ty::TraitRef {
2053-
def_id: tcx.require_lang_item(SizedTraitLangItem, Some(self.last_span)),
2053+
def_id: tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
20542054
substs: tcx.mk_substs_trait(ty, &[]),
20552055
};
20562056

@@ -2148,10 +2148,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21482148
CastKind::Pointer(PointerCast::Unsize) => {
21492149
let &ty = ty;
21502150
let trait_ref = ty::TraitRef {
2151-
def_id: tcx.require_lang_item(
2152-
CoerceUnsizedTraitLangItem,
2153-
Some(self.last_span),
2154-
),
2151+
def_id: tcx
2152+
.require_lang_item(LangItem::CoerceUnsized, Some(self.last_span)),
21552153
substs: tcx.mk_substs_trait(op.ty(body, tcx), &[ty.into()]),
21562154
};
21572155

src/librustc_mir/borrow_check/universal_regions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_data_structures::fx::FxHashMap;
1717
use rustc_errors::DiagnosticBuilder;
1818
use rustc_hir as hir;
1919
use rustc_hir::def_id::{DefId, LocalDefId};
20-
use rustc_hir::lang_items;
20+
use rustc_hir::lang_items::LangItem;
2121
use rustc_hir::{BodyOwnerKind, HirId};
2222
use rustc_index::vec::{Idx, IndexVec};
2323
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin};
@@ -456,7 +456,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
456456
if let DefiningTy::FnDef(def_id, _) = defining_ty {
457457
if self.infcx.tcx.fn_sig(def_id).c_variadic() {
458458
let va_list_did = self.infcx.tcx.require_lang_item(
459-
lang_items::VaListTypeLangItem,
459+
LangItem::VaList,
460460
Some(self.infcx.tcx.def_span(self.mir_def.did)),
461461
);
462462
let region = self

src/librustc_mir/interpret/intrinsics/caller_location.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::convert::TryFrom;
22

3-
use rustc_hir::lang_items::PanicLocationLangItem;
3+
use rustc_hir::lang_items::LangItem;
44
use rustc_middle::mir::TerminatorKind;
55
use rustc_middle::ty::subst::Subst;
66
use rustc_span::{Span, Symbol};
@@ -63,7 +63,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
6363
// Allocate memory for `CallerLocation` struct.
6464
let loc_ty = self
6565
.tcx
66-
.type_of(self.tcx.require_lang_item(PanicLocationLangItem, None))
66+
.type_of(self.tcx.require_lang_item(LangItem::PanicLocation, None))
6767
.subst(*self.tcx, self.tcx.mk_substs([self.tcx.lifetimes.re_erased.into()].iter()));
6868
let loc_layout = self.layout_of(loc_ty).unwrap();
6969
let location = self.allocate(loc_layout, MemoryKind::CallerLocation);

src/librustc_mir/monomorphize/collector.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ use rustc_errors::{ErrorReported, FatalError};
182182
use rustc_hir as hir;
183183
use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, LOCAL_CRATE};
184184
use rustc_hir::itemlikevisit::ItemLikeVisitor;
185-
use rustc_hir::lang_items::{ExchangeMallocFnLangItem, StartFnLangItem};
185+
use rustc_hir::lang_items::LangItem;
186186
use rustc_index::bit_set::GrowableBitSet;
187187
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
188188
use rustc_middle::mir::interpret::{AllocId, ConstValue};
@@ -594,7 +594,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
594594
mir::Rvalue::NullaryOp(mir::NullOp::Box, _) => {
595595
let tcx = self.tcx;
596596
let exchange_malloc_fn_def_id =
597-
tcx.require_lang_item(ExchangeMallocFnLangItem, None);
597+
tcx.require_lang_item(LangItem::ExchangeMalloc, None);
598598
let instance = Instance::mono(tcx, exchange_malloc_fn_def_id);
599599
if should_codegen_locally(tcx, &instance) {
600600
self.output.push(create_fn_mono_item(self.tcx, instance, span));
@@ -1083,7 +1083,7 @@ impl RootCollector<'_, 'v> {
10831083
_ => return,
10841084
};
10851085

1086-
let start_def_id = match self.tcx.lang_items().require(StartFnLangItem) {
1086+
let start_def_id = match self.tcx.lang_items().require(LangItem::Start) {
10871087
Ok(s) => s,
10881088
Err(err) => self.tcx.sess.fatal(&err),
10891089
};

src/librustc_mir/monomorphize/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc_middle::traits;
22
use rustc_middle::ty::adjustment::CustomCoerceUnsized;
33
use rustc_middle::ty::{self, Ty, TyCtxt};
44

5-
use rustc_hir::lang_items::CoerceUnsizedTraitLangItem;
5+
use rustc_hir::lang_items::LangItem;
66

77
pub mod collector;
88
pub mod partitioning;
@@ -13,7 +13,7 @@ pub fn custom_coerce_unsize_info<'tcx>(
1313
source_ty: Ty<'tcx>,
1414
target_ty: Ty<'tcx>,
1515
) -> CustomCoerceUnsized {
16-
let def_id = tcx.require_lang_item(CoerceUnsizedTraitLangItem, None);
16+
let def_id = tcx.require_lang_item(LangItem::CoerceUnsized, None);
1717

1818
let trait_ref = ty::Binder::bind(ty::TraitRef {
1919
def_id,

0 commit comments

Comments
 (0)