Skip to content

Commit 4c423d4

Browse files
committed
Auto merge of #143039 - workingjubilee:rollup-bprphm3, r=workingjubilee
Rollup of 17 pull requests Successful merges: - #124595 (Suggest cloning `Arc` moved into closure) - #139594 (Simplify `ObligationCauseCode::IfExpression`) - #141311 (make `tidy-alphabetical` use a natural sort) - #141648 ([rustdoc] Do not emit redundant_explicit_links lint if the doc comment comes from expansion) - #142255 (Add edition checks for some tests that had divergent output) - #142285 (tests: Do not run afoul of asm.validity.non-exhaustive in input-stats) - #142549 (small iter.intersperse.fold() optimization) - #142637 (Remove some glob imports from the type system) - #142647 ([perf] Compute hard errors without diagnostics in impl_intersection_has_impossible_obligation) - #142700 (Remove incorrect comments in `Weak`) - #142884 (StableMIR: Add method to retrieve body of coroutine) - #142925 (Rewrite `.gitattributes` CRLF ui tests into run-make tests) - #143001 (Rename run always ) - #143010 (Update `browser-ui-test` version to `0.20.7`) - #143015 (Add `sym::macro_pin` diagnostic item for `core::pin::pin!()`) - #143020 (codegen_fn_attrs: make comment more precise) - #143033 (Expand const-stabilized API links in relnotes) r? `@ghost` `@rustbot` modify labels: rollup
2 parents bc4376f + 2a6e71a commit 4c423d4

File tree

180 files changed

+2843
-1186
lines changed

Some content is hidden

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

180 files changed

+2843
-1186
lines changed

RELEASES.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ These previously stable APIs are now stable in const contexts:
6969

