Skip to content
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

2229 editon feature perf test #86967

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 1 addition & 8 deletions compiler/rustc_mir_build/src/build/expr/as_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>(

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

let (capture_index, capture) = if let Some(capture_details) =
find_capture_matching_projections(
Expand All @@ -230,7 +229,7 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>(
) {
capture_details
} else {
if !enable_precise_capture(tcx, closure_span) {
if !tcx.features().capture_disjoint_fields {
bug!(
"No associated capture found for {:?}[{:#?}] even though \
capture_disjoint_fields isn't enabled",
Expand Down Expand Up @@ -783,9 +782,3 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}
}

/// Precise capture is enabled if the feature gate `capture_disjoint_fields` is enabled or if
/// user is using Rust Edition 2021 or higher.
fn enable_precise_capture(tcx: TyCtxt<'_>, closure_span: Span) -> bool {
tcx.features().capture_disjoint_fields || closure_span.rust_2021()
}
14 changes: 2 additions & 12 deletions compiler/rustc_typeck/src/check/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

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

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

// If we have an origin, store it.
if let Some(origin) = delegate.current_origin.clone() {
let origin = if enable_precise_capture(self.tcx, span) {
let origin = if self.tcx.features().capture_disjoint_fields {
(origin.0, restrict_capture_precision(capture_clause, origin.1))
} else {
(origin.0, Place { projections: vec![], ..origin.1 })
Expand Down Expand Up @@ -1979,13 +1979,3 @@ fn determine_place_ancestry_relation(
PlaceAncestryRelation::Divergent
}
}

/// Precise capture is enabled if the feature gate `capture_disjoint_fields` is enabled or if
/// user is using Rust Edition 2021 or higher.
///
/// `span` is the span of the closure.
fn enable_precise_capture(tcx: TyCtxt<'_>, span: Span) -> bool {
// We use span here to ensure that if the closure was generated by a macro with a different
// edition.
tcx.features().capture_disjoint_fields || span.rust_2021()
}

This file was deleted.

This file was deleted.

38 changes: 0 additions & 38 deletions src/test/ui/closures/2229_closure_analysis/by_value.rs

This file was deleted.

63 changes: 0 additions & 63 deletions src/test/ui/closures/2229_closure_analysis/by_value.stderr

This file was deleted.

33 changes: 0 additions & 33 deletions src/test/ui/closures/2229_closure_analysis/capture-analysis-1.rs

This file was deleted.

This file was deleted.

28 changes: 0 additions & 28 deletions src/test/ui/closures/2229_closure_analysis/capture-analysis-2.rs

This file was deleted.