Skip to content

Commit f8e0e78

Browse files
committed
Rename NLL* to Nll* accordingly to C-CASE
1 parent e32f372 commit f8e0e78

File tree

11 files changed

+71
-71
lines changed

11 files changed

+71
-71
lines changed

compiler/rustc_infer/src/infer/canonical/query_response.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::infer::canonical::{
1414
};
1515
use crate::infer::nll_relate::{NormalizationStrategy, TypeRelating, TypeRelatingDelegate};
1616
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
17-
use crate::infer::{InferCtxt, InferOk, InferResult, NLLRegionVariableOrigin};
17+
use crate::infer::{InferCtxt, InferOk, InferResult, NllRegionVariableOrigin};
1818
use crate::traits::query::{Fallible, NoSolution};
1919
use crate::traits::TraitEngine;
2020
use crate::traits::{Obligation, ObligationCause, PredicateObligation};
@@ -644,7 +644,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
644644
}
645645

646646
fn next_existential_region_var(&mut self, from_forall: bool) -> ty::Region<'tcx> {
647-
let origin = NLLRegionVariableOrigin::Existential { from_forall };
647+
let origin = NllRegionVariableOrigin::Existential { from_forall };
648648
self.infcx.next_nll_region_var(origin)
649649
}
650650

@@ -654,7 +654,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
654654

655655
fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
656656
self.infcx.next_nll_region_var_in_universe(
657-
NLLRegionVariableOrigin::Existential { from_forall: false },
657+
NllRegionVariableOrigin::Existential { from_forall: false },
658658
universe,
659659
)
660660
}

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
23422342
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
23432343
format!(" for capture of `{}` by closure", var_name)
23442344
}
2345-
infer::NLL(..) => bug!("NLL variable found in lexical phase"),
2345+
infer::Nll(..) => bug!("NLL variable found in lexical phase"),
23462346
};
23472347

23482348
struct_span_err!(

compiler/rustc_infer/src/infer/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,11 @@ pub enum RegionVariableOrigin {
458458

459459
/// This origin is used for the inference variables that we create
460460
/// during NLL region processing.
461-
NLL(NLLRegionVariableOrigin),
461+
Nll(NllRegionVariableOrigin),
462462
}
463463

464464
#[derive(Copy, Clone, Debug)]
465-
pub enum NLLRegionVariableOrigin {
465+
pub enum NllRegionVariableOrigin {
466466
/// During NLL region processing, we create variables for free
467467
/// regions that we encounter in the function signature and
468468
/// elsewhere. This origin indices we've got one of those.
@@ -1078,17 +1078,17 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
10781078
}
10791079

10801080
/// Just a convenient wrapper of `next_region_var` for using during NLL.
1081-
pub fn next_nll_region_var(&self, origin: NLLRegionVariableOrigin) -> ty::Region<'tcx> {
1082-
self.next_region_var(RegionVariableOrigin::NLL(origin))
1081+
pub fn next_nll_region_var(&self, origin: NllRegionVariableOrigin) -> ty::Region<'tcx> {
1082+
self.next_region_var(RegionVariableOrigin::Nll(origin))
10831083
}
10841084

10851085
/// Just a convenient wrapper of `next_region_var` for using during NLL.
10861086
pub fn next_nll_region_var_in_universe(
10871087
&self,
1088-
origin: NLLRegionVariableOrigin,
1088+
origin: NllRegionVariableOrigin,
10891089
universe: ty::UniverseIndex,
10901090
) -> ty::Region<'tcx> {
1091-
self.next_region_var_in_universe(RegionVariableOrigin::NLL(origin), universe)
1091+
self.next_region_var_in_universe(RegionVariableOrigin::Nll(origin), universe)
10921092
}
10931093

10941094
pub fn var_for_def(&self, span: Span, param: &ty::GenericParamDef) -> GenericArg<'tcx> {
@@ -1770,7 +1770,7 @@ impl RegionVariableOrigin {
17701770
| LateBoundRegion(a, ..)
17711771
| UpvarRegion(_, a) => a,
17721772
BoundRegionInCoherence(_) => rustc_span::DUMMY_SP,
1773-
NLL(..) => bug!("NLL variable used with `span`"),
1773+
Nll(..) => bug!("NLL variable used with `span`"),
17741774
}
17751775
}
17761776
}

compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::collections::VecDeque;
55
use rustc_data_structures::fx::FxHashSet;
66
use rustc_errors::{Applicability, DiagnosticBuilder};
77
use rustc_index::vec::IndexVec;
8-
use rustc_infer::infer::NLLRegionVariableOrigin;
8+
use rustc_infer::infer::NllRegionVariableOrigin;
99
use rustc_middle::mir::{
1010
Body, CastKind, ConstraintCategory, FakeReadCause, Local, Location, Operand, Place, Rvalue,
1111
Statement, StatementKind, TerminatorKind,
@@ -258,7 +258,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
258258
let (category, from_closure, span) = self.regioncx.best_blame_constraint(
259259
&self.body,
260260
borrow_region,
261-
NLLRegionVariableOrigin::FreeRegion,
261+
NllRegionVariableOrigin::FreeRegion,
262262
|r| self.regioncx.provides_universal_region(r, borrow_region, outlived_region),
263263
);
264264

compiler/rustc_mir/src/borrow_check/diagnostics/region_errors.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use rustc_errors::{Applicability, DiagnosticBuilder};
44
use rustc_infer::infer::{
55
error_reporting::nice_region_error::NiceRegionError,
6-
error_reporting::unexpected_hidden_region_diagnostic, NLLRegionVariableOrigin,
6+
error_reporting::unexpected_hidden_region_diagnostic, NllRegionVariableOrigin,
77
};
88
use rustc_middle::mir::{ConstraintCategory, ReturnConstraint};
99
use rustc_middle::ty::subst::Subst;
@@ -75,13 +75,13 @@ crate enum RegionErrorKind<'tcx> {
7575
/// The region element that erroneously must be outlived by `longer_fr`.
7676
error_element: RegionElement,
7777
/// The origin of the placeholder region.
78-
fr_origin: NLLRegionVariableOrigin,
78+
fr_origin: NllRegionVariableOrigin,
7979
},
8080

8181
/// Any other lifetime error.
8282
RegionError {
8383
/// The origin of the region.
84-
fr_origin: NLLRegionVariableOrigin,
84+
fr_origin: NllRegionVariableOrigin,
8585
/// The region that should outlive `shorter_fr`.
8686
longer_fr: RegionVid,
8787
/// The region that should be shorter, but we can't prove it.
@@ -269,7 +269,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
269269
pub(in crate::borrow_check) fn report_region_error(
270270
&mut self,
271271
fr: RegionVid,
272-
fr_origin: NLLRegionVariableOrigin,
272+
fr_origin: NllRegionVariableOrigin,
273273
outlived_fr: RegionVid,
274274
outlives_suggestion: &mut OutlivesSuggestionBuilder,
275275
) {

compiler/rustc_mir/src/borrow_check/region_infer/dump_mir.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use super::{OutlivesConstraint, RegionInferenceContext};
77
use crate::borrow_check::type_check::Locations;
8-
use rustc_infer::infer::NLLRegionVariableOrigin;
8+
use rustc_infer::infer::NllRegionVariableOrigin;
99
use rustc_middle::ty::TyCtxt;
1010
use std::io::{self, Write};
1111

@@ -20,7 +20,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2020
writeln!(out, "| Free Region Mapping")?;
2121

2222
for region in self.regions() {
23-
if let NLLRegionVariableOrigin::FreeRegion = self.definitions[region].origin {
23+
if let NllRegionVariableOrigin::FreeRegion = self.definitions[region].origin {
2424
let classification = self.universal_regions.region_classification(region).unwrap();
2525
let outlived_by = self.universal_region_relations.regions_outlived_by(region);
2626
writeln!(

compiler/rustc_mir/src/borrow_check/region_infer/mod.rs

+34-34
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_hir::def_id::DefId;
99
use rustc_index::vec::IndexVec;
1010
use rustc_infer::infer::canonical::QueryOutlivesConstraint;
1111
use rustc_infer::infer::region_constraints::{GenericKind, VarInfos, VerifyBound};
12-
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin, RegionVariableOrigin};
12+
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin};
1313
use rustc_middle::mir::{
1414
Body, ClosureOutlivesRequirement, ClosureOutlivesSubject, ClosureRegionRequirements,
1515
ConstraintCategory, Local, Location, ReturnConstraint,
@@ -143,9 +143,9 @@ pub(crate) struct AppliedMemberConstraint {
143143

144144
pub(crate) struct RegionDefinition<'tcx> {
145145
/// What kind of variable is this -- a free region? existential
146-
/// variable? etc. (See the `NLLRegionVariableOrigin` for more
146+
/// variable? etc. (See the `NllRegionVariableOrigin` for more
147147
/// info.)
148-
pub(in crate::borrow_check) origin: NLLRegionVariableOrigin,
148+
pub(in crate::borrow_check) origin: NllRegionVariableOrigin,
149149

150150
/// Which universe is this region variable defined in? This is
151151
/// most often `ty::UniverseIndex::ROOT`, but when we encounter
@@ -451,7 +451,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
451451
let scc = self.constraint_sccs.scc(variable);
452452

453453
match self.definitions[variable].origin {
454-
NLLRegionVariableOrigin::FreeRegion => {
454+
NllRegionVariableOrigin::FreeRegion => {
455455
// For each free, universally quantified region X:
456456

457457
// Add all nodes in the CFG to liveness constraints
@@ -462,7 +462,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
462462
self.scc_values.add_element(scc, variable);
463463
}
464464

465-
NLLRegionVariableOrigin::Placeholder(placeholder) => {
465+
NllRegionVariableOrigin::Placeholder(placeholder) => {
466466
// Each placeholder region is only visible from
467467
// its universe `ui` and its extensions. So we
468468
// can't just add it into `scc` unless the
@@ -480,8 +480,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
480480
}
481481
}
482482

483-
NLLRegionVariableOrigin::RootEmptyRegion
484-
| NLLRegionVariableOrigin::Existential { .. } => {
483+
NllRegionVariableOrigin::RootEmptyRegion
484+
| NllRegionVariableOrigin::Existential { .. } => {
485485
// For existential, regions, nothing to do.
486486
}
487487
}
@@ -1348,7 +1348,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13481348
) {
13491349
for (fr, fr_definition) in self.definitions.iter_enumerated() {
13501350
match fr_definition.origin {
1351-
NLLRegionVariableOrigin::FreeRegion => {
1351+
NllRegionVariableOrigin::FreeRegion => {
13521352
// Go through each of the universal regions `fr` and check that
13531353
// they did not grow too large, accumulating any requirements
13541354
// for our caller into the `outlives_requirements` vector.
@@ -1360,12 +1360,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13601360
);
13611361
}
13621362

1363-
NLLRegionVariableOrigin::Placeholder(placeholder) => {
1363+
NllRegionVariableOrigin::Placeholder(placeholder) => {
13641364
self.check_bound_universal_region(fr, placeholder, errors_buffer);
13651365
}
13661366

1367-
NLLRegionVariableOrigin::RootEmptyRegion
1368-
| NLLRegionVariableOrigin::Existential { .. } => {
1367+
NllRegionVariableOrigin::RootEmptyRegion
1368+
| NllRegionVariableOrigin::Existential { .. } => {
13691369
// nothing to check here
13701370
}
13711371
}
@@ -1449,7 +1449,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
14491449
errors_buffer.push(RegionErrorKind::RegionError {
14501450
longer_fr: *longer_fr,
14511451
shorter_fr: *shorter_fr,
1452-
fr_origin: NLLRegionVariableOrigin::FreeRegion,
1452+
fr_origin: NllRegionVariableOrigin::FreeRegion,
14531453
is_reported: true,
14541454
});
14551455
}
@@ -1459,16 +1459,16 @@ impl<'tcx> RegionInferenceContext<'tcx> {
14591459
// a more complete picture on how to separate this responsibility.
14601460
for (fr, fr_definition) in self.definitions.iter_enumerated() {
14611461
match fr_definition.origin {
1462-
NLLRegionVariableOrigin::FreeRegion => {
1462+
NllRegionVariableOrigin::FreeRegion => {
14631463
// handled by polonius above
14641464
}
14651465

1466-
NLLRegionVariableOrigin::Placeholder(placeholder) => {
1466+
NllRegionVariableOrigin::Placeholder(placeholder) => {
14671467
self.check_bound_universal_region(fr, placeholder, errors_buffer);
14681468
}
14691469

1470-
NLLRegionVariableOrigin::RootEmptyRegion
1471-
| NLLRegionVariableOrigin::Existential { .. } => {
1470+
NllRegionVariableOrigin::RootEmptyRegion
1471+
| NllRegionVariableOrigin::Existential { .. } => {
14721472
// nothing to check here
14731473
}
14741474
}
@@ -1516,7 +1516,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
15161516
errors_buffer.push(RegionErrorKind::RegionError {
15171517
longer_fr,
15181518
shorter_fr: representative,
1519-
fr_origin: NLLRegionVariableOrigin::FreeRegion,
1519+
fr_origin: NllRegionVariableOrigin::FreeRegion,
15201520
is_reported: true,
15211521
});
15221522
}
@@ -1539,7 +1539,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
15391539
errors_buffer.push(RegionErrorKind::RegionError {
15401540
longer_fr,
15411541
shorter_fr,
1542-
fr_origin: NLLRegionVariableOrigin::FreeRegion,
1542+
fr_origin: NllRegionVariableOrigin::FreeRegion,
15431543
is_reported: !error_reported,
15441544
});
15451545

@@ -1597,7 +1597,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
15971597
let blame_span_category = self.find_outlives_blame_span(
15981598
body,
15991599
longer_fr,
1600-
NLLRegionVariableOrigin::FreeRegion,
1600+
NllRegionVariableOrigin::FreeRegion,
16011601
shorter_fr,
16021602
);
16031603

@@ -1656,7 +1656,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
16561656
errors_buffer.push(RegionErrorKind::BoundUniversalRegionError {
16571657
longer_fr,
16581658
error_element,
1659-
fr_origin: NLLRegionVariableOrigin::Placeholder(placeholder),
1659+
fr_origin: NllRegionVariableOrigin::Placeholder(placeholder),
16601660
});
16611661
}
16621662

@@ -1732,7 +1732,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
17321732
debug!("cannot_name_value_of(r1={:?}, r2={:?})", r1, r2);
17331733

17341734
match self.definitions[r2].origin {
1735-
NLLRegionVariableOrigin::Placeholder(placeholder) => {
1735+
NllRegionVariableOrigin::Placeholder(placeholder) => {
17361736
let universe1 = self.definitions[r1].universe;
17371737
debug!(
17381738
"cannot_name_value_of: universe1={:?} placeholder={:?}",
@@ -1741,9 +1741,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
17411741
universe1.cannot_name(placeholder.universe)
17421742
}
17431743

1744-
NLLRegionVariableOrigin::RootEmptyRegion
1745-
| NLLRegionVariableOrigin::FreeRegion
1746-
| NLLRegionVariableOrigin::Existential { .. } => false,
1744+
NllRegionVariableOrigin::RootEmptyRegion
1745+
| NllRegionVariableOrigin::FreeRegion
1746+
| NllRegionVariableOrigin::Existential { .. } => false,
17471747
}
17481748
}
17491749

@@ -1771,7 +1771,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
17711771
&self,
17721772
body: &Body<'tcx>,
17731773
fr1: RegionVid,
1774-
fr1_origin: NLLRegionVariableOrigin,
1774+
fr1_origin: NllRegionVariableOrigin,
17751775
fr2: RegionVid,
17761776
) -> (ConstraintCategory, Span) {
17771777
let (category, _, span) = self.best_blame_constraint(body, fr1, fr1_origin, |r| {
@@ -1933,7 +1933,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
19331933
.definitions
19341934
.iter_enumerated()
19351935
.find_map(|(r, definition)| match definition.origin {
1936-
NLLRegionVariableOrigin::Placeholder(p) if p == error_placeholder => Some(r),
1936+
NllRegionVariableOrigin::Placeholder(p) if p == error_placeholder => Some(r),
19371937
_ => None,
19381938
})
19391939
.unwrap(),
@@ -1965,7 +1965,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
19651965
&self,
19661966
body: &Body<'tcx>,
19671967
from_region: RegionVid,
1968-
from_region_origin: NLLRegionVariableOrigin,
1968+
from_region_origin: NllRegionVariableOrigin,
19691969
target_test: impl Fn(RegionVid) -> bool,
19701970
) -> (ConstraintCategory, bool, Span) {
19711971
debug!(
@@ -2059,11 +2059,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
20592059
//
20602060
// and here we prefer to blame the source (the y = x statement).
20612061
let blame_source = match from_region_origin {
2062-
NLLRegionVariableOrigin::FreeRegion
2063-
| NLLRegionVariableOrigin::Existential { from_forall: false } => true,
2064-
NLLRegionVariableOrigin::RootEmptyRegion
2065-
| NLLRegionVariableOrigin::Placeholder(_)
2066-
| NLLRegionVariableOrigin::Existential { from_forall: true } => false,
2062+
NllRegionVariableOrigin::FreeRegion
2063+
| NllRegionVariableOrigin::Existential { from_forall: false } => true,
2064+
NllRegionVariableOrigin::RootEmptyRegion
2065+
| NllRegionVariableOrigin::Placeholder(_)
2066+
| NllRegionVariableOrigin::Existential { from_forall: true } => false,
20672067
};
20682068

20692069
let find_region = |i: &usize| {
@@ -2144,8 +2144,8 @@ impl<'tcx> RegionDefinition<'tcx> {
21442144
// `init_universal_regions`.
21452145

21462146
let origin = match rv_origin {
2147-
RegionVariableOrigin::NLL(origin) => origin,
2148-
_ => NLLRegionVariableOrigin::Existential { from_forall: false },
2147+
RegionVariableOrigin::Nll(origin) => origin,
2148+
_ => NllRegionVariableOrigin::Existential { from_forall: false },
21492149
};
21502150

21512151
Self { origin, universe, external_name: None }

0 commit comments

Comments
 (0)