Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 2e83124

Browse filesBrowse files
committed
Auto merge of rust-lang#133502 - lcnr:rust4, r=<try>
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 ~~[top 100 most downloaded crates on crates.io compile](rust-lang#133502 (comment) [top 1000 most downloaded crates on crates.io compile](rust-lang#133502 (comment)) [first perf run](rust-lang#133502 (comment)) 👻 ### in-flight changes - rust-lang#139587 - rust-lang#140497 - rust-lang#124852, unsure whether I actually want to land this PR for now - https://github.com/lcnr/rust/tree/opaque-type-method-call - rust-lang#140260 - rust-lang#140375 - rust-lang#140405 - rust-lang#140496 r? `@ghost`
2 parents 0fbb922 + 774c6c3 commit 2e83124
Copy full SHA for 2e83124

File tree

Expand file treeCollapse file tree

107 files changed

+2752
-2292
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

107 files changed

+2752
-2292
lines changed

‎compiler/rustc_borrowck/messages.ftl

Copy file name to clipboardExpand all lines: compiler/rustc_borrowck/messages.ftl
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,6 @@ borrowck_moved_due_to_usage_in_operator =
156156
*[false] operator
157157
}
158158
159-
borrowck_opaque_type_lifetime_mismatch =
160-
opaque type used twice with different lifetimes
161-
.label = lifetime `{$arg}` used here
162-
.prev_lifetime_label = lifetime `{$prev}` previously used here
163-
.note = if all non-lifetime generic parameters are the same, but the lifetime parameters differ, it is not possible to differentiate the opaque types
164-
165159
borrowck_partial_var_move_by_use_in_closure =
166160
variable {$is_partial ->
167161
[true] partially moved

‎compiler/rustc_borrowck/src/consumers.rs

Copy file name to clipboardExpand all lines: compiler/rustc_borrowck/src/consumers.rs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub use super::polonius::legacy::{
1515
RichLocation, RustcFacts,
1616
};
1717
pub use super::region_infer::RegionInferenceContext;
18-
use crate::{BorrowCheckRootCtxt, do_mir_borrowck};
18+
use crate::BorrowCheckRootCtxt;
1919

2020
/// Options determining the output behavior of [`get_body_with_borrowck_facts`].
2121
///
@@ -101,6 +101,6 @@ pub fn get_body_with_borrowck_facts(
101101
def_id: LocalDefId,
102102
options: ConsumerOptions,
103103
) -> BodyWithBorrowckFacts<'_> {
104-
let mut root_cx = BorrowCheckRootCtxt::new(tcx, def_id);
105-
*do_mir_borrowck(&mut root_cx, def_id, Some(options)).1.unwrap()
104+
let root_cx = BorrowCheckRootCtxt::new(tcx, def_id);
105+
*root_cx.borrowck_root(Some(options)).1.unwrap()
106106
}

‎compiler/rustc_borrowck/src/dataflow.rs

Copy file name to clipboardExpand all lines: compiler/rustc_borrowck/src/dataflow.rs
+2-42Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::fmt;
22

33
use rustc_data_structures::fx::FxIndexMap;
4-
use rustc_data_structures::graph;
54
use rustc_index::bit_set::DenseBitSet;
65
use rustc_middle::mir::{
76
self, BasicBlock, Body, CallReturnPlaces, Location, Place, TerminatorEdges,
@@ -317,9 +316,8 @@ impl<'tcx> PoloniusOutOfScopePrecomputer<'_, 'tcx> {
317316
loans_out_of_scope_at_location: FxIndexMap::default(),
318317
};
319318
for (loan_idx, loan_data) in borrow_set.iter_enumerated() {
320-
let issuing_region = loan_data.region;
321319
let loan_issued_at = loan_data.reserve_location;
322-
prec.precompute_loans_out_of_scope(loan_idx, issuing_region, loan_issued_at);
320+
prec.precompute_loans_out_of_scope(loan_idx, loan_issued_at);
323321
}
324322