7070
- [`NonNull<T>::replace`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.replace)
7171
- [`<*mut T>::replace`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.replace)
72-
- [`std::ptr::swap_nonoverlapping`](https://github.com/rust-lang/rust/pull/137280)
73-
- [`Cell::{replace, get, get_mut, from_mut, as_slice_of_cells}`](https://github.com/rust-lang/rust/pull/137928)
72+
- [`std::ptr::swap_nonoverlapping`](https://doc.rust-lang.org/stable/std/ptr/fn.swap_nonoverlapping.html)
73+
- [`Cell::replace`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#method.replace)
74+
- [`Cell::get`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#method.get)
75+
- [`Cell::get_mut`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#method.get_mut)
76+
- [`Cell::from_mut`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#method.from_mut)
77+
- [`Cell::as_slice_of_cells`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#method.as_slice_of_cells)
7478

7579

7680
<a id="1.88.0-Cargo"></a>

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4064,9 +4064,9 @@ mod size_asserts {
40644064
static_assert_size!(MetaItemLit, 40);
40654065
static_assert_size!(Param, 40);
40664066
static_assert_size!(Pat, 72);
4067+
static_assert_size!(PatKind, 48);
40674068
static_assert_size!(Path, 24);
40684069
static_assert_size!(PathSegment, 24);
4069-
static_assert_size!(PatKind, 48);
40704070
static_assert_size!(Stmt, 32);
40714071
static_assert_size!(StmtKind, 16);
40724072
static_assert_size!(Ty, 64);

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -518,11 +518,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
518518
} = move_spans
519519
&& can_suggest_clone
520520
{
521-
self.suggest_cloning(err, ty, expr, Some(move_spans));
521+
self.suggest_cloning(err, place.as_ref(), ty, expr, Some(move_spans));
522522
} else if self.suggest_hoisting_call_outside_loop(err, expr) && can_suggest_clone {
523523
// The place where the type moves would be misleading to suggest clone.
524524
// #121466
525-
self.suggest_cloning(err, ty, expr, Some(move_spans));
525+
self.suggest_cloning(err, place.as_ref(), ty, expr, Some(move_spans));
526526
}
527527
}
528528

@@ -1224,6 +1224,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
12241224
pub(crate) fn suggest_cloning(
12251225
&self,
12261226
err: &mut Diag<'_>,
1227+
place: PlaceRef<'tcx>,
12271228
ty: Ty<'tcx>,
12281229
expr: &'tcx hir::Expr<'tcx>,
12291230
use_spans: Option<UseSpans<'tcx>>,
@@ -1238,7 +1239,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
12381239
}
12391240

12401241
if self.implements_clone(ty) {
1241-
self.suggest_cloning_inner(err, ty, expr);
1242+
if self.in_move_closure(expr) {
1243+
if let Some(name) = self.describe_place(place) {
1244+
self.suggest_clone_of_captured_var_in_move_closure(err, &name, use_spans);
1245+
}
1246+
} else {
1247+
self.suggest_cloning_inner(err, ty, expr);
1248+
}
12421249
} else if let ty::Adt(def, args) = ty.kind()
12431250
&& def.did().as_local().is_some()
12441251
&& def.variants().iter().all(|variant| {
@@ -1505,7 +1512,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
15051512
if let hir::ExprKind::AddrOf(_, _, borrowed_expr) = expr.kind
15061513
&& let Some(ty) = typeck_results.expr_ty_opt(borrowed_expr)
15071514
{
1508-
self.suggest_cloning(&mut err, ty, borrowed_expr, Some(move_spans));
1515+
self.suggest_cloning(&mut err, place.as_ref(), ty, borrowed_expr, Some(move_spans));
15091516
} else if typeck_results.expr_adjustments(expr).first().is_some_and(|adj| {
15101517
matches!(
15111518
adj.kind,
@@ -1518,7 +1525,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
15181525
)
15191526
}) && let Some(ty) = typeck_results.expr_ty_opt(expr)
15201527
{
1521-
self.suggest_cloning(&mut err, ty, expr, Some(move_spans));
1528+
self.suggest_cloning(&mut err, place.as_ref(), ty, expr, Some(move_spans));
15221529
}
15231530
}
15241531
self.buffer_error(err);

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -325,25 +325,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
325325
self.cannot_move_out_of(span, &description)
326326
}
327327

328-
fn suggest_clone_of_captured_var_in_move_closure(
328+
pub(in crate::diagnostics) fn suggest_clone_of_captured_var_in_move_closure(
329329
&self,
330330
err: &mut Diag<'_>,
331-
upvar_hir_id: HirId,
332331
upvar_name: &str,
333332
use_spans: Option<UseSpans<'tcx>>,
334333
) {
335334
let tcx = self.infcx.tcx;
336-
let typeck_results = tcx.typeck(self.mir_def_id());
337335
let Some(use_spans) = use_spans else { return };
338336
// We only care about the case where a closure captured a binding.
339337
let UseSpans::ClosureUse { args_span, .. } = use_spans else { return };
340338
let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return };
341-
// Fetch the type of the expression corresponding to the closure-captured binding.
342-
let Some(captured_ty) = typeck_results.node_type_opt(upvar_hir_id) else { return };
343-
if !self.implements_clone(captured_ty) {
344-
// We only suggest cloning the captured binding if the type can actually be cloned.
345-
return;
346-
};
347339
// Find the closure that captured the binding.
348340
let mut expr_finder = FindExprBySpan::new(args_span, tcx);
349341
expr_finder.include_closures = true;
@@ -396,7 +388,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
396388
.indentation_before(stmt.span)
397389
.unwrap_or_else(|| " ".to_string());
398390
err.multipart_suggestion_verbose(
399-
"clone the value before moving it into the closure",
391+
"consider cloning the value before moving it into the closure",
400392
vec![
401393
(
402394
stmt.span.shrink_to_lo(),
@@ -426,7 +418,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
426418
.indentation_before(closure_expr.span)
427419
.unwrap_or_else(|| " ".to_string());
428420
err.multipart_suggestion_verbose(
429-
"clone the value before moving it into the closure",
421+
"consider cloning the value before moving it into the closure",
430422
vec![
431423
(
432424
closure_expr.span.shrink_to_lo(),
@@ -523,20 +515,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
523515
);
524516

525517
let closure_span = tcx.def_span(def_id);
526-
let mut err = self
527-
.cannot_move_out_of(span, &place_description)
518+
self.cannot_move_out_of(span, &place_description)
528519
.with_span_label(upvar_span, "captured outer variable")
529520
.with_span_label(
530521
closure_span,
531522
format!("captured by this `{closure_kind}` closure"),
532-
);
533-
self.suggest_clone_of_captured_var_in_move_closure(
534-
&mut err,
535-
upvar_hir_id,
536-
&upvar_name,
537-
use_spans,
538-
);
539-
err
523+
)
540524
}
541525
_ => {
542526
let source = self.borrowed_content_source(deref_base);
@@ -597,7 +581,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
597581
};
598582

599583
if let Some(expr) = self.find_expr(span) {
600-
self.suggest_cloning(err, place_ty, expr, None);
584+
self.suggest_cloning(err, move_from.as_ref(), place_ty, expr, None);
601585
}
602586

603587
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
@@ -629,7 +613,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
629613
};
630614

631615
if let Some(expr) = self.find_expr(use_span) {
632-
self.suggest_cloning(err, place_ty, expr, Some(use_spans));
616+
self.suggest_cloning(
617+
err,
618+
original_path.as_ref(),
619+
place_ty,
620+
expr,
621+
Some(use_spans),
622+
);
633623
}
634624

635625
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
@@ -832,7 +822,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
832822
let place_desc = self.local_name(*local).map(|sym| format!("`{sym}`"));
833823

834824
if let Some(expr) = self.find_expr(binding_span) {
835-
self.suggest_cloning(err, bind_to.ty, expr, None);
825+
let local_place: PlaceRef<'tcx> = (*local).into();
826+
self.suggest_cloning(err, local_place, bind_to.ty, expr, None);
836827
}
837828

838829
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_hir::def::Res::Def;
1010
use rustc_hir::def_id::DefId;
1111
use rustc_hir::intravisit::VisitorExt;
1212
use rustc_hir::{PolyTraitRef, TyKind, WhereBoundPredicate};
13-
use rustc_infer::infer::{NllRegionVariableOrigin, RelateParamBound};
13+
use rustc_infer::infer::{NllRegionVariableOrigin, SubregionOrigin};
1414
use rustc_middle::bug;
1515
use rustc_middle::hir::place::PlaceBase;
1616
use rustc_middle::mir::{AnnotationSource, ConstraintCategory, ReturnConstraint};
@@ -329,7 +329,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
329329
self.infcx.tcx,
330330
type_test.generic_kind.to_ty(self.infcx.tcx),
331331
);
332-
let origin = RelateParamBound(type_test_span, generic_ty, None);
332+
let origin =
333+
SubregionOrigin::RelateParamBound(type_test_span, generic_ty, None);
333334
self.buffer_error(self.infcx.err_ctxt().construct_generic_bound_failure(
334335
self.body.source.def_id().expect_local(),
335336
type_test_span,

compiler/rustc_borrowck/src/type_check/constraint_conversion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
33
use rustc_infer::infer::outlives::env::RegionBoundPairs;
44
use rustc_infer::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
55
use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
6-
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin};
6+
use rustc_infer::infer::{InferCtxt, SubregionOrigin};
77
use rustc_infer::traits::query::type_op::DeeplyNormalize;
88
use rustc_middle::bug;
99
use rustc_middle::ty::{
@@ -172,7 +172,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
172172
ty::Region::new_var(tcx, universal_regions.implicit_region_bound());
173173
// we don't actually use this for anything, but
174174
// the `TypeOutlives` code needs an origin.
175-
let origin = infer::RelateParamBound(self.span, t1, None);
175+
let origin = SubregionOrigin::RelateParamBound(self.span, t1, None);
176176
TypeOutlives::new(
177177
&mut *self,
178178
tcx,

compiler/rustc_borrowck/src/type_check/input_output.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
6666
Ty::new_tup(self.tcx(), user_provided_sig.inputs()),
6767
args.tupled_upvars_ty(),
6868
args.coroutine_captures_by_ref_ty(),
69-
self.infcx
70-
.next_region_var(RegionVariableOrigin::MiscVariable(self.body.span), || {
71-
RegionCtxt::Unknown
72-
}),
69+
self.infcx.next_region_var(RegionVariableOrigin::Misc(self.body.span), || {
70+
RegionCtxt::Unknown
71+
}),
7372
);
7473

7574
let next_ty_var = || self.infcx.next_ty_var(self.body.span);

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
1616
use rustc_infer::infer::outlives::env::RegionBoundPairs;
1717
use rustc_infer::infer::region_constraints::RegionConstraintData;
1818
use rustc_infer::infer::{
19-
BoundRegion, BoundRegionConversionTime, InferCtxt, NllRegionVariableOrigin,
19+
BoundRegionConversionTime, InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin,
2020
};
2121
use rustc_infer::traits::PredicateObligations;
2222
use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
@@ -794,7 +794,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
794794
};
795795

796796
self.infcx.next_region_var(
797-
BoundRegion(
797+
RegionVariableOrigin::BoundRegion(
798798
term.source_info.span,
799799
br.kind,
800800
BoundRegionConversionTime::FnCall,

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,9 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
446446

447447
mixed_export_name_no_mangle_lint_state.lint_if_mixed(tcx);
448448

449-
// Apply the minimum function alignment here, so that individual backends don't have to.
449+
// Apply the minimum function alignment here. This ensures that a function's alignment is
450+
// determined by the `-C` flags of the crate it is defined in, not the `-C` flags of the crate
451+
// it happens to be codegen'd (or const-eval'd) in.
450452
codegen_fn_attrs.alignment =
451453
Ord::max(codegen_fn_attrs.alignment, tcx.sess.opts.unstable_opts.min_function_alignment);
452454

compiler/rustc_const_eval/src/interpret/operand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,9 @@ mod size_asserts {
878878

879879
use super::*;
880880
// tidy-alphabetical-start
881-
static_assert_size!(Immediate, 48);
882881
static_assert_size!(ImmTy<'_>, 64);
883-
static_assert_size!(Operand, 56);
882+
static_assert_size!(Immediate, 48);
884883
static_assert_size!(OpTy<'_>, 72);
884+
static_assert_size!(Operand, 56);
885885
// tidy-alphabetical-end
886886
}

compiler/rustc_const_eval/src/interpret/place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,9 +1056,9 @@ mod size_asserts {
10561056

10571057
use super::*;
10581058
// tidy-alphabetical-start
1059+
static_assert_size!(MPlaceTy<'_>, 64);
10591060
static_assert_size!(MemPlace, 48);
10601061
static_assert_size!(MemPlaceMeta, 24);
1061-
static_assert_size!(MPlaceTy<'_>, 64);
10621062
static_assert_size!(Place, 48);
10631063
static_assert_size!(PlaceTy<'_>, 64);
10641064
// tidy-alphabetical-end

compiler/rustc_hir/src/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4992,9 +4992,9 @@ mod size_asserts {
49924992
static_assert_size!(LetStmt<'_>, 72);
49934993
static_assert_size!(Param<'_>, 32);
49944994
static_assert_size!(Pat<'_>, 72);
4995+
static_assert_size!(PatKind<'_>, 48);
49954996
static_assert_size!(Path<'_>, 40);
49964997
static_assert_size!(PathSegment<'_>, 48);
4997-
static_assert_size!(PatKind<'_>, 48);
49984998
static_assert_size!(QPath<'_>, 24);
49994999
static_assert_size!(Res, 12);
50005000
static_assert_size!(Stmt<'_>, 32);

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ fn check_opaque_meets_bounds<'tcx>(
312312
// here rather than using ReErased.
313313
let hidden_ty = tcx.type_of(def_id.to_def_id()).instantiate(tcx, args);
314314
let hidden_ty = fold_regions(tcx, hidden_ty, |re, _dbi| match re.kind() {
315-
ty::ReErased => infcx.next_region_var(RegionVariableOrigin::MiscVariable(span)),
315+
ty::ReErased => infcx.next_region_var(RegionVariableOrigin::Misc(span)),
316316
_ => re,
317317
});
318318

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_errors::{Applicability, ErrorGuaranteed, MultiSpan, pluralize, struct_
99
use rustc_hir::def::{DefKind, Res};
1010
use rustc_hir::intravisit::VisitorExt;
1111
use rustc_hir::{self as hir, AmbigArg, GenericParamKind, ImplItemKind, intravisit};
12-
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
12+
use rustc_infer::infer::{self, BoundRegionConversionTime, InferCtxt, TyCtxtInferExt};
1313
use rustc_infer::traits::util;
1414
use rustc_middle::ty::error::{ExpectedFound, TypeError};
1515
use rustc_middle::ty::{
@@ -311,7 +311,7 @@ fn compare_method_predicate_entailment<'tcx>(
311311

312312
let unnormalized_impl_sig = infcx.instantiate_binder_with_fresh_vars(
313313
impl_m_span,
314-
infer::HigherRankedType,
314+
BoundRegionConversionTime::HigherRankedType,
315315
tcx.fn_sig(impl_m.def_id).instantiate_identity(),
316316
);
317317

@@ -518,7 +518,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
518518
param_env,
519519
infcx.instantiate_binder_with_fresh_vars(
520520
return_span,
521-
infer::HigherRankedType,
521+
BoundRegionConversionTime::HigherRankedType,
522522
tcx.fn_sig(impl_m.def_id).instantiate_identity(),
523523
),
524524
);

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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;
14-
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
14+
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin, TyCtxtInferExt};
1515
use rustc_lint_defs::builtin::SUPERTRAIT_ITEM_SHADOWING_DEFINITION;
1616
use rustc_macros::LintDiagnostic;
1717
use rustc_middle::mir::interpret::ErrorHandled;
@@ -739,7 +739,7 @@ fn ty_known_to_outlive<'tcx>(
739739
infcx.register_type_outlives_constraint_inner(infer::TypeOutlivesConstraint {
740740
sub_region: region,
741741
sup_type: ty,
742-
origin: infer::RelateParamBound(DUMMY_SP, ty, None),
742+
origin: SubregionOrigin::RelateParamBound(DUMMY_SP, ty, None),
743743
});
744744
})
745745
}
@@ -755,7 +755,11 @@ fn region_known_to_outlive<'tcx>(
755755
region_b: ty::Region<'tcx>,
756756
) -> bool {
757757
test_region_obligations(tcx, id, param_env, wf_tys, |infcx| {
758-
infcx.sub_regions(infer::RelateRegionParamBound(DUMMY_SP, None), region_b, region_a);
758+
infcx.sub_regions(
759+
SubregionOrigin::RelateRegionParamBound(DUMMY_SP, None),
760+
region_b,
761+
region_a,
762+
);
759763
})
760764
}
761765

compiler/rustc_hir_analysis/src/coherence/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_hir as hir;
1010
use rustc_hir::ItemKind;
1111
use rustc_hir::def_id::{DefId, LocalDefId};
1212
use rustc_hir::lang_items::LangItem;
13-
use rustc_infer::infer::{self, RegionResolutionError, TyCtxtInferExt};
13+
use rustc_infer::infer::{self, RegionResolutionError, SubregionOrigin, TyCtxtInferExt};
1414
use rustc_infer::traits::Obligation;
1515
use rustc_middle::ty::adjustment::CoerceUnsizedInfo;
1616
use rustc_middle::ty::print::PrintTraitRefExt as _;
@@ -415,7 +415,7 @@ pub(crate) fn coerce_unsized_info<'tcx>(
415415
};
416416
let (source, target, trait_def_id, kind, field_span) = match (source.kind(), target.kind()) {
417417
(&ty::Ref(r_a, ty_a, mutbl_a), &ty::Ref(r_b, ty_b, mutbl_b)) => {
418-
infcx.sub_regions(infer::RelateObjectBound(span), r_b, r_a);
418+
infcx.sub_regions(SubregionOrigin::RelateObjectBound(span), r_b, r_a);
419419
let mt_a = ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a };
420420
let mt_b = ty::TypeAndMut { ty: ty_b, mutbl: mutbl_b };
421421
check_mutbl(mt_a, mt_b, &|ty| Ty::new_imm_ref(tcx, r_b, ty))

0 commit comments

Comments
 (0)