Remove unused
This commit is contained in:
parent
8040f4a5e3
commit
d992736e79
@ -14,7 +14,7 @@
|
||||
use crate::{
|
||||
db::HirDatabase, primitive, to_assoc_type_id, to_chalk_trait_id, utils::generics, Binders,
|
||||
CallableSig, FnPointer, FnSig, FnSubst, GenericArg, Interner, ProjectionTy, Substitution,
|
||||
TraitRef, Ty, TyDefId, TyExt, TyKind, TypeWalk, ValueTyDefId,
|
||||
TraitRef, Ty, TyDefId, TyExt, TyKind, ValueTyDefId,
|
||||
};
|
||||
|
||||
/// This is a builder for `Ty` or anything that needs a `Substitution`.
|
||||
|
@ -1,14 +1,8 @@
|
||||
//! Implementations of the Chalk `Cast` trait for our types.
|
||||
|
||||
use chalk_ir::{
|
||||
cast::{Cast, CastTo},
|
||||
interner::HasInterner,
|
||||
};
|
||||
use chalk_ir::interner::HasInterner;
|
||||
|
||||
use crate::{
|
||||
AliasEq, CallableSig, DomainGoal, GenericArg, GenericArgData, Interner, PolyFnSig,
|
||||
ReturnTypeImplTraits, TraitRef, Ty, WhereClause,
|
||||
};
|
||||
use crate::{CallableSig, ReturnTypeImplTraits};
|
||||
|
||||
macro_rules! has_interner {
|
||||
($t:ty) => {
|
||||
@ -18,15 +12,5 @@ impl HasInterner for $t {
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! transitive_impl {
|
||||
($a:ty, $b:ty, $c:ty) => {
|
||||
impl CastTo<$c> for $a {
|
||||
fn cast_to(self, interner: &Interner) -> $c {
|
||||
self.cast::<$b>(interner).cast(interner)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
has_interner!(CallableSig);
|
||||
has_interner!(ReturnTypeImplTraits);
|
||||
|
@ -38,7 +38,6 @@
|
||||
|
||||
use super::{
|
||||
DomainGoal, Guidance, InEnvironment, ProjectionTy, Solution, TraitEnvironment, TraitRef, Ty,
|
||||
TypeWalk,
|
||||
};
|
||||
use crate::{
|
||||
db::HirDatabase, fold_tys, infer::diagnostics::InferenceDiagnostic,
|
||||
|
@ -73,11 +73,11 @@ fn coerce_inner(&mut self, mut from_ty: Ty, to_ty: &Ty) -> bool {
|
||||
// Pointer weakening and function to pointer
|
||||
match (from_ty.kind(&Interner), to_ty.kind(&Interner)) {
|
||||
// `*mut T` -> `*const T`
|
||||
(TyKind::Raw(m1, inner), TyKind::Raw(m2 @ Mutability::Not, ..)) => {
|
||||
(TyKind::Raw(_, inner), TyKind::Raw(m2 @ Mutability::Not, ..)) => {
|
||||
from_ty = TyKind::Raw(*m2, inner.clone()).intern(&Interner);
|
||||
}
|
||||
// `&mut T` -> `&T`
|
||||
(TyKind::Ref(m1, lt, inner), TyKind::Ref(m2 @ Mutability::Not, ..)) => {
|
||||
(TyKind::Ref(_, lt, inner), TyKind::Ref(m2 @ Mutability::Not, ..)) => {
|
||||
from_ty = TyKind::Ref(*m2, lt.clone(), inner.clone()).intern(&Interner);
|
||||
}
|
||||
// `&T` -> `*const T`
|
||||
|
@ -24,7 +24,6 @@
|
||||
utils::{generics, Generics},
|
||||
AdtId, Binders, CallableDefId, FnPointer, FnSig, FnSubst, InEnvironment, Interner,
|
||||
ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyExt, TyKind,
|
||||
TypeWalk,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
@ -12,7 +12,7 @@
|
||||
use crate::{
|
||||
fold_tys, static_lifetime, AliasEq, AliasTy, BoundVar, Canonical, CanonicalVarKinds,
|
||||
DebruijnIndex, FnPointer, FnSubst, InEnvironment, InferenceVar, Interner, Scalar, Substitution,
|
||||
Ty, TyExt, TyKind, TypeWalk, WhereClause,
|
||||
Ty, TyExt, TyKind, WhereClause,
|
||||
};
|
||||
|
||||
impl<'a> InferenceContext<'a> {
|
||||
|
@ -1,8 +1,6 @@
|
||||
//! The type system. We currently use this to infer types for completion, hover
|
||||
//! information and various assists.
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! eprintln {
|
||||
($($tt:tt)*) => { stdx::eprintln!($($tt)*) };
|
||||
@ -34,7 +32,6 @@ macro_rules! eprintln {
|
||||
|
||||
use base_db::salsa;
|
||||
use chalk_ir::{
|
||||
cast::{CastTo, Caster},
|
||||
fold::{Fold, Shift},
|
||||
interner::HasInterner,
|
||||
UintTy,
|
||||
|
@ -35,7 +35,7 @@
|
||||
AliasEq, AliasTy, Binders, BoundVar, CallableSig, DebruijnIndex, DynTy, FnPointer, FnSig,
|
||||
FnSubst, ImplTraitId, OpaqueTy, PolyFnSig, ProjectionTy, QuantifiedWhereClause,
|
||||
QuantifiedWhereClauses, ReturnTypeImplTrait, ReturnTypeImplTraits, Substitution,
|
||||
TraitEnvironment, TraitRef, TraitRefExt, Ty, TyBuilder, TyKind, TypeWalk, WhereClause,
|
||||
TraitEnvironment, TraitRef, TraitRefExt, Ty, TyBuilder, TyKind, WhereClause,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -6,11 +6,7 @@
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use base_db::CrateId;
|
||||
use chalk_ir::{
|
||||
cast::Cast,
|
||||
fold::{Fold, Folder},
|
||||
Fallible, Mutability, UniverseIndex,
|
||||
};
|
||||
use chalk_ir::{cast::Cast, Mutability, UniverseIndex};
|
||||
use hir_def::{
|
||||
lang_item::LangItemTarget, nameres::DefMap, AssocContainerId, AssocItemId, FunctionId,
|
||||
GenericDefId, HasModule, ImplId, Lookup, ModuleId, TraitId,
|
||||
@ -25,9 +21,9 @@
|
||||
primitive::{self, FloatTy, IntTy, UintTy},
|
||||
static_lifetime,
|
||||
utils::all_super_traits,
|
||||
AdtId, BoundVar, Canonical, CanonicalVarKinds, DebruijnIndex, FnPointer, FnSig, ForeignDefId,
|
||||
AdtId, Canonical, CanonicalVarKinds, DebruijnIndex, FnPointer, FnSig, ForeignDefId,
|
||||
InEnvironment, Interner, Scalar, Substitution, TraitEnvironment, TraitRefExt, Ty, TyBuilder,
|
||||
TyExt, TyKind, TypeWalk,
|
||||
TyExt, TyKind,
|
||||
};
|
||||
|
||||
/// This is used as a key for indexing impls.
|
||||
|
@ -12,7 +12,7 @@
|
||||
Solution, TraitRefExt, Ty, TyKind, WhereClause,
|
||||
};
|
||||
|
||||
use self::chalk::{from_chalk, Interner, ToChalk};
|
||||
use self::chalk::Interner;
|
||||
|
||||
pub(crate) mod chalk;
|
||||
|
||||
@ -101,8 +101,7 @@ pub(crate) fn trait_solve_query(
|
||||
// We currently don't deal with universes (I think / hope they're not yet
|
||||
// relevant for our use cases?)
|
||||
let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 };
|
||||
let solution = solve(db, krate, &u_canonical);
|
||||
solution.map(|solution| solution_from_chalk(db, solution))
|
||||
solve(db, krate, &u_canonical)
|
||||
}
|
||||
|
||||
fn solve(
|
||||
@ -170,13 +169,6 @@ fn is_chalk_print() -> bool {
|
||||
std::env::var("CHALK_PRINT").is_ok()
|
||||
}
|
||||
|
||||
fn solution_from_chalk(
|
||||
db: &dyn HirDatabase,
|
||||
solution: chalk_solve::Solution<Interner>,
|
||||
) -> Solution {
|
||||
solution
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum FnTrait {
|
||||
FnOnce,
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
use log::debug;
|
||||
|
||||
use chalk_ir::{fold::shift::Shift, interner::HasInterner, CanonicalVarKinds};
|
||||
use chalk_ir::{fold::shift::Shift, CanonicalVarKinds};
|
||||
use chalk_solve::rust_ir::{self, OpaqueTyDatumBound, WellKnownTrait};
|
||||
|
||||
use base_db::{salsa::InternKey, CrateId};
|
||||
|
@ -3,16 +3,15 @@
|
||||
//! Chalk (in both directions); plus some helper functions for more specialized
|
||||
//! conversions.
|
||||
|
||||
use chalk_ir::{cast::Cast, interner::HasInterner};
|
||||
use chalk_ir::cast::Cast;
|
||||
use chalk_solve::rust_ir;
|
||||
|
||||
use base_db::salsa::InternKey;
|
||||
use hir_def::{GenericDefId, TypeAliasId};
|
||||
|
||||
use crate::{
|
||||
db::HirDatabase, static_lifetime, AliasTy, CallableDefId, Canonical, ConstrainedSubst,
|
||||
DomainGoal, FnPointer, GenericArg, InEnvironment, OpaqueTy, ProjectionTy, ProjectionTyExt,
|
||||
QuantifiedWhereClause, Substitution, TraitRef, Ty, TypeWalk, WhereClause,
|
||||
db::HirDatabase, AliasTy, CallableDefId, ProjectionTyExt, QuantifiedWhereClause, Substitution,
|
||||
Ty, WhereClause,
|
||||
};
|
||||
|
||||
use super::interner::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
//! Helper functions for working with def, which don't need to be a separate
|
||||
//! query, but can't be computed directly from `*Data` (ie, which need a `db`).
|
||||
use std::sync::Arc;
|
||||
|
||||
use chalk_ir::{fold::Shift, BoundVar, DebruijnIndex};
|
||||
use hir_def::{
|
||||
@ -16,9 +15,7 @@
|
||||
};
|
||||
use hir_expand::name::{name, Name};
|
||||
|
||||
use crate::{
|
||||
db::HirDatabase, Interner, Substitution, TraitRef, TraitRefExt, TyKind, TypeWalk, WhereClause,
|
||||
};
|
||||
use crate::{db::HirDatabase, Interner, Substitution, TraitRef, TraitRefExt, TyKind, WhereClause};
|
||||
|
||||
fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> {
|
||||
let resolver = trait_.resolver(db);
|
||||
@ -137,15 +134,6 @@ pub(super) fn associated_type_by_name_including_super_traits(
|
||||
})
|
||||
}
|
||||
|
||||
/// Helper for mutating `Arc<[T]>` (i.e. `Arc::make_mut` for Arc slices).
|
||||
/// The underlying values are cloned if there are other strong references.
|
||||
pub(crate) fn make_mut_slice<T: Clone>(a: &mut Arc<[T]>) -> &mut [T] {
|
||||
if Arc::get_mut(a).is_none() {
|
||||
*a = a.iter().cloned().collect();
|
||||
}
|
||||
Arc::get_mut(a).unwrap()
|
||||
}
|
||||
|
||||
pub(crate) fn generics(db: &dyn DefDatabase, def: GenericDefId) -> Generics {
|
||||
let parent_generics = parent_generic_def(db, def).map(|def| Box::new(generics(db, def)));
|
||||
Generics { def, params: db.generic_params(def), parent_generics }
|
||||
|
@ -1,14 +1,11 @@
|
||||
//! The `TypeWalk` trait (probably to be replaced by Chalk's `Fold` and
|
||||
//! `Visit`).
|
||||
|
||||
use std::mem;
|
||||
|
||||
use chalk_ir::{interner::HasInterner, DebruijnIndex};
|
||||
use chalk_ir::interner::HasInterner;
|
||||
|
||||
use crate::{
|
||||
utils::make_mut_slice, AliasEq, AliasTy, Binders, CallableSig, FnSubst, GenericArg,
|
||||
GenericArgData, Interner, OpaqueTy, ProjectionTy, Substitution, TraitRef, Ty, TyKind,
|
||||
WhereClause,
|
||||
AliasEq, AliasTy, Binders, CallableSig, FnSubst, GenericArg, GenericArgData, Interner,
|
||||
OpaqueTy, ProjectionTy, Substitution, TraitRef, Ty, TyKind, WhereClause,
|
||||
};
|
||||
|
||||
/// This allows walking structures that contain types to do something with those
|
||||
|
Loading…
Reference in New Issue
Block a user