Skip to content

Commit 521b1ee

Browse files
committed
Improve terminology around "after typeck"
1 parent 089a016 commit 521b1ee

File tree

13 files changed

+20
-18
lines changed

13 files changed

+20
-18
lines changed

Diff for: compiler/rustc_infer/src/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ pub struct InferCtxtInner<'tcx> {
200200
// Opaque types found in explicit return types and their
201201
// associated fresh inference variable. Writeback resolves these
202202
// variables to get the concrete type, which can be used to
203-
// 'de-opaque' OpaqueTypeDecl, after typeck is done with all functions.
203+
// 'de-opaque' OpaqueTypeDecl outside of type inference.
204204
pub opaque_types: OpaqueTypeMap<'tcx>,
205205

206206
/// A map from inference variables created from opaque

Diff for: compiler/rustc_lint/src/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl LintStore {
523523
}
524524
}
525525

526-
/// Context for lint checking after type checking.
526+
/// Context for lint checking outside of type inference.
527527
pub struct LateContext<'tcx> {
528528
/// Type context we're checking in.
529529
pub tcx: TyCtxt<'tcx>,

Diff for: compiler/rustc_middle/src/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ pub struct LocalDecl<'tcx> {
864864
/// across a suspension point against the type components of the generator
865865
/// which type checking knows are live across a suspension point. We need to
866866
/// flag drop flags to avoid triggering this check as they are introduced
867-
/// after typeck.
867+
/// outside of type inference.
868868
///
869869
/// This should be sound because the drop flags are fully algebraic, and
870870
/// therefore don't affect the auto-trait or outlives properties of the

Diff for: compiler/rustc_middle/src/ty/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub struct CommonLifetimes<'tcx> {
211211
/// `ReStatic`
212212
pub re_static: Region<'tcx>,
213213

214-
/// Erased region, used after type-checking
214+
/// Erased region, used outside of type inference.
215215
pub re_erased: Region<'tcx>,
216216
}
217217

@@ -351,7 +351,7 @@ pub struct TypeckResults<'tcx> {
351351
field_indices: ItemLocalMap<usize>,
352352

353353
/// Stores the types for various nodes in the AST. Note that this table
354-
/// is not guaranteed to be populated until after typeck. See
354+
/// is not guaranteed to be populated outside inference. See
355355
/// typeck::check::fn_ctxt for details.
356356
node_types: ItemLocalMap<Ty<'tcx>>,
357357

Diff for: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ impl<'tcx> TyCtxt<'tcx> {
1616
/// Erase the regions in `value` and then fully normalize all the
1717
/// types found within. The result will also have regions erased.
1818
///
19-
/// This is appropriate to use only after type-check: it assumes
20-
/// that normalization will succeed, for example.
19+
/// This should only be used outside of type inference. For example,
20+
/// it assumes that normalization will succeed.
2121
pub fn normalize_erasing_regions<T>(self, param_env: ty::ParamEnv<'tcx>, value: T) -> T
2222
where
2323
T: TypeFoldable<'tcx>,

Diff for: compiler/rustc_middle/src/ty/sty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1391,11 +1391,11 @@ pub enum RegionKind {
13911391
/// Static data that has an "infinite" lifetime. Top in the region lattice.
13921392
ReStatic,
13931393

1394-
/// A region variable. Should not exist after typeck.
1394+
/// A region variable. Should not exist outside of type inference.
13951395
ReVar(RegionVid),
13961396

13971397
/// A placeholder region -- basically, the higher-ranked version of `ReFree`.
1398-
/// Should not exist after typeck.
1398+
/// Should not exist outside of type inference.
13991399
RePlaceholder(ty::PlaceholderRegion),
14001400

14011401
/// Empty lifetime is for data that is never accessed. We tag the

Diff for: compiler/rustc_save_analysis/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>(
985985
tcx.dep_graph.with_ignore(|| {
986986
info!("Dumping crate {}", cratename);
987987

988-
// Privacy checking requires and is done after type checking; use a
988+
// Privacy checking must be done outside of type inference; use a
989989
// fallback in case the access levels couldn't have been correctly computed.
990990
let access_levels = match tcx.sess.compile_status() {
991991
Ok(..) => tcx.privacy_access_levels(()),

Diff for: compiler/rustc_target/src/asm/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ impl InlineAsmRegClass {
414414
}
415415

416416
/// Returns a suggested register class to use for this type. This is called
417-
/// after type checking via `supported_types` fails to give a better error
417+
/// when `supported_types` fails to give a better error
418418
/// message to the user.
419419
pub fn suggest_class(self, arch: InlineAsmArch, ty: InlineAsmType) -> Option<Self> {
420420
match self {

Diff for: compiler/rustc_trait_selection/src/traits/codegen.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use rustc_middle::ty::{self, TyCtxt};
1818
/// that type check should guarantee to us that all nested
1919
/// obligations *could be* resolved if we wanted to.
2020
///
21-
/// Assumes that this is run after the entire crate has been successfully type-checked.
2221
/// This also expects that `trait_ref` is fully normalized.
2322
pub fn codegen_fulfill_obligation<'tcx>(
2423
tcx: TyCtxt<'tcx>,
@@ -101,7 +100,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
101100
/// Finishes processes any obligations that remain in the
102101
/// fulfillment context, and then returns the result with all type
103102
/// variables removed and regions erased. Because this is intended
104-
/// for use after type-check has completed, if any errors occur,
103+
/// for use outside of type inference, if any errors occur,
105104
/// it will panic. It is used during normalization and other cases
106105
/// where processing the obligations in `fulfill_cx` may cause
107106
/// type inference variables that appear in `result` to be
@@ -123,7 +122,10 @@ where
123122
if let Err(errors) = fulfill_cx.select_all_or_error(infcx) {
124123
infcx.tcx.sess.delay_span_bug(
125124
rustc_span::DUMMY_SP,
126-
&format!("Encountered errors `{:?}` resolving bounds after type-checking", errors),
125+
&format!(
126+
"Encountered errors `{:?}` resolving bounds outside of type inference",
127+
errors
128+
),
127129
);
128130
}
129131

Diff for: compiler/rustc_trait_selection/src/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ pub fn normalize_param_env_or_error<'tcx>(
295295
//
296296
// In any case, in practice, typeck constructs all the
297297
// parameter environments once for every fn as it goes,
298-
// and errors will get reported then; so after typeck we
298+
// and errors will get reported then; so outside of type inference we
299299
// can be sure that no errors should occur.
300300

301301
debug!(

Diff for: compiler/rustc_trait_selection/src/traits/project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
392392
// severe performance implications for large opaque types with
393393
// late-bound regions. See `issue-88862` benchmark.
394394
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
395-
// Only normalize `impl Trait` after type-checking, usually in codegen.
395+
// Only normalize `impl Trait` outside of type inference, usually in codegen.
396396
match self.param_env.reveal() {
397397
Reveal::UserFacing => ty.super_fold_with(self),
398398

Diff for: compiler/rustc_trait_selection/src/traits/query/normalize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
210210
// severe performance implications for large opaque types with
211211
// late-bound regions. See `issue-88862` benchmark.
212212
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
213-
// Only normalize `impl Trait` after type-checking, usually in codegen.
213+
// Only normalize `impl Trait` outside of type inference, usually in codegen.
214214
match self.param_env.reveal() {
215215
Reveal::UserFacing => ty.super_fold_with(self),
216216

Diff for: compiler/rustc_ty_utils/src/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
267267
// kind of an "idempotent" action, but I'm not sure where would be
268268
// a better place. In practice, we construct environments for
269269
// every fn once during type checking, and we'll abort if there
270-
// are any errors at that point, so after type checking you can be
270+
// are any errors at that point, so outside of type inference you can be
271271
// sure that this will succeed without errors anyway.
272272

273273
if tcx.sess.opts.debugging_opts.chalk {

0 commit comments

Comments
 (0)