Bump rustc deps
This commit is contained in:
@@ -1824,9 +1824,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_abi"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c063a7fef3c49d03837ee9a5d988aad83630c3460b03b32355c279d3fafa7d07"
|
||||
checksum = "a4ce5c9ea794353e02beae390c4674f74ffb23a2ad9de763469fdcef5c1026ef"
|
||||
dependencies = [
|
||||
"bitflags 2.9.4",
|
||||
"ra-ap-rustc_hashes",
|
||||
@@ -1836,24 +1836,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_ast_ir"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a210dbd77e794b33ff17d2d15750dee44eeabd1330685d69a6bad272d515892a"
|
||||
checksum = "1696b77af9bbfe1fcc7a09c907561061c6ef4c8bd6d5f1675b927bc62d349103"
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_hashes"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dea031ea45bb92cd346ed222b35c812e355f304183096ee91bb437b3813c6348"
|
||||
checksum = "c055d8b0d8a592d8cf9547495189f52c1ee5c691d28df1628253a816214e8521"
|
||||
dependencies = [
|
||||
"rustc-stable-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db0114f842b20cba9beb2d9002ca31ae706b47f28ba2d6a49cbf9fd65fa72b9d"
|
||||
checksum = "a08a03e3d4a452144b68f48130eda3a2894d4d79e99ddb44bdb4e0ab8c384e10"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index_macros",
|
||||
"smallvec",
|
||||
@@ -1861,9 +1861,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index_macros"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc738a5bb06fb3893725fbeb3640ff1822bb2aae3f416c4a49f0a706ba89d1cc"
|
||||
checksum = "a1e0446b4d65a8ce19d8fd12826c4bf2365ffa4b8fe0ee94daf5968fe36e920c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1872,9 +1872,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_lexer"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31c35b3d812cfc101d3f534640c13f24c0ec50ee2249685e4c20b2868609c9ee"
|
||||
checksum = "ac80365383a3c749f38af567fdcfaeff3fa6ea5df3846852abbce73e943921b9"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"unicode-properties",
|
||||
@@ -1883,9 +1883,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_next_trait_solver"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7b0fa6fb8e0717ebd0836f8de4a6efc954fca1a8652980fd2584dbe448c7d95"
|
||||
checksum = "a39b419d2d6f7fdec7e0981b7fb7d5beb5dda7140064f1199704ec9dadbb6f73"
|
||||
dependencies = [
|
||||
"derive-where",
|
||||
"ra-ap-rustc_index",
|
||||
@@ -1896,9 +1896,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_parse_format"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33d01bad23470cc749ef607476890aabcc8993ca3ef87d4241d0f6a08c6f9402"
|
||||
checksum = "b743b0c8f795842e41b1720bbc5af6e896129fb9acf04e9785774bfb0dc5947c"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_lexer",
|
||||
"rustc-literal-escaper 0.0.5",
|
||||
@@ -1906,9 +1906,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_pattern_analysis"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a181cf7943dc16e888046584d6172be95818811b25d695dbacbb4dd71973cc3"
|
||||
checksum = "cf944dce80137195528f89a576f70153c2060a6f8ca49c3fa9f55f9da14ab937"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index",
|
||||
"rustc-hash 2.1.1",
|
||||
@@ -1919,9 +1919,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_type_ir"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87c99f33be18d9e50cefef5442822da1f0b416e9a17a483879a9704e08a6a6e6"
|
||||
checksum = "1bfe2722b20bc889a9d7711bd3a1f4f7b082940491241615aa643c17e0deffec"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags 2.9.4",
|
||||
@@ -1939,9 +1939,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_type_ir_macros"
|
||||
version = "0.133.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77b162d65e058abfc058e6b67ae68156cc282fbd78da148c1a7ec77b4230661e"
|
||||
checksum = "6fad1527df26aaa77367393fae86f42818b33e02b3737a19f3846d1c7671e7f9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -86,14 +86,14 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
|
||||
vfs = { path = "./crates/vfs", version = "0.0.0" }
|
||||
edition = { path = "./crates/edition", version = "0.0.0" }
|
||||
|
||||
ra-ap-rustc_lexer = { version = "0.133", default-features = false }
|
||||
ra-ap-rustc_parse_format = { version = "0.133", default-features = false }
|
||||
ra-ap-rustc_index = { version = "0.133", default-features = false }
|
||||
ra-ap-rustc_abi = { version = "0.133", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.133", default-features = false }
|
||||
ra-ap-rustc_ast_ir = { version = "0.133", default-features = false }
|
||||
ra-ap-rustc_type_ir = { version = "0.133", default-features = false }
|
||||
ra-ap-rustc_next_trait_solver = { version = "0.133", default-features = false }
|
||||
ra-ap-rustc_lexer = { version = "0.137", default-features = false }
|
||||
ra-ap-rustc_parse_format = { version = "0.137", default-features = false }
|
||||
ra-ap-rustc_index = { version = "0.137", default-features = false }
|
||||
ra-ap-rustc_abi = { version = "0.137", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.137", default-features = false }
|
||||
ra-ap-rustc_ast_ir = { version = "0.137", default-features = false }
|
||||
ra-ap-rustc_type_ir = { version = "0.137", default-features = false }
|
||||
ra-ap-rustc_next_trait_solver = { version = "0.137", default-features = false }
|
||||
|
||||
# local crates that aren't published to crates.io. These should not have versions.
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ use rustc_apfloat::{
|
||||
use rustc_ast_ir::FloatTy;
|
||||
use rustc_hash::FxHashSet;
|
||||
use rustc_type_ir::{
|
||||
AliasTyKind, CoroutineArgsParts, RegionKind, Upcast,
|
||||
AliasTyKind, BoundVarIndexKind, CoroutineArgsParts, RegionKind, Upcast,
|
||||
inherent::{AdtDef, GenericArgs as _, IntoKind, SliceLike, Term as _, Ty as _, Tys as _},
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
@@ -682,9 +682,12 @@ impl<'db> HirDisplay<'db> for Const<'db> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result<(), HirDisplayError> {
|
||||
match self.kind() {
|
||||
ConstKind::Placeholder(_) => write!(f, "<placeholder>"),
|
||||
ConstKind::Bound(db, bound_const) => {
|
||||
ConstKind::Bound(BoundVarIndexKind::Bound(db), bound_const) => {
|
||||
write!(f, "?{}.{}", db.as_u32(), bound_const.var.as_u32())
|
||||
}
|
||||
ConstKind::Bound(BoundVarIndexKind::Canonical, bound_const) => {
|
||||
write!(f, "?c.{}", bound_const.var.as_u32())
|
||||
}
|
||||
ConstKind::Infer(..) => write!(f, "#c#"),
|
||||
ConstKind::Param(param) => {
|
||||
let generics = generics(f.db, param.id.parent());
|
||||
@@ -1525,9 +1528,12 @@ impl<'db> HirDisplay<'db> for Ty<'db> {
|
||||
}
|
||||
}
|
||||
}
|
||||
TyKind::Bound(debruijn, ty) => {
|
||||
TyKind::Bound(BoundVarIndexKind::Bound(debruijn), ty) => {
|
||||
write!(f, "?{}.{}", debruijn.as_usize(), ty.var.as_usize())?
|
||||
}
|
||||
TyKind::Bound(BoundVarIndexKind::Canonical, ty) => {
|
||||
write!(f, "?c.{}", ty.var.as_usize())?
|
||||
}
|
||||
TyKind::Dynamic(bounds, region) => {
|
||||
// We want to put auto traits after principal traits, regardless of their written order.
|
||||
let mut bounds_to_display = SmallVec::<[_; 4]>::new();
|
||||
@@ -1955,9 +1961,12 @@ impl<'db> HirDisplay<'db> for Region<'db> {
|
||||
write!(f, "{}", param_data.name.display(f.db, f.edition()))?;
|
||||
Ok(())
|
||||
}
|
||||
RegionKind::ReBound(db, idx) => {
|
||||
RegionKind::ReBound(BoundVarIndexKind::Bound(db), idx) => {
|
||||
write!(f, "?{}.{}", db.as_u32(), idx.var.as_u32())
|
||||
}
|
||||
RegionKind::ReBound(BoundVarIndexKind::Canonical, idx) => {
|
||||
write!(f, "?c.{}", idx.var.as_u32())
|
||||
}
|
||||
RegionKind::ReVar(_) => write!(f, "_"),
|
||||
RegionKind::ReStatic => write!(f, "'static"),
|
||||
RegionKind::ReError(..) => {
|
||||
|
||||
@@ -61,7 +61,7 @@ use la_arena::Idx;
|
||||
use mir::{MirEvalError, VTableMap};
|
||||
use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
|
||||
use rustc_type_ir::{
|
||||
TypeSuperVisitable, TypeVisitableExt, UpcastFrom,
|
||||
BoundVarIndexKind, TypeSuperVisitable, TypeVisitableExt, UpcastFrom,
|
||||
inherent::{IntoKind, SliceLike, Ty as _},
|
||||
};
|
||||
use syntax::ast::{ConstArg, make};
|
||||
@@ -405,7 +405,7 @@ where
|
||||
))
|
||||
}
|
||||
TyKind::Infer(_) => error(),
|
||||
TyKind::Bound(index, _) if index > self.binder => error(),
|
||||
TyKind::Bound(BoundVarIndexKind::Bound(index), _) if index > self.binder => error(),
|
||||
_ => t.try_super_fold_with(self),
|
||||
}
|
||||
}
|
||||
@@ -432,7 +432,9 @@ where
|
||||
Ok(Const::new_bound(self.interner, self.binder, BoundConst { var }))
|
||||
}
|
||||
ConstKind::Infer(_) => error(),
|
||||
ConstKind::Bound(index, _) if index > self.binder => error(),
|
||||
ConstKind::Bound(BoundVarIndexKind::Bound(index), _) if index > self.binder => {
|
||||
error()
|
||||
}
|
||||
_ => ct.try_super_fold_with(self),
|
||||
}
|
||||
}
|
||||
@@ -454,7 +456,9 @@ where
|
||||
))
|
||||
}
|
||||
RegionKind::ReVar(_) => error(),
|
||||
RegionKind::ReBound(index, _) if index > self.binder => error(),
|
||||
RegionKind::ReBound(BoundVarIndexKind::Bound(index), _) if index > self.binder => {
|
||||
error()
|
||||
}
|
||||
_ => Ok(region),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ use rustc_ast_ir::Mutability;
|
||||
use rustc_hash::FxHashSet;
|
||||
use rustc_pattern_analysis::Captures;
|
||||
use rustc_type_ir::{
|
||||
AliasTyKind, ConstKind, DebruijnIndex, ExistentialPredicate, ExistentialProjection,
|
||||
ExistentialTraitRef, FnSig, OutlivesPredicate,
|
||||
AliasTyKind, BoundVarIndexKind, ConstKind, DebruijnIndex, ExistentialPredicate,
|
||||
ExistentialProjection, ExistentialTraitRef, FnSig, OutlivesPredicate,
|
||||
TyKind::{self},
|
||||
TypeVisitableExt,
|
||||
inherent::{GenericArg as _, GenericArgs as _, IntoKind as _, Region as _, SliceLike, Ty as _},
|
||||
@@ -858,11 +858,13 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
|
||||
if let Some(bounds) = bounds {
|
||||
let region = match lifetime {
|
||||
Some(it) => match it.kind() {
|
||||
rustc_type_ir::RegionKind::ReBound(db, var) => Region::new_bound(
|
||||
self.interner,
|
||||
db.shifted_out_to_binder(DebruijnIndex::from_u32(2)),
|
||||
var,
|
||||
),
|
||||
rustc_type_ir::RegionKind::ReBound(BoundVarIndexKind::Bound(db), var) => {
|
||||
Region::new_bound(
|
||||
self.interner,
|
||||
db.shifted_out_to_binder(DebruijnIndex::from_u32(2)),
|
||||
var,
|
||||
)
|
||||
}
|
||||
_ => it,
|
||||
},
|
||||
None => Region::new_static(self.interner),
|
||||
|
||||
@@ -6,8 +6,9 @@ use hir_def::ConstParamId;
|
||||
use macros::{TypeFoldable, TypeVisitable};
|
||||
use rustc_ast_ir::visit::VisitorResult;
|
||||
use rustc_type_ir::{
|
||||
BoundVar, DebruijnIndex, FlagComputation, Flags, TypeFoldable, TypeSuperFoldable,
|
||||
TypeSuperVisitable, TypeVisitable, TypeVisitableExt, WithCachedTypeInfo,
|
||||
BoundVar, BoundVarIndexKind, ConstVid, DebruijnIndex, FlagComputation, Flags, InferConst,
|
||||
TypeFoldable, TypeSuperFoldable, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
|
||||
WithCachedTypeInfo,
|
||||
inherent::{IntoKind, ParamEnv as _, PlaceholderLike, SliceLike},
|
||||
relate::Relate,
|
||||
};
|
||||
@@ -49,11 +50,11 @@ impl<'db> Const<'db> {
|
||||
}
|
||||
|
||||
pub fn error(interner: DbInterner<'db>) -> Self {
|
||||
Const::new(interner, rustc_type_ir::ConstKind::Error(ErrorGuaranteed))
|
||||
Const::new(interner, ConstKind::Error(ErrorGuaranteed))
|
||||
}
|
||||
|
||||
pub fn new_param(interner: DbInterner<'db>, param: ParamConst) -> Self {
|
||||
Const::new(interner, rustc_type_ir::ConstKind::Param(param))
|
||||
Const::new(interner, ConstKind::Param(param))
|
||||
}
|
||||
|
||||
pub fn new_placeholder(interner: DbInterner<'db>, placeholder: PlaceholderConst) -> Self {
|
||||
@@ -61,7 +62,7 @@ impl<'db> Const<'db> {
|
||||
}
|
||||
|
||||
pub fn new_bound(interner: DbInterner<'db>, index: DebruijnIndex, bound: BoundConst) -> Self {
|
||||
Const::new(interner, ConstKind::Bound(index, bound))
|
||||
Const::new(interner, ConstKind::Bound(BoundVarIndexKind::Bound(index), bound))
|
||||
}
|
||||
|
||||
pub fn new_valtree(
|
||||
@@ -340,28 +341,34 @@ impl<'db> Flags for Const<'db> {
|
||||
}
|
||||
|
||||
impl<'db> rustc_type_ir::inherent::Const<DbInterner<'db>> for Const<'db> {
|
||||
fn new_infer(interner: DbInterner<'db>, var: rustc_type_ir::InferConst) -> Self {
|
||||
fn new_infer(interner: DbInterner<'db>, var: InferConst) -> Self {
|
||||
Const::new(interner, ConstKind::Infer(var))
|
||||
}
|
||||
|
||||
fn new_var(interner: DbInterner<'db>, var: rustc_type_ir::ConstVid) -> Self {
|
||||
Const::new(interner, ConstKind::Infer(rustc_type_ir::InferConst::Var(var)))
|
||||
fn new_var(interner: DbInterner<'db>, var: ConstVid) -> Self {
|
||||
Const::new(interner, ConstKind::Infer(InferConst::Var(var)))
|
||||
}
|
||||
|
||||
fn new_bound(
|
||||
interner: DbInterner<'db>,
|
||||
debruijn: rustc_type_ir::DebruijnIndex,
|
||||
var: BoundConst,
|
||||
) -> Self {
|
||||
Const::new(interner, ConstKind::Bound(debruijn, var))
|
||||
fn new_bound(interner: DbInterner<'db>, debruijn: DebruijnIndex, var: BoundConst) -> Self {
|
||||
Const::new(interner, ConstKind::Bound(BoundVarIndexKind::Bound(debruijn), var))
|
||||
}
|
||||
|
||||
fn new_anon_bound(
|
||||
fn new_anon_bound(interner: DbInterner<'db>, debruijn: DebruijnIndex, var: BoundVar) -> Self {
|
||||
Const::new(
|
||||
interner,
|
||||
ConstKind::Bound(BoundVarIndexKind::Bound(debruijn), BoundConst { var }),
|
||||
)
|
||||
}
|
||||
|
||||
fn new_canonical_bound(interner: DbInterner<'db>, var: BoundVar) -> Self {
|
||||
Const::new(interner, ConstKind::Bound(BoundVarIndexKind::Canonical, BoundConst { var }))
|
||||
}
|
||||
|
||||
fn new_placeholder(
|
||||
interner: DbInterner<'db>,
|
||||
debruijn: rustc_type_ir::DebruijnIndex,
|
||||
var: rustc_type_ir::BoundVar,
|
||||
param: <DbInterner<'db> as rustc_type_ir::Interner>::PlaceholderConst,
|
||||
) -> Self {
|
||||
Const::new(interner, ConstKind::Bound(debruijn, BoundConst { var }))
|
||||
Const::new(interner, ConstKind::Placeholder(param))
|
||||
}
|
||||
|
||||
fn new_unevaluated(
|
||||
@@ -378,13 +385,6 @@ impl<'db> rustc_type_ir::inherent::Const<DbInterner<'db>> for Const<'db> {
|
||||
fn new_error(interner: DbInterner<'db>, guar: ErrorGuaranteed) -> Self {
|
||||
Const::new(interner, ConstKind::Error(guar))
|
||||
}
|
||||
|
||||
fn new_placeholder(
|
||||
interner: DbInterner<'db>,
|
||||
param: <DbInterner<'db> as rustc_type_ir::Interner>::PlaceholderConst,
|
||||
) -> Self {
|
||||
Const::new(interner, ConstKind::Placeholder(param))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! Fold impls for the next-trait-solver.
|
||||
|
||||
use rustc_type_ir::{
|
||||
DebruijnIndex, RegionKind, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt,
|
||||
inherent::IntoKind,
|
||||
BoundVarIndexKind, DebruijnIndex, RegionKind, TypeFoldable, TypeFolder, TypeSuperFoldable,
|
||||
TypeVisitableExt, inherent::IntoKind,
|
||||
};
|
||||
|
||||
use crate::next_solver::BoundConst;
|
||||
@@ -79,7 +79,9 @@ where
|
||||
|
||||
fn fold_ty(&mut self, t: Ty<'db>) -> Ty<'db> {
|
||||
match t.kind() {
|
||||
TyKind::Bound(debruijn, bound_ty) if debruijn == self.current_index => {
|
||||
TyKind::Bound(BoundVarIndexKind::Bound(debruijn), bound_ty)
|
||||
if debruijn == self.current_index =>
|
||||
{
|
||||
let ty = self.delegate.replace_ty(bound_ty);
|
||||
debug_assert!(!ty.has_vars_bound_above(DebruijnIndex::ZERO));
|
||||
rustc_type_ir::shift_vars(self.interner, ty, self.current_index.as_u32())
|
||||
@@ -96,9 +98,12 @@ where
|
||||
|
||||
fn fold_region(&mut self, r: Region<'db>) -> Region<'db> {
|
||||
match r.kind() {
|
||||
RegionKind::ReBound(debruijn, br) if debruijn == self.current_index => {
|
||||
RegionKind::ReBound(BoundVarIndexKind::Bound(debruijn), br)
|
||||
if debruijn == self.current_index =>
|
||||
{
|
||||
let region = self.delegate.replace_region(br);
|
||||
if let RegionKind::ReBound(debruijn1, br) = region.kind() {
|
||||
if let RegionKind::ReBound(BoundVarIndexKind::Bound(debruijn1), br) = region.kind()
|
||||
{
|
||||
// If the callback returns a bound region,
|
||||
// that region should always use the INNERMOST
|
||||
// debruijn index. Then we adjust it to the
|
||||
@@ -115,7 +120,9 @@ where
|
||||
|
||||
fn fold_const(&mut self, ct: Const<'db>) -> Const<'db> {
|
||||
match ct.kind() {
|
||||
ConstKind::Bound(debruijn, bound_const) if debruijn == self.current_index => {
|
||||
ConstKind::Bound(BoundVarIndexKind::Bound(debruijn), bound_const)
|
||||
if debruijn == self.current_index =>
|
||||
{
|
||||
let ct = self.delegate.replace_const(bound_const);
|
||||
debug_assert!(!ct.has_vars_bound_above(DebruijnIndex::ZERO));
|
||||
rustc_type_ir::shift_vars(self.interner, ct, self.current_index.as_u32())
|
||||
|
||||
@@ -8,19 +8,18 @@
|
||||
use rustc_hash::FxHashMap;
|
||||
use rustc_index::Idx;
|
||||
use rustc_type_ir::InferTy::{self, FloatVar, IntVar, TyVar};
|
||||
use rustc_type_ir::inherent::{Const as _, IntoKind as _, SliceLike, Ty as _};
|
||||
use rustc_type_ir::inherent::{Const as _, IntoKind as _, Region as _, SliceLike, Ty as _};
|
||||
use rustc_type_ir::{
|
||||
BoundVar, CanonicalQueryInput, DebruijnIndex, Flags, InferConst, RegionKind, TyVid, TypeFlags,
|
||||
TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt, UniverseIndex,
|
||||
BoundVar, BoundVarIndexKind, CanonicalQueryInput, DebruijnIndex, Flags, InferConst, RegionKind,
|
||||
TyVid, TypeFlags, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt, UniverseIndex,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::next_solver::infer::InferCtxt;
|
||||
use crate::next_solver::{
|
||||
Binder, BoundConst, BoundRegion, BoundRegionKind, BoundTy, Canonical, CanonicalVarKind,
|
||||
CanonicalVars, Const, ConstKind, DbInterner, GenericArg, ParamEnvAnd, Placeholder, Region, Ty,
|
||||
TyKind,
|
||||
Binder, Canonical, CanonicalVarKind, CanonicalVars, Const, ConstKind, DbInterner, GenericArg,
|
||||
ParamEnvAnd, Placeholder, Region, Ty, TyKind,
|
||||
};
|
||||
|
||||
/// When we canonicalize a value to form a query, we wind up replacing
|
||||
@@ -345,12 +344,9 @@ impl<'cx, 'db> TypeFolder<DbInterner<'db>> for Canonicalizer<'cx, 'db> {
|
||||
|
||||
fn fold_region(&mut self, r: Region<'db>) -> Region<'db> {
|
||||
match r.kind() {
|
||||
RegionKind::ReBound(index, ..) => {
|
||||
if index >= self.binder_index {
|
||||
panic!("escaping late-bound region during canonicalization");
|
||||
} else {
|
||||
r
|
||||
}
|
||||
RegionKind::ReBound(BoundVarIndexKind::Bound(..), ..) => r,
|
||||
RegionKind::ReBound(BoundVarIndexKind::Canonical, ..) => {
|
||||
panic!("canonicalized bound var found during canonicalization");
|
||||
}
|
||||
|
||||
RegionKind::ReStatic
|
||||
@@ -427,12 +423,9 @@ impl<'cx, 'db> TypeFolder<DbInterner<'db>> for Canonicalizer<'cx, 'db> {
|
||||
self.canonicalize_ty_var(CanonicalVarKind::PlaceholderTy(placeholder), t)
|
||||
}
|
||||
|
||||
TyKind::Bound(debruijn, _) => {
|
||||
if debruijn >= self.binder_index {
|
||||
panic!("escaping bound type during canonicalization")
|
||||
} else {
|
||||
t
|
||||
}
|
||||
TyKind::Bound(BoundVarIndexKind::Bound(..), _) => t,
|
||||
TyKind::Bound(BoundVarIndexKind::Canonical, ..) => {
|
||||
panic!("canonicalized bound var found during canonicalization");
|
||||
}
|
||||
|
||||
TyKind::Closure(..)
|
||||
@@ -503,12 +496,11 @@ impl<'cx, 'db> TypeFolder<DbInterner<'db>> for Canonicalizer<'cx, 'db> {
|
||||
ConstKind::Infer(InferConst::Fresh(_)) => {
|
||||
panic!("encountered a fresh const during canonicalization")
|
||||
}
|
||||
ConstKind::Bound(debruijn, _) => {
|
||||
if debruijn >= self.binder_index {
|
||||
panic!("escaping bound const during canonicalization")
|
||||
} else {
|
||||
return ct;
|
||||
}
|
||||
ConstKind::Bound(BoundVarIndexKind::Bound(..), _) => {
|
||||
return ct;
|
||||
}
|
||||
ConstKind::Bound(BoundVarIndexKind::Canonical, ..) => {
|
||||
panic!("canonicalized bound var found during canonicalization");
|
||||
}
|
||||
ConstKind::Placeholder(placeholder) => {
|
||||
return self
|
||||
@@ -758,8 +750,7 @@ impl<'cx, 'db> Canonicalizer<'cx, 'db> {
|
||||
r: Region<'db>,
|
||||
) -> Region<'db> {
|
||||
let var = self.canonical_var(info, r.into());
|
||||
let br = BoundRegion { var, kind: BoundRegionKind::Anon };
|
||||
Region::new_bound(self.cx(), self.binder_index, br)
|
||||
Region::new_canonical_bound(self.cx(), var)
|
||||
}
|
||||
|
||||
/// Given a type variable `ty_var` of the given kind, first check
|
||||
@@ -769,11 +760,7 @@ impl<'cx, 'db> Canonicalizer<'cx, 'db> {
|
||||
fn canonicalize_ty_var(&mut self, info: CanonicalVarKind<'db>, ty_var: Ty<'db>) -> Ty<'db> {
|
||||
debug_assert_eq!(ty_var, self.infcx.shallow_resolve(ty_var));
|
||||
let var = self.canonical_var(info, ty_var.into());
|
||||
Ty::new_bound(
|
||||
self.tcx,
|
||||
self.binder_index,
|
||||
BoundTy { kind: crate::next_solver::BoundTyKind::Anon, var },
|
||||
)
|
||||
Ty::new_canonical_bound(self.cx(), var)
|
||||
}
|
||||
|
||||
/// Given a type variable `const_var` of the given kind, first check
|
||||
@@ -787,6 +774,6 @@ impl<'cx, 'db> Canonicalizer<'cx, 'db> {
|
||||
) -> Const<'db> {
|
||||
debug_assert_eq!(const_var, self.infcx.shallow_resolve_const(const_var));
|
||||
let var = self.canonical_var(info, const_var.into());
|
||||
Const::new_bound(self.tcx, self.binder_index, BoundConst { var })
|
||||
Const::new_canonical_bound(self.cx(), var)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,7 +353,9 @@ fn candidate_should_be_dropped_in_favor_of<'db>(
|
||||
// Prefer dyn candidates over non-dyn candidates. This is necessary to
|
||||
// handle the unsoundness between `impl<T: ?Sized> Any for T` and `dyn Any: Any`.
|
||||
(
|
||||
CandidateSource::Impl(_) | CandidateSource::ParamEnv(_) | CandidateSource::AliasBound,
|
||||
CandidateSource::Impl(_)
|
||||
| CandidateSource::ParamEnv(_)
|
||||
| CandidateSource::AliasBound(_),
|
||||
CandidateSource::BuiltinImpl(BuiltinImplSource::Object { .. }),
|
||||
) => true,
|
||||
|
||||
@@ -399,7 +401,9 @@ fn to_selection<'db>(cand: InspectCandidate<'_, 'db>) -> Option<Selection<'db>>
|
||||
})
|
||||
}
|
||||
CandidateSource::BuiltinImpl(builtin) => ImplSource::Builtin(builtin, nested),
|
||||
CandidateSource::ParamEnv(_) | CandidateSource::AliasBound => ImplSource::Param(nested),
|
||||
CandidateSource::ParamEnv(_) | CandidateSource::AliasBound(_) => {
|
||||
ImplSource::Param(nested)
|
||||
}
|
||||
CandidateSource::CoherenceUnknowable => {
|
||||
panic!("didn't expect to select an unknowable candidate")
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ use rustc_hash::FxHashSet;
|
||||
use rustc_index::bit_set::DenseBitSet;
|
||||
use rustc_type_ir::{
|
||||
AliasTermKind, AliasTyKind, BoundVar, CollectAndApply, DebruijnIndex, EarlyBinder,
|
||||
FlagComputation, Flags, GenericArgKind, ImplPolarity, InferTy, TraitRef, TypeVisitableExt,
|
||||
UniverseIndex, Upcast, Variance,
|
||||
FlagComputation, Flags, GenericArgKind, ImplPolarity, InferTy, Interner, TraitRef,
|
||||
TypeVisitableExt, UniverseIndex, Upcast, Variance,
|
||||
elaborate::elaborate,
|
||||
error::TypeError,
|
||||
inherent::{self, GenericsOf, IntoKind, SliceLike as _, Span as _, Ty as _},
|
||||
@@ -33,8 +33,8 @@ use crate::{
|
||||
method_resolution::{ALL_FLOAT_FPS, ALL_INT_FPS, TyFingerprint},
|
||||
next_solver::{
|
||||
AdtIdWrapper, BoundConst, CallableIdWrapper, CanonicalVarKind, ClosureIdWrapper,
|
||||
CoroutineIdWrapper, Ctor, FnSig, FxIndexMap, ImplIdWrapper, RegionAssumptions,
|
||||
SolverContext, SolverDefIds, TraitIdWrapper, TypeAliasIdWrapper,
|
||||
CoroutineIdWrapper, Ctor, FnSig, FxIndexMap, ImplIdWrapper, OpaqueTypeKey,
|
||||
RegionAssumptions, SolverContext, SolverDefIds, TraitIdWrapper, TypeAliasIdWrapper,
|
||||
util::{ContainsTypeErrors, explicit_item_bounds, for_trait_impls},
|
||||
},
|
||||
};
|
||||
@@ -850,7 +850,7 @@ macro_rules! as_lang_item {
|
||||
}};
|
||||
}
|
||||
|
||||
impl<'db> rustc_type_ir::Interner for DbInterner<'db> {
|
||||
impl<'db> Interner for DbInterner<'db> {
|
||||
type DefId = SolverDefId;
|
||||
type LocalDefId = SolverDefId;
|
||||
type LocalDefIds = SolverDefIds<'db>;
|
||||
@@ -877,9 +877,9 @@ impl<'db> rustc_type_ir::Interner for DbInterner<'db> {
|
||||
|
||||
fn mk_predefined_opaques_in_body(
|
||||
self,
|
||||
data: rustc_type_ir::solve::PredefinedOpaquesData<Self>,
|
||||
data: &[(OpaqueTypeKey<'db>, Self::Ty)],
|
||||
) -> Self::PredefinedOpaques {
|
||||
PredefinedOpaques::new(self, data)
|
||||
PredefinedOpaques::new_from_iter(self, data.iter().cloned())
|
||||
}
|
||||
|
||||
type CanonicalVarKinds = CanonicalVars<'db>;
|
||||
@@ -997,8 +997,8 @@ impl<'db> rustc_type_ir::Interner for DbInterner<'db> {
|
||||
from_entry(&f())
|
||||
}
|
||||
|
||||
fn evaluation_is_concurrent(&self) -> bool {
|
||||
false
|
||||
fn assert_evaluation_is_concurrent(&self) {
|
||||
panic!("evaluation shouldn't be concurrent yet")
|
||||
}
|
||||
|
||||
fn expand_abstract_consts<T: rustc_type_ir::TypeFoldable<Self>>(self, _: T) -> T {
|
||||
@@ -1953,6 +1953,13 @@ impl<'db> rustc_type_ir::Interner for DbInterner<'db> {
|
||||
Self,
|
||||
>(self, canonical_goal)
|
||||
}
|
||||
|
||||
fn is_sizedness_trait(self, def_id: Self::TraitId) -> bool {
|
||||
matches!(
|
||||
self.as_trait_lang_item(def_id),
|
||||
Some(SolverTraitLangItem::Sized | SolverTraitLangItem::MetaSized)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> DbInterner<'db> {
|
||||
|
||||
@@ -1,85 +1,18 @@
|
||||
//! Things related to opaques in the next-trait-solver.
|
||||
|
||||
use rustc_ast_ir::try_visit;
|
||||
use rustc_type_ir::inherent::SliceLike;
|
||||
|
||||
use crate::next_solver::SolverDefId;
|
||||
|
||||
use super::{DbInterner, interned_vec_nolifetime_salsa};
|
||||
use super::{DbInterner, SolverDefId, Ty, interned_vec_db, interned_vec_nolifetime_salsa};
|
||||
|
||||
pub type OpaqueTypeKey<'db> = rustc_type_ir::OpaqueTypeKey<DbInterner<'db>>;
|
||||
pub type PredefinedOpaquesData<'db> = rustc_type_ir::solve::PredefinedOpaquesData<DbInterner<'db>>;
|
||||
|
||||
type PredefinedOpaque<'db> = (OpaqueTypeKey<'db>, Ty<'db>);
|
||||
interned_vec_db!(PredefinedOpaques, PredefinedOpaque);
|
||||
|
||||
pub type ExternalConstraintsData<'db> =
|
||||
rustc_type_ir::solve::ExternalConstraintsData<DbInterner<'db>>;
|
||||
|
||||
#[salsa::interned(constructor = new_, debug)]
|
||||
pub struct PredefinedOpaques<'db> {
|
||||
#[returns(ref)]
|
||||
kind_: rustc_type_ir::solve::PredefinedOpaquesData<DbInterner<'db>>,
|
||||
}
|
||||
|
||||
impl<'db> PredefinedOpaques<'db> {
|
||||
pub fn new(interner: DbInterner<'db>, data: PredefinedOpaquesData<'db>) -> Self {
|
||||
PredefinedOpaques::new_(interner.db(), data)
|
||||
}
|
||||
|
||||
pub fn inner(&self) -> &PredefinedOpaquesData<'db> {
|
||||
crate::with_attached_db(|db| {
|
||||
let inner = self.kind_(db);
|
||||
// SAFETY: ¯\_(ツ)_/¯
|
||||
unsafe { std::mem::transmute(inner) }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> rustc_type_ir::TypeVisitable<DbInterner<'db>> for PredefinedOpaques<'db> {
|
||||
fn visit_with<V: rustc_type_ir::TypeVisitor<DbInterner<'db>>>(
|
||||
&self,
|
||||
visitor: &mut V,
|
||||
) -> V::Result {
|
||||
self.opaque_types.visit_with(visitor)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> rustc_type_ir::TypeFoldable<DbInterner<'db>> for PredefinedOpaques<'db> {
|
||||
fn try_fold_with<F: rustc_type_ir::FallibleTypeFolder<DbInterner<'db>>>(
|
||||
self,
|
||||
folder: &mut F,
|
||||
) -> Result<Self, F::Error> {
|
||||
Ok(PredefinedOpaques::new(
|
||||
folder.cx(),
|
||||
PredefinedOpaquesData {
|
||||
opaque_types: self
|
||||
.opaque_types
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|opaque| opaque.try_fold_with(folder))
|
||||
.collect::<Result<_, F::Error>>()?,
|
||||
},
|
||||
))
|
||||
}
|
||||
fn fold_with<F: rustc_type_ir::TypeFolder<DbInterner<'db>>>(self, folder: &mut F) -> Self {
|
||||
PredefinedOpaques::new(
|
||||
folder.cx(),
|
||||
PredefinedOpaquesData {
|
||||
opaque_types: self
|
||||
.opaque_types
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|opaque| opaque.fold_with(folder))
|
||||
.collect(),
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> std::ops::Deref for PredefinedOpaques<'db> {
|
||||
type Target = PredefinedOpaquesData<'db>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.inner()
|
||||
}
|
||||
}
|
||||
|
||||
interned_vec_nolifetime_salsa!(SolverDefIds, SolverDefId);
|
||||
|
||||
#[salsa::interned(constructor = new_, debug)]
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
use hir_def::LifetimeParamId;
|
||||
use intern::Symbol;
|
||||
use rustc_type_ir::{
|
||||
BoundVar, DebruijnIndex, Flags, INNERMOST, RegionVid, TypeFlags, TypeFoldable, TypeVisitable,
|
||||
BoundVar, BoundVarIndexKind, DebruijnIndex, Flags, INNERMOST, RegionVid, TypeFlags,
|
||||
TypeFoldable, TypeVisitable,
|
||||
inherent::{IntoKind, PlaceholderLike, SliceLike},
|
||||
relate::Relate,
|
||||
};
|
||||
@@ -67,7 +68,7 @@ impl<'db> Region<'db> {
|
||||
index: DebruijnIndex,
|
||||
bound: BoundRegion,
|
||||
) -> Region<'db> {
|
||||
Region::new(interner, RegionKind::ReBound(index, bound))
|
||||
Region::new(interner, RegionKind::ReBound(BoundVarIndexKind::Bound(index), bound))
|
||||
}
|
||||
|
||||
pub fn is_placeholder(&self) -> bool {
|
||||
@@ -116,7 +117,11 @@ impl<'db> Region<'db> {
|
||||
RegionKind::ReStatic => {
|
||||
flags |= TypeFlags::HAS_FREE_REGIONS;
|
||||
}
|
||||
RegionKind::ReBound(..) => {
|
||||
RegionKind::ReBound(BoundVarIndexKind::Canonical, ..) => {
|
||||
flags |= TypeFlags::HAS_RE_BOUND;
|
||||
flags |= TypeFlags::HAS_CANONICAL_BOUND;
|
||||
}
|
||||
RegionKind::ReBound(BoundVarIndexKind::Bound(..), ..) => {
|
||||
flags |= TypeFlags::HAS_RE_BOUND;
|
||||
}
|
||||
RegionKind::ReErased => {
|
||||
@@ -293,7 +298,7 @@ impl<'db> Flags for Region<'db> {
|
||||
|
||||
fn outer_exclusive_binder(&self) -> rustc_type_ir::DebruijnIndex {
|
||||
match &self.inner() {
|
||||
RegionKind::ReBound(debruijn, _) => debruijn.shifted_in(1),
|
||||
RegionKind::ReBound(BoundVarIndexKind::Bound(debruijn), _) => debruijn.shifted_in(1),
|
||||
_ => INNERMOST,
|
||||
}
|
||||
}
|
||||
@@ -305,7 +310,7 @@ impl<'db> rustc_type_ir::inherent::Region<DbInterner<'db>> for Region<'db> {
|
||||
debruijn: rustc_type_ir::DebruijnIndex,
|
||||
var: BoundRegion,
|
||||
) -> Self {
|
||||
Region::new(interner, RegionKind::ReBound(debruijn, var))
|
||||
Region::new(interner, RegionKind::ReBound(BoundVarIndexKind::Bound(debruijn), var))
|
||||
}
|
||||
|
||||
fn new_anon_bound(
|
||||
@@ -315,7 +320,20 @@ impl<'db> rustc_type_ir::inherent::Region<DbInterner<'db>> for Region<'db> {
|
||||
) -> Self {
|
||||
Region::new(
|
||||
interner,
|
||||
RegionKind::ReBound(debruijn, BoundRegion { var, kind: BoundRegionKind::Anon }),
|
||||
RegionKind::ReBound(
|
||||
BoundVarIndexKind::Bound(debruijn),
|
||||
BoundRegion { var, kind: BoundRegionKind::Anon },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn new_canonical_bound(interner: DbInterner<'db>, var: rustc_type_ir::BoundVar) -> Self {
|
||||
Region::new(
|
||||
interner,
|
||||
RegionKind::ReBound(
|
||||
BoundVarIndexKind::Canonical,
|
||||
BoundRegion { var, kind: BoundRegionKind::Anon },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@ use hir_def::{TraitId, type_ref::Rawness};
|
||||
use rustc_abi::{Float, Integer, Size};
|
||||
use rustc_ast_ir::{Mutability, try_visit, visit::VisitorResult};
|
||||
use rustc_type_ir::{
|
||||
AliasTyKind, BoundVar, ClosureKind, FlagComputation, Flags, FloatTy, FloatVid, InferTy, IntTy,
|
||||
IntVid, Interner, TyVid, TypeFoldable, TypeSuperFoldable, TypeSuperVisitable, TypeVisitable,
|
||||
TypeVisitableExt, TypeVisitor, UintTy, Upcast, WithCachedTypeInfo,
|
||||
AliasTyKind, BoundVar, BoundVarIndexKind, ClosureKind, DebruijnIndex, FlagComputation, Flags,
|
||||
FloatTy, FloatVid, InferTy, IntTy, IntVid, Interner, TyVid, TypeFoldable, TypeSuperFoldable,
|
||||
TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, UintTy, Upcast,
|
||||
WithCachedTypeInfo,
|
||||
inherent::{
|
||||
AdtDef as _, BoundExistentialPredicates, BoundVarLike, Const as _, GenericArgs as _,
|
||||
IntoKind, ParamLike, PlaceholderLike, Safety as _, SliceLike, Ty as _,
|
||||
@@ -27,7 +28,7 @@ use crate::{
|
||||
ImplTraitId,
|
||||
db::HirDatabase,
|
||||
next_solver::{
|
||||
AdtDef, Binder, CallableIdWrapper, Clause, ClauseKind, ClosureIdWrapper, Const,
|
||||
AdtDef, AliasTy, Binder, CallableIdWrapper, Clause, ClauseKind, ClosureIdWrapper, Const,
|
||||
CoroutineIdWrapper, FnSig, GenericArg, PolyFnSig, Region, TraitRef, TypeAliasIdWrapper,
|
||||
abi::Safety,
|
||||
interner::InternedWrapperNoDebug,
|
||||
@@ -895,27 +896,28 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
Ty::new(interner, TyKind::Placeholder(param))
|
||||
}
|
||||
|
||||
fn new_bound(
|
||||
interner: DbInterner<'db>,
|
||||
debruijn: rustc_type_ir::DebruijnIndex,
|
||||
var: BoundTy,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::Bound(debruijn, var))
|
||||
fn new_bound(interner: DbInterner<'db>, debruijn: DebruijnIndex, var: BoundTy) -> Self {
|
||||
Ty::new(interner, TyKind::Bound(BoundVarIndexKind::Bound(debruijn), var))
|
||||
}
|
||||
|
||||
fn new_anon_bound(
|
||||
interner: DbInterner<'db>,
|
||||
debruijn: rustc_type_ir::DebruijnIndex,
|
||||
var: BoundVar,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::Bound(debruijn, BoundTy { var, kind: BoundTyKind::Anon }))
|
||||
fn new_anon_bound(interner: DbInterner<'db>, debruijn: DebruijnIndex, var: BoundVar) -> Self {
|
||||
Ty::new(
|
||||
interner,
|
||||
TyKind::Bound(
|
||||
BoundVarIndexKind::Bound(debruijn),
|
||||
BoundTy { var, kind: BoundTyKind::Anon },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn new_alias(
|
||||
interner: DbInterner<'db>,
|
||||
kind: rustc_type_ir::AliasTyKind,
|
||||
alias_ty: rustc_type_ir::AliasTy<DbInterner<'db>>,
|
||||
) -> Self {
|
||||
fn new_canonical_bound(interner: DbInterner<'db>, var: BoundVar) -> Self {
|
||||
Ty::new(
|
||||
interner,
|
||||
TyKind::Bound(BoundVarIndexKind::Canonical, BoundTy { var, kind: BoundTyKind::Anon }),
|
||||
)
|
||||
}
|
||||
|
||||
fn new_alias(interner: DbInterner<'db>, kind: AliasTyKind, alias_ty: AliasTy<'db>) -> Self {
|
||||
Ty::new(interner, TyKind::Alias(kind, alias_ty))
|
||||
}
|
||||
|
||||
@@ -925,7 +927,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
|
||||
fn new_adt(
|
||||
interner: DbInterner<'db>,
|
||||
adt_def: <DbInterner<'db> as rustc_type_ir::Interner>::AdtDef,
|
||||
adt_def: <DbInterner<'db> as Interner>::AdtDef,
|
||||
args: GenericArgs<'db>,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::Adt(adt_def, args))
|
||||
@@ -937,8 +939,8 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
|
||||
fn new_dynamic(
|
||||
interner: DbInterner<'db>,
|
||||
preds: <DbInterner<'db> as rustc_type_ir::Interner>::BoundExistentialPredicates,
|
||||
region: <DbInterner<'db> as rustc_type_ir::Interner>::Region,
|
||||
preds: <DbInterner<'db> as Interner>::BoundExistentialPredicates,
|
||||
region: <DbInterner<'db> as Interner>::Region,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::Dynamic(preds, region))
|
||||
}
|
||||
@@ -946,7 +948,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
fn new_coroutine(
|
||||
interner: DbInterner<'db>,
|
||||
def_id: CoroutineIdWrapper,
|
||||
args: <DbInterner<'db> as rustc_type_ir::Interner>::GenericArgs,
|
||||
args: <DbInterner<'db> as Interner>::GenericArgs,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::Coroutine(def_id, args))
|
||||
}
|
||||
@@ -954,7 +956,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
fn new_coroutine_closure(
|
||||
interner: DbInterner<'db>,
|
||||
def_id: CoroutineIdWrapper,
|
||||
args: <DbInterner<'db> as rustc_type_ir::Interner>::GenericArgs,
|
||||
args: <DbInterner<'db> as Interner>::GenericArgs,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::CoroutineClosure(def_id, args))
|
||||
}
|
||||
@@ -962,7 +964,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
fn new_closure(
|
||||
interner: DbInterner<'db>,
|
||||
def_id: ClosureIdWrapper,
|
||||
args: <DbInterner<'db> as rustc_type_ir::Interner>::GenericArgs,
|
||||
args: <DbInterner<'db> as Interner>::GenericArgs,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::Closure(def_id, args))
|
||||
}
|
||||
@@ -970,7 +972,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
fn new_coroutine_witness(
|
||||
interner: DbInterner<'db>,
|
||||
def_id: CoroutineIdWrapper,
|
||||
args: <DbInterner<'db> as rustc_type_ir::Interner>::GenericArgs,
|
||||
args: <DbInterner<'db> as Interner>::GenericArgs,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::CoroutineWitness(def_id, args))
|
||||
}
|
||||
@@ -978,7 +980,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
fn new_coroutine_witness_for_coroutine(
|
||||
interner: DbInterner<'db>,
|
||||
def_id: CoroutineIdWrapper,
|
||||
coroutine_args: <DbInterner<'db> as rustc_type_ir::Interner>::GenericArgs,
|
||||
coroutine_args: <DbInterner<'db> as Interner>::GenericArgs,
|
||||
) -> Self {
|
||||
// HACK: Coroutine witness types are lifetime erased, so they
|
||||
// never reference any lifetime args from the coroutine. We erase
|
||||
@@ -1006,7 +1008,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
|
||||
fn new_ref(
|
||||
interner: DbInterner<'db>,
|
||||
region: <DbInterner<'db> as rustc_type_ir::Interner>::Region,
|
||||
region: <DbInterner<'db> as Interner>::Region,
|
||||
ty: Self,
|
||||
mutbl: rustc_ast_ir::Mutability,
|
||||
) -> Self {
|
||||
@@ -1016,7 +1018,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
fn new_array_with_const_len(
|
||||
interner: DbInterner<'db>,
|
||||
ty: Self,
|
||||
len: <DbInterner<'db> as rustc_type_ir::Interner>::Const,
|
||||
len: <DbInterner<'db> as Interner>::Const,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::Array(ty, len))
|
||||
}
|
||||
@@ -1025,10 +1027,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
Ty::new(interner, TyKind::Slice(ty))
|
||||
}
|
||||
|
||||
fn new_tup(
|
||||
interner: DbInterner<'db>,
|
||||
tys: &[<DbInterner<'db> as rustc_type_ir::Interner>::Ty],
|
||||
) -> Self {
|
||||
fn new_tup(interner: DbInterner<'db>, tys: &[<DbInterner<'db> as Interner>::Ty]) -> Self {
|
||||
Ty::new(interner, TyKind::Tuple(Tys::new_from_iter(interner, tys.iter().cloned())))
|
||||
}
|
||||
|
||||
@@ -1043,7 +1042,7 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
fn new_fn_def(
|
||||
interner: DbInterner<'db>,
|
||||
def_id: CallableIdWrapper,
|
||||
args: <DbInterner<'db> as rustc_type_ir::Interner>::GenericArgs,
|
||||
args: <DbInterner<'db> as Interner>::GenericArgs,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::FnDef(def_id, args))
|
||||
}
|
||||
@@ -1059,12 +1058,19 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
fn new_pat(
|
||||
interner: DbInterner<'db>,
|
||||
ty: Self,
|
||||
pat: <DbInterner<'db> as rustc_type_ir::Interner>::Pat,
|
||||
pat: <DbInterner<'db> as Interner>::Pat,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::Pat(ty, pat))
|
||||
}
|
||||
|
||||
fn tuple_fields(self) -> <DbInterner<'db> as rustc_type_ir::Interner>::Tys {
|
||||
fn new_unsafe_binder(
|
||||
interner: DbInterner<'db>,
|
||||
ty: rustc_type_ir::Binder<DbInterner<'db>, <DbInterner<'db> as Interner>::Ty>,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::UnsafeBinder(ty.into()))
|
||||
}
|
||||
|
||||
fn tuple_fields(self) -> <DbInterner<'db> as Interner>::Tys {
|
||||
match self.kind() {
|
||||
TyKind::Tuple(args) => args,
|
||||
_ => panic!("tuple_fields called on non-tuple: {self:?}"),
|
||||
@@ -1111,10 +1117,11 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
}
|
||||
}
|
||||
|
||||
fn discriminant_ty(
|
||||
self,
|
||||
interner: DbInterner<'db>,
|
||||
) -> <DbInterner<'db> as rustc_type_ir::Interner>::Ty {
|
||||
fn has_unsafe_fields(self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn discriminant_ty(self, interner: DbInterner<'db>) -> <DbInterner<'db> as Interner>::Ty {
|
||||
match self.kind() {
|
||||
TyKind::Adt(adt, _) if adt.is_enum() => adt.repr().discr_type().to_ty(interner),
|
||||
TyKind::Coroutine(_, args) => args.as_coroutine().discr_ty(interner),
|
||||
@@ -1168,20 +1175,6 @@ impl<'db> rustc_type_ir::inherent::Ty<DbInterner<'db>> for Ty<'db> {
|
||||
TyKind::UnsafeBinder(..) => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn new_unsafe_binder(
|
||||
interner: DbInterner<'db>,
|
||||
ty: rustc_type_ir::Binder<
|
||||
DbInterner<'db>,
|
||||
<DbInterner<'db> as rustc_type_ir::Interner>::Ty,
|
||||
>,
|
||||
) -> Self {
|
||||
Ty::new(interner, TyKind::UnsafeBinder(ty.into()))
|
||||
}
|
||||
|
||||
fn has_unsafe_fields(self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
interned_vec_db!(Tys, Ty);
|
||||
@@ -1193,14 +1186,14 @@ impl<'db> Tys<'db> {
|
||||
}
|
||||
|
||||
impl<'db> rustc_type_ir::inherent::Tys<DbInterner<'db>> for Tys<'db> {
|
||||
fn inputs(self) -> <DbInterner<'db> as rustc_type_ir::Interner>::FnInputTys {
|
||||
fn inputs(self) -> <DbInterner<'db> as Interner>::FnInputTys {
|
||||
Tys::new_from_iter(
|
||||
DbInterner::conjure(),
|
||||
self.as_slice().split_last().unwrap().1.iter().copied(),
|
||||
)
|
||||
}
|
||||
|
||||
fn output(self) -> <DbInterner<'db> as rustc_type_ir::Interner>::Ty {
|
||||
fn output(self) -> <DbInterner<'db> as Interner>::Ty {
|
||||
*self.as_slice().split_last().unwrap().0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user