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

Commit f2b449c

Browse files
committed
Auto merge of rust-lang#126710 - jieyouxu:rollup-3hmke71, r=jieyouxu
Rollup of 7 pull requests Successful merges: - rust-lang#124807 (Migrate `run-make/rustdoc-io-error` to `rmake.rs`) - rust-lang#126095 (Migrate `link-args-order`, `ls-metadata` and `lto-readonly-lib` `run-make` tests to `rmake`) - rust-lang#126308 (Ban `ArrayToPointer` and `MutToConstPointer` from runtime MIR) - rust-lang#126620 (Actually taint InferCtxt when a fulfillment error is emitted) - rust-lang#126629 (Migrate `run-make/compressed-debuginfo` to `rmake.rs`) - rust-lang#126644 (Rewrite `extern-flag-rename-transitive`. `debugger-visualizer-dep-info`, `metadata-flag-frobs-symbols`, `extern-overrides-distribution` and `forced-unwind-terminate-pof` `run-make` tests to rmake) - rust-lang#126650 (Rename a bunch of things in the new solver and `rustc_type_ir`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d8a38b0 + 5d6bebd commit f2b449c

File tree

145 files changed

+1435
-970
lines changed

Some content is hidden

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

145 files changed

+1435
-970
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
11101110
tcx: TyCtxt<'tcx>,
11111111
}
11121112
impl<'tcx> ty::TypeFolder<TyCtxt<'tcx>> for OpaqueFolder<'tcx> {
1113-
fn interner(&self) -> TyCtxt<'tcx> {
1113+
fn cx(&self) -> TyCtxt<'tcx> {
11141114
self.tcx
11151115
}
11161116
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -677,21 +677,22 @@ fn codegen_stmt<'tcx>(
677677
CastKind::PointerCoercion(PointerCoercion::UnsafeFnPointer),
678678
ref operand,
679679
to_ty,
680-
)
681-
| Rvalue::Cast(
682-
CastKind::PointerCoercion(PointerCoercion::MutToConstPointer),
683-
ref operand,
684-
to_ty,
685-
)
686-
| Rvalue::Cast(
687-
CastKind::PointerCoercion(PointerCoercion::ArrayToPointer),
688-
ref operand,
689-
to_ty,
690680
) => {
691681
let to_layout = fx.layout_of(fx.monomorphize(to_ty));
692682
let operand = codegen_operand(fx, operand);
693683
lval.write_cvalue(fx, operand.cast_pointer_to(to_layout));
694684
}
685+
Rvalue::Cast(
686+
CastKind::PointerCoercion(
687+
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
688+
),
689+
..,
690+
) => {
691+
bug!(
692+
"{:?} is for borrowck, and should never appear in codegen",
693+
to_place_and_rval.1
694+
);
695+
}
695696
Rvalue::Cast(
696697
CastKind::IntToInt
697698
| CastKind::FloatToFloat

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
456456
base::unsize_ptr(bx, lldata, operand.layout.ty, cast.ty, llextra);
457457
OperandValue::Pair(lldata, llextra)
458458
}
459-
mir::CastKind::PointerCoercion(PointerCoercion::MutToConstPointer)
460-
| mir::CastKind::PtrToPtr
459+
mir::CastKind::PointerCoercion(
460+
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
461+
) => {
462+
bug!("{kind:?} is for borrowck, and should never appear in codegen");
463+
}
464+
mir::CastKind::PtrToPtr
461465
if bx.cx().is_backend_scalar_pair(operand.layout) =>
462466
{
463467
if let OperandValue::Pair(data_ptr, meta) = operand.val {
@@ -477,9 +481,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
477481
base::cast_to_dyn_star(bx, lldata, operand.layout, cast.ty, llextra);
478482
OperandValue::Pair(lldata, llextra)
479483
}
480-
mir::CastKind::PointerCoercion(
481-
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
482-
)
483484
| mir::CastKind::IntToInt
484485
| mir::CastKind::FloatToInt
485486
| mir::CastKind::FloatToFloat

compiler/rustc_const_eval/src/interpret/cast.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
7070
CastKind::PointerCoercion(
7171
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
7272
) => {
73-
// These are NOPs, but can be wide pointers.
74-
let v = self.read_immediate(src)?;
75-
self.write_immediate(*v, dest)?;
73+
bug!("{cast_kind:?} casts are for borrowck only, not runtime MIR");
7674
}
7775

7876
CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer) => {

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ struct RemapLateBound<'a, 'tcx> {
397397
}
398398

399399
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RemapLateBound<'_, 'tcx> {
400-
fn interner(&self) -> TyCtxt<'tcx> {
400+
fn cx(&self) -> TyCtxt<'tcx> {
401401
self.tcx
402402
}
403403

@@ -790,13 +790,13 @@ impl<'tcx, E> TypeFolder<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'_, 'tcx, E
790790
where
791791
E: 'tcx,
792792
{
793-
fn interner(&self) -> TyCtxt<'tcx> {
793+
fn cx(&self) -> TyCtxt<'tcx> {
794794
self.ocx.infcx.tcx
795795
}
796796

797797
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
798798
if let ty::Alias(ty::Projection, proj) = ty.kind()
799-
&& self.interner().is_impl_trait_in_trait(proj.def_id)
799+
&& self.cx().is_impl_trait_in_trait(proj.def_id)
800800
{
801801
if let Some((ty, _)) = self.types.get(&proj.def_id) {
802802
return *ty;
@@ -810,9 +810,9 @@ where
810810
self.types.insert(proj.def_id, (infer_ty, proj.args));
811811
// Recurse into bounds
812812
for (pred, pred_span) in self
813-
.interner()
813+
.cx()
814814
.explicit_item_bounds(proj.def_id)
815-
.iter_instantiated_copied(self.interner(), proj.args)
815+
.iter_instantiated_copied(self.cx(), proj.args)
816816
{
817817
let pred = pred.fold_with(self);
818818
let pred = self.ocx.normalize(
@@ -822,7 +822,7 @@ where
822822
);
823823

824824
self.ocx.register_obligation(traits::Obligation::new(
825-
self.interner(),
825+
self.cx(),
826826
ObligationCause::new(
827827
self.span,
828828
self.body_id,
@@ -853,7 +853,7 @@ struct RemapHiddenTyRegions<'tcx> {
853853
impl<'tcx> ty::FallibleTypeFolder<TyCtxt<'tcx>> for RemapHiddenTyRegions<'tcx> {
854854
type Error = ErrorGuaranteed;
855855

856-
fn interner(&self) -> TyCtxt<'tcx> {
856+
fn cx(&self) -> TyCtxt<'tcx> {
857857
self.tcx
858858
}
859859

@@ -2072,7 +2072,7 @@ struct ReplaceTy<'tcx> {
20722072
}
20732073

20742074
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReplaceTy<'tcx> {
2075-
fn interner(&self) -> TyCtxt<'tcx> {
2075+
fn cx(&self) -> TyCtxt<'tcx> {
20762076
self.tcx
20772077
}
20782078

compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ struct Anonymize<'tcx> {
322322
}
323323

324324
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Anonymize<'tcx> {
325-
fn interner(&self) -> TyCtxt<'tcx> {
325+
fn cx(&self) -> TyCtxt<'tcx> {
326326
self.tcx
327327
}
328328

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,7 @@ where
119119

120120
let errors = wfcx.select_all_or_error();
121121
if !errors.is_empty() {
122-
let err = infcx.err_ctxt().report_fulfillment_errors(errors);
123-
if tcx.dcx().has_errors().is_some() {
124-
return Err(err);
125-
} else {
126-
// HACK(oli-obk): tests/ui/specialization/min_specialization/specialize_on_type_error.rs
127-
// causes an delayed bug during normalization, without reporting an error, so we need
128-
// to act as if no error happened, in order to let our callers continue and report an
129-
// error later in check_impl_items_against_trait.
130-
return Ok(());
131-
}
122+
return Err(infcx.err_ctxt().report_fulfillment_errors(errors));
132123
}
133124

134125
debug!(?assumed_wf_types);

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ struct TyVarReplacer<'cx, 'tcx> {
539539
}
540540

541541
impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for TyVarReplacer<'cx, 'tcx> {
542-
fn interner(&self) -> TyCtxt<'tcx> {
542+
fn cx(&self) -> TyCtxt<'tcx> {
543543
self.infcx.tcx
544544
}
545545

compiler/rustc_hir_analysis/src/collect/item_bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ struct AssocTyToOpaque<'tcx> {
203203
}
204204

205205
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTyToOpaque<'tcx> {
206-
fn interner(&self) -> TyCtxt<'tcx> {
206+
fn cx(&self) -> TyCtxt<'tcx> {
207207
self.tcx
208208
}
209209

compiler/rustc_hir_typeck/src/writeback.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
793793
}
794794

795795
fn report_error(&self, p: impl Into<ty::GenericArg<'tcx>>) -> ErrorGuaranteed {
796-
if let Some(guar) = self.fcx.dcx().has_errors() {
796+
if let Some(guar) = self.fcx.tainted_by_errors() {
797797
guar
798798
} else {
799799
self.fcx
@@ -847,7 +847,7 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
847847
}
848848

849849
impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Resolver<'cx, 'tcx> {
850-
fn interner(&self) -> TyCtxt<'tcx> {
850+
fn cx(&self) -> TyCtxt<'tcx> {
851851
self.fcx.tcx
852852
}
853853

0 commit comments

Comments
 (0)