Skip to content

Commit 335f7ca

Browse files
committed
Move BoundConst to ty::consts
1 parent a04bd9b commit 335f7ca

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

compiler/rustc_middle/src/ty/bound_const.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

compiler/rustc_middle/src/ty/consts/kind.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
use super::Const;
2-
use crate::mir;
3-
use crate::mir::interpret::{AllocId, ConstValue, Scalar};
4-
use crate::ty::abstract_const::CastKind;
5-
use crate::ty::subst::{InternalSubsts, SubstsRef};
6-
use crate::ty::ParamEnv;
7-
use crate::ty::{self, List, Ty, TyCtxt, TypeVisitableExt};
81
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
92
use rustc_errors::ErrorGuaranteed;
103
use rustc_hir::def_id::DefId;
114
use rustc_macros::HashStable;
125
use rustc_target::abi::Size;
136

14-
use super::ScalarInt;
7+
use crate::mir;
8+
use crate::mir::interpret::{AllocId, ConstValue, Scalar};
9+
use crate::ty::abstract_const::CastKind;
10+
use crate::ty::subst::{InternalSubsts, SubstsRef};
11+
use crate::ty::{self, BoundVar, Const, List, ParamEnv, ScalarInt, Ty, TyCtxt, TypeVisitableExt};
1512

1613
/// An unevaluated (potentially generic) constant used in the type-system.
1714
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable, Lift)]
@@ -74,6 +71,13 @@ pub enum ConstKind<'tcx> {
7471
Expr(Expr<'tcx>),
7572
}
7673

74+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
75+
#[derive(TyEncodable, TyDecodable, PartialOrd, Ord)]
76+
pub struct BoundConst<'tcx> {
77+
pub var: BoundVar,
78+
pub ty: Ty<'tcx>,
79+
}
80+
7781
impl<'tcx> From<ty::ConstVid<'tcx>> for ConstKind<'tcx> {
7882
fn from(const_vid: ty::ConstVid<'tcx>) -> Self {
7983
InferConst::Var(const_vid).into()

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ pub mod walk;
5858
mod adt;
5959
mod alias_relation_direction;
6060
mod assoc;
61-
mod bound_const;
6261
mod bound_constness;
6362
mod c_reader_cache_key;
6463
mod closure;
@@ -112,7 +111,6 @@ pub use self::alias_relation_direction::AliasRelationDirection;
112111
pub use self::assoc::*;
113112
pub use self::binding::BindingMode;
114113
pub use self::binding::BindingMode::*;
115-
pub use self::bound_const::BoundConst;
116114
pub use self::bound_constness::BoundConstness;
117115
pub use self::c_reader_cache_key::CReaderCacheKey;
118116
pub use self::closure::{
@@ -126,7 +124,8 @@ pub use self::coherence::{
126124
CrateInherentImpls, ImplHeader, ImplOverlapKind, ImplPolarity, ImplSubject,
127125
};
128126
pub use self::consts::{
129-
Const, ConstData, ConstInt, ConstKind, Expr, InferConst, ScalarInt, UnevaluatedConst, ValTree,
127+
BoundConst, Const, ConstData, ConstInt, ConstKind, Expr, InferConst, ScalarInt,
128+
UnevaluatedConst, ValTree,
130129
};
131130
pub use self::context::{
132131
tls, CtxtInterners, DeducedParamAttrs, FreeRegionInfo, GlobalCtxt, Lift, TyCtxt, TyCtxtFeed,

0 commit comments

Comments
 (0)