Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b258537

Browse files
committedApr 8, 2025·
Auto merge of rust-lang#139536 - matthiaskrgr:rollup-j6goald, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#139476 (rm `RegionInferenceContext::var_infos`) - rust-lang#139485 (compiletest: Stricter parsing for diagnostic kinds) - rust-lang#139491 (Update books) - rust-lang#139500 (document panic behavior of Vec::resize and Vec::resize_with) - rust-lang#139501 (Fix stack overflow in exhaustiveness due to recursive HIR opaque hidden types) - rust-lang#139504 (add missing word in doc comment) - rust-lang#139509 (clean: remove Deref<Target=RegionKind> impl for Region and use `.kind()`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d4f880f + 1cbf8b5 commit b258537

File tree

89 files changed

+531
-305
lines changed

Some content is hidden

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

89 files changed

+531
-305
lines changed
 

Diff for: ‎compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ impl<'tcx> TypeOpInfo<'tcx> for crate::type_check::InstantiateOpaqueType<'tcx> {
406406
// started MIR borrowchecking with, so the region
407407
// constraints have already been taken. Use the data from
408408
// our `mbcx` instead.
409-
|vid| mbcx.regioncx.var_infos[vid].origin,
410-
|vid| mbcx.regioncx.var_infos[vid].universe,
409+
|vid| RegionVariableOrigin::Nll(mbcx.regioncx.definitions[vid].origin),
410+
|vid| mbcx.regioncx.definitions[vid].universe,
411411
)
412412
}
413413
}
@@ -487,7 +487,7 @@ fn try_extract_error_from_region_constraints<'a, 'tcx>(
487487
let (sub_region, cause) = info?;
488488

489489
debug!(?sub_region, "cause = {:#?}", cause);
490-
let error = match (error_region, *sub_region) {
490+
let error = match (error_region, sub_region.kind()) {
491491
(Some(error_region), ty::ReVar(vid)) => RegionResolutionError::SubSupConflict(
492492
vid,
493493
region_var_origin(vid),

Diff for: ‎compiler/rustc_borrowck/src/diagnostics/mod.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ use rustc_errors::{Applicability, Diag, EmissionGuarantee, MultiSpan, listify};
88
use rustc_hir::def::{CtorKind, Namespace};
99
use rustc_hir::{self as hir, CoroutineKind, LangItem};
1010
use rustc_index::IndexSlice;
11-
use rustc_infer::infer::{
12-
BoundRegionConversionTime, NllRegionVariableOrigin, RegionVariableOrigin,
13-
};
11+
use rustc_infer::infer::{BoundRegionConversionTime, NllRegionVariableOrigin};
1412
use rustc_infer::traits::SelectionError;
1513
use rustc_middle::bug;
1614
use rustc_middle::mir::{
@@ -587,7 +585,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
587585
// this by hooking into the pretty printer and telling it to label the
588586
// lifetimes without names with the value `'0`.
589587
if let ty::Ref(region, ..) = ty.kind() {
590-
match **region {
588+
match region.kind() {
591589
ty::ReBound(_, ty::BoundRegion { kind: br, .. })
592590
| ty::RePlaceholder(ty::PlaceholderRegion {
593591
bound: ty::BoundRegion { kind: br, .. },
@@ -607,7 +605,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
607605
let mut printer = ty::print::FmtPrinter::new(self.infcx.tcx, Namespace::TypeNS);
608606

609607
let region = if let ty::Ref(region, ..) = ty.kind() {
610-
match **region {
608+
match region.kind() {
611609
ty::ReBound(_, ty::BoundRegion { kind: br, .. })
612610
| ty::RePlaceholder(ty::PlaceholderRegion {
613611
bound: ty::BoundRegion { kind: br, .. },
@@ -633,9 +631,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
633631
) {
634632
let predicate_span = path.iter().find_map(|constraint| {
635633
let outlived = constraint.sub;
636-
if let Some(origin) = self.regioncx.var_infos.get(outlived)
637-
&& let RegionVariableOrigin::Nll(NllRegionVariableOrigin::Placeholder(_)) =
638-
origin.origin
634+
if let Some(origin) = self.regioncx.definitions.get(outlived)
635+
&& let NllRegionVariableOrigin::Placeholder(_) = origin.origin
639636
&& let ConstraintCategory::Predicate(span) = constraint.category
640637
{
641638
Some(span)

0 commit comments

Comments
 (0)
Please sign in to comment.