Improve terminology around "after typeck"
This commit is contained in:
parent
089a016919
commit
521b1ee974
13 changed files with 20 additions and 18 deletions
|
@ -200,7 +200,7 @@ pub struct InferCtxtInner<'tcx> {
|
||||||
// Opaque types found in explicit return types and their
|
// Opaque types found in explicit return types and their
|
||||||
// associated fresh inference variable. Writeback resolves these
|
// associated fresh inference variable. Writeback resolves these
|
||||||
// variables to get the concrete type, which can be used to
|
// variables to get the concrete type, which can be used to
|
||||||
// 'de-opaque' OpaqueTypeDecl, after typeck is done with all functions.
|
// 'de-opaque' OpaqueTypeDecl outside of type inference.
|
||||||
pub opaque_types: OpaqueTypeMap<'tcx>,
|
pub opaque_types: OpaqueTypeMap<'tcx>,
|
||||||
|
|
||||||
/// A map from inference variables created from opaque
|
/// A map from inference variables created from opaque
|
||||||
|
|
|
@ -523,7 +523,7 @@ impl LintStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Context for lint checking after type checking.
|
/// Context for lint checking outside of type inference.
|
||||||
pub struct LateContext<'tcx> {
|
pub struct LateContext<'tcx> {
|
||||||
/// Type context we're checking in.
|
/// Type context we're checking in.
|
||||||
pub tcx: TyCtxt<'tcx>,
|
pub tcx: TyCtxt<'tcx>,
|
||||||
|
|
|
@ -864,7 +864,7 @@ pub struct LocalDecl<'tcx> {
|
||||||
/// across a suspension point against the type components of the generator
|
/// across a suspension point against the type components of the generator
|
||||||
/// which type checking knows are live across a suspension point. We need to
|
/// which type checking knows are live across a suspension point. We need to
|
||||||
/// flag drop flags to avoid triggering this check as they are introduced
|
/// flag drop flags to avoid triggering this check as they are introduced
|
||||||
/// after typeck.
|
/// outside of type inference.
|
||||||
///
|
///
|
||||||
/// This should be sound because the drop flags are fully algebraic, and
|
/// This should be sound because the drop flags are fully algebraic, and
|
||||||
/// therefore don't affect the auto-trait or outlives properties of the
|
/// therefore don't affect the auto-trait or outlives properties of the
|
||||||
|
|
|
@ -211,7 +211,7 @@ pub struct CommonLifetimes<'tcx> {
|
||||||
/// `ReStatic`
|
/// `ReStatic`
|
||||||
pub re_static: Region<'tcx>,
|
pub re_static: Region<'tcx>,
|
||||||
|
|
||||||
/// Erased region, used after type-checking
|
/// Erased region, used outside of type inference.
|
||||||
pub re_erased: Region<'tcx>,
|
pub re_erased: Region<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ pub struct TypeckResults<'tcx> {
|
||||||
field_indices: ItemLocalMap<usize>,
|
field_indices: ItemLocalMap<usize>,
|
||||||
|
|
||||||
/// Stores the types for various nodes in the AST. Note that this table
|
/// Stores the types for various nodes in the AST. Note that this table
|
||||||
/// is not guaranteed to be populated until after typeck. See
|
/// is not guaranteed to be populated outside inference. See
|
||||||
/// typeck::check::fn_ctxt for details.
|
/// typeck::check::fn_ctxt for details.
|
||||||
node_types: ItemLocalMap<Ty<'tcx>>,
|
node_types: ItemLocalMap<Ty<'tcx>>,
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
/// Erase the regions in `value` and then fully normalize all the
|
/// Erase the regions in `value` and then fully normalize all the
|
||||||
/// types found within. The result will also have regions erased.
|
/// types found within. The result will also have regions erased.
|
||||||
///
|
///
|
||||||
/// This is appropriate to use only after type-check: it assumes
|
/// This should only be used outside of type inference. For example,
|
||||||
/// that normalization will succeed, for example.
|
/// it assumes that normalization will succeed.
|
||||||
pub fn normalize_erasing_regions<T>(self, param_env: ty::ParamEnv<'tcx>, value: T) -> T
|
pub fn normalize_erasing_regions<T>(self, param_env: ty::ParamEnv<'tcx>, value: T) -> T
|
||||||
where
|
where
|
||||||
T: TypeFoldable<'tcx>,
|
T: TypeFoldable<'tcx>,
|
||||||
|
|
|
@ -1391,11 +1391,11 @@ pub enum RegionKind {
|
||||||
/// Static data that has an "infinite" lifetime. Top in the region lattice.
|
/// Static data that has an "infinite" lifetime. Top in the region lattice.
|
||||||
ReStatic,
|
ReStatic,
|
||||||
|
|
||||||
/// A region variable. Should not exist after typeck.
|
/// A region variable. Should not exist outside of type inference.
|
||||||
ReVar(RegionVid),
|
ReVar(RegionVid),
|
||||||
|
|
||||||
/// A placeholder region -- basically, the higher-ranked version of `ReFree`.
|
/// A placeholder region -- basically, the higher-ranked version of `ReFree`.
|
||||||
/// Should not exist after typeck.
|
/// Should not exist outside of type inference.
|
||||||
RePlaceholder(ty::PlaceholderRegion),
|
RePlaceholder(ty::PlaceholderRegion),
|
||||||
|
|
||||||
/// Empty lifetime is for data that is never accessed. We tag the
|
/// Empty lifetime is for data that is never accessed. We tag the
|
||||||
|
|
|
@ -985,7 +985,7 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>(
|
||||||
tcx.dep_graph.with_ignore(|| {
|
tcx.dep_graph.with_ignore(|| {
|
||||||
info!("Dumping crate {}", cratename);
|
info!("Dumping crate {}", cratename);
|
||||||
|
|
||||||
// Privacy checking requires and is done after type checking; use a
|
// Privacy checking must be done outside of type inference; use a
|
||||||
// fallback in case the access levels couldn't have been correctly computed.
|
// fallback in case the access levels couldn't have been correctly computed.
|
||||||
let access_levels = match tcx.sess.compile_status() {
|
let access_levels = match tcx.sess.compile_status() {
|
||||||
Ok(..) => tcx.privacy_access_levels(()),
|
Ok(..) => tcx.privacy_access_levels(()),
|
||||||
|
|
|
@ -414,7 +414,7 @@ impl InlineAsmRegClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a suggested register class to use for this type. This is called
|
/// Returns a suggested register class to use for this type. This is called
|
||||||
/// after type checking via `supported_types` fails to give a better error
|
/// when `supported_types` fails to give a better error
|
||||||
/// message to the user.
|
/// message to the user.
|
||||||
pub fn suggest_class(self, arch: InlineAsmArch, ty: InlineAsmType) -> Option<Self> {
|
pub fn suggest_class(self, arch: InlineAsmArch, ty: InlineAsmType) -> Option<Self> {
|
||||||
match self {
|
match self {
|
||||||
|
|
|
@ -18,7 +18,6 @@ use rustc_middle::ty::{self, TyCtxt};
|
||||||
/// that type check should guarantee to us that all nested
|
/// that type check should guarantee to us that all nested
|
||||||
/// obligations *could be* resolved if we wanted to.
|
/// obligations *could be* resolved if we wanted to.
|
||||||
///
|
///
|
||||||
/// Assumes that this is run after the entire crate has been successfully type-checked.
|
|
||||||
/// This also expects that `trait_ref` is fully normalized.
|
/// This also expects that `trait_ref` is fully normalized.
|
||||||
pub fn codegen_fulfill_obligation<'tcx>(
|
pub fn codegen_fulfill_obligation<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
|
@ -101,7 +100,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
|
||||||
/// Finishes processes any obligations that remain in the
|
/// Finishes processes any obligations that remain in the
|
||||||
/// fulfillment context, and then returns the result with all type
|
/// fulfillment context, and then returns the result with all type
|
||||||
/// variables removed and regions erased. Because this is intended
|
/// variables removed and regions erased. Because this is intended
|
||||||
/// for use after type-check has completed, if any errors occur,
|
/// for use outside of type inference, if any errors occur,
|
||||||
/// it will panic. It is used during normalization and other cases
|
/// it will panic. It is used during normalization and other cases
|
||||||
/// where processing the obligations in `fulfill_cx` may cause
|
/// where processing the obligations in `fulfill_cx` may cause
|
||||||
/// type inference variables that appear in `result` to be
|
/// type inference variables that appear in `result` to be
|
||||||
|
@ -123,7 +122,10 @@ where
|
||||||
if let Err(errors) = fulfill_cx.select_all_or_error(infcx) {
|
if let Err(errors) = fulfill_cx.select_all_or_error(infcx) {
|
||||||
infcx.tcx.sess.delay_span_bug(
|
infcx.tcx.sess.delay_span_bug(
|
||||||
rustc_span::DUMMY_SP,
|
rustc_span::DUMMY_SP,
|
||||||
&format!("Encountered errors `{:?}` resolving bounds after type-checking", errors),
|
&format!(
|
||||||
|
"Encountered errors `{:?}` resolving bounds outside of type inference",
|
||||||
|
errors
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ pub fn normalize_param_env_or_error<'tcx>(
|
||||||
//
|
//
|
||||||
// In any case, in practice, typeck constructs all the
|
// In any case, in practice, typeck constructs all the
|
||||||
// parameter environments once for every fn as it goes,
|
// parameter environments once for every fn as it goes,
|
||||||
// and errors will get reported then; so after typeck we
|
// and errors will get reported then; so outside of type inference we
|
||||||
// can be sure that no errors should occur.
|
// can be sure that no errors should occur.
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
|
|
|
@ -392,7 +392,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
|
||||||
// severe performance implications for large opaque types with
|
// severe performance implications for large opaque types with
|
||||||
// late-bound regions. See `issue-88862` benchmark.
|
// late-bound regions. See `issue-88862` benchmark.
|
||||||
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
|
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
|
||||||
// Only normalize `impl Trait` after type-checking, usually in codegen.
|
// Only normalize `impl Trait` outside of type inference, usually in codegen.
|
||||||
match self.param_env.reveal() {
|
match self.param_env.reveal() {
|
||||||
Reveal::UserFacing => ty.super_fold_with(self),
|
Reveal::UserFacing => ty.super_fold_with(self),
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
|
||||||
// severe performance implications for large opaque types with
|
// severe performance implications for large opaque types with
|
||||||
// late-bound regions. See `issue-88862` benchmark.
|
// late-bound regions. See `issue-88862` benchmark.
|
||||||
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
|
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
|
||||||
// Only normalize `impl Trait` after type-checking, usually in codegen.
|
// Only normalize `impl Trait` outside of type inference, usually in codegen.
|
||||||
match self.param_env.reveal() {
|
match self.param_env.reveal() {
|
||||||
Reveal::UserFacing => ty.super_fold_with(self),
|
Reveal::UserFacing => ty.super_fold_with(self),
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
|
||||||
// kind of an "idempotent" action, but I'm not sure where would be
|
// kind of an "idempotent" action, but I'm not sure where would be
|
||||||
// a better place. In practice, we construct environments for
|
// a better place. In practice, we construct environments for
|
||||||
// every fn once during type checking, and we'll abort if there
|
// every fn once during type checking, and we'll abort if there
|
||||||
// are any errors at that point, so after type checking you can be
|
// are any errors at that point, so outside of type inference you can be
|
||||||
// sure that this will succeed without errors anyway.
|
// sure that this will succeed without errors anyway.
|
||||||
|
|
||||||
if tcx.sess.opts.debugging_opts.chalk {
|
if tcx.sess.opts.debugging_opts.chalk {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue