mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Add impl trait lowering mode
This commit is contained in:
parent
22a65b11b3
commit
7ea4bce1b2
6 changed files with 141 additions and 40 deletions
|
@ -733,8 +733,7 @@ impl Local {
|
|||
let ty = infer[self.pat_id].clone();
|
||||
let resolver = def.resolver(db);
|
||||
let krate = def.module(db).krate;
|
||||
let ctx = hir_ty::TyLoweringContext { db, resolver: &resolver };
|
||||
let environment = TraitEnvironment::lower(&ctx);
|
||||
let environment = TraitEnvironment::lower(db, &resolver);
|
||||
Type { krate, ty: InEnvironment { value: ty, environment } }
|
||||
}
|
||||
|
||||
|
@ -790,8 +789,12 @@ impl ImplBlock {
|
|||
pub fn target_ty(&self, db: &impl HirDatabase) -> Type {
|
||||
let impl_data = db.impl_data(self.id);
|
||||
let resolver = self.id.resolver(db);
|
||||
let ctx = hir_ty::TyLoweringContext { db, resolver: &resolver };
|
||||
let environment = TraitEnvironment::lower(&ctx);
|
||||
let ctx = hir_ty::TyLoweringContext {
|
||||
db,
|
||||
resolver: &resolver,
|
||||
impl_trait_mode: hir_ty::ImplTraitLoweringMode::Disallowed,
|
||||
};
|
||||
let environment = TraitEnvironment::lower(db, &resolver);
|
||||
let ty = Ty::from_hir(&ctx, &impl_data.target_type);
|
||||
Type {
|
||||
krate: self.id.lookup(db).container.module(db).krate,
|
||||
|
@ -846,8 +849,7 @@ pub struct Type {
|
|||
impl Type {
|
||||
fn new(db: &impl HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type {
|
||||
let resolver = lexical_env.resolver(db);
|
||||
let ctx = hir_ty::TyLoweringContext { db, resolver: &resolver };
|
||||
let environment = TraitEnvironment::lower(&ctx);
|
||||
let environment = TraitEnvironment::lower(db, &resolver);
|
||||
Type { krate, ty: InEnvironment { value: ty, environment } }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue