Skip to content

Commit 8a6985d

Browse files
committed
2229 editon feature perf test
1 parent d2b04f0 commit 8a6985d

File tree

150 files changed

+22
-7849
lines changed

Some content is hidden

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

150 files changed

+22
-7849
lines changed

compiler/rustc_mir_build/src/build/expr/as_place.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>(
219219

220220
// We won't be building MIR if the closure wasn't local
221221
let closure_hir_id = tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local());
222-
let closure_span = tcx.hir().span(closure_hir_id);
223222

224223
let (capture_index, capture) = if let Some(capture_details) =
225224
find_capture_matching_projections(
@@ -230,7 +229,7 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>(
230229
) {
231230
capture_details
232231
} else {
233-
if !enable_precise_capture(tcx, closure_span) {
232+
if !tcx.features().capture_disjoint_fields {
234233
bug!(
235234
"No associated capture found for {:?}[{:#?}] even though \
236235
capture_disjoint_fields isn't enabled",
@@ -783,9 +782,3 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
783782
}
784783
}
785784
}
786-
787-
/// Precise capture is enabled if the feature gate `capture_disjoint_fields` is enabled or if
788-
/// user is using Rust Edition 2021 or higher.
789-
fn enable_precise_capture(tcx: TyCtxt<'_>, closure_span: Span) -> bool {
790-
tcx.features().capture_disjoint_fields || closure_span.rust_2021()
791-
}

compiler/rustc_typeck/src/check/upvar.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
179179

180180
// We now fake capture information for all variables that are mentioned within the closure
181181
// We do this after handling migrations so that min_captures computes before
182-
if !enable_precise_capture(self.tcx, span) {
182+
if !self.tcx.features().capture_disjoint_fields {
183183
let mut capture_information: InferredCaptureInformation<'tcx> = Default::default();
184184

185185
if let Some(upvars) = self.tcx.upvars_mentioned(closure_def_id) {
@@ -216,7 +216,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
216216

217217
// If we have an origin, store it.
218218
if let Some(origin) = delegate.current_origin.clone() {
219-
let origin = if enable_precise_capture(self.tcx, span) {
219+
let origin = if self.tcx.features().capture_disjoint_fields {
220220
(origin.0, restrict_capture_precision(capture_clause, origin.1))
221221
} else {
222222
(origin.0, Place { projections: vec![], ..origin.1 })
@@ -1979,13 +1979,3 @@ fn determine_place_ancestry_relation(
19791979
PlaceAncestryRelation::Divergent
19801980
}
19811981
}
1982-
1983-
/// Precise capture is enabled if the feature gate `capture_disjoint_fields` is enabled or if
1984-
/// user is using Rust Edition 2021 or higher.
1985-
///
1986-
/// `span` is the span of the closure.
1987-
fn enable_precise_capture(tcx: TyCtxt<'_>, span: Span) -> bool {
1988-
// We use span here to ensure that if the closure was generated by a macro with a different
1989-
// edition.
1990-
tcx.features().capture_disjoint_fields || span.rust_2021()
1991-
}

src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.rs

-21
This file was deleted.

src/test/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr

-48
This file was deleted.

src/test/ui/closures/2229_closure_analysis/by_value.rs

-38
This file was deleted.

src/test/ui/closures/2229_closure_analysis/by_value.stderr

-63
This file was deleted.

src/test/ui/closures/2229_closure_analysis/capture-analysis-1.rs

-33
This file was deleted.

src/test/ui/closures/2229_closure_analysis/capture-analysis-1.stderr

-68
This file was deleted.

src/test/ui/closures/2229_closure_analysis/capture-analysis-2.rs

-28
This file was deleted.

0 commit comments

Comments
 (0)