325323
prec.loans_out_of_scope_at_location
@@ -328,45 +326,7 @@ impl<'tcx> PoloniusOutOfScopePrecomputer<'_, 'tcx> {
328326
/// Loans are in scope while they are live: whether they are contained within any live region.
329327
/// In the location-insensitive analysis, a loan will be contained in a region if the issuing
330328
/// region can reach it in the subset graph. So this is a reachability problem.
331-
fn precompute_loans_out_of_scope(
332-
&mut self,
333-
loan_idx: BorrowIndex,
334-
issuing_region: RegionVid,
335-
loan_issued_at: Location,
336-
) {
337-
let sccs = self.regioncx.constraint_sccs();
338-
let universal_regions = self.regioncx.universal_regions();
339-
340-
// The loop below was useful for the location-insensitive analysis but shouldn't be
341-
// impactful in the location-sensitive case. It seems that it does, however, as without it a
342-
// handful of tests fail. That likely means some liveness or outlives data related to choice
343-
// regions is missing
344-
// FIXME: investigate the impact of loans traversing applied member constraints and why some
345-
// tests fail otherwise.
346-
//
347-
// We first handle the cases where the loan doesn't go out of scope, depending on the
348-
// issuing region's successors.
349-
for successor in graph::depth_first_search(&self.regioncx.region_graph(), issuing_region) {
350-
// Via applied member constraints
351-
//
352-
// The issuing region can flow into the choice regions, and they are either:
353-
// - placeholders or free regions themselves,
354-
// - or also transitively outlive a free region.
355-
//
356-
// That is to say, if there are applied member constraints here, the loan escapes the
357-
// function and cannot go out of scope. We could early return here.
358-
//
359-
// For additional insurance via fuzzing and crater, we verify that the constraint's min
360-
// choice indeed escapes the function. In the future, we could e.g. turn this check into
361-
// a debug assert and early return as an optimization.
362-
let scc = sccs.scc(successor);
363-
for constraint in self.regioncx.applied_member_constraints(scc) {
364-
if universal_regions.is_universal_region(constraint.min_choice) {
365-
return;
366-
}
367-
}
368-
}
369-
329+
fn precompute_loans_out_of_scope(&mut self, loan_idx: BorrowIndex, loan_issued_at: Location) {
370330
let first_block = loan_issued_at.block;
371331
let first_bb_data = &self.body.basic_blocks[first_block];
372332

‎compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Copy file name to clipboardExpand all lines: compiler/rustc_borrowck/src/diagnostics/region_errors.rs
-43Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use rustc_trait_selection::error_reporting::infer::nice_region_error::{
2323
self, HirTraitObjectVisitor, NiceRegionError, TraitObjectVisitor, find_anon_type,
2424
find_param_with_region, suggest_adding_lifetime_params,
2525
};
26-
use rustc_trait_selection::error_reporting::infer::region::unexpected_hidden_region_diagnostic;
2726
use rustc_trait_selection::infer::InferCtxtExt;
2827
use rustc_trait_selection::traits::{Obligation, ObligationCtxt};
2928
use tracing::{debug, instrument, trace};
@@ -84,9 +83,6 @@ impl<'tcx> RegionErrors<'tcx> {
8483
let guar = self.1.sess.dcx().delayed_bug(format!("{val:?}"));
8584
self.0.push((val, guar));
8685
}
87-
pub(crate) fn is_empty(&self) -> bool {
88-
self.0.is_empty()
89-
}
9086
pub(crate) fn into_iter(
9187
self,
9288
) -> impl Iterator<Item = (RegionErrorKind<'tcx>, ErrorGuaranteed)> {
@@ -108,18 +104,6 @@ pub(crate) enum RegionErrorKind<'tcx> {
108104
/// A generic bound failure for a type test (`T: 'a`).
109105
TypeTestError { type_test: TypeTest<'tcx> },
110106

111-
/// An unexpected hidden region for an opaque type.
112-
UnexpectedHiddenRegion {
113-
/// The span for the member constraint.
114-
span: Span,
115-
/// The hidden type.
116-
hidden_ty: Ty<'tcx>,
117-
/// The opaque type.
118-
key: ty::OpaqueTypeKey<'tcx>,
119-
/// The unexpected region.
120-
member_region: ty::Region<'tcx>,
121-
},
122-
123107
/// Higher-ranked subtyping error.
124108
BoundUniversalRegionError {
125109
/// The placeholder free region.
@@ -312,9 +296,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
312296
// buffered in the `MirBorrowckCtxt`.
313297

314298
let mut outlives_suggestion = OutlivesSuggestionBuilder::default();
315-
let mut last_unexpected_hidden_region: Option<(Span, Ty<'_>, ty::OpaqueTypeKey<'tcx>)> =
316-
None;
317-
318299
for (nll_error, _) in nll_errors.into_iter() {
319300
match nll_error {
320301
RegionErrorKind::TypeTestError { type_test } => {
@@ -364,30 +345,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
364345
}
365346
}
366347

367-
RegionErrorKind::UnexpectedHiddenRegion { span, hidden_ty, key, member_region } => {
368-
let named_ty =
369-
self.regioncx.name_regions_for_member_constraint(self.infcx.tcx, hidden_ty);
370-
let named_key =
371-
self.regioncx.name_regions_for_member_constraint(self.infcx.tcx, key);
372-
let named_region = self
373-
.regioncx
374-
.name_regions_for_member_constraint(self.infcx.tcx, member_region);
375-
let diag = unexpected_hidden_region_diagnostic(
376-
self.infcx,
377-
self.mir_def_id(),
378-
span,
379-
named_ty,
380-
named_region,
381-
named_key,
382-
);
383-
if last_unexpected_hidden_region != Some((span, named_ty, named_key)) {
384-
self.buffer_error(diag);
385-
last_unexpected_hidden_region = Some((span, named_ty, named_key));
386-
} else {
387-
diag.delay_as_bug();
388-
}
389-
}
390-
391348
RegionErrorKind::BoundUniversalRegionError {
392349
longer_fr,
393350
placeholder,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.