Skip to content

Commit

Permalink
feat: get rid of ImplExprAtom::{FnPointer,Closure}
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed May 6, 2024
1 parent 122a64e commit f2e20fa
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 36 deletions.
3 changes: 0 additions & 3 deletions engine/lib/ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ functor
| ImplApp of { impl : impl_expr; args : impl_expr list }
| Dyn
| Builtin of trait_goal
| FnPointer of ty
(* The `IE` suffix is there because visitors conflicts...... *)
| ClosureIE of todo

and trait_goal = { trait : concrete_ident; args : generic_value list }
(** A fully applied trait: [Foo<SomeTy, T0, ..., Tn>] (or
Expand Down
18 changes: 0 additions & 18 deletions engine/lib/ast_visitors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,6 @@ functor
| Builtin x0 ->
let x0 = self#visit_trait_goal env x0 in
Builtin x0
| FnPointer x0 ->
let x0 = self#visit_ty env x0 in
FnPointer x0
| ClosureIE x0 ->
let x0 = self#visit_todo env x0 in
ClosureIE x0

method visit_trait_goal (env : 'env) (this : trait_goal) : trait_goal =
let trait = self#visit_concrete_ident env this.trait in
Expand Down Expand Up @@ -1115,12 +1109,6 @@ functor
| Builtin x0 ->
let x0, reduce_acc = self#visit_trait_goal env x0 in
(Builtin x0, reduce_acc)
| FnPointer x0 ->
let x0, reduce_acc = self#visit_ty env x0 in
(FnPointer x0, reduce_acc)
| ClosureIE x0 ->
let x0, reduce_acc = self#visit_todo env x0 in
(ClosureIE x0, reduce_acc)

method visit_trait_goal (env : 'env) (this : trait_goal)
: trait_goal * 'acc =
Expand Down Expand Up @@ -2301,12 +2289,6 @@ functor
| Builtin x0 ->
let reduce_acc = self#visit_trait_goal env x0 in
reduce_acc
| FnPointer x0 ->
let reduce_acc = self#visit_ty env x0 in
reduce_acc
| ClosureIE x0 ->
let reduce_acc = self#visit_todo env x0 in
reduce_acc

method visit_trait_goal (env : 'env) (this : trait_goal) : 'acc =
let reduce_acc = self#visit_concrete_ident env this.trait in
Expand Down
2 changes: 0 additions & 2 deletions engine/lib/import_thir.ml
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,6 @@ end) : EXPR = struct
| Dyn -> Dyn
| SelfImpl { path; _ } -> List.fold ~init:Self ~f:browse_path path
| Builtin { trait } -> Builtin (c_trait_ref span trait)
| FnPointer { fn_ty } -> FnPointer (c_ty span fn_ty)
| Closure _ as x -> ClosureIE ([%show: Thir.impl_expr_atom] x)
| Todo str -> failwith @@ "impl_expr_atom: Todo " ^ str

and c_generic_value (span : Thir.span) (ty : Thir.generic_arg) : generic_value
Expand Down
2 changes: 0 additions & 2 deletions engine/lib/subtype.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ struct
}
| Dyn -> Dyn
| Builtin tr -> Builtin (dtrait_goal span tr)
| ClosureIE todo -> ClosureIE todo
| FnPointer ty -> FnPointer (dty span ty)

and dgeneric_value (span : span) (generic_value : A.generic_value) :
B.generic_value =
Expand Down
11 changes: 0 additions & 11 deletions frontend/exporter/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ pub enum ImplExprAtom {
Dyn,
/// A built-in trait whose implementation is computed by the compiler, such as `Sync`.
Builtin { r#trait: TraitRef },
/// Function pointer types (e.g. `fn(bool, u32) -> u32`) automaticlaly implement some traits
/// such as `Copy` and the appropriate `Fn` traits.
/// FIXME: currently unused because rustc no longer identifies those explicitly.
FnPointer { fn_ty: Box<Ty> },
/// Closures automatically implement the appropriate `Fn` traits.
/// FIXME: currently unused because rustc no longer identifies those explicitly.
Closure {
closure_def_id: DefId,
parent_substs: Vec<GenericArg>,
signature: Box<PolyFnSig>,
},
/// Anything else. Currently used for trait upcasting and trait aliases.
Todo(String),
}
Expand Down

0 comments on commit f2e20fa

Please sign in to comment.