Issue #2761: A pub fn whose throws merge two errors draws rustc’s “type is more private than the item” warning on the generated error sum

Open and answer this issue on GitHub.

bug, ready · opened 2026-11-22 · updated 2026-11-22 · 0 comments

Found while supervising the safety lane (re-recording a_pub_parameter_at_a_raw_sink_is_from_outside.stderr for #2483).

Found (traced)

tests/compiler/tests/a_pub_parameter_at_a_raw_sink_is_from_outside.stderr records a rustc warning as expected output:

warning: Type `__NikaiaThrows_io_IoError__process_Exit` is more private than the item `list_guarded`.
  --> tests/a_pub_parameter_at_a_raw_sink_is_from_outside.nika:20:1
   |
20 | pub fn list_guarded(dir: String) throws {
   = note: But type `__NikaiaThrows_io_IoError__process_Exit` is only usable at visibility `pub(crate)`.

Probe: any program with pub fn f(x: String) throws { if x == "" { process::exit(2) }; process::run("ls", [x]) } called from main (a pub fn whose inferred throws are two errors, so the emitter makes a sum).

Cause: crates/nikaia-std/src/compiler/emit_sums.nika:194 writes the sum enum pub only when is_std || offered_to_rust || every_item_public || as_a_module(); otherwise it is private, while the pub fn whose signature names it is pub. The comment two lines below says “a warning about this file is a defect here (Part III C.1)”. The test then enshrines the warning in its expected stderr.

To build

Done when

No expected output holds a rustc more private warning, and the new test is green and failed on the old tree.

Back to Open Issues