Skip to content

Rollup of 17 pull requests #143039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e6c3008
small iter.intersperse.fold() optimization
the8472 Jun 15, 2025
644469e
Remove incorrect comments in `Weak`
theemathas Jun 19, 2025
e40515a
add method to retrieve body of coroutine
makai410 Jun 22, 2025
7e683cc
Do not emit `redundant_explicit_links` rustdoc lint if the doc commen…
GuillaumeGomez May 27, 2025
a0d6417
Add ui test for `redundant_explicit_links` rustdoc lint for items com…
GuillaumeGomez May 27, 2025
987c2ff
Update clippy source code to changes on `source_span_for_markdown_range`
GuillaumeGomez May 27, 2025
78cbcaf
Update tests to work with new DocFragment field and `redundant_explic…
GuillaumeGomez Jun 3, 2025
3b5525b
Improve code and documentation
GuillaumeGomez Jun 10, 2025
904652b
Suggest cloning `Arc` moved into closure
estebank May 1, 2024
f908939
rename run_always to run_in_dry_run
Shourya742 Jun 25, 2025
4f80053
Update `browser-ui-test` version to `0.20.7`
GuillaumeGomez Jun 25, 2025
b75b14f
Add `sym::macro_pin` diagnostic item for `core::pin::pin!()`
samueltardieu Jun 25, 2025
8304435
Compute hard errors without diagnostics in impl_intersection_has_impo…
compiler-errors Jun 17, 2025
44254c8
Remove some glob imports from the type system
compiler-errors Jun 17, 2025
c995070
rename RegionVariableOrigin::MiscVariable to RegionVariableOrigin::Misc
compiler-errors Jun 18, 2025
9d11fd0
codegen_fn_attrs: make comment more precise
RalfJung Jun 25, 2025
f1fb323
Do not use `gen` as binding name
estebank Jun 9, 2025
8c3a033
Add edition checks for some tests that had divergent output
estebank Jun 9, 2025
2338821
tests: Do not run afoul of asm.validity.non-exhaustive in input-stats
workingjubilee Jun 11, 2025
1dfc840
make `tidy-alphabetical` use a natural sort
folkertdev May 20, 2025
12e1f3d
Rewrite .gitattributes CRLF ui tests into run-make tests
Oneirical Jun 23, 2025
1aa5e17
Expand const-stabilized API links
jieyouxu Jun 26, 2025
59e1a3c
Simplify IfCause
compiler-errors Jun 25, 2025
f24d64a
Rollup merge of #124595 - estebank:issue-104232, r=davidtwco
workingjubilee Jun 26, 2025
bdd3f7a
Rollup merge of #139594 - compiler-errors:if-cause, r=oli-obk
workingjubilee Jun 26, 2025
70e40d7
Rollup merge of #141311 - folkertdev:tidy-natural-sort, r=jieyouxu
workingjubilee Jun 26, 2025
ef2d0e1
Rollup merge of #141648 - GuillaumeGomez:redundant_explicit_links-exp…
workingjubilee Jun 26, 2025
650deea
Rollup merge of #142255 - estebank:edition-diagnostic-changes, r=fee1…
workingjubilee Jun 26, 2025
04cba4c
Rollup merge of #142285 - workingjubilee:dont-use-bad-assembly, r=nne…
workingjubilee Jun 26, 2025
b289634
Rollup merge of #142549 - the8472:intersperse-fold-tweak, r=tgross35
workingjubilee Jun 26, 2025
f4c648b
Rollup merge of #142637 - compiler-errors:less-globs, r=lcnr
workingjubilee Jun 26, 2025
67f4b3c
Rollup merge of #142647 - compiler-errors:less-work-in-coherence, r=lcnr
workingjubilee Jun 26, 2025
3b2fe8c
Rollup merge of #142700 - theemathas:remove-weak-comment, r=ibraheemdev
workingjubilee Jun 26, 2025
234877b
Rollup merge of #142884 - makai410:coroutine-body, r=celinval
workingjubilee Jun 26, 2025
ec1c9c1
Rollup merge of #142925 - Oneirical:unattentive-immobility, r=jieyouxu
workingjubilee Jun 26, 2025
882a4ef
Rollup merge of #143001 - Shourya742:2025-06-25-rename-run-always, r=…
workingjubilee Jun 26, 2025
afb8025
Rollup merge of #143010 - GuillaumeGomez:update-browser-ui-test, r=Ko…
workingjubilee Jun 26, 2025
08c8ed6
Rollup merge of #143015 - samueltardieu:pin-macro-diag-item, r=Urgau
workingjubilee Jun 26, 2025
4e15659
Rollup merge of #143020 - RalfJung:codegen_fn_attrs, r=oli-obk
workingjubilee Jun 26, 2025
2a6e71a
Rollup merge of #143033 - jieyouxu:expand-apis, r=cuviper
workingjubilee Jun 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ These previously stable APIs are now stable in const contexts:

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


<a id="1.88.0-Cargo"></a>
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4064,9 +4064,9 @@ mod size_asserts {
static_assert_size!(MetaItemLit, 40);
static_assert_size!(Param, 40);
static_assert_size!(Pat, 72);
static_assert_size!(PatKind, 48);
static_assert_size!(Path, 24);
static_assert_size!(PathSegment, 24);
static_assert_size!(PatKind, 48);
static_assert_size!(Stmt, 32);
static_assert_size!(StmtKind, 16);
static_assert_size!(Ty, 64);
Expand Down
17 changes: 12 additions & 5 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
} = move_spans
&& can_suggest_clone
{
self.suggest_cloning(err, ty, expr, Some(move_spans));
self.suggest_cloning(err, place.as_ref(), ty, expr, Some(move_spans));
} else if self.suggest_hoisting_call_outside_loop(err, expr) && can_suggest_clone {
// The place where the type moves would be misleading to suggest clone.
// #121466
self.suggest_cloning(err, ty, expr, Some(move_spans));
self.suggest_cloning(err, place.as_ref(), ty, expr, Some(move_spans));
}
}

Expand Down Expand Up @@ -1224,6 +1224,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
pub(crate) fn suggest_cloning(
&self,
err: &mut Diag<'_>,
place: PlaceRef<'tcx>,
ty: Ty<'tcx>,
expr: &'tcx hir::Expr<'tcx>,
use_spans: Option<UseSpans<'tcx>>,
Expand All @@ -1238,7 +1239,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}

if self.implements_clone(ty) {
self.suggest_cloning_inner(err, ty, expr);
if self.in_move_closure(expr) {
if let Some(name) = self.describe_place(place) {
self.suggest_clone_of_captured_var_in_move_closure(err, &name, use_spans);
}
} else {
self.suggest_cloning_inner(err, ty, expr);
}
} else if let ty::Adt(def, args) = ty.kind()
&& def.did().as_local().is_some()
&& def.variants().iter().all(|variant| {
Expand Down Expand Up @@ -1505,7 +1512,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if let hir::ExprKind::AddrOf(_, _, borrowed_expr) = expr.kind
&& let Some(ty) = typeck_results.expr_ty_opt(borrowed_expr)
{
self.suggest_cloning(&mut err, ty, borrowed_expr, Some(move_spans));
self.suggest_cloning(&mut err, place.as_ref(), ty, borrowed_expr, Some(move_spans));
} else if typeck_results.expr_adjustments(expr).first().is_some_and(|adj| {
matches!(
adj.kind,
Expand All @@ -1518,7 +1525,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
)
}) && let Some(ty) = typeck_results.expr_ty_opt(expr)
{
self.suggest_cloning(&mut err, ty, expr, Some(move_spans));
self.suggest_cloning(&mut err, place.as_ref(), ty, expr, Some(move_spans));
}
}
self.buffer_error(err);
Expand Down
39 changes: 15 additions & 24 deletions compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,25 +325,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.cannot_move_out_of(span, &description)
}

fn suggest_clone_of_captured_var_in_move_closure(
pub(in crate::diagnostics) fn suggest_clone_of_captured_var_in_move_closure(
&self,
err: &mut Diag<'_>,
upvar_hir_id: HirId,
upvar_name: &str,
use_spans: Option<UseSpans<'tcx>>,
) {
let tcx = self.infcx.tcx;
let typeck_results = tcx.typeck(self.mir_def_id());
let Some(use_spans) = use_spans else { return };
// We only care about the case where a closure captured a binding.
let UseSpans::ClosureUse { args_span, .. } = use_spans else { return };
let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return };
// Fetch the type of the expression corresponding to the closure-captured binding.
let Some(captured_ty) = typeck_results.node_type_opt(upvar_hir_id) else { return };
if !self.implements_clone(captured_ty) {
// We only suggest cloning the captured binding if the type can actually be cloned.
return;
};
// Find the closure that captured the binding.
let mut expr_finder = FindExprBySpan::new(args_span, tcx);
expr_finder.include_closures = true;
Expand Down Expand Up @@ -396,7 +388,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
.indentation_before(stmt.span)
.unwrap_or_else(|| " ".to_string());
err.multipart_suggestion_verbose(
"clone the value before moving it into the closure",
"consider cloning the value before moving it into the closure",
vec![
(
stmt.span.shrink_to_lo(),
Expand Down Expand Up @@ -426,7 +418,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
.indentation_before(closure_expr.span)
.unwrap_or_else(|| " ".to_string());
err.multipart_suggestion_verbose(
"clone the value before moving it into the closure",
"consider cloning the value before moving it into the closure",
vec![
(
closure_expr.span.shrink_to_lo(),
Expand Down Expand Up @@ -523,20 +515,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
);

let closure_span = tcx.def_span(def_id);
let mut err = self
.cannot_move_out_of(span, &place_description)
self.cannot_move_out_of(span, &place_description)
.with_span_label(upvar_span, "captured outer variable")
.with_span_label(
closure_span,
format!("captured by this `{closure_kind}` closure"),
);
self.suggest_clone_of_captured_var_in_move_closure(
&mut err,
upvar_hir_id,
&upvar_name,
use_spans,
);
err
)
}
_ => {
let source = self.borrowed_content_source(deref_base);
Expand Down Expand Up @@ -597,7 +581,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
};

if let Some(expr) = self.find_expr(span) {
self.suggest_cloning(err, place_ty, expr, None);
self.suggest_cloning(err, move_from.as_ref(), place_ty, expr, None);
}

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

if let Some(expr) = self.find_expr(use_span) {
self.suggest_cloning(err, place_ty, expr, Some(use_spans));
self.suggest_cloning(
err,
original_path.as_ref(),
place_ty,
expr,
Some(use_spans),
);
}

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

if let Some(expr) = self.find_expr(binding_span) {
self.suggest_cloning(err, bind_to.ty, expr, None);
let local_place: PlaceRef<'tcx> = (*local).into();
self.suggest_cloning(err, local_place, bind_to.ty, expr, None);
}

err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_hir::def::Res::Def;
use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::VisitorExt;
use rustc_hir::{PolyTraitRef, TyKind, WhereBoundPredicate};
use rustc_infer::infer::{NllRegionVariableOrigin, RelateParamBound};
use rustc_infer::infer::{NllRegionVariableOrigin, SubregionOrigin};
use rustc_middle::bug;
use rustc_middle::hir::place::PlaceBase;
use rustc_middle::mir::{AnnotationSource, ConstraintCategory, ReturnConstraint};
Expand Down Expand Up @@ -329,7 +329,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.infcx.tcx,
type_test.generic_kind.to_ty(self.infcx.tcx),
);
let origin = RelateParamBound(type_test_span, generic_ty, None);
let origin =
SubregionOrigin::RelateParamBound(type_test_span, generic_ty, None);
self.buffer_error(self.infcx.err_ctxt().construct_generic_bound_failure(
self.body.source.def_id().expect_local(),
type_test_span,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
use rustc_infer::infer::outlives::env::RegionBoundPairs;
use rustc_infer::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin};
use rustc_infer::infer::{InferCtxt, SubregionOrigin};
use rustc_infer::traits::query::type_op::DeeplyNormalize;
use rustc_middle::bug;
use rustc_middle::ty::{
Expand Down Expand Up @@ -172,7 +172,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
ty::Region::new_var(tcx, universal_regions.implicit_region_bound());
// we don't actually use this for anything, but
// the `TypeOutlives` code needs an origin.
let origin = infer::RelateParamBound(self.span, t1, None);
let origin = SubregionOrigin::RelateParamBound(self.span, t1, None);
TypeOutlives::new(
&mut *self,
tcx,
Expand Down
7 changes: 3 additions & 4 deletions compiler/rustc_borrowck/src/type_check/input_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
Ty::new_tup(self.tcx(), user_provided_sig.inputs()),
args.tupled_upvars_ty(),
args.coroutine_captures_by_ref_ty(),
self.infcx
.next_region_var(RegionVariableOrigin::MiscVariable(self.body.span), || {
RegionCtxt::Unknown
}),
self.infcx.next_region_var(RegionVariableOrigin::Misc(self.body.span), || {
RegionCtxt::Unknown
}),
);

let next_ty_var = || self.infcx.next_ty_var(self.body.span);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
use rustc_infer::infer::outlives::env::RegionBoundPairs;
use rustc_infer::infer::region_constraints::RegionConstraintData;
use rustc_infer::infer::{
BoundRegion, BoundRegionConversionTime, InferCtxt, NllRegionVariableOrigin,
BoundRegionConversionTime, InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin,
};
use rustc_infer::traits::PredicateObligations;
use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
Expand Down Expand Up @@ -794,7 +794,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
};

self.infcx.next_region_var(
BoundRegion(
RegionVariableOrigin::BoundRegion(
term.source_info.span,
br.kind,
BoundRegionConversionTime::FnCall,
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {

mixed_export_name_no_mangle_lint_state.lint_if_mixed(tcx);

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

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,9 @@ mod size_asserts {

use super::*;
// tidy-alphabetical-start
static_assert_size!(Immediate, 48);
static_assert_size!(ImmTy<'_>, 64);
static_assert_size!(Operand, 56);
static_assert_size!(Immediate, 48);
static_assert_size!(OpTy<'_>, 72);
static_assert_size!(Operand, 56);
// tidy-alphabetical-end
}
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/interpret/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,9 @@ mod size_asserts {

use super::*;
// tidy-alphabetical-start
static_assert_size!(MPlaceTy<'_>, 64);
static_assert_size!(MemPlace, 48);
static_assert_size!(MemPlaceMeta, 24);
static_assert_size!(MPlaceTy<'_>, 64);
static_assert_size!(Place, 48);
static_assert_size!(PlaceTy<'_>, 64);
// tidy-alphabetical-end
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4992,9 +4992,9 @@ mod size_asserts {
static_assert_size!(LetStmt<'_>, 72);
static_assert_size!(Param<'_>, 32);
static_assert_size!(Pat<'_>, 72);
static_assert_size!(PatKind<'_>, 48);
static_assert_size!(Path<'_>, 40);
static_assert_size!(PathSegment<'_>, 48);
static_assert_size!(PatKind<'_>, 48);
static_assert_size!(QPath<'_>, 24);
static_assert_size!(Res, 12);
static_assert_size!(Stmt<'_>, 32);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ fn check_opaque_meets_bounds<'tcx>(
// here rather than using ReErased.
let hidden_ty = tcx.type_of(def_id.to_def_id()).instantiate(tcx, args);
let hidden_ty = fold_regions(tcx, hidden_ty, |re, _dbi| match re.kind() {
ty::ReErased => infcx.next_region_var(RegionVariableOrigin::MiscVariable(span)),
ty::ReErased => infcx.next_region_var(RegionVariableOrigin::Misc(span)),
_ => re,
});

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_errors::{Applicability, ErrorGuaranteed, MultiSpan, pluralize, struct_
use rustc_hir::def::{DefKind, Res};
use rustc_hir::intravisit::VisitorExt;
use rustc_hir::{self as hir, AmbigArg, GenericParamKind, ImplItemKind, intravisit};
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
use rustc_infer::infer::{self, BoundRegionConversionTime, InferCtxt, TyCtxtInferExt};
use rustc_infer::traits::util;
use rustc_middle::ty::error::{ExpectedFound, TypeError};
use rustc_middle::ty::{
Expand Down Expand Up @@ -311,7 +311,7 @@ fn compare_method_predicate_entailment<'tcx>(

let unnormalized_impl_sig = infcx.instantiate_binder_with_fresh_vars(
impl_m_span,
infer::HigherRankedType,
BoundRegionConversionTime::HigherRankedType,
tcx.fn_sig(impl_m.def_id).instantiate_identity(),
);

Expand Down Expand Up @@ -518,7 +518,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
param_env,
infcx.instantiate_binder_with_fresh_vars(
return_span,
infer::HigherRankedType,
BoundRegionConversionTime::HigherRankedType,
tcx.fn_sig(impl_m.def_id).instantiate_identity(),
),
);
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::lang_items::LangItem;
use rustc_hir::{AmbigArg, ItemKind};
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin, TyCtxtInferExt};
use rustc_lint_defs::builtin::SUPERTRAIT_ITEM_SHADOWING_DEFINITION;
use rustc_macros::LintDiagnostic;
use rustc_middle::mir::interpret::ErrorHandled;
Expand Down Expand Up @@ -739,7 +739,7 @@ fn ty_known_to_outlive<'tcx>(
infcx.register_type_outlives_constraint_inner(infer::TypeOutlivesConstraint {
sub_region: region,
sup_type: ty,
origin: infer::RelateParamBound(DUMMY_SP, ty, None),
origin: SubregionOrigin::RelateParamBound(DUMMY_SP, ty, None),
});
})
}
Expand All @@ -755,7 +755,11 @@ fn region_known_to_outlive<'tcx>(
region_b: ty::Region<'tcx>,
) -> bool {
test_region_obligations(tcx, id, param_env, wf_tys, |infcx| {
infcx.sub_regions(infer::RelateRegionParamBound(DUMMY_SP, None), region_b, region_a);
infcx.sub_regions(
SubregionOrigin::RelateRegionParamBound(DUMMY_SP, None),
region_b,
region_a,
);
})
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/coherence/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_hir as hir;
use rustc_hir::ItemKind;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::lang_items::LangItem;
use rustc_infer::infer::{self, RegionResolutionError, TyCtxtInferExt};
use rustc_infer::infer::{self, RegionResolutionError, SubregionOrigin, TyCtxtInferExt};
use rustc_infer::traits::Obligation;
use rustc_middle::ty::adjustment::CoerceUnsizedInfo;
use rustc_middle::ty::print::PrintTraitRefExt as _;
Expand Down Expand Up @@ -415,7 +415,7 @@ pub(crate) fn coerce_unsized_info<'tcx>(
};
let (source, target, trait_def_id, kind, field_span) = match (source.kind(), target.kind()) {
(&ty::Ref(r_a, ty_a, mutbl_a), &ty::Ref(r_b, ty_b, mutbl_b)) => {
infcx.sub_regions(infer::RelateObjectBound(span), r_b, r_a);
infcx.sub_regions(SubregionOrigin::RelateObjectBound(span), r_b, r_a);
let mt_a = ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a };
let mt_b = ty::TypeAndMut { ty: ty_b, mutbl: mutbl_b };
check_mutbl(mt_a, mt_b, &|ty| Ty::new_imm_ref(tcx, r_b, ty))
Expand Down
Loading
Loading