Skip to content

Commit

Permalink
chore: minor clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed Apr 18, 2024
1 parent 1f8874f commit b92c568
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
7 changes: 3 additions & 4 deletions engine/lib/import_thir.ml
Original file line number Diff line number Diff line change
Expand Up @@ -901,14 +901,13 @@ end) : EXPR = struct
| Tuple types ->
let types = List.map ~f:(fun ty -> GType (c_ty span ty)) types in
TApp { ident = `TupleType (List.length types); args = types }
(* | Alias (_kind, { trait_def_id = Some (_did, impl_expr); def_id; _ }) -> *)
| Alias { kind = Projection { assoc_item = _; impl_expr }; def_id; _ } ->
let impl = c_impl_expr span impl_expr in
let item = Concrete_ident.of_def_id (AssociatedItem Type) def_id in
TAssociatedType { impl; item }
| Alias _ -> unimplemented [ span ] "xx"
(* | Alias (_kind, { def_id; trait_def_id = None; _ }) -> *)
(* TOpaque (Concrete_ident.of_def_id Type def_id) *)
| Alias { kind = Opaque; def_id; _ } ->
TOpaque (Concrete_ident.of_def_id Type def_id)
| Alias { kind = Inherent; _ } -> unimplemented [ span ] "type Alias::Inherent"
| Param { index; name } ->
(* TODO: [id] might not unique *)
TParam { name; id = Local_ident.mk_id Typ (MyInt64.to_int_exn index) }
Expand Down
11 changes: 4 additions & 7 deletions frontend/exporter/src/constant_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ impl From<ConstantExpr> for Expr {
base: None,
user_ty: None,
}),
TraitConst { .. } => {
// SH: I leave this for you Lucas
unimplemented!()
}
GlobalName { id } => ExprKind::GlobalName { id },
Borrow(e) => ExprKind::Borrow {
borrow_kind: BorrowKind::Shared,
Expand All @@ -154,9 +150,9 @@ impl From<ConstantExpr> for Expr {
Tuple { fields } => ExprKind::Tuple {
fields: fields.into_iter().map(|field| field.into()).collect(),
},
FnPtr { .. } => {
kind @ (FnPtr { .. } | TraitConst { .. }) => {
// SH: I see the `Closure` kind, but it's not the same as function pointer?
unimplemented!()
ExprKind::Todo(format!("FnPtr or TraitConst. kind={:#?}", kind))
}
Todo(msg) => ExprKind::Todo(msg),
};
Expand Down Expand Up @@ -286,7 +282,7 @@ pub(crate) fn is_anon_const<'tcx>(
)
}

pub(crate) fn trait_const_to_constant_expr_kind<'tcx, S: BaseState<'tcx> + HasOwnerId>(
fn trait_const_to_constant_expr_kind<'tcx, S: BaseState<'tcx> + HasOwnerId>(
s: &S,
_const_def_id: rustc_hir::def_id::DefId,
substs: rustc_middle::ty::SubstsRef<'tcx>,
Expand All @@ -300,6 +296,7 @@ pub(crate) fn trait_const_to_constant_expr_kind<'tcx, S: BaseState<'tcx> + HasOw

ConstantExprKind::TraitConst { impl_expr, name }
}

impl ConstantExprKind {
pub fn decorate(self, ty: Ty, span: Span) -> Decorated<Self> {
Decorated {
Expand Down

0 comments on commit b92c568

Please sign in to comment.