Upgrade rustc crates
Changes: - `const_of_item()` was added to `Interner`, analogous to `type_of()`. No strongly-typed ID (yet). - New solver trait lang item: `TrivialClone`. - `TypeRelation` changed a bit, the code was copied from rustc.
This commit is contained in:
parent
610008bf96
commit
6cd1740e17
7 changed files with 86 additions and 58 deletions
|
|
@ -2040,9 +2040,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_abi"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce480c45c05462cf6b700468118201b00132613a968a1849da5f7a555c0f1db9"
|
||||
checksum = "1d49dbe5d570793b3c3227972a6ac85fc3e830f09b32c3cb3b68cfceebad3b0a"
|
||||
dependencies = [
|
||||
"bitflags 2.9.4",
|
||||
"ra-ap-rustc_hashes",
|
||||
|
|
@ -2052,34 +2052,33 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_ast_ir"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "453da2376de406d740ca28412a31ae3d5a6039cd45698c1c2fb01b577dff64ae"
|
||||
checksum = "cd0956db62c264a899d15667993cbbd2e8f0b02108712217e2579c61ac30b94b"
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_hashes"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf411a55deaa3ea348594c8273fb2d1200265bf87b881b40c62b32f75caf8323"
|
||||
checksum = "7df512084c24f4c96c8cc9a59cbd264301efbc8913d3759b065398024af316c9"
|
||||
dependencies = [
|
||||
"rustc-stable-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d0dd4cf1417ea8a809e9e7bf296c6ce6e05b75b043483872d1bd2951a08142c"
|
||||
checksum = "bca3a49a928d38ba7927605e5909b6abe77d09ff359e4695c070c3f91d69cc8a"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index_macros",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index_macros"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1b0d218fb91f8969716a962142c722d88b3cd3fd1f7ef03093261bf37e85dfd"
|
||||
checksum = "4463e908a62c64c2a65c1966c2f4995d0e1f8b7dfc85a8b8de2562edf3d89070"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -2088,9 +2087,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_lexer"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ec7c26e92c44d5433b29cf661faf0027e263b70a411d0f28996bd67e3bdb57e"
|
||||
checksum = "228e01e1b237adb4bd8793487e1c37019c1e526a8f93716d99602301be267056"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"unicode-properties",
|
||||
|
|
@ -2099,9 +2098,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_next_trait_solver"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "029686fdbc8a058cf3d81ad157e1cdc81a37b9de0400289ccb86a62465484313"
|
||||
checksum = "10d6f91143011d474bb844d268b0784c6a4c6db57743558b83f5ad34511627f1"
|
||||
dependencies = [
|
||||
"derive-where",
|
||||
"ra-ap-rustc_index",
|
||||
|
|
@ -2112,9 +2111,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_parse_format"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "509d279f1e87acc33476da3fbd05a6054e9ffeb4427cb38ba01b9d2656aec268"
|
||||
checksum = "37fa8effbc436c0ddd9d7b1421aa3cccf8b94566c841c4e4aa3e09063b8f423f"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_lexer",
|
||||
"rustc-literal-escaper 0.0.5",
|
||||
|
|
@ -2122,9 +2121,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_pattern_analysis"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bb2c9930854314b03bd7aab060a14bca6f194b76381a4c309e3905ec3a02bbc"
|
||||
checksum = "883c843fc27847ad03b8e772dd4a2d2728af4333a6d6821a22dfcfe7136dff3e"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index",
|
||||
"rustc-hash 2.1.1",
|
||||
|
|
@ -2135,9 +2134,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_type_ir"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e4a92a3e4dbdebb0d4c9caceb52eff45c4df784d21fb2da90dac50e218f95c0"
|
||||
checksum = "a86e33c46b2b261a173b23f207461a514812a8b2d2d7935bbc685f733eacce10"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags 2.9.4",
|
||||
|
|
@ -2155,9 +2154,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_type_ir_macros"
|
||||
version = "0.139.0"
|
||||
version = "0.143.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca368eca2472367f2e6fdfb431c8342e99d848e4ce89cb20dd3b3bdcc43cbc28"
|
||||
checksum = "15034c2fcaa5cf302aea6db20eda0f71fffeb0b372d6073cc50f940e974a2a47"
|
||||
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.139", default-features = false }
|
||||
ra-ap-rustc_parse_format = { version = "0.139", default-features = false }
|
||||
ra-ap-rustc_index = { version = "0.139", default-features = false }
|
||||
ra-ap-rustc_abi = { version = "0.139", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.139", default-features = false }
|
||||
ra-ap-rustc_ast_ir = { version = "0.139", default-features = false }
|
||||
ra-ap-rustc_type_ir = { version = "0.139", default-features = false }
|
||||
ra-ap-rustc_next_trait_solver = { version = "0.139", default-features = false }
|
||||
ra-ap-rustc_lexer = { version = "0.143", default-features = false }
|
||||
ra-ap-rustc_parse_format = { version = "0.143", default-features = false }
|
||||
ra-ap-rustc_index = { version = "0.143", default-features = false }
|
||||
ra-ap-rustc_abi = { version = "0.143", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.143", default-features = false }
|
||||
ra-ap-rustc_ast_ir = { version = "0.143", default-features = false }
|
||||
ra-ap-rustc_type_ir = { version = "0.143", default-features = false }
|
||||
ra-ap-rustc_next_trait_solver = { version = "0.143", default-features = false }
|
||||
|
||||
# local crates that aren't published to crates.io. These should not have versions.
|
||||
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ language_item_table! { LangItems =>
|
|||
StructuralTeq, sym::structural_teq, structural_teq_trait, TraitId, GenericRequirement::None;
|
||||
Copy, sym::copy, copy_trait, TraitId, GenericRequirement::Exact(0);
|
||||
Clone, sym::clone, clone_trait, TraitId, GenericRequirement::None;
|
||||
TrivialClone, sym::trivial_clone, clone_trait, TraitId, GenericRequirement::None;
|
||||
Sync, sym::sync, sync_trait, TraitId, GenericRequirement::Exact(0);
|
||||
DiscriminantKind, sym::discriminant_kind, discriminant_kind_trait, TraitId, GenericRequirement::None;
|
||||
/// The associated item of the `DiscriminantKind` trait.
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ use tracing::{debug, instrument, warn};
|
|||
use super::{
|
||||
PredicateEmittingRelation, Relate, RelateResult, StructurallyRelateAliases, TypeRelation,
|
||||
};
|
||||
use crate::next_solver::infer::type_variable::TypeVariableValue;
|
||||
use crate::next_solver::infer::unify_key::ConstVariableValue;
|
||||
use crate::next_solver::infer::{InferCtxt, relate};
|
||||
use crate::next_solver::util::MaxUniverse;
|
||||
use crate::next_solver::{
|
||||
AliasTy, Binder, ClauseKind, Const, ConstKind, DbInterner, GenericArgs, PredicateKind, Region,
|
||||
SolverDefId, Term, TermVid, Ty, TyKind, TypingMode, UnevaluatedConst,
|
||||
AliasTy, Binder, ClauseKind, Const, ConstKind, DbInterner, PredicateKind, Region, SolverDefId,
|
||||
Term, TermVid, Ty, TyKind, TypingMode, UnevaluatedConst,
|
||||
};
|
||||
use crate::next_solver::{GenericArgs, infer::type_variable::TypeVariableValue};
|
||||
|
||||
impl<'db> InferCtxt<'db> {
|
||||
/// The idea is that we should ensure that the type variable `target_vid`
|
||||
|
|
@ -384,29 +384,26 @@ impl<'db> TypeRelation<DbInterner<'db>> for Generalizer<'_, 'db> {
|
|||
self.infcx.interner
|
||||
}
|
||||
|
||||
fn relate_item_args(
|
||||
fn relate_ty_args(
|
||||
&mut self,
|
||||
item_def_id: SolverDefId,
|
||||
a_arg: GenericArgs<'db>,
|
||||
b_arg: GenericArgs<'db>,
|
||||
) -> RelateResult<'db, GenericArgs<'db>> {
|
||||
if self.ambient_variance == Variance::Invariant {
|
||||
a_ty: Ty<'db>,
|
||||
_: Ty<'db>,
|
||||
def_id: SolverDefId,
|
||||
a_args: GenericArgs<'db>,
|
||||
b_args: GenericArgs<'db>,
|
||||
mk: impl FnOnce(GenericArgs<'db>) -> Ty<'db>,
|
||||
) -> RelateResult<'db, Ty<'db>> {
|
||||
let args = if self.ambient_variance == Variance::Invariant {
|
||||
// Avoid fetching the variance if we are in an invariant
|
||||
// context; no need, and it can induce dependency cycles
|
||||
// (e.g., #41849).
|
||||
relate::relate_args_invariantly(self, a_arg, b_arg)
|
||||
relate::relate_args_invariantly(self, a_args, b_args)
|
||||
} else {
|
||||
let tcx = self.cx();
|
||||
let opt_variances = tcx.variances_of(item_def_id);
|
||||
relate::relate_args_with_variances(
|
||||
self,
|
||||
item_def_id,
|
||||
opt_variances,
|
||||
a_arg,
|
||||
b_arg,
|
||||
false,
|
||||
)
|
||||
}
|
||||
let interner = self.cx();
|
||||
let variances = interner.variances_of(def_id);
|
||||
relate::relate_args_with_variances(self, variances, a_args, b_args)
|
||||
}?;
|
||||
if args == a_args { Ok(a_ty) } else { Ok(mk(args)) }
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self, variance, b), ret)]
|
||||
|
|
|
|||
|
|
@ -18,17 +18,19 @@
|
|||
//! [lattices]: https://en.wikipedia.org/wiki/Lattice_(order)
|
||||
|
||||
use rustc_type_ir::{
|
||||
AliasRelationDirection, TypeVisitableExt, Upcast, Variance,
|
||||
AliasRelationDirection, Interner, TypeVisitableExt, Upcast, Variance,
|
||||
inherent::{IntoKind, Span as _},
|
||||
relate::{
|
||||
Relate, StructurallyRelateAliases, TypeRelation, VarianceDiagInfo,
|
||||
combine::{PredicateEmittingRelation, super_combine_consts, super_combine_tys},
|
||||
combine::{
|
||||
PredicateEmittingRelation, combine_ty_args, super_combine_consts, super_combine_tys,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
use crate::next_solver::{
|
||||
AliasTy, Binder, Const, DbInterner, Goal, ParamEnv, Predicate, PredicateKind, Region, Span, Ty,
|
||||
TyKind,
|
||||
AliasTy, Binder, Const, DbInterner, GenericArgs, Goal, ParamEnv, Predicate, PredicateKind,
|
||||
Region, SolverDefId, Span, Ty, TyKind,
|
||||
infer::{
|
||||
InferCtxt, TypeTrace,
|
||||
relate::RelateResult,
|
||||
|
|
@ -82,6 +84,19 @@ impl<'db> TypeRelation<DbInterner<'db>> for LatticeOp<'_, 'db> {
|
|||
self.infcx.interner
|
||||
}
|
||||
|
||||
fn relate_ty_args(
|
||||
&mut self,
|
||||
a_ty: Ty<'db>,
|
||||
b_ty: Ty<'db>,
|
||||
def_id: SolverDefId,
|
||||
a_args: GenericArgs<'db>,
|
||||
b_args: GenericArgs<'db>,
|
||||
mk: impl FnOnce(GenericArgs<'db>) -> Ty<'db>,
|
||||
) -> RelateResult<'db, Ty<'db>> {
|
||||
let variances = self.cx().variances_of(def_id);
|
||||
combine_ty_args(self.infcx, self, a_ty, b_ty, variances, a_args, b_args, mk)
|
||||
}
|
||||
|
||||
fn relate_with_variance<T: Relate<DbInterner<'db>>>(
|
||||
&mut self,
|
||||
variance: Variance,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ use rustc_type_ir::{
|
|||
elaborate::elaborate,
|
||||
error::TypeError,
|
||||
fast_reject,
|
||||
inherent::{self, GenericsOf, IntoKind, SliceLike as _, Span as _, Ty as _},
|
||||
inherent::{self, Const as _, GenericsOf, IntoKind, SliceLike as _, Span as _, Ty as _},
|
||||
lang_items::{SolverAdtLangItem, SolverLangItem, SolverTraitLangItem},
|
||||
solve::SizedTraitKind,
|
||||
};
|
||||
|
|
@ -39,7 +39,7 @@ use crate::{
|
|||
AdtIdWrapper, BoundConst, CallableIdWrapper, CanonicalVarKind, ClosureIdWrapper,
|
||||
CoroutineIdWrapper, Ctor, FnSig, FxIndexMap, GeneralConstIdWrapper, ImplIdWrapper,
|
||||
OpaqueTypeKey, RegionAssumptions, SimplifiedType, SolverContext, SolverDefIds,
|
||||
TraitIdWrapper, TypeAliasIdWrapper, util::explicit_item_bounds,
|
||||
TraitIdWrapper, TypeAliasIdWrapper, UnevaluatedConst, util::explicit_item_bounds,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -1512,6 +1512,7 @@ impl<'db> Interner for DbInterner<'db> {
|
|||
SolverTraitLangItem::BikeshedGuaranteedNoDrop => {
|
||||
unimplemented!()
|
||||
}
|
||||
SolverTraitLangItem::TrivialClone => lang_items.TrivialClone,
|
||||
};
|
||||
lang_item.expect("Lang item required but not found.").into()
|
||||
}
|
||||
|
|
@ -1565,6 +1566,7 @@ impl<'db> Interner for DbInterner<'db> {
|
|||
AsyncFn,
|
||||
AsyncFnMut,
|
||||
AsyncFnOnce,
|
||||
TrivialClone,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1651,6 +1653,7 @@ impl<'db> Interner for DbInterner<'db> {
|
|||
AsyncFn,
|
||||
AsyncFnMut,
|
||||
AsyncFnOnce,
|
||||
TrivialClone,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -2167,6 +2170,18 @@ impl<'db> Interner for DbInterner<'db> {
|
|||
Some(SolverTraitLangItem::Sized | SolverTraitLangItem::MetaSized)
|
||||
)
|
||||
}
|
||||
|
||||
fn const_of_item(self, def_id: Self::DefId) -> rustc_type_ir::EarlyBinder<Self, Self::Const> {
|
||||
let id = match def_id {
|
||||
SolverDefId::StaticId(id) => id.into(),
|
||||
SolverDefId::ConstId(id) => id.into(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
EarlyBinder::bind(Const::new_unevaluated(
|
||||
self,
|
||||
UnevaluatedConst { def: GeneralConstIdWrapper(id), args: GenericArgs::empty(self) },
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> DbInterner<'db> {
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ define_symbols! {
|
|||
cfg_select,
|
||||
char,
|
||||
clone,
|
||||
trivial_clone,
|
||||
Clone,
|
||||
coerce_unsized,
|
||||
column,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue