diff --git a/src/lib.ml b/src/lib.ml index 2b08760ff53..a227d146783 100644 --- a/src/lib.ml +++ b/src/lib.ml @@ -268,6 +268,8 @@ let modes t = t.info.modes let virtual_ t = t.info.virtual_ +let is_impl t = Option.is_some t.implements + let src_dir t = t.info.src_dir let orig_src_dir t = Option.value ~default:t.info.src_dir t.info.orig_src_dir let obj_dir t = t.info.obj_dir diff --git a/src/lib.mli b/src/lib.mli index ba0d61394dc..18d2f62a822 100644 --- a/src/lib.mli +++ b/src/lib.mli @@ -40,6 +40,11 @@ val wrapped : t -> Wrapped.t option Or_exn.t val virtual_ : t -> Lib_modules.t Lib_info.Source.t option +(** [is_impl lib] returns [true] if the library is an implementation + of a virtual library *) +val is_impl : t -> bool + + val special_builtin_support : t -> Dune_file.Library.Special_builtin_support.t option diff --git a/src/odoc.ml b/src/odoc.ml index 55089d077a9..774f26ea7f0 100644 --- a/src/odoc.ml +++ b/src/odoc.ml @@ -287,7 +287,10 @@ let setup_toplevel_index_rule sctx = let libs_of_pkg sctx ~pkg = match Package.Name.Map.find (SC.libs_by_package sctx) pkg with | None -> Lib.Set.empty - | Some (_, libs) -> libs + | Some (_, libs) -> + (* Filter out all implementations of virtual libraries *) + Lib.Set.filter ~f:(fun lib -> + not (Lib.is_impl lib)) libs let load_all_odoc_rules_pkg sctx ~pkg = let pkg_libs = libs_of_pkg sctx ~pkg in