Skip to content

Commit 545eaa5

Browse files
refactor: check for module interface rather than AST
1 parent 0850425 commit 545eaa5

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

compiler-cli/src/publish.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,20 +382,21 @@ fn do_build_hex_tarball(paths: &ProjectPaths, config: &mut PackageConfig) -> Res
382382
});
383383
}
384384

385-
// empty_modules is a list of modules that contain no public definitions
386-
// it is used to refuse to publish packages that are not yet finished.
385+
// empty_modules is a list of modules that do not export any values or types.
386+
// We do not allow publishing packages that contain empty modules.
387387
let empty_modules: Vec<_> = built
388388
.root_package
389389
.modules
390390
.iter()
391391
.filter(|module| {
392-
module
393-
.ast
394-
.definitions
395-
.iter()
396-
.filter(|def| def.is_public())
397-
.count()
398-
== 0
392+
built
393+
.module_interfaces
394+
.get(&module.name)
395+
.map(|interface| {
396+
// Check if the module exports any values or types
397+
interface.values.is_empty() && interface.types.is_empty()
398+
})
399+
.unwrap_or(false)
399400
})
400401
.map(|module| module.name.clone())
401402
.collect();

0 commit comments

Comments
 (0)