mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
replace has_local_value
with needs_infer
This commit is contained in:
parent
969c145f96
commit
03d66a06e4
@ -1 +0,0 @@
|
|||||||
Subproject commit 5bd60bc51efaec04e69e2e18b59678e2af066433
|
|
@ -488,12 +488,12 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
|
|||||||
V: TypeFoldable<'tcx>,
|
V: TypeFoldable<'tcx>,
|
||||||
{
|
{
|
||||||
let needs_canonical_flags = if canonicalize_region_mode.any() {
|
let needs_canonical_flags = if canonicalize_region_mode.any() {
|
||||||
TypeFlags::KEEP_IN_LOCAL_TCX |
|
TypeFlags::NEEDS_INFER |
|
||||||
TypeFlags::HAS_FREE_REGIONS | // `HAS_RE_PLACEHOLDER` implies `HAS_FREE_REGIONS`
|
TypeFlags::HAS_FREE_REGIONS | // `HAS_RE_PLACEHOLDER` implies `HAS_FREE_REGIONS`
|
||||||
TypeFlags::HAS_TY_PLACEHOLDER |
|
TypeFlags::HAS_TY_PLACEHOLDER |
|
||||||
TypeFlags::HAS_CT_PLACEHOLDER
|
TypeFlags::HAS_CT_PLACEHOLDER
|
||||||
} else {
|
} else {
|
||||||
TypeFlags::KEEP_IN_LOCAL_TCX
|
TypeFlags::NEEDS_INFER
|
||||||
| TypeFlags::HAS_RE_PLACEHOLDER
|
| TypeFlags::HAS_RE_PLACEHOLDER
|
||||||
| TypeFlags::HAS_TY_PLACEHOLDER
|
| TypeFlags::HAS_TY_PLACEHOLDER
|
||||||
| TypeFlags::HAS_CT_PLACEHOLDER
|
| TypeFlags::HAS_CT_PLACEHOLDER
|
||||||
@ -524,7 +524,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
|
|||||||
// Once we have canonicalized `out_value`, it should not
|
// Once we have canonicalized `out_value`, it should not
|
||||||
// contain anything that ties it to this inference context
|
// contain anything that ties it to this inference context
|
||||||
// anymore, so it should live in the global arena.
|
// anymore, so it should live in the global arena.
|
||||||
debug_assert!(!out_value.has_type_flags(TypeFlags::KEEP_IN_LOCAL_TCX));
|
debug_assert!(!out_value.needs_infer());
|
||||||
|
|
||||||
let canonical_variables = tcx.intern_canonical_var_infos(&canonicalizer.variables);
|
let canonical_variables = tcx.intern_canonical_var_infos(&canonicalizer.variables);
|
||||||
|
|
||||||
|
@ -181,10 +181,8 @@ impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
||||||
if !t.needs_infer() && !ty::keep_local(&t) {
|
if !t.needs_infer() {
|
||||||
t // micro-optimize -- if there is nothing in this type that this fold affects...
|
t // micro-optimize -- if there is nothing in this type that this fold affects...
|
||||||
// ^ we need to have the `keep_local` check to un-default
|
|
||||||
// defaulted tuples.
|
|
||||||
} else {
|
} else {
|
||||||
let t = self.infcx.shallow_resolve(t);
|
let t = self.infcx.shallow_resolve(t);
|
||||||
match t.kind {
|
match t.kind {
|
||||||
@ -222,10 +220,8 @@ impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fold_const(&mut self, c: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> {
|
fn fold_const(&mut self, c: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> {
|
||||||
if !c.needs_infer() && !ty::keep_local(&c) {
|
if !c.needs_infer() {
|
||||||
c // micro-optimize -- if there is nothing in this const that this fold affects...
|
c // micro-optimize -- if there is nothing in this const that this fold affects...
|
||||||
// ^ we need to have the `keep_local` check to un-default
|
|
||||||
// defaulted tuples.
|
|
||||||
} else {
|
} else {
|
||||||
let c = self.infcx.shallow_resolve(c);
|
let c = self.infcx.shallow_resolve(c);
|
||||||
match c.val {
|
match c.val {
|
||||||
|
@ -2065,10 +2065,6 @@ macro_rules! direct_interners {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool {
|
|
||||||
x.has_type_flags(ty::TypeFlags::KEEP_IN_LOCAL_TCX)
|
|
||||||
}
|
|
||||||
|
|
||||||
direct_interners!(
|
direct_interners!(
|
||||||
region: mk_region(RegionKind),
|
region: mk_region(RegionKind),
|
||||||
goal: mk_goal(GoalKind<'tcx>),
|
goal: mk_goal(GoalKind<'tcx>),
|
||||||
|
@ -40,7 +40,7 @@ impl TypeFolder<'tcx> for RegionEraserVisitor<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||||
if ty.has_local_value() { ty.super_fold_with(self) } else { self.tcx.erase_regions_ty(ty) }
|
if ty.needs_infer() { ty.super_fold_with(self) } else { self.tcx.erase_regions_ty(ty) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fold_binder<T>(&mut self, t: &ty::Binder<T>) -> ty::Binder<T>
|
fn fold_binder<T>(&mut self, t: &ty::Binder<T>) -> ty::Binder<T>
|
||||||
|
@ -114,8 +114,7 @@ impl FlagComputation {
|
|||||||
ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_) => {}
|
ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_) => {}
|
||||||
|
|
||||||
ty::TyVar(_) | ty::IntVar(_) | ty::FloatVar(_) => {
|
ty::TyVar(_) | ty::IntVar(_) | ty::FloatVar(_) => {
|
||||||
self.add_flags(TypeFlags::HAS_TY_INFER);
|
self.add_flags(TypeFlags::HAS_TY_INFER)
|
||||||
self.add_flags(TypeFlags::KEEP_IN_LOCAL_TCX)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,10 +223,7 @@ impl FlagComputation {
|
|||||||
self.add_flags(TypeFlags::STILL_FURTHER_SPECIALIZABLE);
|
self.add_flags(TypeFlags::STILL_FURTHER_SPECIALIZABLE);
|
||||||
match infer {
|
match infer {
|
||||||
InferConst::Fresh(_) => {}
|
InferConst::Fresh(_) => {}
|
||||||
InferConst::Var(_) => {
|
InferConst::Var(_) => self.add_flags(TypeFlags::HAS_CT_INFER),
|
||||||
self.add_flags(TypeFlags::HAS_CT_INFER);
|
|
||||||
self.add_flags(TypeFlags::KEEP_IN_LOCAL_TCX)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::ConstKind::Bound(debruijn, _) => {
|
ty::ConstKind::Bound(debruijn, _) => {
|
||||||
|
@ -96,9 +96,6 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
|
|||||||
fn has_infer_consts(&self) -> bool {
|
fn has_infer_consts(&self) -> bool {
|
||||||
self.has_type_flags(TypeFlags::HAS_CT_INFER)
|
self.has_type_flags(TypeFlags::HAS_CT_INFER)
|
||||||
}
|
}
|
||||||
fn has_local_value(&self) -> bool {
|
|
||||||
self.has_type_flags(TypeFlags::KEEP_IN_LOCAL_TCX)
|
|
||||||
}
|
|
||||||
fn needs_infer(&self) -> bool {
|
fn needs_infer(&self) -> bool {
|
||||||
self.has_type_flags(TypeFlags::NEEDS_INFER)
|
self.has_type_flags(TypeFlags::NEEDS_INFER)
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ pub use crate::ty::diagnostics::*;
|
|||||||
pub use self::binding::BindingMode;
|
pub use self::binding::BindingMode;
|
||||||
pub use self::binding::BindingMode::*;
|
pub use self::binding::BindingMode::*;
|
||||||
|
|
||||||
pub use self::context::{keep_local, tls, FreeRegionInfo, TyCtxt};
|
pub use self::context::{tls, FreeRegionInfo, TyCtxt};
|
||||||
pub use self::context::{
|
pub use self::context::{
|
||||||
CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, ResolvedOpaqueTy,
|
CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, ResolvedOpaqueTy,
|
||||||
UserType, UserTypeAnnotationIndex,
|
UserType, UserTypeAnnotationIndex,
|
||||||
@ -577,27 +577,23 @@ bitflags! {
|
|||||||
| TypeFlags::HAS_TY_OPAQUE.bits
|
| TypeFlags::HAS_TY_OPAQUE.bits
|
||||||
| TypeFlags::HAS_CT_PROJECTION.bits;
|
| TypeFlags::HAS_CT_PROJECTION.bits;
|
||||||
|
|
||||||
/// Present if the type belongs in a local type context.
|
|
||||||
/// Set for placeholders and inference variables that are not "Fresh".
|
|
||||||
const KEEP_IN_LOCAL_TCX = 1 << 13;
|
|
||||||
|
|
||||||
/// Is an error type reachable?
|
/// Is an error type reachable?
|
||||||
const HAS_TY_ERR = 1 << 14;
|
const HAS_TY_ERR = 1 << 13;
|
||||||
|
|
||||||
/// Does this have any region that "appears free" in the type?
|
/// Does this have any region that "appears free" in the type?
|
||||||
/// Basically anything but [ReLateBound] and [ReErased].
|
/// Basically anything but [ReLateBound] and [ReErased].
|
||||||
const HAS_FREE_REGIONS = 1 << 15;
|
const HAS_FREE_REGIONS = 1 << 14;
|
||||||
|
|
||||||
/// Does this have any [ReLateBound] regions? Used to check
|
/// Does this have any [ReLateBound] regions? Used to check
|
||||||
/// if a global bound is safe to evaluate.
|
/// if a global bound is safe to evaluate.
|
||||||
const HAS_RE_LATE_BOUND = 1 << 16;
|
const HAS_RE_LATE_BOUND = 1 << 15;
|
||||||
|
|
||||||
/// Does this have any [ReErased] regions?
|
/// Does this have any [ReErased] regions?
|
||||||
const HAS_RE_ERASED = 1 << 17;
|
const HAS_RE_ERASED = 1 << 16;
|
||||||
|
|
||||||
/// Does this value have parameters/placeholders/inference variables which could be
|
/// Does this value have parameters/placeholders/inference variables which could be
|
||||||
/// replaced later, in a way that would change the results of `impl` specialization?
|
/// replaced later, in a way that would change the results of `impl` specialization?
|
||||||
const STILL_FURTHER_SPECIALIZABLE = 1 << 18;
|
const STILL_FURTHER_SPECIALIZABLE = 1 << 17;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
|
|||||||
let tcx = relation.tcx();
|
let tcx = relation.tcx();
|
||||||
|
|
||||||
let eagerly_eval = |x: &'tcx ty::Const<'tcx>| {
|
let eagerly_eval = |x: &'tcx ty::Const<'tcx>| {
|
||||||
if !x.val.has_local_value() {
|
if !x.val.needs_infer() {
|
||||||
return x.eval(tcx, relation.param_env()).val;
|
return x.eval(tcx, relation.param_env()).val;
|
||||||
}
|
}
|
||||||
x.val
|
x.val
|
||||||
|
@ -1605,7 +1605,6 @@ impl RegionKind {
|
|||||||
flags = flags | TypeFlags::HAS_FREE_REGIONS;
|
flags = flags | TypeFlags::HAS_FREE_REGIONS;
|
||||||
flags = flags | TypeFlags::HAS_FREE_LOCAL_REGIONS;
|
flags = flags | TypeFlags::HAS_FREE_LOCAL_REGIONS;
|
||||||
flags = flags | TypeFlags::HAS_RE_INFER;
|
flags = flags | TypeFlags::HAS_RE_INFER;
|
||||||
flags = flags | TypeFlags::KEEP_IN_LOCAL_TCX;
|
|
||||||
flags = flags | TypeFlags::STILL_FURTHER_SPECIALIZABLE;
|
flags = flags | TypeFlags::STILL_FURTHER_SPECIALIZABLE;
|
||||||
}
|
}
|
||||||
ty::RePlaceholder(..) => {
|
ty::RePlaceholder(..) => {
|
||||||
@ -2361,8 +2360,8 @@ impl<'tcx> Const<'tcx> {
|
|||||||
let try_const_eval = |did, param_env: ParamEnv<'tcx>, substs, promoted| {
|
let try_const_eval = |did, param_env: ParamEnv<'tcx>, substs, promoted| {
|
||||||
let param_env_and_substs = param_env.with_reveal_all().and(substs);
|
let param_env_and_substs = param_env.with_reveal_all().and(substs);
|
||||||
|
|
||||||
// Avoid querying `tcx.const_eval(...)` with any e.g. inference vars.
|
// Avoid querying `tcx.const_eval(...)` with any inference vars.
|
||||||
if param_env_and_substs.has_local_value() {
|
if param_env_and_substs.needs_infer() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2377,12 +2376,12 @@ impl<'tcx> Const<'tcx> {
|
|||||||
|
|
||||||
match self.val {
|
match self.val {
|
||||||
ConstKind::Unevaluated(did, substs, promoted) => {
|
ConstKind::Unevaluated(did, substs, promoted) => {
|
||||||
// HACK(eddyb) when substs contain e.g. inference variables,
|
// HACK(eddyb) when substs contain inference variables,
|
||||||
// attempt using identity substs instead, that will succeed
|
// attempt using identity substs instead, that will succeed
|
||||||
// when the expression doesn't depend on any parameters.
|
// when the expression doesn't depend on any parameters.
|
||||||
// FIXME(eddyb, skinny121) pass `InferCtxt` into here when it's available, so that
|
// FIXME(eddyb, skinny121) pass `InferCtxt` into here when it's available, so that
|
||||||
// we can call `infcx.const_eval_resolve` which handles inference variables.
|
// we can call `infcx.const_eval_resolve` which handles inference variables.
|
||||||
if substs.has_local_value() {
|
if substs.needs_infer() {
|
||||||
let identity_substs = InternalSubsts::identity_for_item(tcx, did);
|
let identity_substs = InternalSubsts::identity_for_item(tcx, did);
|
||||||
// The `ParamEnv` needs to match the `identity_substs`.
|
// The `ParamEnv` needs to match the `identity_substs`.
|
||||||
let identity_param_env = tcx.param_env(did);
|
let identity_param_env = tcx.param_env(did);
|
||||||
|
@ -995,15 +995,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
self.definitions[upper_bound].external_name.unwrap_or(r)
|
self.definitions[upper_bound].external_name.unwrap_or(r)
|
||||||
} else {
|
} else {
|
||||||
// In the case of a failure, use a `ReVar` result. This will
|
// In the case of a failure, use a `ReVar` result. This will
|
||||||
// cause the `has_local_value` later on to return `None`.
|
// cause the `needs_infer` later on to return `None`.
|
||||||
r
|
r
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
debug!("try_promote_type_test_subject: folded ty = {:?}", ty);
|
debug!("try_promote_type_test_subject: folded ty = {:?}", ty);
|
||||||
|
|
||||||
// `has_local_value` will only be true if we failed to promote some region.
|
// `needs_infer` will only be true if we failed to promote some region.
|
||||||
if ty.has_local_value() {
|
if ty.needs_infer() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
|||||||
) -> bool {
|
) -> bool {
|
||||||
let ty = self.resolve_vars_if_possible(&ty);
|
let ty = self.resolve_vars_if_possible(&ty);
|
||||||
|
|
||||||
if !(param_env, ty).has_local_value() {
|
if !(param_env, ty).needs_infer() {
|
||||||
return ty.is_copy_modulo_regions(self.tcx, param_env, span);
|
return ty.is_copy_modulo_regions(self.tcx, param_env, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ fn do_normalize_predicates<'tcx>(
|
|||||||
return Err(ErrorReported);
|
return Err(ErrorReported);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if predicates.has_local_value() {
|
if predicates.needs_infer() {
|
||||||
// FIXME: shouldn't we, you know, actually report an error here? or an ICE?
|
// FIXME: shouldn't we, you know, actually report an error here? or an ICE?
|
||||||
Err(ErrorReported)
|
Err(ErrorReported)
|
||||||
} else {
|
} else {
|
||||||
|
@ -820,7 +820,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.can_use_global_caches(param_env) {
|
if self.can_use_global_caches(param_env) {
|
||||||
if !trait_ref.has_local_value() {
|
if !trait_ref.needs_infer() {
|
||||||
debug!(
|
debug!(
|
||||||
"insert_evaluation_cache(trait_ref={:?}, candidate={:?}) global",
|
"insert_evaluation_cache(trait_ref={:?}, candidate={:?}) global",
|
||||||
trait_ref, result,
|
trait_ref, result,
|
||||||
@ -1178,10 +1178,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
/// Do note that if the type itself is not in the
|
/// Do note that if the type itself is not in the
|
||||||
/// global tcx, the local caches will be used.
|
/// global tcx, the local caches will be used.
|
||||||
fn can_use_global_caches(&self, param_env: ty::ParamEnv<'tcx>) -> bool {
|
fn can_use_global_caches(&self, param_env: ty::ParamEnv<'tcx>) -> bool {
|
||||||
// If there are any e.g. inference variables in the `ParamEnv`, then we
|
// If there are any inference variables in the `ParamEnv`, then we
|
||||||
// always use a cache local to this particular scope. Otherwise, we
|
// always use a cache local to this particular scope. Otherwise, we
|
||||||
// switch to a global cache.
|
// switch to a global cache.
|
||||||
if param_env.has_local_value() {
|
if param_env.needs_infer() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1242,7 +1242,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
result: &SelectionResult<'tcx, SelectionCandidate<'tcx>>,
|
result: &SelectionResult<'tcx, SelectionCandidate<'tcx>>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
match result {
|
match result {
|
||||||
Ok(Some(SelectionCandidate::ParamCandidate(trait_ref))) => !trait_ref.has_local_value(),
|
Ok(Some(SelectionCandidate::ParamCandidate(trait_ref))) => !trait_ref.needs_infer(),
|
||||||
_ => true,
|
_ => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1269,8 +1269,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
if self.can_use_global_caches(param_env) {
|
if self.can_use_global_caches(param_env) {
|
||||||
if let Err(Overflow) = candidate {
|
if let Err(Overflow) = candidate {
|
||||||
// Don't cache overflow globally; we only produce this in certain modes.
|
// Don't cache overflow globally; we only produce this in certain modes.
|
||||||
} else if !trait_ref.has_local_value() {
|
} else if !trait_ref.needs_infer() {
|
||||||
if !candidate.has_local_value() {
|
if !candidate.needs_infer() {
|
||||||
debug!(
|
debug!(
|
||||||
"insert_candidate_cache(trait_ref={:?}, candidate={:?}) global",
|
"insert_candidate_cache(trait_ref={:?}, candidate={:?}) global",
|
||||||
trait_ref, candidate,
|
trait_ref, candidate,
|
||||||
|
@ -369,7 +369,7 @@ fn check_type_defn<'tcx, F>(
|
|||||||
packed && {
|
packed && {
|
||||||
let ty = variant.fields.last().unwrap().ty;
|
let ty = variant.fields.last().unwrap().ty;
|
||||||
let ty = fcx.tcx.erase_regions(&ty);
|
let ty = fcx.tcx.erase_regions(&ty);
|
||||||
if ty.has_local_value() {
|
if ty.needs_infer() {
|
||||||
fcx_tcx
|
fcx_tcx
|
||||||
.sess
|
.sess
|
||||||
.delay_span_bug(item.span, &format!("inference variables in {:?}", ty));
|
.delay_span_bug(item.span, &format!("inference variables in {:?}", ty));
|
||||||
|
@ -365,8 +365,12 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||||||
for (&local_id, c_ty) in fcx_tables.user_provided_types().iter() {
|
for (&local_id, c_ty) in fcx_tables.user_provided_types().iter() {
|
||||||
let hir_id = hir::HirId { owner: common_hir_owner, local_id };
|
let hir_id = hir::HirId { owner: common_hir_owner, local_id };
|
||||||
|
|
||||||
if cfg!(debug_assertions) && c_ty.has_local_value() {
|
if cfg!(debug_assertions) && c_ty.needs_infer() {
|
||||||
span_bug!(hir_id.to_span(self.fcx.tcx), "writeback: `{:?}` is a local value", c_ty);
|
span_bug!(
|
||||||
|
hir_id.to_span(self.fcx.tcx),
|
||||||
|
"writeback: `{:?}` has inference variables",
|
||||||
|
c_ty
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.tables.user_provided_types_mut().insert(hir_id, c_ty.clone());
|
self.tables.user_provided_types_mut().insert(hir_id, c_ty.clone());
|
||||||
@ -399,10 +403,10 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||||||
assert_eq!(fcx_tables.hir_owner, self.tables.hir_owner);
|
assert_eq!(fcx_tables.hir_owner, self.tables.hir_owner);
|
||||||
|
|
||||||
for (&def_id, c_sig) in fcx_tables.user_provided_sigs.iter() {
|
for (&def_id, c_sig) in fcx_tables.user_provided_sigs.iter() {
|
||||||
if cfg!(debug_assertions) && c_sig.has_local_value() {
|
if cfg!(debug_assertions) && c_sig.needs_infer() {
|
||||||
span_bug!(
|
span_bug!(
|
||||||
self.fcx.tcx.hir().span_if_local(def_id).unwrap(),
|
self.fcx.tcx.hir().span_if_local(def_id).unwrap(),
|
||||||
"writeback: `{:?}` is a local value",
|
"writeback: `{:?}` has inference variables",
|
||||||
c_sig
|
c_sig
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -457,7 +461,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !opaque_defn.substs.has_local_value() {
|
if !opaque_defn.substs.needs_infer() {
|
||||||
// We only want to add an entry into `concrete_opaque_types`
|
// We only want to add an entry into `concrete_opaque_types`
|
||||||
// if we actually found a defining usage of this opaque type.
|
// if we actually found a defining usage of this opaque type.
|
||||||
// Otherwise, we do nothing - we'll either find a defining usage
|
// Otherwise, we do nothing - we'll either find a defining usage
|
||||||
@ -485,7 +489,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.tcx().sess.delay_span_bug(span, "`opaque_defn` is a local value");
|
self.tcx().sess.delay_span_bug(span, "`opaque_defn` has inference variables");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -579,8 +583,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||||||
T: TypeFoldable<'tcx>,
|
T: TypeFoldable<'tcx>,
|
||||||
{
|
{
|
||||||
let x = x.fold_with(&mut Resolver::new(self.fcx, span, self.body));
|
let x = x.fold_with(&mut Resolver::new(self.fcx, span, self.body));
|
||||||
if cfg!(debug_assertions) && x.has_local_value() {
|
if cfg!(debug_assertions) && x.needs_infer() {
|
||||||
span_bug!(span.to_span(self.fcx.tcx), "writeback: `{:?}` is a local value", x);
|
span_bug!(span.to_span(self.fcx.tcx), "writeback: `{:?}` has inference variables", x);
|
||||||
}
|
}
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user