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

Commit 604d521

Browse files
committed
Auto merge of rust-lang#104743 - JohnTitor:rollup-9z9u7yd, r=JohnTitor
Rollup of 7 pull requests Successful merges: - rust-lang#101368 (Forbid inlining `thread_local!`'s `__getit` function on Windows) - rust-lang#102293 (Add powerpc64-ibm-aix as Tier-3 target) - rust-lang#104717 (Add failing test for projections used as const generic) - rust-lang#104720 (rustdoc: remove no-op CSS `.popover::before / a.test-arrow { display: inline-block }`) - rust-lang#104722 (Speed up mpsc_stress test) - rust-lang#104724 (Fix `ClosureKind::to_def_id`) - rust-lang#104728 (Use `tcx.require_lang_item` instead of unwrapping lang items) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ff8c8df + 3ec1ca0 commit 604d521

File tree

22 files changed

+218
-54
lines changed

22 files changed

+218
-54
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_errors::{
77
};
88
use rustc_hir as hir;
99
use rustc_hir::intravisit::{walk_block, walk_expr, Visitor};
10-
use rustc_hir::{AsyncGeneratorKind, GeneratorKind};
10+
use rustc_hir::{AsyncGeneratorKind, GeneratorKind, LangItem};
1111
use rustc_infer::infer::TyCtxtInferExt;
1212
use rustc_infer::traits::ObligationCause;
1313
use rustc_middle::mir::tcx::PlaceTy;
@@ -601,7 +601,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
601601
else { return; };
602602
// Try to find predicates on *generic params* that would allow copying `ty`
603603
let infcx = tcx.infer_ctxt().build();
604-
let copy_did = infcx.tcx.lang_items().copy_trait().unwrap();
604+
let copy_did = infcx.tcx.require_lang_item(LangItem::Copy, Some(span));
605605
let cause = ObligationCause::new(
606606
span,
607607
self.mir_hir_id(),

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Concrete error types for all operations which may be invalid in a certain const context.
22
33
use hir::def_id::LocalDefId;
4-
use hir::ConstContext;
4+
use hir::{ConstContext, LangItem};
55
use rustc_errors::{
66
error_code, struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
77
};
@@ -304,7 +304,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
304304
err.span_note(deref_target, "deref defined here");
305305
}
306306

307-
diag_trait(&mut err, self_ty, tcx.lang_items().deref_trait().unwrap());
307+
diag_trait(&mut err, self_ty, tcx.require_lang_item(LangItem::Deref, Some(span)));
308308
err
309309
}
310310
_ if tcx.opt_parent(callee) == tcx.get_diagnostic_item(sym::ArgumentV1Methods) => {

compiler/rustc_const_eval/src/util/call_kind.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! context.
44
55
use rustc_hir::def_id::DefId;
6-
use rustc_hir::lang_items;
6+
use rustc_hir::{lang_items, LangItem};
77
use rustc_middle::ty::subst::SubstsRef;
88
use rustc_middle::ty::{self, AssocItemContainer, DefIdTree, Instance, ParamEnv, Ty, TyCtxt};
99
use rustc_span::symbol::Ident;
@@ -26,7 +26,7 @@ impl CallDesugaringKind {
2626
match self {
2727
Self::ForLoopIntoIter => tcx.get_diagnostic_item(sym::IntoIterator).unwrap(),
2828
Self::QuestionBranch | Self::TryBlockFromOutput => {
29-
tcx.lang_items().try_trait().unwrap()
29+
tcx.require_lang_item(LangItem::Try, None)
3030
}
3131
Self::QuestionFromResidual => tcx.get_diagnostic_item(sym::FromResidual).unwrap(),
3232
}

compiler/rustc_hir_analysis/src/coherence/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
114114
traits::ObligationCause::dummy_with_span(field_ty_span),
115115
param_env,
116116
ty,
117-
tcx.lang_items().copy_trait().unwrap(),
117+
tcx.require_lang_item(LangItem::Copy, Some(span)),
118118
) {
119119
let error_predicate = error.obligation.predicate;
120120
// Only note if it's not the root obligation, otherwise it's trivial and

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11181118
let lhs_deref_ty_is_sized = self
11191119
.infcx
11201120
.type_implements_trait(
1121-
self.tcx.lang_items().sized_trait().unwrap(),
1121+
self.tcx.require_lang_item(LangItem::Sized, None),
11221122
[lhs_deref_ty],
11231123
self.param_env,
11241124
)

compiler/rustc_middle/src/ty/closure.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::{mir, ty};
55

66
use std::fmt::Write;
77

8+
use hir::LangItem;
89
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
910
use rustc_hir as hir;
1011
use rustc_hir::def_id::{DefId, LocalDefId};
@@ -130,11 +131,14 @@ impl<'tcx> ClosureKind {
130131
}
131132

132133
pub fn to_def_id(&self, tcx: TyCtxt<'_>) -> DefId {
133-
match self {
134-
ClosureKind::Fn => tcx.lang_items().fn_once_trait().unwrap(),
135-
ClosureKind::FnMut => tcx.lang_items().fn_mut_trait().unwrap(),
136-
ClosureKind::FnOnce => tcx.lang_items().fn_trait().unwrap(),
137-
}
134+
tcx.require_lang_item(
135+
match self {
136+
ClosureKind::Fn => LangItem::Fn,
137+
ClosureKind::FnMut => LangItem::FnMut,
138+
ClosureKind::FnOnce => LangItem::FnOnce,
139+
},
140+
None,
141+
)
138142
}
139143
}
140144

