move DelaySpanBugEmitted to ty::context
This commit is contained in:
parent
009551f758
commit
e1cd1853c8
4 changed files with 12 additions and 15 deletions
|
@ -34,7 +34,7 @@ pub enum ConstKind<'tcx> {
|
||||||
|
|
||||||
/// A placeholder for a const which could not be computed; this is
|
/// A placeholder for a const which could not be computed; this is
|
||||||
/// propagated to avoid useless error messages.
|
/// propagated to avoid useless error messages.
|
||||||
Error(ty::sty::DelaySpanBugEmitted),
|
Error(ty::DelaySpanBugEmitted),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
|
|
@ -64,6 +64,12 @@ use std::mem;
|
||||||
use std::ops::{Bound, Deref};
|
use std::ops::{Bound, Deref};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
/// A type that is not publicly constructable. This prevents people from making `TyKind::Error`
|
||||||
|
/// except through `tcx.err*()`, which are in this module.
|
||||||
|
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
||||||
|
#[derive(TyEncodable, TyDecodable, HashStable)]
|
||||||
|
pub struct DelaySpanBugEmitted(());
|
||||||
|
|
||||||
type InternedSet<'tcx, T> = ShardedHashMap<Interned<'tcx, T>, ()>;
|
type InternedSet<'tcx, T> = ShardedHashMap<Interned<'tcx, T>, ()>;
|
||||||
|
|
||||||
pub struct CtxtInterners<'tcx> {
|
pub struct CtxtInterners<'tcx> {
|
||||||
|
@ -1170,7 +1176,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn ty_error_with_message<S: Into<MultiSpan>>(self, span: S, msg: &str) -> Ty<'tcx> {
|
pub fn ty_error_with_message<S: Into<MultiSpan>>(self, span: S, msg: &str) -> Ty<'tcx> {
|
||||||
self.sess.delay_span_bug(span, msg);
|
self.sess.delay_span_bug(span, msg);
|
||||||
self.mk_ty(Error(super::sty::DelaySpanBugEmitted(())))
|
self.mk_ty(Error(DelaySpanBugEmitted(())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Like `err` but for constants.
|
/// Like `err` but for constants.
|
||||||
|
@ -1178,10 +1184,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
pub fn const_error(self, ty: Ty<'tcx>) -> &'tcx Const<'tcx> {
|
pub fn const_error(self, ty: Ty<'tcx>) -> &'tcx Const<'tcx> {
|
||||||
self.sess
|
self.sess
|
||||||
.delay_span_bug(DUMMY_SP, "ty::ConstKind::Error constructed but no error reported.");
|
.delay_span_bug(DUMMY_SP, "ty::ConstKind::Error constructed but no error reported.");
|
||||||
self.mk_const(ty::Const {
|
self.mk_const(ty::Const { val: ty::ConstKind::Error(DelaySpanBugEmitted(())), ty })
|
||||||
val: ty::ConstKind::Error(super::sty::DelaySpanBugEmitted(())),
|
|
||||||
ty,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn consider_optimizing<T: Fn() -> String>(&self, msg: T) -> bool {
|
pub fn consider_optimizing<T: Fn() -> String>(&self, msg: T) -> bool {
|
||||||
|
|
|
@ -72,8 +72,8 @@ pub use self::binding::BindingMode::*;
|
||||||
|
|
||||||
pub use self::context::{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,
|
||||||
UserType, UserTypeAnnotationIndex,
|
DelaySpanBugEmitted, ResolvedOpaqueTy, UserType, UserTypeAnnotationIndex,
|
||||||
};
|
};
|
||||||
pub use self::context::{
|
pub use self::context::{
|
||||||
CtxtInterners, GeneratorInteriorTypeCause, GlobalCtxt, Lift, TypeckResults,
|
CtxtInterners, GeneratorInteriorTypeCause, GlobalCtxt, Lift, TypeckResults,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::ty::subst::{GenericArg, InternalSubsts, Subst, SubstsRef};
|
||||||
use crate::ty::{
|
use crate::ty::{
|
||||||
self, AdtDef, DefIdTree, Discr, Ty, TyCtxt, TypeFlags, TypeFoldable, WithConstness,
|
self, AdtDef, DefIdTree, Discr, Ty, TyCtxt, TypeFlags, TypeFoldable, WithConstness,
|
||||||
};
|
};
|
||||||
use crate::ty::{List, ParamEnv, TyS};
|
use crate::ty::{DelaySpanBugEmitted, List, ParamEnv, TyS};
|
||||||
use polonius_engine::Atom;
|
use polonius_engine::Atom;
|
||||||
use rustc_ast::ast;
|
use rustc_ast::ast;
|
||||||
use rustc_data_structures::captures::Captures;
|
use rustc_data_structures::captures::Captures;
|
||||||
|
@ -212,12 +212,6 @@ impl TyKind<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A type that is not publicly constructable. This prevents people from making `TyKind::Error`
|
|
||||||
/// except through `tcx.err*()`.
|
|
||||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
|
||||||
#[derive(TyEncodable, TyDecodable, HashStable)]
|
|
||||||
pub struct DelaySpanBugEmitted(pub(super) ());
|
|
||||||
|
|
||||||
// `TyKind` is used a lot. Make sure it doesn't unintentionally get bigger.
|
// `TyKind` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
static_assert_size!(TyKind<'_>, 24);
|
static_assert_size!(TyKind<'_>, 24);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue