From 389d9a6c2d297d838b4cfa754565b6bea5f8c757 Mon Sep 17 00:00:00 2001 From: Charles Lew Date: Wed, 16 Sep 2020 20:57:14 +0800 Subject: Lower extern type alias as foreign opaque type. --- crates/hir_ty/src/lower.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index cd574e983..39252bc5e 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -1101,9 +1101,13 @@ fn type_for_type_alias(db: &dyn HirDatabase, t: TypeAliasId) -> Binders { let resolver = t.resolver(db.upcast()); let ctx = TyLoweringContext::new(db, &resolver).with_type_param_mode(TypeParamLoweringMode::Variable); - let type_ref = &db.type_alias_data(t).type_ref; let substs = Substs::bound_vars(&generics, DebruijnIndex::INNERMOST); - let inner = Ty::from_hir(&ctx, type_ref.as_ref().unwrap_or(&TypeRef::Error)); + let inner = if db.type_alias_data(t).is_extern { + Ty::simple(TypeCtor::ForeignType(t)) + } else { + let type_ref = &db.type_alias_data(t).type_ref; + Ty::from_hir(&ctx, type_ref.as_ref().unwrap_or(&TypeRef::Error)) + }; Binders::new(substs.len(), inner) } -- cgit v1.2.3