compiler/rustc_middle/src/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2293,7 +2293,7 @@ impl<'tcx> TyCtxt<'tcx> {
22932293
/// Given a `ty`, return whether it's an `impl Future<...>`.
22942294
pub fn ty_is_opaque_future(self, ty: Ty<'_>) -> bool {
22952295
let ty::Opaque(def_id, _) = ty.kind() else { return false };
2296-
let future_trait = self.lang_items().future_trait().unwrap();
2296+
let future_trait = self.require_lang_item(LangItem::Future, None);
22972297

22982298
self.explicit_item_bounds(def_id).iter().any(|(predicate, _)| {
22992299
let ty::PredicateKind::Trait(trait_predicate) = predicate.kind().skip_binder() else {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use rustc_hir as hir;
1111
use rustc_hir::def::{self, CtorKind, DefKind, Namespace};
1212
use rustc_hir::def_id::{DefId, DefIdSet, CRATE_DEF_ID, LOCAL_CRATE};
1313
use rustc_hir::definitions::{DefPathData, DefPathDataName, DisambiguatedDefPathData};
14+
use rustc_hir::LangItem;
1415
use rustc_session::config::TrimmedDefPaths;
1516
use rustc_session::cstore::{ExternCrate, ExternCrateSource};
1617
use rustc_session::Limit;
@@ -889,7 +890,7 @@ pub trait PrettyPrinter<'tcx>:
889890
// Group the return ty with its def id, if we had one.
890891
entry
891892
.return_ty
892-
.map(|ty| (tcx.lang_items().fn_once_output().unwrap(), ty)),
893+
.map(|ty| (tcx.require_lang_item(LangItem::FnOnce, None), ty)),
893894
);
894895
}
895896
if let Some(trait_ref) = entry.fn_mut_trait_ref {

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use rustc_data_structures::captures::Captures;
1717
use rustc_data_structures::intern::Interned;
1818
use rustc_hir as hir;
1919
use rustc_hir::def_id::DefId;
20+
use rustc_hir::LangItem;
2021
use rustc_index::vec::Idx;
2122
use rustc_macros::HashStable;
2223
use rustc_span::symbol::{kw, sym, Symbol};
@@ -2108,7 +2109,7 @@ impl<'tcx> Ty<'tcx> {
21082109

21092110
ty::Str | ty::Slice(_) => (tcx.types.usize, false),
21102111
ty::Dynamic(..) => {
2111-
let dyn_metadata = tcx.lang_items().dyn_metadata().unwrap();
2112+
let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, None);
21122113
(tcx.bound_type_of(dyn_metadata).subst(tcx, &[tail.into()]), false)
21132114
},
21142115

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
use crate::abi::Endian;
2+
use crate::spec::{crt_objects, cvs, Cc, CodeModel, LinkOutputKind, LinkerFlavor, TargetOptions};
3+
4+
pub fn opts() -> TargetOptions {
5+
TargetOptions {
6+
abi: "vec-extabi".into(),
7+
code_model: Some(CodeModel::Small),
8+
cpu: "pwr7".into(),
9+
os: "aix".into(),
10+
vendor: "ibm".into(),
11+
dynamic_linking: true,
12+
endian: Endian::Big,
13+
executables: true,
14+
archive_format: "aix_big".into(),
15+
families: cvs!["unix"],
16+
has_rpath: false,
17+
has_thread_local: true,
18+
crt_static_respected: true,
19+
linker_flavor: LinkerFlavor::Unix(Cc::No),
20+
linker: Some("ld".into()),
21+
eh_frame_header: false,
22+
is_like_aix: true,
23+
default_dwarf_version: 3,
24+
function_sections: true,
25+
pre_link_objects: crt_objects::new(&[
26+
(LinkOutputKind::DynamicNoPicExe, &["/usr/lib/crt0_64.o", "/usr/lib/crti_64.o"]),
27+
(LinkOutputKind::DynamicPicExe, &["/usr/lib/crt0_64.o", "/usr/lib/crti_64.o"]),
28+
]),
29+
dll_suffix: ".a".into(),
30+
..Default::default()
31+
}
32+
}

0 commit comments

Comments
 (0)